Skip to content

Commit 4551baa

Browse files
committedOct 28, 2024·
docs(linter): document rules (#6983)
closes #6370
1 parent 46e5360 commit 4551baa

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed
 

‎crates/oxc_linter/src/config/oxlintrc.rs

+17-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,23 @@ use crate::{options::LintPlugins, utils::read_to_string};
5151
pub struct Oxlintrc {
5252
pub plugins: LintPlugins,
5353
pub categories: OxlintCategories,
54-
/// See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).
54+
/// Example
55+
///
56+
/// `.oxlintrc.json`
57+
///
58+
/// ```json
59+
/// {
60+
/// "$schema": "./node_modules/oxlint/configuration_schema.json",
61+
/// "rules": {
62+
/// "eqeqeq": "warn",
63+
/// "import/no-cycle": "error",
64+
/// "prefer-const": ["error", { "ignoreReadBeforeAssign": true }]
65+
/// }
66+
/// }
67+
/// ```
68+
///
69+
/// See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html) for the list of
70+
/// rules.
5571
pub rules: OxlintRules,
5672
pub settings: OxlintSettings,
5773
/// Environments enable and disable collections of global variables.

‎crates/oxc_linter/src/snapshots/schema_json.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ expression: json
5050
]
5151
},
5252
"rules": {
53-
"description": "See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).",
53+
"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.",
5454
"default": {},
5555
"allOf": [
5656
{

‎npm/oxlint/configuration_schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
]
4747
},
4848
"rules": {
49-
"description": "See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html).",
49+
"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.",
5050
"default": {},
5151
"allOf": [
5252
{

0 commit comments

Comments
 (0)
Please sign in to comment.