From 6922af85ffbdb2a2193e99b5fcc034919d154796 Mon Sep 17 00:00:00 2001 From: Boshen Date: Sun, 1 Dec 2024 16:19:12 +0800 Subject: [PATCH] docs(linter): fix config example headings --- crates/oxc_linter/src/config/settings/jsx_a11y.rs | 2 +- crates/oxc_linter/src/config/settings/mod.rs | 2 -- crates/oxc_linter/src/config/settings/next.rs | 2 +- crates/oxc_linter/src/config/settings/react.rs | 4 ++-- crates/oxc_linter/src/snapshots/schema_json.snap | 11 ++++++----- npm/oxlint/configuration_schema.json | 10 +++++----- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/crates/oxc_linter/src/config/settings/jsx_a11y.rs b/crates/oxc_linter/src/config/settings/jsx_a11y.rs index e2744ee5ba8c3e..96038b9d4a397a 100644 --- a/crates/oxc_linter/src/config/settings/jsx_a11y.rs +++ b/crates/oxc_linter/src/config/settings/jsx_a11y.rs @@ -29,7 +29,7 @@ pub struct JSXA11yPluginSettings { /// To have your custom components be checked as DOM elements, you can /// provide a mapping of your component names to the DOM element name. /// - /// ## Example + /// Example: /// /// ```json /// { diff --git a/crates/oxc_linter/src/config/settings/mod.rs b/crates/oxc_linter/src/config/settings/mod.rs index 0aed87547a34c5..e32c7d75822af6 100644 --- a/crates/oxc_linter/src/config/settings/mod.rs +++ b/crates/oxc_linter/src/config/settings/mod.rs @@ -15,8 +15,6 @@ use self::{ /// /// Configure the behavior of linter plugins. /// -/// ## Example -/// /// Here's an example if you're using Next.js in a monorepo: /// /// ```json diff --git a/crates/oxc_linter/src/config/settings/next.rs b/crates/oxc_linter/src/config/settings/next.rs index 7e0f1b31e91931..52e00d05b848cf 100644 --- a/crates/oxc_linter/src/config/settings/next.rs +++ b/crates/oxc_linter/src/config/settings/next.rs @@ -12,7 +12,7 @@ pub struct NextPluginSettings { /// This is particularly useful when you have a monorepo and your Next.js /// project is in a subfolder. /// - /// ## Example + /// Example: /// /// ```json /// { diff --git a/crates/oxc_linter/src/config/settings/react.rs b/crates/oxc_linter/src/config/settings/react.rs index 0432189c7d2d12..ed42a02931b7fa 100644 --- a/crates/oxc_linter/src/config/settings/react.rs +++ b/crates/oxc_linter/src/config/settings/react.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; pub struct ReactPluginSettings { /// Components used as alternatives to `
` for forms, such as ``. /// - /// ## Example + /// Example: /// /// ```jsonc /// { @@ -35,7 +35,7 @@ pub struct ReactPluginSettings { /// Components used as alternatives to `` for linking, such as ``. /// - /// ## Example + /// Example: /// /// ```jsonc /// { diff --git a/crates/oxc_linter/src/snapshots/schema_json.snap b/crates/oxc_linter/src/snapshots/schema_json.snap index 0ded976439e32d..6c939e9ee3a06b 100644 --- a/crates/oxc_linter/src/snapshots/schema_json.snap +++ b/crates/oxc_linter/src/snapshots/schema_json.snap @@ -1,6 +1,7 @@ --- source: crates/oxc_linter/src/lib.rs expression: json +snapshot_kind: text --- { "$schema": "http://json-schema.org/draft-07/schema#", @@ -252,7 +253,7 @@ expression: json "type": "object", "properties": { "components": { - "description": "To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.\n\n## Example\n\n```json { \"settings\": { \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"IconButton\": \"button\" } } } } ```", + "description": "To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.\n\nExample:\n\n```json { \"settings\": { \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"IconButton\": \"button\" } } } } ```", "default": {}, "type": "object", "additionalProperties": { @@ -279,7 +280,7 @@ expression: json "type": "object", "properties": { "rootDir": { - "description": "The root directory of the Next.js project.\n\nThis is particularly useful when you have a monorepo and your Next.js project is in a subfolder.\n\n## Example\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" } } } ```", + "description": "The root directory of the Next.js project.\n\nThis is particularly useful when you have a monorepo and your Next.js project is in a subfolder.\n\nExample:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" } } } ```", "default": [], "allOf": [ { @@ -396,7 +397,7 @@ expression: json }, "OxlintSettings": { "title": "Oxlint Plugin Settings", - "description": "Configure the behavior of linter plugins.\n\n## Example\n\nHere's an example if you're using Next.js in a monorepo:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" }, \"react\": { \"linkComponents\": [ { \"name\": \"Link\", \"linkAttribute\": \"to\" } ] }, \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"Button\": \"button\" } } } } ```", + "description": "Configure the behavior of linter plugins.\n\nHere's an example if you're using Next.js in a monorepo:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" }, \"react\": { \"linkComponents\": [ { \"name\": \"Link\", \"linkAttribute\": \"to\" } ] }, \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"Button\": \"button\" } } } } ```", "type": "object", "properties": { "jsdoc": { @@ -455,7 +456,7 @@ expression: json "type": "object", "properties": { "formComponents": { - "description": "Components used as alternatives to `` for forms, such as ``.\n\n## Example\n\n```jsonc { \"settings\": { \"react\": { \"formComponents\": [ \"CustomForm\", // OtherForm is considered a form component and has an endpoint attribute { \"name\": \"OtherForm\", \"formAttribute\": \"endpoint\" }, // allows specifying multiple properties if necessary { \"name\": \"Form\", \"formAttribute\": [\"registerEndpoint\", \"loginEndpoint\"] } ] } } } ```", + "description": "Components used as alternatives to `` for forms, such as ``.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"formComponents\": [ \"CustomForm\", // OtherForm is considered a form component and has an endpoint attribute { \"name\": \"OtherForm\", \"formAttribute\": \"endpoint\" }, // allows specifying multiple properties if necessary { \"name\": \"Form\", \"formAttribute\": [\"registerEndpoint\", \"loginEndpoint\"] } ] } } } ```", "default": [], "type": "array", "items": { @@ -463,7 +464,7 @@ expression: json } }, "linkComponents": { - "description": "Components used as alternatives to `` for linking, such as ``.\n\n## Example\n\n```jsonc { \"settings\": { \"react\": { \"linkComponents\": [ \"HyperLink\", // Use `linkAttribute` for components that use a different prop name // than `href`. { \"name\": \"MyLink\", \"linkAttribute\": \"to\" }, // allows specifying multiple properties if necessary { \"name\": \"Link\", \"linkAttribute\": [\"to\", \"href\"] } ] } } } ```", + "description": "Components used as alternatives to `` for linking, such as ``.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"linkComponents\": [ \"HyperLink\", // Use `linkAttribute` for components that use a different prop name // than `href`. { \"name\": \"MyLink\", \"linkAttribute\": \"to\" }, // allows specifying multiple properties if necessary { \"name\": \"Link\", \"linkAttribute\": [\"to\", \"href\"] } ] } } } ```", "default": [], "type": "array", "items": { diff --git a/npm/oxlint/configuration_schema.json b/npm/oxlint/configuration_schema.json index ba0f547ab38958..8209ad1655b808 100644 --- a/npm/oxlint/configuration_schema.json +++ b/npm/oxlint/configuration_schema.json @@ -248,7 +248,7 @@ "type": "object", "properties": { "components": { - "description": "To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.\n\n## Example\n\n```json { \"settings\": { \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"IconButton\": \"button\" } } } } ```", + "description": "To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name.\n\nExample:\n\n```json { \"settings\": { \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"IconButton\": \"button\" } } } } ```", "default": {}, "type": "object", "additionalProperties": { @@ -275,7 +275,7 @@ "type": "object", "properties": { "rootDir": { - "description": "The root directory of the Next.js project.\n\nThis is particularly useful when you have a monorepo and your Next.js project is in a subfolder.\n\n## Example\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" } } } ```", + "description": "The root directory of the Next.js project.\n\nThis is particularly useful when you have a monorepo and your Next.js project is in a subfolder.\n\nExample:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" } } } ```", "default": [], "allOf": [ { @@ -392,7 +392,7 @@ }, "OxlintSettings": { "title": "Oxlint Plugin Settings", - "description": "Configure the behavior of linter plugins.\n\n## Example\n\nHere's an example if you're using Next.js in a monorepo:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" }, \"react\": { \"linkComponents\": [ { \"name\": \"Link\", \"linkAttribute\": \"to\" } ] }, \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"Button\": \"button\" } } } } ```", + "description": "Configure the behavior of linter plugins.\n\nHere's an example if you're using Next.js in a monorepo:\n\n```json { \"settings\": { \"next\": { \"rootDir\": \"apps/dashboard/\" }, \"react\": { \"linkComponents\": [ { \"name\": \"Link\", \"linkAttribute\": \"to\" } ] }, \"jsx-a11y\": { \"components\": { \"Link\": \"a\", \"Button\": \"button\" } } } } ```", "type": "object", "properties": { "jsdoc": { @@ -451,7 +451,7 @@ "type": "object", "properties": { "formComponents": { - "description": "Components used as alternatives to `` for forms, such as ``.\n\n## Example\n\n```jsonc { \"settings\": { \"react\": { \"formComponents\": [ \"CustomForm\", // OtherForm is considered a form component and has an endpoint attribute { \"name\": \"OtherForm\", \"formAttribute\": \"endpoint\" }, // allows specifying multiple properties if necessary { \"name\": \"Form\", \"formAttribute\": [\"registerEndpoint\", \"loginEndpoint\"] } ] } } } ```", + "description": "Components used as alternatives to `` for forms, such as ``.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"formComponents\": [ \"CustomForm\", // OtherForm is considered a form component and has an endpoint attribute { \"name\": \"OtherForm\", \"formAttribute\": \"endpoint\" }, // allows specifying multiple properties if necessary { \"name\": \"Form\", \"formAttribute\": [\"registerEndpoint\", \"loginEndpoint\"] } ] } } } ```", "default": [], "type": "array", "items": { @@ -459,7 +459,7 @@ } }, "linkComponents": { - "description": "Components used as alternatives to `` for linking, such as ``.\n\n## Example\n\n```jsonc { \"settings\": { \"react\": { \"linkComponents\": [ \"HyperLink\", // Use `linkAttribute` for components that use a different prop name // than `href`. { \"name\": \"MyLink\", \"linkAttribute\": \"to\" }, // allows specifying multiple properties if necessary { \"name\": \"Link\", \"linkAttribute\": [\"to\", \"href\"] } ] } } } ```", + "description": "Components used as alternatives to `` for linking, such as ``.\n\nExample:\n\n```jsonc { \"settings\": { \"react\": { \"linkComponents\": [ \"HyperLink\", // Use `linkAttribute` for components that use a different prop name // than `href`. { \"name\": \"MyLink\", \"linkAttribute\": \"to\" }, // allows specifying multiple properties if necessary { \"name\": \"Link\", \"linkAttribute\": [\"to\", \"href\"] } ] } } } ```", "default": [], "type": "array", "items": {