mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
docs(linter): fix config example headings (#7562)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
This commit is contained in:
parent
0f3f67a05a
commit
a6b0100501
7 changed files with 19 additions and 21 deletions
|
|
@ -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
|
||||
/// {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/// {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize};
|
|||
pub struct ReactPluginSettings {
|
||||
/// Components used as alternatives to `<form>` for forms, such as `<Formik>`.
|
||||
///
|
||||
/// ## Example
|
||||
/// Example:
|
||||
///
|
||||
/// ```jsonc
|
||||
/// {
|
||||
|
|
@ -35,7 +35,7 @@ pub struct ReactPluginSettings {
|
|||
|
||||
/// Components used as alternatives to `<a>` for linking, such as `<Link>`.
|
||||
///
|
||||
/// ## Example
|
||||
/// Example:
|
||||
///
|
||||
/// ```jsonc
|
||||
/// {
|
||||
|
|
|
|||
|
|
@ -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 `<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": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -463,7 +464,7 @@ expression: json
|
|||
}
|
||||
},
|
||||
"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": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
|
|||
|
|
@ -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 `<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": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
@ -459,7 +459,7 @@
|
|||
}
|
||||
},
|
||||
"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": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
source: tasks/website/src/linter/json_schema.rs
|
||||
expression: snapshot
|
||||
snapshot_kind: text
|
||||
---
|
||||
# Oxlint Configuration File
|
||||
|
||||
|
|
@ -225,8 +226,6 @@ type: `object`
|
|||
|
||||
Configure the behavior of linter plugins.
|
||||
|
||||
## Example
|
||||
|
||||
Here's an example if you're using Next.js in a monorepo:
|
||||
|
||||
```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.
|
||||
|
||||
## Example
|
||||
Example:
|
||||
|
||||
```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>`.
|
||||
|
||||
## 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"] } ] } } } ```
|
||||
|
||||
|
|
@ -427,7 +426,7 @@ default: `[]`
|
|||
|
||||
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"] } ] } } } ```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue