Skip to content

fix: add Oxlint rule tester and fix issue in sort-classes#726

Merged
azat-io merged 7 commits into
azat-io:mainfrom
hugop95:fix/725/oxlint
Mar 24, 2026
Merged

fix: add Oxlint rule tester and fix issue in sort-classes#726
azat-io merged 7 commits into
azat-io:mainfrom
hugop95:fix/725/oxlint

Conversation

@hugop95
Copy link
Copy Markdown
Contributor

@hugop95 hugop95 commented Mar 23, 2026

Description

Oxlint provides a different AST shape than ESLint. Notably, accessibility modifiers on class members can be null rather than undefined, causing uncaught errors.

Because Oxlint is gaining traction as an ESLint replacement/co-existing tool, ensuring compatibility with it will become increasingly important over time. As such, this PR lays the groundwork for reliable Oxlint support by introducing a dedicated Oxlint rule tester.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5a019b1-6db3-473a-89e5-c9d1efa943f2

📥 Commits

Reviewing files that changed from the base of the PR and between 75ce624 and 48dc5a3.

📒 Files selected for processing (5)
  • cspell.config.ts
  • rules/sort-classes/is-known-class-element.ts
  • rules/sort-classes/node-info/common-modifiers.ts
  • test/rules/sort-classes.test.ts
  • utils/assert-is-never.ts
✅ Files skipped from review due to trivial changes (3)
  • cspell.config.ts
  • utils/assert-is-never.ts
  • rules/sort-classes/is-known-class-element.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • rules/sort-classes/node-info/common-modifiers.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a recognized spell-check term.
  • Tests

    • Expanded oxlint-backed test coverage across many sorting rules and added a reusable oxlint test helper.
  • Chores

    • Added oxlint as a development dependency.
  • Refactor

    • Introduced a shared compile-time assertion helper to tighten internal exhaustiveness checks.

Walkthrough

Adds an oxlint-based RuleTester and oxlint test cases across many sorting rule suites, introduces an exported compile-time exhaustive-check helper assertIsNever, replaces local unreachable-case assertions in class-sorting helpers, adds oxlint devDependency, and registers oxlint in spell-check words.

Changes

Cohort / File(s) Summary
Exhaustiveness helper & class-sorting fixes
utils/assert-is-never.ts, rules/sort-classes/is-known-class-element.ts, rules/sort-classes/node-info/common-modifiers.ts
Add exported assertIsNever and replace local unreachable-case stubs with this shared assertion; adjust accessibility modifier handling to guard exhaustiveness and handle null accessibility.
Dev dependency & spelling
package.json, cspell.config.ts
Add oxlint to devDependencies and add 'oxlint' to the cspell words list.
Oxlint test harness
test/rules/build-oxlint-rule-tester.ts
New exported helper that builds/configures an oxlint-compatible RuleTester (supports ts/jsx) and exposes a run helper for tests.
Oxlint test coverage (many rule tests)
test/rules/.../sort-*.test.ts (e.g. test/rules/sort-classes.test.ts, test/rules/sort-imports.test.ts, test/rules/sort-enums.test.ts, etc.)
Add buildOxlintRuleTester usage and new describe('oxlint', ...) blocks across many sorting rule tests, each adding paired oxlint invalid/valid cases with messageIds, data, and autofix outputs (alphabetical/asc).

Sequence Diagram(s)

sequenceDiagram
  participant TestFile as Test Suite
  participant Builder as buildOxlintRuleTester
  participant RuleTester as oxlint RuleTester
  participant RuleModule as Rule
  participant Vitest as Vitest/it

  TestFile->>Builder: import & call buildOxlintRuleTester(rule, {lang})
  Builder->>RuleTester: configure (languageOptions, parserOptions)
  Builder->>Vitest: set RuleTester.it = it
  TestFile->>RuleTester: run(name, tests)
  RuleTester->>RuleModule: instantiate with languageOptions
  RuleTester->>RuleModule: execute rule against fixtures
  RuleModule-->>RuleTester: report diagnostics/fixes
  RuleTester-->>TestFile: surface test results/assertions
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • azat-io
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the PR's main objectives: adding Oxlint rule tester support and fixing the sort-classes issue with null accessibility modifiers.
Description check ✅ Passed The description references issue #725, explains the problem (null accessibility modifiers in Oxlint AST), and outlines the solution (dedicated Oxlint rule tester). All required template sections are adequately addressed.
Linked Issues check ✅ Passed The PR comprehensively addresses issue #725 by fixing the null accessibility modifier handling in sort-classes and introducing a buildOxlintRuleTester to prevent similar compatibility issues across all sorting rules.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing Oxlint compatibility. Helper utilities (assertIsNever), core rule fixes (common-modifiers.ts), and extensive test coverage for Oxlint across all sorting rules are all within scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 23, 2026

⚠️ Duplicate Dependencies (found: 86, threshold: 1)

📦 Package 📋 Versions
@types/node
2 versions
  • root@
    • @astrojs/sitemap@3.7.1
      • sitemap@9.0.1
        • @types/node@24.12.0

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • vite@7.3.1
          • @types/node@25.5.0

@types/unist
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • ...
        • mdast-util-mdx-jsx@3.2.0
          • parse-entities@4.0.2
            • @types/unist@2.0.11

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • hast-util-from-html@2.0.3
          • @types/hast@3.0.4
            • @types/unist@3.0.3

changelogen
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7

  • root@
    • changelogen@0.6.2

tinyexec
2 versions
  • root@
    • changelogithub@14.0.0
      • ...
        • giget@1.2.5
          • nypm@0.5.4
            • tinyexec@0.3.2

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • tinyexec@1.0.4

typescript
2 versions
  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • typescript@5.8.2

  • root@
    • @typescript-eslint/utils@8.57.1
      • @typescript-eslint/typescript-estree@8.57.1
        • @typescript-eslint/project-service@8.57.1
          • @typescript-eslint/tsconfig-utils@8.57.1
            • typescript@5.9.3

unist-util-visit
2 versions
  • root@
    • remark-sectionize@2.1.0
      • unist-util-visit@4.1.2

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • mdast-util-definitions@6.0.0
          • unist-util-visit@5.1.0

chokidar
3 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • chokidar@3.6.0

  • root@
    • @astrojs/check@0.9.8
      • chokidar@4.0.3

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • unstorage@1.17.4
          • chokidar@5.0.0

picomatch
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • unstorage@1.17.4
          • anymatch@3.1.3
            • picomatch@2.3.1

  • root@
    • @typescript-eslint/utils@8.57.1
      • @typescript-eslint/typescript-estree@8.57.1
        • tinyglobby@0.2.15
          • fdir@6.5.0
            • picomatch@4.0.3

@astrojs/compiler
2 versions
  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • @astrojs/compiler@2.13.1

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • @astrojs/compiler@3.0.1

unist-util-visit-parents
2 versions
  • root@
    • remark-sectionize@2.1.0
      • unist-util-visit@4.1.2
        • unist-util-visit-parents@5.1.3

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • mdast-util-definitions@6.0.0
          • unist-util-visit@5.1.0
            • unist-util-visit-parents@6.0.2

source-map
2 versions
  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • source-map@0.6.1

  • root@
    • @astrojs/mdx@5.0.1
      • @mdx-js/mdx@3.1.1
        • recma-jsx@1.0.1
          • estree-util-to-js@2.0.0
            • source-map@0.7.6

zod
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-compiler@19.1.0-rc.2
        • zod@3.25.76

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • zod@4.3.6

yaml
3 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-svelte@3.15.2
        • postcss-load-config@3.1.4
          • yaml@1.10.2

  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • volar-service-yaml@0.0.70
          • yaml-language-server@1.20.0
            • yaml@2.7.1

  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • @astrojs/yaml2ts@0.2.3
          • yaml@2.8.2

globals
3 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-n@17.24.0
        • globals@15.15.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-astro@1.6.0
        • globals@16.5.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-sonarjs@4.0.2
        • globals@17.4.0

js-tokens
3 versions
  • root@
    • @vitest/coverage-v8@4.1.0
      • ast-v8-to-istanbul@1.0.0
        • js-tokens@10.0.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-compiler@19.1.0-rc.2
        • @babel/core@7.29.0
          • @babel/code-frame@7.29.0
            • js-tokens@4.0.0

  • root@
    • postcss-html@1.8.1
      • js-tokens@9.0.1

semver
3 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-compiler@19.1.0-rc.2
        • @babel/core@7.29.0
          • @babel/helper-compilation-targets@7.28.6
            • semver@6.3.1

  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • @microsoft/api-extractor-model@7.33.4
          • @rushstack/node-core-library@5.20.3
            • semver@7.5.4

  • root@
    • @typescript-eslint/utils@8.57.1
      • @typescript-eslint/typescript-estree@8.57.1
        • semver@7.7.4

lru-cache
3 versions
  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • unstorage@1.17.4
          • lru-cache@11.2.7

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-compiler@19.1.0-rc.2
        • @babel/core@7.29.0
          • @babel/helper-compilation-targets@7.28.6
            • lru-cache@5.1.1

  • root@
    • vite-plugin-dts@4.5.4
      • ...
        • @rushstack/node-core-library@5.20.3
          • semver@7.5.4
            • lru-cache@6.0.0

keyv
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • ...
        • file-entry-cache@8.0.0
          • flat-cache@4.0.1
            • keyv@4.5.4

  • root@
    • @azat-io/stylelint-config@1.8.0
      • ...
        • @cacheable/memory@2.0.8
          • @cacheable/utils@2.4.0
            • keyv@5.6.0

ajv
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • ajv@6.14.0

  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • volar-service-yaml@0.0.70
          • yaml-language-server@1.20.0
            • ajv@8.18.0

global-directory
2 versions
  • root@
    • @commitlint/cli@20.5.0
      • @commitlint/load@20.5.0
        • @commitlint/resolve-extends@20.5.0
          • global-directory@4.0.1

  • root@
    • cspell@9.7.0
      • @cspell/cspell-worker@9.7.0
        • cspell-lib@9.7.0
          • @cspell/cspell-resolver@9.7.0
            • global-directory@5.0.0

resolve-from
2 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • cosmiconfig@9.0.1
          • import-fresh@3.3.1
            • resolve-from@4.0.0

  • root@
    • @commitlint/cli@20.5.0
      • @commitlint/load@20.5.0
        • @commitlint/resolve-extends@20.5.0
          • resolve-from@5.0.0

css-tree
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • svgo@4.0.1
          • csso@5.0.5
            • css-tree@2.2.1

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • svgo@4.0.1
          • css-tree@3.2.1

escape-string-regexp
3 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-unicorn@63.0.0
        • clean-regexp@1.0.0
          • escape-string-regexp@1.0.5

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • escape-string-regexp@4.0.0

  • root@
    • @astrojs/mdx@5.0.1
      • ...
        • mdast-util-gfm-autolink-literal@2.0.1
          • mdast-util-find-and-replace@3.0.2
            • escape-string-regexp@5.0.0

ignore
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • ignore@5.3.2

  • root@
    • @azat-io/eslint-config@2.73.0
      • @eslint-community/eslint-plugin-eslint-comments@4.7.1
        • ignore@7.0.5

eslint-visitor-keys
3 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint-visitor-keys@3.4.3

  • root@
    • @azat-io/eslint-config@2.73.0
      • astro-eslint-parser@1.3.0
        • eslint-visitor-keys@4.2.1

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • eslint-visitor-keys@5.0.1

minimatch
4 versions
  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • minimatch@10.2.3

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • @eslint/config-array@0.23.3
            • minimatch@10.2.4

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-jsx-a11y@6.10.2
        • minimatch@3.1.5

  • root@
    • vite-plugin-dts@4.5.4
      • @vue/language-core@2.2.0
        • minimatch@9.0.9

estree-walker
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • @rollup/pluginutils@5.3.0
          • estree-walker@2.0.2

  • root@
    • @astrojs/mdx@5.0.1
      • @mdx-js/mdx@3.1.1
        • estree-walker@3.0.3

@rollup/pluginutils
2 versions
  • root@
    • @poppanator/sveltekit-svg@6.0.1
      • @rollup/pluginutils@5.1.4

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • @rollup/pluginutils@5.3.0

strip-json-comments
2 versions
  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • @rushstack/rig-package@0.7.2
          • strip-json-comments@3.1.1

  • root@
    • knip@5.87.0
      • strip-json-comments@5.0.3

supports-color
3 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • supports-hyperlinks@4.4.0
          • supports-color@10.2.2

  • root@
    • @vitest/coverage-v8@4.1.0
      • istanbul-lib-report@3.0.1
        • supports-color@7.2.0

  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • @rushstack/terminal@0.22.3
          • supports-color@8.1.1

argparse
2 versions
  • root@
    • vite-plugin-dts@4.5.4
      • @microsoft/api-extractor@7.57.7
        • @rushstack/ts-command-line@5.3.3
          • argparse@1.0.10

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • js-yaml@4.1.1
          • argparse@2.0.1

undici-types
2 versions
  • root@
    • @astrojs/sitemap@3.7.1
      • sitemap@9.0.1
        • @types/node@24.12.0
          • undici-types@7.16.0

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • vite@7.3.1
          • @types/node@25.5.0
            • undici-types@7.18.2

std-env
2 versions
  • root@
    • changelogen@0.6.2
      • std-env@3.10.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • @vitest/eslint-plugin@1.6.12
        • vitest@4.1.0
          • std-env@4.0.0

pathe
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • pathe@1.1.2

  • root@
    • @azat-io/eslint-config@2.73.0
      • @vitest/eslint-plugin@1.6.12
        • vitest@4.1.0
          • @vitest/runner@4.1.0
            • pathe@2.0.3

request-light
2 versions
  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • volar-service-yaml@0.0.70
          • yaml-language-server@1.20.0
            • request-light@0.5.8

  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • @volar/language-server@2.4.28
          • request-light@0.7.0

jsonc-parser
2 versions
  • root@
    • @astrojs/check@0.9.8
      • @astrojs/language-server@2.16.5
        • volar-service-emmet@0.0.70
          • @vscode/emmet-helper@2.11.0
            • jsonc-parser@2.3.1

  • root@
    • @astrojs/check@0.9.8
      • ...
        • yaml-language-server@1.20.0
          • vscode-json-languageservice@4.1.8
            • jsonc-parser@3.3.1

entities
3 versions
  • root@
    • @astrojs/mdx@5.0.1
      • ...
        • domutils@3.2.2
          • dom-serializer@2.0.0
            • entities@4.5.0

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • hast-util-from-html@2.0.3
          • parse5@7.3.0
            • entities@6.0.1

  • root@
    • vite-plugin-dts@4.5.4
      • @vue/language-core@2.2.0
        • @vue/compiler-dom@3.5.30
          • @vue/compiler-core@3.5.30
            • entities@7.0.1

json-schema-traverse
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • ajv@6.14.0
            • json-schema-traverse@0.4.1

  • root@
    • @astrojs/check@0.9.8
      • ...
        • yaml-language-server@1.20.0
          • ajv@8.18.0
            • json-schema-traverse@1.0.0

eslint-scope
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • astro-eslint-parser@1.3.0
        • eslint-scope@8.4.0

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • eslint-scope@9.1.2

espree
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • astro-eslint-parser@1.3.0
        • espree@10.4.0

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • espree@11.2.0

aria-query
2 versions
  • root@
    • @astrojs/svelte@8.0.1
      • @sveltejs/vite-plugin-svelte@6.2.4
        • @sveltejs/vite-plugin-svelte-inspector@5.0.2
          • svelte@5.53.13
            • aria-query@5.3.1

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • aria-query@5.3.2

cookie
2 versions
  • root@
    • @humanwhocodes/crosspost@1.0.3
      • @modelcontextprotocol/sdk@1.27.1
        • express@5.2.1
          • cookie@0.7.2

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • cookie@1.1.1

html-escaper
2 versions
  • root@
    • @vitest/coverage-v8@4.1.0
      • istanbul-reports@3.2.0
        • html-escaper@2.0.2

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • html-escaper@3.0.3

p-limit
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • ...
        • locate-path@6.0.0
          • p-locate@5.0.0
            • p-limit@3.1.0

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • p-limit@7.3.0

yargs-parser
2 versions
  • root@
    • @astrojs/check@0.9.8
      • yargs@17.7.2
        • yargs-parser@21.1.1

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • yargs-parser@22.0.0

brace-expansion
3 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-jsx-a11y@6.10.2
        • minimatch@3.1.5
          • brace-expansion@1.1.12

  • root@
    • vite-plugin-dts@4.5.4
      • @vue/language-core@2.2.0
        • minimatch@9.0.9
          • brace-expansion@2.0.2

  • root@
    • @typescript-eslint/utils@8.57.1
      • ...
        • @eslint/config-array@0.23.3
          • minimatch@10.2.4
            • brace-expansion@5.0.4

balanced-match
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-jsx-a11y@6.10.2
        • minimatch@3.1.5
          • brace-expansion@1.1.12
            • balanced-match@1.0.2

  • root@
    • @typescript-eslint/utils@8.57.1
      • ...
        • minimatch@10.2.4
          • brace-expansion@5.0.4
            • balanced-match@4.0.4

c12
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2

  • root@
    • changelogen@0.6.2
      • c12@3.3.3

confbox
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • confbox@0.1.8

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • confbox@0.2.4

dotenv
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • dotenv@16.6.1

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • dotenv@17.3.1

giget
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • giget@1.2.5

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • giget@2.0.0

jiti
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • jiti@1.21.7

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • jiti@2.6.1

ohash
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • ohash@1.1.6

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • unifont@0.7.4
          • ohash@2.0.11

perfect-debounce
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • perfect-debounce@1.0.0

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • perfect-debounce@2.1.0

pkg-types
2 versions
  • root@
    • changelogithub@14.0.0
      • ...
        • giget@1.2.5
          • nypm@0.5.4
            • pkg-types@1.3.1

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • pkg-types@2.3.0

glob-parent
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • astro-eslint-parser@1.3.0
        • fast-glob@3.3.3
          • glob-parent@5.1.2

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • glob-parent@6.0.2

readdirp
3 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • chokidar@3.6.0
            • readdirp@3.6.0

  • root@
    • @astrojs/check@0.9.8
      • chokidar@4.0.3
        • readdirp@4.1.2

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • unstorage@1.17.4
          • chokidar@5.0.0
            • readdirp@5.0.0

citty
2 versions
  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • giget@2.0.0
          • citty@0.1.6

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • giget@2.0.0
          • nypm@0.6.5
            • citty@0.2.1

lilconfig
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-svelte@3.15.2
        • postcss-load-config@3.1.4
          • lilconfig@2.1.0

  • root@
    • clean-publish@6.0.4
      • lilconfig@3.1.3

parent-module
2 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • cosmiconfig@9.0.1
          • import-fresh@3.3.1
            • parent-module@1.0.1

  • root@
    • cspell@9.7.0
      • @cspell/cspell-worker@9.7.0
        • cspell-lib@9.7.0
          • clear-module@4.1.2
            • parent-module@2.0.0

string-width
2 versions
  • root@
    • @astrojs/check@0.9.8
      • yargs@17.7.2
        • cliui@8.0.1
          • string-width@4.2.3

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • string-width@8.2.0

strip-ansi
2 versions
  • root@
    • @astrojs/check@0.9.8
      • yargs@17.7.2
        • cliui@8.0.1
          • string-width@4.2.3
            • strip-ansi@6.0.1

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • string-width@8.2.0
          • strip-ansi@7.2.0

meow
2 versions
  • root@
    • @commitlint/cli@20.5.0
      • @commitlint/format@20.5.0
        • @commitlint/types@20.5.0
          • conventional-commits-parser@6.3.0
            • meow@13.2.0

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • meow@14.1.0

env-paths
2 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • cosmiconfig@9.0.1
          • env-paths@2.2.1

  • root@
    • cspell@9.7.0
      • @cspell/cspell-worker@9.7.0
        • cspell-lib@9.7.0
          • env-paths@4.0.0

path-key
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • cross-spawn@7.0.6
            • path-key@3.1.1

  • root@
    • changelogithub@14.0.0
      • execa@9.6.1
        • npm-run-path@6.0.0
          • path-key@4.0.0

which
2 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • global-modules@2.0.0
          • global-prefix@3.0.0
            • which@1.3.1

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • cross-spawn@7.0.6
            • which@2.0.2

ansi-regex
2 versions
  • root@
    • @astrojs/check@0.9.8
      • ...
        • string-width@4.2.3
          • strip-ansi@6.0.1
            • ansi-regex@5.0.1

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • string-width@8.2.0
          • strip-ansi@7.2.0
            • ansi-regex@6.2.2

commander
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • svgo@4.0.1
          • commander@11.1.0

  • root@
    • cspell@9.7.0
      • commander@14.0.3

mdn-data
2 versions
  • root@
    • @astrojs/mdx@5.0.1
      • ...
        • csso@5.0.5
          • css-tree@2.2.1
            • mdn-data@2.0.28

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • svgo@4.0.1
          • css-tree@3.2.1
            • mdn-data@2.27.1

eslint-compat-utils
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-n@17.24.0
        • eslint-plugin-es-x@7.8.0
          • eslint-compat-utils@0.5.1

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-astro@1.6.0
        • eslint-compat-utils@0.6.5

spdx-expression-parse
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • ...
        • validate-npm-package-license@3.0.4
          • spdx-correct@3.2.0
            • spdx-expression-parse@3.0.1

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-jsdoc@62.8.0
        • spdx-expression-parse@4.0.0

emoji-regex
2 versions
  • root@
    • @astrojs/check@0.9.8
      • yargs@17.7.2
        • cliui@8.0.1
          • string-width@4.2.3
            • emoji-regex@8.0.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-jsx-a11y@6.10.2
        • emoji-regex@9.2.2

zod-validation-error
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-compiler@19.1.0-rc.2
        • zod-validation-error@3.5.4

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-react-hooks@7.0.1
        • zod-validation-error@4.0.2

builtin-modules
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-sonarjs@4.0.2
        • builtin-modules@3.3.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-unicorn@63.0.0
        • is-builtin-module@5.0.0
          • builtin-modules@5.0.0

postcss-safe-parser
2 versions
  • root@
    • postcss-html@1.8.1
      • postcss-safe-parser@6.0.0

  • root@
    • @azat-io/eslint-config@2.73.0
      • eslint-plugin-svelte@3.15.2
        • postcss-safe-parser@7.0.1

file-entry-cache
2 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • file-entry-cache@11.1.2

  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • file-entry-cache@8.0.0

flat-cache
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • @eslint-community/eslint-utils@4.9.1
        • eslint@10.0.3
          • file-entry-cache@8.0.0
            • flat-cache@4.0.1

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • file-entry-cache@11.1.2
          • flat-cache@6.1.20

minipass
2 versions
  • root@
    • changelogithub@14.0.0
      • ...
        • tar@6.2.1
          • fs-minipass@2.1.0
            • minipass@3.3.6

  • root@
    • changelogithub@14.0.0
      • ...
        • giget@1.2.5
          • tar@6.2.1
            • minipass@5.0.0

nypm
2 versions
  • root@
    • changelogithub@14.0.0
      • changelogen@0.5.7
        • c12@1.11.2
          • giget@1.2.5
            • nypm@0.5.4

  • root@
    • changelogen@0.6.2
      • c12@3.3.3
        • giget@2.0.0
          • nypm@0.6.5

ini
3 versions
  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • global-modules@2.0.0
          • global-prefix@3.0.0
            • ini@1.3.8

  • root@
    • @commitlint/cli@20.5.0
      • @commitlint/load@20.5.0
        • @commitlint/resolve-extends@20.5.0
          • global-directory@4.0.1
            • ini@4.1.1

  • root@
    • cspell@9.7.0
      • ...
        • @cspell/cspell-resolver@9.7.0
          • global-directory@5.0.0
            • ini@6.0.0

unicorn-magic
2 versions
  • root@
    • changelogithub@14.0.0
      • execa@9.6.1
        • npm-run-path@6.0.0
          • unicorn-magic@0.3.0

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • globby@16.1.1
          • unicorn-magic@0.4.0

unist-util-find-after
2 versions
  • root@
    • remark-sectionize@2.1.0
      • unist-util-find-after@4.0.1

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • hast-util-to-text@4.0.2
          • unist-util-find-after@5.0.0

yallist
2 versions
  • root@
    • @azat-io/eslint-config@2.73.0
      • ...
        • @babel/helper-compilation-targets@7.28.6
          • lru-cache@5.1.1
            • yallist@3.1.1

  • root@
    • changelogithub@14.0.0
      • ...
        • fs-minipass@2.1.0
          • minipass@3.3.6
            • yallist@4.0.0

unist-util-is
2 versions
  • root@
    • remark-sectionize@2.1.0
      • unist-util-find-after@4.0.1
        • unist-util-is@5.2.1

  • root@
    • @astrojs/mdx@5.0.1
      • @astrojs/markdown-remark@7.0.0
        • hast-util-to-text@4.0.2
          • unist-util-find-after@5.0.0
            • unist-util-is@6.0.1

yocto-queue
2 versions
  • root@
    • @typescript-eslint/utils@8.57.1
      • ...
        • p-locate@5.0.0
          • p-limit@3.1.0
            • yocto-queue@0.1.0

  • root@
    • @astrojs/mdx@5.0.1
      • astro@6.0.5
        • p-limit@7.3.0
          • yocto-queue@1.2.2

has-flag
2 versions
  • root@
    • @vitest/coverage-v8@4.1.0
      • istanbul-lib-report@3.0.1
        • supports-color@7.2.0
          • has-flag@4.0.0

  • root@
    • @azat-io/stylelint-config@1.8.0
      • stylelint@17.4.0
        • supports-hyperlinks@4.4.0
          • has-flag@5.0.1

💡 To find out what depends on a specific package, run: pnpm -r why example-package

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b08d53d) to head (48dc5a3).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #726   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          221       223    +2     
  Lines         4352      4364   +12     
  Branches      1350      1353    +3     
=========================================
+ Hits          4352      4364   +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hugop95 hugop95 marked this pull request as ready for review March 23, 2026 22:40
@hugop95 hugop95 changed the title fix: add Oxlint rule tester fix: add Oxlint rule tester and fix issue in sort-classes Mar 23, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
rules/sort-classes/node-info/common-modifiers.ts (1)

45-55: ⚠️ Potential issue | 🟠 Major

Normalize null accessibility to 'public' instead of dropping the modifier.

The current fallback returns [], which removes accessibility from computed modifiers and can mis-group/sort members. For oxlint’s null, this should behave like missing accessibility (public), not “no modifier”.

💡 Proposed fix
 export function computeAccessibilityModifier({
   hasPrivateHash,
   node,
 }: {
   node: Accessor | Property | Method
   hasPrivateHash: boolean
 }): Modifier[] {
   if (hasPrivateHash) {
     return ['private']
   }

-  switch (node.accessibility) {
+  const accessibility = node.accessibility ?? 'public'
+
+  switch (accessibility) {
     case 'protected':
       return ['protected']
     case 'private':
       return ['private']
-    case undefined:
     case 'public':
       return ['public']
     default:
-      assertIsNever(node.accessibility)
-      return []
+      assertIsNever(accessibility)
+      return ['public']
   }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/sort-classes/node-info/common-modifiers.ts` around lines 45 - 55, The
switch over node.accessibility currently drops null by falling into default and
returning [], which removes the accessibility modifier; update the handling in
the switch (the one switching on node.accessibility) so that null is treated the
same as undefined/'public' (either add an explicit case null that returns
['public'] or coerce node.accessibility to 'public' before the switch), keeping
the assertIsNever(node.accessibility) in place for true unexpected values.
🧹 Nitpick comments (2)
test/rules/sort-heritage-clauses.test.ts (1)

3287-3294: Consider adding one valid class case in Oxlint coverage.

You already validate class behavior in invalid; adding a sorted class case in valid would close the false-positive gap for that node type.

Suggested diff
         valid: [
           {
             code: dedent`
               interface Interface extends a, b {}
             `,
             options: [{ type: 'alphabetical', order: 'asc' }],
           },
+          {
+            code: dedent`
+              class Class implements a, b {}
+            `,
+            options: [{ type: 'alphabetical', order: 'asc' }],
+          },
         ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/rules/sort-heritage-clauses.test.ts` around lines 3287 - 3294, Add a
positive test for a sorted class heritage clause to the existing valid cases so
class nodes are covered (mirror the interface case). In the test file
sort-heritage-clauses.test.ts add an entry to the valid array with a class
declaration that has sorted extends/implements (e.g., "class MyClass extends A,
B {}" or includes implements) and use the same options object used by the
interface case (options: [{ type: 'alphabetical', order: 'asc' }]) so the rule's
class behavior is validated as a true-positive.
test/rules/sort-decorators.test.ts (1)

6608-6615: Optional: broaden Oxlint valid coverage to member contexts.

Current Oxlint valid only checks top-level class decorators. Adding one sorted member/accessor/method/parameter case would better guard against backend-specific false positives.

Suggested diff
         valid: [
           {
             code: dedent`
               `@A`
               `@B`
               class Foo {}
             `,
             options: [{ type: 'alphabetical', order: 'asc' }],
           },
+          {
+            code: dedent`
+              class Foo {
+                `@A`
+                `@B`
+                property
+
+                `@A`
+                `@B`
+                accessor field
+
+                `@A`
+                `@B`
+                method(
+                  `@A`
+                  `@B`
+                  parameter) {}
+              }
+            `,
+            options: [{ type: 'alphabetical', order: 'asc' }],
+          },
         ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/rules/sort-decorators.test.ts` around lines 6608 - 6615, The test
suite's `valid` cases only cover top-level class decorators; add at least one
sorted-member case to guard against backend-specific false positives by adding
examples of decorators in member/accessor/method/parameter contexts (e.g., a
class property with `@A/`@B, a getter/setter or method decorated with `@A/`@B, and a
parameter decorated with `@A/`@B) using the same options ({ type: 'alphabetical',
order: 'asc' }) so the rule is exercised for non-top-level decorator positions;
update the `valid` array in test/rules/sort-decorators.test.ts to include these
strings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/rules/build-oxlint-rule-tester.ts`:
- Line 17: The parameter default only applies when the whole param is omitted;
update buildOxlintRuleTester's parameter destructuring so the lang property
itself defaults to 'ts' (i.e., change the signature from "{ lang }: { lang?:
Language } = { lang: 'ts' }" to using a property default and an empty-object
default for the param) so calling buildOxlintRuleTester(rule, {}) yields lang
=== 'ts'.

---

Outside diff comments:
In `@rules/sort-classes/node-info/common-modifiers.ts`:
- Around line 45-55: The switch over node.accessibility currently drops null by
falling into default and returning [], which removes the accessibility modifier;
update the handling in the switch (the one switching on node.accessibility) so
that null is treated the same as undefined/'public' (either add an explicit case
null that returns ['public'] or coerce node.accessibility to 'public' before the
switch), keeping the assertIsNever(node.accessibility) in place for true
unexpected values.

---

Nitpick comments:
In `@test/rules/sort-decorators.test.ts`:
- Around line 6608-6615: The test suite's `valid` cases only cover top-level
class decorators; add at least one sorted-member case to guard against
backend-specific false positives by adding examples of decorators in
member/accessor/method/parameter contexts (e.g., a class property with `@A/`@B, a
getter/setter or method decorated with `@A/`@B, and a parameter decorated with
`@A/`@B) using the same options ({ type: 'alphabetical', order: 'asc' }) so the
rule is exercised for non-top-level decorator positions; update the `valid`
array in test/rules/sort-decorators.test.ts to include these strings.

In `@test/rules/sort-heritage-clauses.test.ts`:
- Around line 3287-3294: Add a positive test for a sorted class heritage clause
to the existing valid cases so class nodes are covered (mirror the interface
case). In the test file sort-heritage-clauses.test.ts add an entry to the valid
array with a class declaration that has sorted extends/implements (e.g., "class
MyClass extends A, B {}" or includes implements) and use the same options object
used by the interface case (options: [{ type: 'alphabetical', order: 'asc' }])
so the rule's class behavior is validated as a true-positive.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7de94fda-cef0-41ca-9115-33e61b4ed001

📥 Commits

Reviewing files that changed from the base of the PR and between b08d53d and 6bf8d71.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (28)
  • cspell.config.ts
  • package.json
  • rules/sort-classes/is-known-class-element.ts
  • rules/sort-classes/node-info/common-modifiers.ts
  • test/rules/build-oxlint-rule-tester.ts
  • test/rules/sort-array-includes.test.ts
  • test/rules/sort-classes.test.ts
  • test/rules/sort-decorators.test.ts
  • test/rules/sort-enums.test.ts
  • test/rules/sort-export-attributes.test.ts
  • test/rules/sort-exports.test.ts
  • test/rules/sort-heritage-clauses.test.ts
  • test/rules/sort-import-attributes.test.ts
  • test/rules/sort-imports.test.ts
  • test/rules/sort-interfaces.test.ts
  • test/rules/sort-intersection-types.test.ts
  • test/rules/sort-jsx-props.test.ts
  • test/rules/sort-maps.test.ts
  • test/rules/sort-modules.test.ts
  • test/rules/sort-named-exports.test.ts
  • test/rules/sort-named-imports.test.ts
  • test/rules/sort-object-types.test.ts
  • test/rules/sort-objects.test.ts
  • test/rules/sort-sets.test.ts
  • test/rules/sort-switch-case.test.ts
  • test/rules/sort-union-types.test.ts
  • test/rules/sort-variable-declarations.test.ts
  • utils/assert-is-never.ts

*/
export function buildOxlintRuleTester(
rule: RuleModule,
{ lang }: { lang?: Language } = { lang: 'ts' },
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether any current callsites pass an empty options object or undefined lang.
rg -nP --type ts '\bbuildOxlintRuleTester\s*\(\s*[^,]+,\s*\{\s*\}\s*\)'
rg -nP --type ts '\bbuildOxlintRuleTester\s*\(\s*[^,]+,\s*\{\s*lang\s*:\s*undefined\s*\}\s*\)'

Repository: azat-io/eslint-plugin-perfectionist

Length of output: 61


Default lang parameter should default the property, not just the entire parameter.

Line 17's destructuring pattern only defaults when the parameter is omitted entirely. Calling buildOxlintRuleTester(rule, {}) would pass lang: undefined despite the documented default being 'ts'. While no current callsites trigger this, the fix improves API correctness and defensiveness:

Proposed fix
 export function buildOxlintRuleTester(
   rule: RuleModule,
-  { lang }: { lang?: Language } = { lang: 'ts' },
+  { lang = 'ts' }: { lang?: Language } = {},
 ): {
   run(name: string, tests: RuleTester.TestCases): void
 } {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{ lang }: { lang?: Language } = { lang: 'ts' },
{ lang = 'ts' }: { lang?: Language } = {},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/rules/build-oxlint-rule-tester.ts` at line 17, The parameter default
only applies when the whole param is omitted; update buildOxlintRuleTester's
parameter destructuring so the lang property itself defaults to 'ts' (i.e.,
change the signature from "{ lang }: { lang?: Language } = { lang: 'ts' }" to
using a property default and an empty-object default for the param) so calling
buildOxlintRuleTester(rule, {}) yields lang === 'ts'.

@hugop95 hugop95 marked this pull request as draft March 23, 2026 22:51
@hugop95 hugop95 marked this pull request as ready for review March 23, 2026 23:03
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rules/sort-classes/node-info/common-modifiers.ts`:
- Around line 48-49: The current runtime throw discards the modifier because
Error only takes one message argument; update the throw in common-modifiers.ts
(the branch that currently does: throw new Error('Unhandled accessibility
modifier', modifier)) to include the actual modifier value in the error message
(e.g., build a single message that embeds or stringifies the modifier) so
runtime errors preserve the unexpected AST value for debugging; ensure you keep
the existing "v8 ignore next -- `@preserve` Unhandled case" comment and reference
the same modifier variable when constructing the message.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 63d2f6ef-90a9-4628-baad-7f4ee7025e02

📥 Commits

Reviewing files that changed from the base of the PR and between 6bf8d71 and 75ce624.

📒 Files selected for processing (26)
  • cspell.config.ts
  • rules/sort-classes/is-known-class-element.ts
  • rules/sort-classes/node-info/common-modifiers.ts
  • test/rules/sort-array-includes.test.ts
  • test/rules/sort-classes.test.ts
  • test/rules/sort-decorators.test.ts
  • test/rules/sort-enums.test.ts
  • test/rules/sort-export-attributes.test.ts
  • test/rules/sort-exports.test.ts
  • test/rules/sort-heritage-clauses.test.ts
  • test/rules/sort-import-attributes.test.ts
  • test/rules/sort-imports.test.ts
  • test/rules/sort-interfaces.test.ts
  • test/rules/sort-intersection-types.test.ts
  • test/rules/sort-jsx-props.test.ts
  • test/rules/sort-maps.test.ts
  • test/rules/sort-modules.test.ts
  • test/rules/sort-named-exports.test.ts
  • test/rules/sort-named-imports.test.ts
  • test/rules/sort-object-types.test.ts
  • test/rules/sort-objects.test.ts
  • test/rules/sort-sets.test.ts
  • test/rules/sort-switch-case.test.ts
  • test/rules/sort-union-types.test.ts
  • test/rules/sort-variable-declarations.test.ts
  • utils/assert-is-never.ts
✅ Files skipped from review due to trivial changes (7)
  • cspell.config.ts
  • utils/assert-is-never.ts
  • test/rules/sort-heritage-clauses.test.ts
  • test/rules/sort-switch-case.test.ts
  • test/rules/sort-maps.test.ts
  • test/rules/sort-sets.test.ts
  • test/rules/sort-modules.test.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • rules/sort-classes/is-known-class-element.ts
  • test/rules/sort-export-attributes.test.ts
  • test/rules/sort-interfaces.test.ts
  • test/rules/sort-object-types.test.ts
  • test/rules/sort-named-exports.test.ts
  • test/rules/sort-classes.test.ts
  • test/rules/sort-named-imports.test.ts

Comment on lines +48 to +49
/* v8 ignore next -- @preserve Unhandled case */
throw new Error('Unhandled accessibility modifier', modifier)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n "rules/sort-classes/node-info/common-modifiers.ts" | head -60

Repository: azat-io/eslint-plugin-perfectionist

Length of output: 2208


🏁 Script executed:

cat -n "utils/assert-is-never.ts"

Repository: azat-io/eslint-plugin-perfectionist

Length of output: 446


🏁 Script executed:

node -e "
try {
  throw new Error('Test message', 'extra param');
} catch (e) {
  console.log('Error message:', e.message);
  console.log('Full error:', e.toString());
  console.log('Error has 2 args, does second appear in message?', e.message.includes('extra param'));
}
"

Repository: azat-io/eslint-plugin-perfectionist

Length of output: 193


Preserve the unexpected modifier in the runtime error.

The Error constructor does not include the second argument in the error message. Line 49's throw new Error('Unhandled accessibility modifier', modifier) silently discards the modifier value, making it impossible to diagnose future AST-shape mismatches at runtime. Since assertIsNever is compile-time only, this runtime path needs explicit error context.

Suggested change
-    throw new Error('Unhandled accessibility modifier', modifier)
+    throw new Error(
+      `Unhandled accessibility modifier: ${String(modifier)}`,
+    )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/* v8 ignore next -- @preserve Unhandled case */
throw new Error('Unhandled accessibility modifier', modifier)
/* v8 ignore next -- `@preserve` Unhandled case */
throw new Error(
`Unhandled accessibility modifier: ${String(modifier)}`,
)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/sort-classes/node-info/common-modifiers.ts` around lines 48 - 49, The
current runtime throw discards the modifier because Error only takes one message
argument; update the throw in common-modifiers.ts (the branch that currently
does: throw new Error('Unhandled accessibility modifier', modifier)) to include
the actual modifier value in the error message (e.g., build a single message
that embeds or stringifies the modifier) so runtime errors preserve the
unexpected AST value for debugging; ensure you keep the existing "v8 ignore next
-- `@preserve` Unhandled case" comment and reference the same modifier variable
when constructing the message.

Copy link
Copy Markdown
Owner

@azat-io azat-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

@azat-io azat-io merged commit 4949b1d into azat-io:main Mar 24, 2026
14 checks passed
@hugop95 hugop95 deleted the fix/725/oxlint branch March 24, 2026 18:40
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.

Bug: sort-classes in oxlint

2 participants