docs(linter): fix config example headings (#7562)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
This commit is contained in:
Boshen 2024-12-01 16:31:22 +08:00 committed by GitHub
parent 0f3f67a05a
commit a6b0100501
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 19 additions and 21 deletions

View file

@ -29,7 +29,7 @@ pub struct JSXA11yPluginSettings {
/// To have your custom components be checked as DOM elements, you can /// To have your custom components be checked as DOM elements, you can
/// provide a mapping of your component names to the DOM element name. /// provide a mapping of your component names to the DOM element name.
/// ///
/// ## Example /// Example:
/// ///
/// ```json /// ```json
/// { /// {

View file

@ -15,8 +15,6 @@ use self::{
/// ///
/// Configure the behavior of linter plugins. /// Configure the behavior of linter plugins.
/// ///
/// ## Example
///
/// Here's an example if you're using Next.js in a monorepo: /// Here's an example if you're using Next.js in a monorepo:
/// ///
/// ```json /// ```json

View file

@ -12,7 +12,7 @@ pub struct NextPluginSettings {
/// This is particularly useful when you have a monorepo and your Next.js /// This is particularly useful when you have a monorepo and your Next.js
/// project is in a subfolder. /// project is in a subfolder.
/// ///
/// ## Example /// Example:
/// ///
/// ```json /// ```json
/// { /// {

View file

@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
pub struct ReactPluginSettings { pub struct ReactPluginSettings {
/// Components used as alternatives to `<form>` for forms, such as `<Formik>`. /// Components used as alternatives to `<form>` for forms, such as `<Formik>`.
/// ///
/// ## Example /// Example:
/// ///
/// ```jsonc /// ```jsonc
/// { /// {
@ -35,7 +35,7 @@ pub struct ReactPluginSettings {
/// Components used as alternatives to `<a>` for linking, such as `<Link>`. /// Components used as alternatives to `<a>` for linking, such as `<Link>`.
/// ///
/// ## Example /// Example:
/// ///
/// ```jsonc /// ```jsonc
/// { /// {

View file

@ -1,6 +1,7 @@
--- ---
source: crates/oxc_linter/src/lib.rs source: crates/oxc_linter/src/lib.rs
expression: json expression: json
snapshot_kind: text
--- ---
{ {
"$schema": "http://json-schema.org/draft-07/schema#", "$schema": "http://json-schema.org/draft-07/schema#",
@ -252,7 +253,7 @@ expression: json
"type": "object", "type": "object",
"properties": { "properties": {
"components": { "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": {}, "default": {},
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
@ -279,7 +280,7 @@ expression: json
"type": "object", "type": "object",
"properties": { "properties": {
"rootDir": { "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": [], "default": [],
"allOf": [ "allOf": [
{ {
@ -396,7 +397,7 @@ expression: json
}, },
"OxlintSettings": { "OxlintSettings": {
"title": "Oxlint Plugin Settings", "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", "type": "object",
"properties": { "properties": {
"jsdoc": { "jsdoc": {
@ -455,7 +456,7 @@ expression: json
"type": "object", "type": "object",
"properties": { "properties": {
"formComponents": { "formComponents": {
"description": "Components used as alternatives to `<form>` for forms, such as `<Formik>`.\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 `<form>` for forms, such as `<Formik>`.\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": [], "default": [],
"type": "array", "type": "array",
"items": { "items": {
@ -463,7 +464,7 @@ expression: json
} }
}, },
"linkComponents": { "linkComponents": {
"description": "Components used as alternatives to `<a>` for linking, such as `<Link>`.\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 `<a>` for linking, such as `<Link>`.\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": [], "default": [],
"type": "array", "type": "array",
"items": { "items": {

View file

@ -248,7 +248,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"components": { "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": {}, "default": {},
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
@ -275,7 +275,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"rootDir": { "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": [], "default": [],
"allOf": [ "allOf": [
{ {
@ -392,7 +392,7 @@
}, },
"OxlintSettings": { "OxlintSettings": {
"title": "Oxlint Plugin Settings", "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", "type": "object",
"properties": { "properties": {
"jsdoc": { "jsdoc": {
@ -451,7 +451,7 @@
"type": "object", "type": "object",
"properties": { "properties": {
"formComponents": { "formComponents": {
"description": "Components used as alternatives to `<form>` for forms, such as `<Formik>`.\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 `<form>` for forms, such as `<Formik>`.\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": [], "default": [],
"type": "array", "type": "array",
"items": { "items": {
@ -459,7 +459,7 @@
} }
}, },
"linkComponents": { "linkComponents": {
"description": "Components used as alternatives to `<a>` for linking, such as `<Link>`.\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 `<a>` for linking, such as `<Link>`.\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": [], "default": [],
"type": "array", "type": "array",
"items": { "items": {

View file

@ -1,6 +1,7 @@
--- ---
source: tasks/website/src/linter/json_schema.rs source: tasks/website/src/linter/json_schema.rs
expression: snapshot expression: snapshot
snapshot_kind: text
--- ---
# Oxlint Configuration File # Oxlint Configuration File
@ -225,8 +226,6 @@ type: `object`
Configure the behavior of linter plugins. Configure the behavior of linter plugins.
## Example
Here's an example if you're using Next.js in a monorepo: Here's an example if you're using Next.js in a monorepo:
```json ```json
@ -352,7 +351,7 @@ default: `{}`
To have your custom components be checked as DOM elements, you can provide a mapping of your component names to the DOM element name. 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 { "settings": { "jsx-a11y": { "components": { "Link": "a", "IconButton": "button" } } } } ``` ```json { "settings": { "jsx-a11y": { "components": { "Link": "a", "IconButton": "button" } } } } ```
@ -407,7 +406,7 @@ default: `[]`
Components used as alternatives to `<form>` for forms, such as `<Formik>`. Components used as alternatives to `<form>` for forms, such as `<Formik>`.
## Example Example:
```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"] } ] } } } ``` ```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"] } ] } } } ```
@ -427,7 +426,7 @@ default: `[]`
Components used as alternatives to `<a>` for linking, such as `<Link>`. Components used as alternatives to `<a>` for linking, such as `<Link>`.
## Example Example:
```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"] } ] } } } ``` ```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"] } ] } } } ```