docs(linter): document rules (#6983)

closes #6370
This commit is contained in:
Boshen 2024-10-28 14:49:16 +00:00
parent 46e5360372
commit 4551baaf4a
3 changed files with 19 additions and 3 deletions

View file

@ -51,7 +51,23 @@ use crate::{options::LintPlugins, utils::read_to_string};
pub struct Oxlintrc {
pub plugins: LintPlugins,
pub categories: OxlintCategories,
/// See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).
/// Example
///
/// `.oxlintrc.json`
///
/// ```json
/// {
/// "$schema": "./node_modules/oxlint/configuration_schema.json",
/// "rules": {
/// "eqeqeq": "warn",
/// "import/no-cycle": "error",
/// "prefer-const": ["error", { "ignoreReadBeforeAssign": true }]
/// }
/// }
/// ```
///
/// See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of
/// rules.
pub rules: OxlintRules,
pub settings: OxlintSettings,
/// Environments enable and disable collections of global variables.

View file

@ -50,7 +50,7 @@ expression: json
]
},
"rules": {
"description": "See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).",
"description": "Example\n\n`.oxlintrc.json`\n\n```json { \"$schema\": \"./node_modules/oxlint/configuration_schema.json\", \"rules\": { \"eqeqeq\": \"warn\", \"import/no-cycle\": \"error\", \"prefer-const\": [\"error\", { \"ignoreReadBeforeAssign\": true }] } } ```\n\nSee [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of rules.",
"default": {},
"allOf": [
{

View file

@ -46,7 +46,7 @@
]
},
"rules": {
"description": "See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).",
"description": "Example\n\n`.oxlintrc.json`\n\n```json { \"$schema\": \"./node_modules/oxlint/configuration_schema.json\", \"rules\": { \"eqeqeq\": \"warn\", \"import/no-cycle\": \"error\", \"prefer-const\": [\"error\", { \"ignoreReadBeforeAssign\": true }] } } ```\n\nSee [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of rules.",
"default": {},
"allOf": [
{