Skip to content

feat(oxlint-config): update @stylistic/eslint-plugin to v6 and use list-style - #213

Draft
dangreen wants to merge 2 commits into
mainfrom
feat/stylistic-eslint-plugin-6
Draft

dangreen wants to merge 2 commits into
mainfrom
feat/stylistic-eslint-plugin-6

Conversation

@dangreen

Copy link
Copy Markdown
Member

Why

@stylistic/eslint-plugin 6 is out. It deprecates 8 of the rules the config uses in favor of list-style, and every oxlint run prints a deprecation warning for each of them to stderr.

Draft until a release fixes an indent bug of 6.0.x: the statement right after a type ending in a type predicate (x is T) without a semicolon is reported, and --fix breaks its indentation. It is reported in eslint-stylistic/eslint-stylistic#1347 and fixed in eslint-stylistic/eslint-stylistic#1346, which is not merged yet.

What

  • @stylistic/eslint-plugin 6.
  • array-bracket-newline, array-bracket-spacing, array-element-newline, function-call-argument-newline, function-paren-newline, object-curly-newline, object-curly-spacing and object-property-newline are replaced with list-style. Its defaults already match the config: spaces inside braces, none inside brackets, items wrapped like the first one. An object literal with properties stays multi-line through ObjectExpression: { singleLine: { maxItems: 0 } }, and if conditions are not checked, so if (a\n && b\n) { keeps working.

Notes

  • Every option of the 72 stylistic rules passes the v6 schemas, and the repository lints clean with no stderr output.
  • Checked the stylistic rules against v5 on nano_kit, simple-release, conventional-changelog and one private project. Apart from the indent bug, they report 2 type positions of no-extra-parens ((infer I)[], a parenthesized nested conditional type), 2 calls in nano_kit that wrap a JSX argument in parentheses (hydrate((\n <App />\n), el)) and one generated array.
  • 6.0.1 behaves the same as 6.0.0 on all of them. The patch of fix(indent): ignore type predicates in type annotation offset eslint-stylistic/eslint-stylistic#1346 applied to 6.0.1 removes the indent false positives and changes nothing else. Before this leaves draft, the dependency moves to the release with the fix.
  • If the fix takes too long, 'TSTypePredicate > TSTypeAnnotation' in the ignoredNodes of indent works around it in oxlint with the same result.
  • The Renovate PR fix(deps): update dependency @stylistic/eslint-plugin to v6 #209 becomes obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant