Skip to content

feat(oxc_linter): Sort rules by plugin and rule name when outputting resolved config as a JSON string#9799

Merged
Boshen merged 2 commits intooxc-project:mainfrom
nrayburn-tech:oxlint-sort-init-rules
Mar 16, 2025
Merged

feat(oxc_linter): Sort rules by plugin and rule name when outputting resolved config as a JSON string#9799
Boshen merged 2 commits intooxc-project:mainfrom
nrayburn-tech:oxlint-sort-init-rules

Conversation

@nrayburn-tech
Copy link
Collaborator

The current rules aren't sorted in any way, sorting by plugin name and rule name is pretty common from what I've seen. This makes the generated config easier to read.

New Config File
{
  "plugins": [
    "react",
    "unicorn",
    "typescript",
    "oxc"
  ],
  "categories": {},
  "rules": {
    "for-direction": "warn",
    "no-async-promise-executor": "warn",
    "no-caller": "warn",
    "no-class-assign": "warn",
    "no-compare-neg-zero": "warn",
    "no-cond-assign": "warn",
    "no-const-assign": "warn",
    "no-constant-binary-expression": "warn",
    "no-constant-condition": "warn",
    "no-control-regex": "warn",
    "no-debugger": "warn",
    "no-delete-var": "warn",
    "no-dupe-class-members": "warn",
    "no-dupe-else-if": "warn",
    "no-dupe-keys": "warn",
    "no-duplicate-case": "warn",
    "no-empty-character-class": "warn",
    "no-empty-pattern": "warn",
    "no-empty-static-block": "warn",
    "no-eval": "warn",
    "no-ex-assign": "warn",
    "no-extra-boolean-cast": "warn",
    "no-func-assign": "warn",
    "no-global-assign": "warn",
    "no-import-assign": "warn",
    "no-invalid-regexp": "warn",
    "no-irregular-whitespace": "warn",
    "no-loss-of-precision": "warn",
    "no-new-native-nonconstructor": "warn",
    "no-nonoctal-decimal-escape": "warn",
    "no-obj-calls": "warn",
    "no-self-assign": "warn",
    "no-setter-return": "warn",
    "no-shadow-restricted-names": "warn",
    "no-sparse-arrays": "warn",
    "no-this-before-super": "warn",
    "no-unsafe-finally": "warn",
    "no-unsafe-negation": "warn",
    "no-unsafe-optional-chaining": "warn",
    "no-unused-labels": "warn",
    "no-unused-private-class-members": "warn",
    "no-unused-vars": "warn",
    "no-useless-catch": "warn",
    "no-useless-escape": "warn",
    "no-useless-rename": "warn",
    "no-with": "warn",
    "require-yield": "warn",
    "use-isnan": "warn",
    "valid-typeof": "warn",
    "oxc/bad-array-method-on-arguments": "warn",
    "oxc/bad-char-at-comparison": "warn",
    "oxc/bad-comparison-sequence": "warn",
    "oxc/bad-min-max-func": "warn",
    "oxc/bad-object-literal-comparison": "warn",
    "oxc/bad-replace-all-arg": "warn",
    "oxc/const-comparisons": "warn",
    "oxc/double-comparisons": "warn",
    "oxc/erasing-op": "warn",
    "oxc/missing-throw": "warn",
    "oxc/number-arg-out-of-range": "warn",
    "oxc/only-used-in-recursion": "warn",
    "oxc/uninvoked-array-callback": "warn",
    "react/jsx-key": "warn",
    "react/jsx-no-duplicate-props": "warn",
    "react/jsx-no-target-blank": "warn",
    "react/jsx-no-undef": "warn",
    "react/jsx-props-no-spread-multi": "warn",
    "react/no-children-prop": "warn",
    "react/no-danger-with-children": "warn",
    "react/no-direct-mutation-state": "warn",
    "react/no-find-dom-node": "warn",
    "react/no-is-mounted": "warn",
    "react/no-render-return-value": "warn",
    "react/no-string-refs": "warn",
    "react/void-dom-elements-no-children": "warn",
    "typescript/no-duplicate-enum-values": "warn",
    "typescript/no-extra-non-null-assertion": "warn",
    "typescript/no-misused-new": "warn",
    "typescript/no-non-null-asserted-optional-chain": "warn",
    "typescript/no-this-alias": "warn",
    "typescript/no-unsafe-declaration-merging": "warn",
    "typescript/no-useless-empty-export": "warn",
    "typescript/no-wrapper-object-types": "warn",
    "typescript/prefer-as-const": "warn",
    "typescript/triple-slash-reference": "warn",
    "unicorn/no-await-in-promise-methods": "warn",
    "unicorn/no-document-cookie": "warn",
    "unicorn/no-empty-file": "warn",
    "unicorn/no-invalid-fetch-options": "warn",
    "unicorn/no-invalid-remove-event-listener": "warn",
    "unicorn/no-new-array": "warn",
    "unicorn/no-single-promise-in-promise-methods": "warn",
    "unicorn/no-thenable": "warn",
    "unicorn/no-unnecessary-await": "warn",
    "unicorn/no-useless-fallback-in-spread": "warn",
    "unicorn/no-useless-length-check": "warn",
    "unicorn/no-useless-spread": "warn",
    "unicorn/prefer-set-size": "warn",
    "unicorn/prefer-string-starts-ends-with": "warn"
  },
  "settings": {
    "jsx-a11y": {
      "polymorphicPropName": null,
      "components": {}
    },
    "next": {
      "rootDir": []
    },
    "react": {
      "formComponents": [],
      "linkComponents": []
    },
    "jsdoc": {
      "ignorePrivate": false,
      "ignoreInternal": false,
      "ignoreReplacesDocs": true,
      "overrideReplacesDocs": true,
      "augmentsExtendsReplacesDocs": false,
      "implementsReplacesDocs": false,
      "exemptDestructuredRootsFromChecks": false,
      "tagNamePreference": {}
    }
  },
  "env": {
    "builtin": true
  },
  "globals": {},
  "ignorePatterns": []
}

@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 15, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-linter Area - Linter C-enhancement Category - New feature or request labels Mar 15, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 15, 2025

CodSpeed Performance Report

Merging #9799 will not alter performance

Comparing nrayburn-tech:oxlint-sort-init-rules (81e3a10) with main (ea6b6d9)

Summary

✅ 33 untouched benchmarks

@Boshen Boshen merged commit c22276e into oxc-project:main Mar 16, 2025
25 checks passed
Boshen added a commit that referenced this pull request Mar 16, 2025
## [0.16.0] - 2025-03-16

- 225e266 linter: [**BREAKING**] Enable `--experimental-nested-config`
by default and add `--disable-nested-config` option (#9760) (camchenry)

### Features

- 27d6e9b editor: Only watch .oxlintrc.json or user supplied config
paths (#9731) (Nicholas Rayburn)
- 8dd6809 linter: Add `eslint/no-lonely-if` (#9660) (therewillbecode)
- c22276e oxc_linter: Sort rules by plugin and rule name when outputting
resolved config as a JSON string (#9799) (Nicholas Rayburn)

### Bug Fixes

- 22f18ac linter: Improve `jsx-a11y/anchor-ambiguous-text` diagnostic
message (#9789) (1zumii)
- 6c11740 linter: False positive in `unicorn/catch-error-name` (#9763)
(shulaoda)

### Documentation

- ea6b6d9 linter: Improve docs for `eslint-valid-typeof` (#9797)
(therewillbecode)
- 2c48fba linter: Fix typo in `oxc/bad-min-max-func` (#9791) (Flo)
- 210b876 linter: Improve `eslint-no-async-promise-executor` (#9778)
(therewillbecode)
- f8628bc linter: Improve `eslint-no-class-assign` (#9779)
(therewillbecode)
- faca7a8 linter: Improve `eslint-no-self-assign` (#9768)
(therewillbecode)

### Refactor

- 227d203 linter: Improve `typescript-no-unnecessary-type-constraint`
(#9798) (therewillbecode)
- 05fe2cd linter: Use `is_lexical` when checking for lexical decl
(#9781) (camc314)
- fcdd810 linter: Remove if let nesting from `unicorn-no-date-clone`
(#9767) (therewillbecode)
- 5a9e1b9 linter: Improve `typescript-no-misused-new` (#9766)
(therewillbecode)
- 9df5565 linter: Improve `unicorn/filename-case` (#9762) (shulaoda)
- b0b1f18 linter: Remove if let nesting from
`nextjs-no-async-client-component` (#9764) (therewillbecode)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
@nrayburn-tech nrayburn-tech deleted the oxlint-sort-init-rules branch July 10, 2025 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants