oxc-project
oxc
BlogDocsChangelog

docs(linter): Handle rules that use tuple config options with DefaultRuleConfig

#16555
Comparing
handle-tuple-rules-better
(
48cda35
) with
main
(
8babdf9
)
CodSpeed Performance Gauge
0%
Untouched
4
Skipped
41

Benchmarks

Skipped (41)

formatter[binder.ts]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
21.2 ms*
formatter[cal.com.tsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
188.5 ms*
formatter[react.development.js]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
10.7 ms*
semantic[binder.ts]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
Skipped
4.1 ms*
semantic[cal.com.tsx]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
Skipped
26.4 ms*
semantic[react.development.js]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
Skipped
1.6 ms*
semantic[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/semantic.rs::semantic::bench_semantic
Skipped
72.4 µs*
estree[checker.ts]
tasks/benchmark/benches/parser.rs::parser::bench_estree
Skipped
104.6 ms*
parser[binder.ts]
tasks/benchmark/benches/parser.rs::parser::bench_parser
Skipped
3.2 ms*
parser[react.development.js]
tasks/benchmark/benches/parser.rs::parser::bench_parser
Skipped
1.3 ms*
parser[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/parser.rs::parser::bench_parser
Skipped
81.3 µs*
parser[cal.com.tsx]
tasks/benchmark/benches/parser.rs::parser::bench_parser
Skipped
26.1 ms*
codegen[binder.ts]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
Skipped
4.3 ms*
codegen[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
Skipped
122.5 µs*
codegen[cal.com.tsx]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
Skipped
34.6 ms*
codegen[react.development.js]
tasks/benchmark/benches/codegen.rs::codegen::bench_codegen
Skipped
1.9 ms*
mangler[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/minifier.rs::minifier::bench_mangler
Skipped
13.3 µs*
mangler[cal.com.tsx]
tasks/benchmark/benches/minifier.rs::minifier::bench_mangler
Skipped
2.9 ms*
mangler[binder.ts]
tasks/benchmark/benches/minifier.rs::minifier::bench_mangler
Skipped
763 µs*
minifier[cal.com.tsx]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
Skipped
36.1 ms*
minifier[react.development.js]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
Skipped
2.5 ms*
minifier[binder.ts]
tasks/benchmark/benches/minifier.rs::minifier::bench_minifier
Skipped
4 ms*
mangler[react.development.js]
tasks/benchmark/benches/minifier.rs::minifier::bench_mangler
Skipped
267.2 µs*
lexer[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
Skipped
21.1 µs*
lexer[react.development.js]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
Skipped
357.9 µs*
lexer[binder.ts]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
Skipped
884.6 µs*
lexer[cal.com.tsx]
tasks/benchmark/benches/lexer.rs::lexer::bench_lexer
Skipped
5.5 ms*
formatter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
441.6 µs*
formatter[App.tsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
48.3 ms*
formatter[handle-comments.js]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
3.5 ms*
formatter[index.tsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
4.5 ms*
formatter[next.ts]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
2.7 ms*
formatter[errors.ts]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
766.6 µs*
formatter[types.ts]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
14.7 ms*
formatter[core.js]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
2.2 ms*
formatter[Search.tsx]
tasks/benchmark/benches/formatter.rs::formatter::bench_formatter
Skipped
1.9 ms*
transformer[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
Skipped
135.5 µs*
transformer[binder.ts]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
Skipped
1.7 ms*
isolated-declarations[vue-id.ts]
tasks/benchmark/benches/transformer.rs::transformer::bench_isolated_declarations
Skipped
58 ms*
transformer[cal.com.tsx]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
Skipped
26.4 ms*
transformer[react.development.js]
tasks/benchmark/benches/transformer.rs::transformer::bench_transformer
Skipped
716.7 µs*

Passed

linter[RadixUIAdoptionSection.jsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
717.9 µs*717 µs
linter[cal.com.tsx]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
466.8 ms*466.7 ms
linter[binder.ts]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
47 ms*47 ms
linter[react.development.js]
tasks/benchmark/benches/linter.rs::linter::bench_linter
CodSpeed Performance Gauge
0%
19 ms*19 ms

Commits

Click on a commit to change the comparison range
Base
main
8babdf9
-0.11%
Appease the linter.
962bfe2
11 days ago
by connorshea
+0.1%
Remove all but one usage of clone in DefaultRuleConfig deserialization.
fdc4795
9 days ago
by connorshea
-0.07%
refactor(linter): Remove support for double-object tuples. This simplifies the config parsing logic *a ton*.
332f8ea
9 days ago
by connorshea
+0.08%
Fix tuple test to use an actual tuple struct.
3fea757
9 days ago
by connorshea
-0.12%
Add a few comments.
19b5d40
9 days ago
by connorshea
+0.02%
Update one more test to use the custom assert fn
a6a0eb1
9 days ago
by connorshea
+0.07%
Resolve lint violations.
5f2ee80
9 days ago
by connorshea
+0.18%
docs(linter): Updated `eslint/yoda` rule with auto-gen config options, I have. (#16562) Uses DefaultRuleConfig now, this rule does. Updated to use a proper tuple config, it has been. Continue to pass, the tests do. Part of #14743 and dependent on #16555, this PR is. Generated docs: ```md ## Configuration ### The 1st option type: `"never" | "always"` #### `"never"` The default `"never"` option can have exception options in an object literal, via `exceptRange` and `onlyEquality`. #### `"always"` The `"always"` option requires that literal values must always come first in comparisons. ### The 2nd option This option is an object with the following properties: #### exceptRange type: `boolean` default: `false` If the `"exceptRange"` property is `true`, the rule _allows_ yoda conditions in range comparisons which are wrapped directly in parentheses, including the parentheses of an `if` or `while` condition. A _range_ comparison tests whether a variable is inside or outside the range between two literal values. #### onlyEquality type: `boolean` default: `false` If the `"onlyEquality"` property is `true`, the rule reports yoda conditions _only_ for the equality operators `==` and `===`. The `onlyEquality` option allows a superset of the exceptions which `exceptRange` allows, thus both options are not useful together. ```
232b8ba
7 days ago
by connorshea
-0.11%
fix(linter): Fix default behavior of the `eslint/eqeqeq` rule, and also the config option docs for it (#16560) This is part of #16023. See [the tests for the original rule](https://github.com/eslint/eslint/blob/b017f094d4e53728f8d335b9cf8b16dc074afda3/tests/lib/rules/eqeqeq.js). We have a test in [the eqeqeq.rs implementation](https://github.com/oxc-project/oxc/blob/e24aabdfa65044a7223e4ea7b294ad3bf5dfb1ec/crates/oxc_linter/src/rules/eslint/eqeqeq.rs) like so: ```rs // Issue: <https://github.com/oxc-project/oxc/issues/8773> ("href != null", Some(json!([{"null": "ignore"}]))), ``` The problem is that this test has an incorrect shape for the config object, see here: ```jsonc // Should always be in one of these three formats, all three work in the original rule as well: "eslint/eqeqeq": ["error", "always", { "null": "never" }], "eslint/eqeqeq": ["error", "always"], "eslint/eqeqeq": ["error"], // But right now the tests have a case where the string arg is skipped, while the ESLint rule does not allow this: "eslint/eqeqeq": ["error", { "null": "ignore" }], ``` The problem is that the code _did_ previously handle this config array as invalid. However, because the implementation of `from` on NullType would fall back to `ignore` if it received bad data, it looked like it worked: ```rs impl NullType { pub fn from(raw: &str) -> Self { match raw { "always" => Self::Always, "never" => Self::Never, _ => Self::Ignore, } } } ``` Because `always` is marked as the default value (and is also the default value in the original ESLint rule), and so should be the default case. The test was just hitting the fallback value, so it looked like it worked, but really the fallback value was incorrect previously and did not match the docs _or_ the ESLint behavior. This fixes that issue by correcting the fallback value, and also fixes the auto-generated config shape/docs, so it correctly represents itself as taking a tuple. Generated docs: ```md ## Configuration ### The 1st option type: `"always" | "smart"` #### `"always"` Always require triple-equal comparisons, `===`/`!==`. This is the default. #### `"smart"` Allow certain safe comparisons to use `==`/`!=` (`typeof`, literals, nullish). ### The 2nd option This option is an object with the following properties: #### null type: `"always" | "never" | "ignore"` ##### `"always"` Always require triple-equals when comparing with null, `=== null`/`!== null`. This is the default. ##### `"never"` Never require triple-equals when comparing with null, always use `== null`/`!= null` ##### `"ignore"` Ignore null comparisons, allow either `== null`/`!= null` and `=== null`/`!== null` ```
48cda35
7 days ago
by connorshea
© 2025 CodSpeed Technology
Home Terms Privacy Docs