Commit graph

79 commits

Author SHA1 Message Date
oxc-bot
88d17b96e3
release(oxlint): v0.13.1 (#7441)
## [0.13.1] - 2024-11-23

### Features

- 4ad26b9 linter: Add `no-promise-in-callback` (#7307) (no-yan)
- 9558087 oxlint: Auto detect config file in CLI (#7348) (Alexander S.)

### Bug Fixes

- 8507464 linter: Hanging when source has syntax/is flow (#7432)
(Cameron)
- e88cf1b linter: Make `overrides` globs relative to config path (#7407)
(camchenry)
- 9002e97 linter: Add proper support for findIndex and findLastIndex for
`unicorn/prefer-array-some` (#7405) (Dmitry Zakharov)

### Documentation

- 6730e3e linter: Add more examples for `unicorn/prefer-array-some`
(#7411) (Dmitry Zakharov)

### Refactor

- 6c0d31b linter: Remove useless `const` declaration (#7430) (Song Gao)
- c8adc46 linter/no-unused-vars: Improve implementation to remove using
SymbolFlags::Export (#7412) (Dunqing)
- c90537f linter/only-used-in-recursion: Improve implementation to
remove using SymbolFlags::Export (#7413) (Dunqing)

### Testing

- 779f479 editor: Check if workspace configuration is updated (#7403)
(Alexander S.)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-23 23:46:16 +08:00
Cameron
8507464d5a
fix(linter): hanging when source has syntax/is flow (#7432)
Closes #7406

See
https://github.com/oxc-project/oxc/issues/7406#issuecomment-2494981152
for why this is happening

not sure whether there's a better solve for this/
2024-11-23 23:20:19 +08:00
Alexander S.
9558087db9
feat(oxlint): auto detect config file in CLI (#7348)
waiting fior #7352

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-23 23:17:05 +08:00
camchenry
e88cf1bfd6 fix(linter): make overrides globs relative to config path (#7407)
- fixes https://github.com/oxc-project/oxc/issues/7365

currently, we are matching globs on the absolute path to the file, which means that in order to properly match, all globs would need to start with `**/`. this is not consistent with the behavior in ESLint, which is defined here:  https://eslint.org/docs/v8.x/use/configure/configuration-files#how-do-overrides-work

> **The patterns are applied against the file path relative to the directory of the config file.** For example, if your config file has the path `/Users/john/workspace/any-project/.eslintrc.js` and the file you want to lint has the path `/Users/john/workspace/any-project/lib/util.js`, then the pattern provided in `.eslintrc.js` is executed against the relative path `lib/util.js`.

This PR adds the ability to store the path to the configuration file along with the configuration data, so that we can later use it to resolve the relative paths of the files in the overrides section.

I'm not exactly sure if this will still make sense with nested configuration files, but I think it makes sense to store a path to each configuration file, alongside where the overrides are stored.
2024-11-22 14:37:45 +00:00
oxc-bot
4b5a176630
release(oxlint): v0.13.0 (#7398)
## [0.13.0] - 2024-11-21

- 7bf970a linter: [**BREAKING**] Remove tree_shaking plugin (#7372)
(Boshen)
- 7f8747d linter: Implement `react/no-array-index-key` (#6960)
(BitterGourd)

### Features

- be152c0 linter: Add `typescript/no-require-imports` rule (#7315)
(Dmitry Zakharov)
- 849489e linter: Add suggestion for no-console (#4312) (DonIsaac)
- 8cebdc8 linter: Allow appending plugins in override (#7379)
(camchenry)
- 8cfea3c oxc_cfg: Add implicit return instruction (#5568)
(IWANABETHATGUY)
- e6922df parser: Fix incorrect AST for `x?.f<T>()` (#7387) (Boshen)

### Bug Fixes

- e91c287 linter: Fix panic in react/no-array-index-key (#7395) (Boshen)
- a32f5a7 linter/no-array-index-key: Compile error due to it uses a
renamed API (#7391) (Dunqing)
- 666b6c1 parser: Add missing `ChainExpression` in optional
`TSInstantiationExpression` (#7371) (Boshen)

### Documentation

- df143ca linter: Add docs for config settings (#4827) (DonIsaac)
- ad44cfa linter: Import/first options (#7381) (Zak)

### Refactor

- c34d649 linter: Use `scope_id` etc methods (#7394) (overlookmotel)
- 466f395 vscode: Split `ConfigService` and `Config` (#7376) (Alexander
S.)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-21 22:21:32 +08:00
Boshen
878189c407 feat(parser,linter)!: add ParserReturn::is_flow_language; linter ignore flow error (#7373)
closes #7123
2024-11-20 12:50:24 +00:00
oxc-bot
b6d5c0f33e
release(oxlint): v0.12.0 (#7366)
## [0.12.0] - 2024-11-20

- 20d9080 linter: [**BREAKING**] Override plugins array when passed in
config file (#7303) (camchenry)

### Features

- 1d9f528 linter: Implement `unicorn/prefer-string-raw` lint rule
(#7335) (Ryan Walker)
- d445e0f linter: Implement `unicorn/consistent-existence-index-check`
(#7262) (Ryan Walker)
- 01ddf37 linter: Add `allowReject` option to
`no-useless-promise-resolve-reject` (#7274) (no-yan)
- 755a31b linter: Support bind function case for compatibility with
`promise/no-return-wrap` (#7232) (no-yan)
- 428770e linter: Add `import/no-namespace` rule (#7229) (Dmitry
Zakharov)
- 9c91151 linter: Implement typescript/no-empty-object-type (#6977)
(Orenbek)
- 2268a0e linter: Support `overrides` config field (#6974) (DonIsaac)
- 3dcac1a linter: React/exhaustive-deps (#7151) (camc314)
- d3a0119 oxlint: Add `cwd` property to `LintRunner` (#7352) (Alexander
S.)

### Bug Fixes

- ba0b2ff editor: Reload workspace configuration after change (#7302)
(Alexander S.)
- bc0e72c linter: Handle user variables correctly for import/no_commonjs
(#7316) (Dmitry Zakharov)
- bf839c1 linter: False positive in `jest/expect-expect` (#7341)
(dalaoshu)
- ff2a1d4 linter: Move `exhaustive-deps` to `react` (#7251) (camc314)
- df5c535 linter: Revert unmatched rule error (#7257) (Cameron A
McHenry)
- c4ed230 linter: Fix false positive in eslint/no-cond-assign (#7241)
(camc314)
- ef847da linter: False positive in `jsx-a11y/iframe-has-title` (#7253)
(dalaoshu)
- 62b6327 linter: React/exhaustive-deps update span for unknown deps
diagnostic (#7249) (camc314)

### Documentation

- 4c124a8 editor/vscode: Update VS Code readme with installation
instructions and available features (#7306) (Nicholas Rayburn)

### Refactor

- c6a4868 linter: Temporarily remove unknown rules checking (#7260)
(camchenry)

### Testing

- 5190b7f editor: Add test setup (#7361) (Alexander S.)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-20 15:45:24 +08:00
Alexander S.
d3a0119a42
feat(oxlint): add cwd property to LintRunner (#7352)
allows to use multiple `LintRunner` in one file targeting multiple
directory.
The current problem is for the test in #7348 we can not change
`env::current_dir`,
so as a workaround I introduce a new property :) 

See more info here:
https://discord.com/channels/1079625926024900739/1117322804291964931/1308179827576016897
2024-11-20 12:44:50 +08:00
DonIsaac
2268a0ef90 feat(linter): support overrides config field (#6974)
Part of #5653
2024-11-13 05:40:59 +00:00
Cameron A McHenry
df5c535dd0
fix(linter): revert unmatched rule error (#7257)
- related to https://github.com/oxc-project/oxc/issues/6988

This is causing a lot of errors currently such as
https://github.com/oxc-project/oxc/issues/7233. I think we need to
handle rule names more robustly first:

- https://github.com/oxc-project/oxc/issues/7240
- https://github.com/oxc-project/oxc/issues/7082
- https://github.com/oxc-project/oxc/discussions/7242

then, I think we can revisit this and maybe implement it as an actual
lint plugin too? https://github.com/oxc-project/oxc/discussions/7086
2024-11-13 09:06:20 +08:00
oxc-bot
68dc899887
release(oxlint): v0.11.1 (#7224)
## [0.11.1] - 2024-11-09

### Features

- 4dd9b60 editor/vscode: Replace existing output channel and trace
output channel with a single LogOutputChannel (#7196) (Nicholas Rayburn)
- 1fcd709 linter: Add jsx support for only-used-in-recursion (#7120)
(no-yan)
- 4d577cf linter: Add `import/first` rule (#7180) (Dmitry Zakharov)
- 9b8973f linter: Add `import/unambiguous` rule (#7187) (Dmitry
Zakharov)
- 5ab1ff6 linter: Implement @typescript-eslint/no-unsafe-function-type
(#6989) (Orenbek)

### Bug Fixes

- eea8879 editor/vscode: Update language client id to fix the resolution
of the oxc.trace.server setting (#7181) (Nicholas Rayburn)
- b73cfd9 linter: Fix `is_method_call` with parentheses and chain
expression (#7095) (tbashiyy)

### Refactor

- 8c0a362 linter: Use `ctx.source_range(comment.content_span())` API
(#7155) (Boshen)
- c5485ae semantic: Add `ancestor_kinds` iterator function (#7217)
(camchenry)
- abf1602 semantic: Rename `iter_parents` to `ancestors` (#7216)
(camchenry)
- 42171eb semantic: Rename `ancestors` to `ancestor_ids` (#7215)
(camchenry)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-11-09 19:57:08 +08:00
oxc-bot
2d40b073cb
release(oxlint): v0.11.0 (#7094)
## [0.11.0] - 2024-11-03

- 9fd9f4f linter: [**BREAKING**] Sync sindresorhus/globals; removed
Object.prototype properties from builtin and es* globals (#6991)
(Boshen)

### Features

- 6b619da editor: Listen to config file changes and trigger a
didChangeConfiguration update (#6964) (Nicholas Rayburn)
- 7872927 editor/vscode: Support window/showMessage event (#7085)
(Nicholas Rayburn)
- 2184588 linter: Do not bail for unmatched rules yet (#7093) (Boshen)
- a6fcd81 linter: Add `import/no-commonjs` rule (#6978) (Dmitry
Zakharov)
- 1691cab linter: Support user-configurable secrets for
`oxc-security/api-keys` (#5938) (DonIsaac)
- 610621c linter: Implement `react/style-prop-object` (#6342) (Albert
Kaaman)
- 1e2f012 linter: Add `oxc/no-map-spread` (#6751) (DonIsaac)
- 1c66473 linter: Implement `eslint/prefer-object-has-own` (#6905)
(tomoya yanagibashi)

### Bug Fixes

- ebf3753 editor: Fix onConfigChange to send the correct config for
didChangeConfiguration notification (#6962) (Nicholas Rayburn)
- 79bf74a linter: Check is_reference_to_global_variable in
`no-array-constructor` (#7067) (Naoya Yoshizawa)
- 38d1f78 linter: Remove confusing help text for now (#7081) (Cam
McHenry)
- 147e2e4 linter: Allow replacing rule when none are enabled yet (#7014)
(camchenry)
- 7aa496a linter: Remove unsafe fixer of `no-useless-spread` (#6655)
(dalaoshu)
- f5a7134 linter/no-unused-vars: False positive for discarded reads
within sequences (#6907) (DonIsaac)

### Documentation

- 4551baa linter: Document `rules` (#6983) (Boshen)

### Refactor

- a8dc75d linter: Remove unused CLI result types (#7088) (camchenry)
- 8f1460e linter: Move `LintPlugins` from `LintOptions` to `LintConfig`
(#6932) (DonIsaac)

### Testing

- c35d3f2 linter: Improve test failure output (#6975) (camchenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-03 11:27:30 +08:00
Boshen
218458811b
feat(linter): do not bail for unmatched rules yet (#7093)
I intend to make a release today, let's hold onto this behaviour.
2024-11-03 11:18:36 +08:00
camchenry
a8dc75d6ba refactor(linter): remove unused CLI result types (#7088)
It doesn't seem like we should implement type checking or formatting in the `oxlint` binary. Plus, these are unused currently. So I removed them.
2024-11-02 06:17:28 +00:00
Cam McHenry
38d1f78754
fix(linter): remove confusing help text for now (#7081)
It's possible that the rule may not exist at all, or it's part of a
disabled plugin. The help text doesn't give a clue as to which is the
case currently, so it's probably less confusing to just omit it
completely.
2024-11-02 11:50:42 +08:00
camchenry
1f2a6c666f feat(linter)!: report unmatched rules with error exit code (#7027)
- closes https://github.com/oxc-project/oxc/issues/6988

we now return an error exit code when there are unmatched rules. previously, we would print an error to stderr and continue running. however, this masked errors in some tests that actually had unmatched rules in them. these test cases now trigger a panic (in tests only, not at runtime), and help ensure that we are reporting an error message to the user for unknown rules, which we did not have any tests cases for before.

- fixes https://github.com/oxc-project/oxc/issues/7025

this also fixes https://github.com/oxc-project/oxc/issues/7025, where we were reporting rules as unmatched simply because they had been disabled prior to being configured. similar to https://github.com/oxc-project/oxc/issues/7009.
2024-11-01 03:27:25 +00:00
oxc-bot
1ea0be1b6a
release(oxlint): v0.10.3 (#6911)
## [0.10.3] - 2024-10-26

- 90c786c regular_expression: [**BREAKING**] Support ES2025 Duplicated
named capture groups (#6847) (leaysgur)

- 8032813 regular_expression: [**BREAKING**] Migrate to new regexp
parser API (#6741) (leaysgur)

### Features

- a73c5af linter: Add fixer for `jsx-a11y/no-access-key` rule (#6781)
(Tapan Prakash)
- 2aa763c linter: Warn unmatched rule names (#6782) (Tapan Prakash)
- 0acca58 linter: Support `--print-config all` to print config file for
project (#6579) (mysteryven)

### Bug Fixes

- f49b3e2 linter: `react/iframe-missing-sandbox` ignores vanilla JS APIs
(#6872) (DonIsaac)
- 54a5032 linter: Correct false positive in `no-duplicates` (#6748)
(dalaoshu)
- a47c70e minifier: Fix remaining runtime bugs (#6855) (Boshen)

### Documentation

- 3923e63 linter: Add schema to config examples (#6838) (Dmitry
Zakharov)

### Refactor

- a148023 linter: Dereference IDs as soon as possible (#6821)
(overlookmotel)
- 423d54c rust: Remove the annoying `clippy::wildcard_imports` (#6860)
(Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-26 17:13:06 +08:00
mysteryven
0acca58581 feat(linter): support --print-config all to print config file for project (#6579)
Continue work on #4742.

Only `oxlint --print-config all` is supported. It's useful to migrate from command-line interface to config file.

The `--print-config PATH` looks not really useful for us now, I will add it after config file overrides supported.
2024-10-22 17:56:23 +00:00
oxc-bot
9648e98998
release(oxlint): v0.10.2 (#6764)
## [0.10.2] - 2024-10-22

### Features

- dbe1972 linter: Import/no-cycle should turn on ignore_types by default
(#6761) (Boshen)
- 619d06f linter: Fix suggestion for `eslint:no_empty_static_block` rule
(#6732) (Tapan Prakash)

### Bug Fixes


### Performance

- 8387bac linter: Apply small file optimization, up to 30% faster
(#6600) (camchenry)

### Refactor

- b884577 linter: All ast_util functions take Semantic (#6753)
(DonIsaac)
- 744aa74 linter: Impl `Deref<Target = Semantic>` for `LintContext`
(#6752) (DonIsaac)
- 6ffdcc0 oxlint: Lint/mod.rs -> lint.rs (#6746) (Boshen)

### Testing

- b03cec6 oxlint: Add `--fix` test case (#6747) (Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-22 12:31:17 +08:00
Boshen
b03cec6ae9 test(oxlint): add --fix test case (#6747)
closes #6061
2024-10-21 15:38:19 +00:00
Boshen
6ffdcc0e3e refactor(oxlint): lint/mod.rs -> lint.rs (#6746) 2024-10-21 15:10:52 +00:00
oxc-bot
abb4ff30eb
release(oxlint): v0.10.1 (#6729)
## [0.10.1] - 2024-10-21

### Features

- af25752 linter: Add `unicorn/prefer-math-min-max` (#6621) (Brian Liu)
- 5095f02 linter: Added fixer for duplicate prefix in valid title jest
rule (#6699) (Tapan Prakash)
- e9976d4 linter: Add title whitespace fixer for jest valid title rule
(#6669) (Tapan Prakash)
- 45f02d5 linter: Add `unicorn/consistent-empty-array-spread` (#6695)
(Brian Liu)
- 01a35bb linter/eslint: Show ignore patterns in `eslint/no-unused-vars`
diagnostic messages (#6696) (DonIsaac)

### Bug Fixes

- 1bcd707 editor: Update config sent to language server (#6724)
(Nicholas Rayburn)
- ce25c45 linter: Panic in `disable-directives` (#6677) (dalaoshu)
- a5de230 linter/import: `import/no-duplicates` handles namespace
imports correctly (#6694) (DonIsaac)
- b0b6ac7 linter/no-cond-assign: False positive when assignment is in
body statement (#6665) (camchenry)

### Performance

- 6a76ea8 linter/no-unused-vars: Use default IgnorePattern when /^_/ is
provided as a pattern (#6697) (DonIsaac)

### Refactor

- d6609e9 linter: Use `run_on_jest_node` for existing lint rules (#6722)
(camchenry)
- 97195ec linter: Add `run_on_jest_node` to run rules on only jest nodes
(#6721) (camchenry)
- 155fe7e linter: Allow `Semantic` to be passed for collecting Jest
nodes (#6720) (camchenry)
- ad8f281 linter: Use iter for collecting jest nodes (#6719) (camchenry)
- dc19a8f linter: Use iterator for collecting jest imports (#6718)
(camchenry)
- 29c1447 linter: `jest/valid-title` fixer to use `Span::shrink` method
(#6703) (Tapan Prakash)
- 2eb984a linter: Add missing `should_run` implementations (#6666)
(camchenry)
- 23f88b3 linter/import: Better diagnostic messages for
`import/no-duplicates` (#6693) (DonIsaac)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-21 12:29:57 +08:00
camchenry
d6609e91c2 refactor(linter): use run_on_jest_node for existing lint rules (#6722)
- closes https://github.com/oxc-project/oxc/issues/6038

Migrates all simple iterations over Jest nodes to use the `run_on_jest_node` method. Rules which require more custom data (such as getting nodes in order or storing data about counts, duplicates, etc.) have not been migrated.

Some simple benchmarking shows that this is ~5% faster on `vscode` when the Jest/Vitest rules are NOT enabled (due to being able to skip them now). And it is up to 8% on `vscode` when the Jest/Vitest plugins are enabled.

```
hyperfine -i -N --warmup 3 --runs 30 './oxlint-jest-iter --deny=all --silent ./vscode' './oxlint-main --deny=all --silent ./vscode'
Benchmark 1: ./oxlint-jest-iter --deny=all --silent ./vscode
  Time (mean ± σ):      2.348 s ±  0.104 s    [User: 16.922 s, System: 0.641 s]
  Range (min … max):    2.141 s …  2.544 s    30 runs

Benchmark 2: ./oxlint-main --deny=all --silent ./vscode
  Time (mean ± σ):      2.476 s ±  0.042 s    [User: 17.768 s, System: 0.668 s]
  Range (min … max):    2.430 s …  2.598 s    30 runs

Summary
  ./oxlint-jest-iter --deny=all --silent ./vscode ran
    1.05 ± 0.05 times faster than ./oxlint-main --deny=all --silent ./vscode
```

```
hyperfine -i -N --warmup 3 --runs 30 './oxlint-jest-iter --deny=all --jest-plugin --vitest-plugin --silent ./vscode' './oxlint-main --deny=all --jest-plugin --vitest-plugin --silent ./vscode'
Benchmark 1: ./oxlint-jest-iter --deny=all --jest-plugin --vitest-plugin --silent ./vscode
  Time (mean ± σ):      2.728 s ±  0.118 s    [User: 19.782 s, System: 0.786 s]
  Range (min … max):    2.580 s …  3.078 s    30 runs

Benchmark 2: ./oxlint-main --deny=all --jest-plugin --vitest-plugin --silent ./vscode
  Time (mean ± σ):      2.939 s ±  0.051 s    [User: 21.259 s, System: 0.859 s]
  Range (min … max):    2.848 s …  3.064 s    30 runs

Summary
  ./oxlint-jest-iter --deny=all --jest-plugin --vitest-plugin --silent ./vscode ran
    1.08 ± 0.05 times faster than ./oxlint-main --deny=all --jest-plugin --vitest-plugin --silent ./vscode
```
2024-10-21 02:13:59 +00:00
oxc-bot
70c6f24a08
release(oxlint): v0.10.0 (#6661)
## [0.10.0] - 2024-10-18

- 7f6b219 editor/vscode: [**BREAKING**] Unify configuration logic
(#6630) (DonIsaac)

- 782f0a7 codegen: [**BREAKING**] Rename `print_char` method to
`print_ascii_byte` (#6512) (overlookmotel)

- 7645e5c codegen: [**BREAKING**] Remove CommentOptions API (#6451)
(Boshen)

- 5200960 oxc: [**BREAKING**] Remove passing `Trivias` around (#6446)
(Boshen)

- 80266d8 linter: [**BREAKING**] Support plugins in oxlint config files
(#6088) (DonIsaac)

### Features

- 6f22538 ecmascript: Add `ToBoolean`, `ToNumber`, `ToString` (#6502)
(Boshen)
- 1e7fab3 linter: Implement `no-callback-in-promise` (#6157) (dalaoshu)
- c56343d linter: Promote `no_unsafe_optional_chaining` to correctness
(#6491) (Boshen)
- 454874a linter: Implement `react/iframe-missing-sandbox` (#6383) (Radu
Baston)
- c8174e2 linter: Add suggestions for `no-plusplus` (#6376) (camchenry)
- 6e3224d linter: Configure by category in config files (#6120)
(DonIsaac)
- c5e66e1 linter/no-unused-vars: Report own type references within
class, interface, and type alias declarations (#6557) (DonIsaac)
- 8c78f97 linter/node: Implement no-new-require (#6165) (Jelle van der
Waa)

### Bug Fixes

- cf92730 editor: Use human-readable output channel names (#6629)
(DonIsaac)
- d9159a2 editor: Misaligned command prefixes (#6628) (DonIsaac)
- b9c94bb editors/vscode: Temporarily solve oxc_language_server issue on
windows (#6384) (dalaoshu)
- e340424 linter: Support import type with namespaced import in
`import/no-duplicates` (#6650) (Dmitry Zakharov)
- a668397 linter: Panic in `no-else-return` (#6648) (dalaoshu)
- 41dc8e3 linter: Stack overflow in `oxc/no-async-endpoint-handlers`
(#6614) (DonIsaac)
- d07a9b0 linter: Panic in `no-zero-fractions` (#6607) (dalaoshu)
- d6a0d2e linter: Fix file name checking behavior of
`unicorn/filename-case` (#6463) (camchenry)
- 0784e74 linter: Error fixer of `switch-case-braces` (#6474) (dalaoshu)
- e811812 linter: Error diagnostic message based on parameter length of
valid-expect (#6455) (dalaoshu)
- f71c91e linter: Move `eslint/sort-keys` to `style` category (#6377)
(DonIsaac)
- 2b86de9 linter/no-control-regex: False negative for flags in template
literals (#6531) (DonIsaac)
- 685a590 linter/no-control-regex: Better diagnostic messages (#6530)
(DonIsaac)
- 6d5a9f2 linter/no-control-regex: Allow capture group references
(#6529) (DonIsaac)
- ba53bc9 linter/no-unused-vars: False positives in TS type assertions
(#6397) (DonIsaac)
- d3e59c6 linter/no-unused-vars: False positive in some default export
cases (#6395) (DonIsaac)
- e08f956 linter/no-unused-vars: False positive for functions and
classes in arrays (#6394) (DonIsaac)
- b9d7c5f no-unused-vars: Consider functions within conditional
expressions usable (#6553) (Brian Donovan)

### Performance

- 0cbd4d0 linter: Avoid megamorphism in `RuleFixer` methods (#6606)
(DonIsaac)
- 725f9f6 linter: Get fewer parent nodes in
`unicorn/prefer-dom-node-text-content` (#6467) (camchenry)
- c00f669 linter: Use NonZeroUsize for pending module cache entries
(#6439) (DonIsaac)
- a1a2721 linter: Replace `ToString::to_string` with `CompactStr` in
remaining rules (#6407) (camchenry)
- c5c69d6 linter: Use `CompactStr` in `valid-title` (#6406) (camchenry)
- d66e826 linter: Use `CompactStr` in `prefer-lowercase-title` (#6405)
(camchenry)
- 889400c linter: Use `CompactStr` for `get_node_name` in Jest rules
(#6403) (camchenry)
- 9906849 linter: Use `CompactStr` in `no-large-snapshots` (#6402)
(camchenry)
- c382ec4 linter: Use `CompactStr` in `no-hooks` (#6401) (camchenry)
- 24a5d9b linter: Use `CompactStr` in `expect-expect` (#6400)
(camchenry)
- 71dbdad linter: Use `CompactStr` in `no-console` (#6399) (camchenry)
- f5f00a1 linter: Use `CompactStr` in `no-bitwise` (#6398) (camchenry)
- 62afaa9 linter/jsx-no-comment-textnodes: Remove regex for checking
comment patterns (#6534) (camchenry)
- b3d0cce linter/no-unescaped-entities: Add fast path to check if char
should be replaced (#6594) (camchenry)
- ee73f56 linter/no-unused-vars: Do not construct `Regex` for default
ignore pattern (#6590) (camchenry)
- 77ddab8 linter/numeric-separators-style: Replace regex with number
parser (#6546) (camchenry)
- 8f47cd0 linter/react: Remove regex patterns in `no-unknown-property`
(#6536) (camchenry)

### Documentation

- 557f941 linter: Add docs to no-unused-vars and Tester (#6558)
(DonIsaac)

### Refactor

- ecce5c5 linter: Improve recursive argument handling and diagnostics
creation (#6513) (no-yan)
- f960e9e linter: Add suggested file names for `unicorn/filename-case`
(#6465) (camchenry)
- 7240ee2 linter: Make advertised fix kinds consistent (#6461)
(Alexander S.)
- b48c368 linter: `no_global_assign` rule: reduce name lookups (#6460)
(overlookmotel)
- 2566ce7 linter: Remove OxlintOptions (#6098) (DonIsaac)
- 002078a linter: Make Runtime's members private (#6440) (DonIsaac)
- 6a0a533 linter: Move module cache logic out of Runtime (#6438)
(DonIsaac)
- c18c6e9 linter: Split service code into separate modules (#6437)
(DonIsaac)
- 5ea9ef7 linter: Improve labels and help message for
`eslint/no-useless-constructor` (#6389) (DonIsaac)
- 2c32dac linter/no-control-regex: Remove duplicate code (#6527)
(DonIsaac)
- 435a89c oxc: Remove useless `allocator.alloc(program)` calls (#6571)
(Boshen)
- f70e93b oxc: Ban index methods on std::str::Chars (#6075) (dalaoshu)

### Testing

- a6cae98 linter: Make sure all auto-fixing rules have fixer test
(#6378) (DonIsaac)
- 06b09b2 linter/no-unused-vars: Enable now-passing tests (#6556)
(DonIsaac)
- badd11c linter/no-unused-vars: Ignored catch parameters (#6555)
(DonIsaac)
- 84aa2a2 linter/no-useless-constructor: Add cases for initializers in
subclass constructors (#6390) (DonIsaac)

---------

Co-authored-by: DonIsaac <22823424+DonIsaac@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-18 20:34:15 -04:00
DonIsaac
80266d85c9 feat(linter)!: support plugins in oxlint config files (#6088)
> Closes #5046
This PR migrates the linter crate and oxlint app to use the new `LinterBuilder` API. This PR has the following effects:

1. `plugins` in oxlint config files are now supported
2. irons out weirdness when using CLI args and config files together. CLI args are now always applied on top of config file settings, overriding them.

# Breaking Changes
Before, config files would override rules set in CLI arguments. For example, running this command:
```sh
oxlint -A correctness -c oxlintrc.json
```
With this config file
```jsonc
// oxlintrc.json
{
  "rules": {
    "no-const-assign": "error"
  }
}
```
Would result in a single rule, `no-const-assign` being turned on at an error level with all other rules disabled (i.e. set to "allow").

Now, **CLI arguments will override config files**. That same command with the same config file will result with **all rules being disabled**.

## Details

For a more in-depth explanation, assume we are running the below command using the `oxlintrc.json` file above:
```sh
oxlint -A all -W correctness -A all -W suspicious -c oxlintrc.json
```

### Before
> Note: GitHub doesn't seem to like deeply nested lists. Apologies for the formatting.

Here was the config resolution process _before_ this PR:
<details><summary>Before Steps</summary>

1. Start with a default set of filters (["correctness", "warn"]) if no filters were passed to the CLI. Since some were, the filter list starts out empty.
2. Apply each filter taken from the CLI from left to right. When a filter allows a rule or category, it clears the configured set of rules. So applying those filters looks like this
  a. start with an empty list `[]`
  b. `("all", "allow")` -> `[]`
  c. `("correctness", "warn")` -> `[ <correctness rules> ]`
  d. `("all", "allow")` -> `[]`
  e. `("suspicious", "warn")` -> `[ <suspicious rules> ]`. This is the final rule set for this step
3. Apply overrides from `oxlintrc.json`. This is where things get a little funky, as mentioned in point 2 of what this PR does. At this point, all rules in the rules list are only from the CLI.
  a. If a rule is only set in the CLI and is not present in the config file, there's no effect
  b. If a rule is in the config file but not the CLI, it gets inserted into the list.
  c. If a rule is already in the list and in the config file
    i. If the rule is only present once (e.g. `"no-loss-of-precision": "error"`), unconditionally override whatever was in the CLI with what was set in the config file
    ii. If the rule is present twice (e.g. `"no-loss-of-precision": "off", "@typescript-eslint/no-loss-of-precision": "error"`),
      a. if all rules in the config file are set to `allow`, then turn the rule off
      b. If one of them is `warn` or `deny`, then update the currently-set rule's config object, but _leave its severity alone_.

  So, for our example, the final rule set would be `[<all suspicious rules: "warn">, no-const-assign: "error"]`

</details>

### After
Rule filters were completely re-worked in a previous PR. Now, lint filters aren't kept on hand-only the rule list is.

<details><summary>After Steps</summary>

1. Start with the default rule set, which is all correctness rules for all enabled plugins (`[<all correctness rules: "warn">]`)
2. Apply configuration from `oxlintrc.json` _first_.
  a. If the rule is warn/deny exists in the list already, update its severity and config object. If it's not in the list, add it.
  b. If the rule is set to allow, remove it from the list.

  The list is now `[<all correctness rules except no-const-assign: "warn">, no-const-assign: "error"]`.

3. Apply each filter taken from the CLI from left to right. This works the same way as before. So, after they're applied, the list is now `[<suspicous rules: "warn">]`

</details>
2024-10-10 19:21:50 +00:00
oxc-bot
62d45bf14e
release(oxlint): v0.9.10 (#6340)
## [0.9.10] - 2024-10-07

### Features

- f272137 editors/vscode: Clear diagnostics on file deletion (#6326)
(dalaoshu)
- 1a5f293 editors/vscode: Update VSCode extention to use project's
language server (#6132) (dalaoshu)
- 376cc09 linter: Implement `no-throw-literal` (#6144) (dalaoshu)
- 5957214 linter: Allow fixing in files with source offsets (#6197)
(camchenry)
- a089e19 linter: Eslint/no-else-return (#4305) (yoho)
- 183739f linter: Implement prefer-await-to-callbacks (#6153) (dalaoshu)
- ae539af linter: Implement no-return-assign (#6108) (Radu Baston)

### Bug Fixes

- 9e9808b linter: Fix regression when parsing ts in vue files (#6336)
(Boshen)
- 93c6db6 linter: Improve docs and diagnostics message for
no-else-return (#6327) (DonIsaac)
- e0a3378 linter: Correct false positive in
`unicorn/prefer-string-replace-all` (#6263) (H11)
- ea28ee9 linter: Improve the fixer of `prefer-namespace-keyword`
(#6230) (dalaoshu)
- f6a3450 linter: Get correct source offsets for astro files (#6196)
(camchenry)
- be0030c linter: Allow whitespace control characters in
`no-control-regex` (#6140) (camchenry)
- e7e8ead linter: False positive in `no-return-assign` (#6128)
(DonIsaac)

### Performance

- ac0a82a linter: Reuse allocator when there are multiple source texts
(#6337) (Boshen)
- 50a0029 linter: Do not concat vec in `no-useless-length-check` (#6276)
(camchenry)

### Documentation

- 7ca70dd linter: Add docs for `ContextHost` and `LintContext` (#6272)
(camchenry)
- a949ecb linter: Improve docs for `eslint/getter-return` (#6229)
(DonIsaac)
- 14ba263 linter: Improve docs for `eslint-plugin-import` rules (#6131)
(dalaoshu)

### Refactor

- 642725c linter: Rename vars from `ast_node_id` to `node_id` (#6305)
(overlookmotel)
- 8413175 linter: Move shared function from utils to rule (#6127)
(dalaoshu)
- ba9c372 linter: Make jest/vitest rule mapping more clear (#6273)
(camchenry)
- 82b8f21 linter: Add schemars and serde traits to AllowWarnDeny and
RuleCategories (#6119) (DonIsaac)
- ea908f7 linter: Consolidate file loading logic (#6130) (DonIsaac)
- db751f0 linter: Use regexp AST visitor in `no-control-regex` (#6129)
(camchenry)
- 3aa7e42 linter: Use RegExp AST visitor for `no-hex-escape` (#6117)
(camchenry)
- 9d5b44a linter: Use regex visitor in `no-regex-spaces` (#6063)
(camchenry)
- 0d44cf7 linter: Use regex visitor in `no-useless-escape` (#6062)
(camchenry)
- eeb8873 linter: Use regex visitor in `no-empty-character-class`
(#6058) (camchenry)

### Testing

- d883562 linter: Invalid `eslint/no-unused-vars` options (#6228)
(DonIsaac)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-08 12:14:54 +08:00
Boshen
9e9808b429 fix(linter): fix regression when parsing ts in vue files (#6336) 2024-10-07 14:28:44 +00:00
DonIsaac
ea908f742d refactor(linter): consolidate file loading logic (#6130)
# Human Description
Low on time, so this one is short.
- consolidate source file and partial loader logic into `loader` module. I have more plans for this.
- ~LSP no longer uses `VALID_EXTENSIONS`, so now `.d.ts` files (and the like) will be linted as well~ LSP does not respect `.gitignore` files, so this change was reverted.

# AI Description
## Refactor Loader and Partial Loader

This PR refactors the loader and partial loader functionality in the oxc_linter crate:

* Introduce a new `Loader` struct with methods for checking if a file can be loaded and loading file contents
* Move `partial_loader` module to `loader/partial_loader`
* Rename `JavaScriptSource` to `source.rs` and move it to the `loader` module
* Update `JavaScriptSource` to use `u32` for `start` offset instead of `usize`
* Refactor `IsolatedLintHandler` to use the new `Loader`
* Update imports and module references throughout the codebase

This change improves the organization of the loader-related code and provides a more unified interface for loading different file types.
2024-09-29 02:48:01 +00:00
oxc-bot
3ef248afbd
release(oxlint): v0.9.9 (#6101)
## [0.9.9] - 2024-09-27

### Bug Fixes

- bd8f786 linter: Rule and generic filters do not re-configure existing
rules (#6087) (DonIsaac)
- c5cdb4c linter: Disable all rules in a plugin when that plugin gets
turned off (#6086) (DonIsaac)
- 6c855af linter: Only write fix results if source code has changed
(#6096) (DonIsaac)
- 8759528 linter: Category filters not re-configuring already-enabled
rules (#6085) (DonIsaac)
- c2616f7 linter: Fix panic in fixer for `oxc/only-used-in-recursion`
(#6070) (camc314)
- 3da3845 linter: Malformed snippets in `eslint/for-direction` docs
(#6060) (DonIsaac)
- c047d42 linter: `no-useless-escape`: do not crash on backslash
character (#6048) (camchenry)
- 6f76ebe linter: Ignore invalid or partial disable directives (#6045)
(camchenry)
- 09a24cd linter: Fix false positives for generics in
`no-unexpected-multiline` (#6039) (camchenry)
- d05fd20 linter: Newline in type parameters causing false positive in
`no-unexpected-multiline` (#6031) (DonIsaac)
- 01b9c4b npm/oxlint: Make bin/oxc_language_server an executable (#6066)
(Boshen)

### Performance

- f8464a3 linter: `no-magic-numbers` remove redudant checks in
`is_array_index` (#6033) (Alexander S.)
- c16ae60 linter: `jest/prefer-hooks-in-order`: rewrite rule to allocate
less and iterate fewer times (#6030) (camchenry)

### Documentation

- a4fdf1b linter: Improve docs for promise rules (#6051) (dalaoshu)
- 21cdb78 linter: Fix incorrect "bad" example in
`only-used-in-recursion` (#6029) (Boshen)

### Refactor

- 1f92d61 linter: `jest/prefer-hooks-in-order`: improve diagnostic
messages (#6036) (camchenry)

### Testing

- 55949eb linter: Add `OxlintRules::override_rules` tests (#6081)
(DonIsaac)
- 1a6923a linter: Add filter parsing test cases (#6080) (DonIsaac)
- 58d333a linter: Add more test cases for disable directives (#6047)
(camchenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 14:41:55 +08:00
oxc-bot
539751cd13
release(oxlint): v0.9.8 (#6025)
## [0.9.8] - 2024-09-24

### Bug Fixes

- e3c8a12 linter: Fix panic in sort-keys (#6017) (Boshen)
- 4771492 linter: Fix `import/no_cycle` with `ignoreTypes` (#5995)
(Boshen)

### Performance

- 5ae3f36 linter: `no-fallthrough`: Use string matching instead of Regex
for default comment pattern (#6008) (camchenry)
- 2b17003 linter, prettier, diagnostics: Use `FxHashMap` instead of
`std::collections::HashMap` (#5993) (camchenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-24 19:43:11 +08:00
oxc-bot
859227e457
release(oxlint): v0.9.7 (#5988)
## [0.9.7] - 2024-09-23

### Features

- d24985e linter: Add `oxc-security/api-keys` (#5906) (DonIsaac)
- f9b44c5 linter: Add unicode sets support to `no-useless-escape` rule
(#5974) (camchenry)
- 0f19848 linter: Implement `no-unexpected-multiline` rule (#5911)
(camchenry)
- 16fe383 linter: Implement `no-extend-native` rule (#5867) (Cam
McHenry)

### Bug Fixes

- eed9ac7 linter: Include actual span size in `no-regex-spaces`
diagnostic (#5957) (camchenry)
- 40c89c2 linter: Move `promise/avoid-new` to style category (#5961)
(DonIsaac)

### Performance

- 608d637 linter: Use `aho-corasick` instead of `regex` for string
matching in `jsx-a11y/img-redundant-alt` (#5892) (camchenry)
- 3148d4b linter: Check file path after checking node kind for
`nextjs/no-head-element` (#5868) (Cam McHenry)

### Refactor

- 0a5a4a9 linter: Use parsed patterns for `unicorn/no-hex-escape`
(#5985) (camchenry)
- 2cf2edd linter: Use parsed patterns in `no-empty-character-class` rule
(#5980) (camchenry)
- a9a8e2a linter: Use regex parser in `eslint/no-regex-spaces` (#5952)
(camchenry)
- 05f592b linter: Use parsed patterns in
`unicorn/prefer-string-starts-ends-with` (#5949) (camchenry)
- 3273b64 linter: Use parsed patterns for
`unicorn/prefer-string-replace-all` rule (#5943) (camchenry)
- ba7b01f linter: Add `LinterBuilder` (#5714) (DonIsaac)
- db4f16a semantic: Call `with_trivias` before `build_with_jsdoc`
(#5875) (Boshen)
- 3d13c6d semantic: Impl `IntoIterator` for `&AstNodes` (#5873)
(DonIsaac)

### Testing

- b681c9a linter: Import test cases for `no-empty-character-class`
(#5981) (camchenry)
- 767602b linter: Add regression test for #5227 (#5975) (camchenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-23 15:10:33 +08:00
DonIsaac
d24985ed51 feat(linter): add oxc-security/api-keys (#5906)
## What This PR does
Adds a new `oxc-security/api-key` rule that scans for hard-coded API keys.

It is broken up into "secret rules", where each one is responsible for finding a different kind of key. It is architecturally identical to how lint rules themselves. This PR also includes the first of these rules, for AWS access key IDs.

Logic and rules are based on [keyhunter](https://github.com/Donisaac/keyhunter). I've licensed that repo under GNU GPLv3, but it's my code and I can do what I want with it 😈 (read: I'm fine with it being MIT for oxc).

This PR is a complete feature in its own right, but does not represent the end of this work. See https://github.com/oxc-project/backlog/issues/116 to track overall progress.
2024-09-22 22:39:56 +00:00
oxc-bot
65a17346cd
release(oxlint): v0.9.6 (#5843)
## [0.9.6] - 2024-09-18

### Features

- 3bf7b24 linter: Make `typescript/no-duplicate-enum-values` a
`correctness` rule (#5810) (DonIsaac)
- 7799c06 linter/react: Implement `no-danger-with-children` rule (#5420)
(Cam McHenry)

### Bug Fixes

- f942485 linter: Remove all* remaining "Disallow <foo>" messages
(#5812) (DonIsaac)
- b5ad518 linter: Improve diagnostic messages for various lint rules
(#5808) (DonIsaac)
- 858f7af linter: Plugin prefix name for eslint-plugin-node (#5807)
(DonIsaac)
- 737ba1d linter: Fix some cases on ```AssignmentExpression``` for
```unicorn/consistent-function-scoping``` (#5675) (Arian94)
- 148c7a8 linter: Replace bitwise AND (&) with logical AND (&&) in
explici… (#5780) (kaykdm)
- b4ed564 linter/no-unused-vars: Writes to members triggering false
positive (#5744) (Dunqing)
- e9c084a linter/no-unused-vars: False positive when a variable used as
a computed member property (#5722) (Dunqing)

### Performance

- 3725d5d linter: Make all rules share a diagnostics vec (#5806)
(DonIsaac)
- e978567 linter: Shrink size of `DisableDirectives` (#5798) (DonIsaac)
- 1bfa515 linter: Remove redundant clone of diagnostics in context
(#5797) (DonIsaac)
- e413cad linter: Move shared context info to `ContextHost` (#5795)
(DonIsaac)

### Refactor

- 6dd6f7c ast: Change `Comment` struct (#5783) (Boshen)
- 7caae5b codegen: Add `GetSpan` requirement to `Gen` trait (#5772)
(Boshen)
- 026ee6a linter: Decouple module resolution from import plugin (#5829)
(dalaoshu)
- 50834bc linter: Move `override_rule` to `OxlintRules` (#5708)
(DonIsaac)
- a438743 linter: Move `OxlintConfig` to `Oxlintrc` (#5707) (DonIsaac)
- f61e8b5 linter: Impl serde and schemars traits for `LintPlugins`
(#5706) (DonIsaac)
- 20a7861 linter: Shorten `Option` syntax (#5735) (overlookmotel)
- d8b612c oxc_linter: Prefer pass Enum instead of str `no_plus_plus`
(#5730) (IWANABETHATGUY)
- cc0408b semantic: S/AstNodeId/NodeId (#5740) (Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-18 12:02:09 +08:00
dalaoshu
026ee6a7e8
refactor(linter): decouple module resolution from import plugin (#5829)
closes #5815
2024-09-17 15:48:03 -04:00
oxc-bot
1dad9fa301
release(oxlint): v0.9.5 (#5724)
## [0.9.5] - 2024-09-12

### Features

- 4b04f65 linter: Implement `no-plusplus` rule (#5570) (Cam McHenry)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-12 16:59:25 +08:00
oxc-bot
d06bab6260
release(oxlint): v0.9.4 (#5718)
## [0.9.4] - 2024-09-12

### Features

- 9ca2593 linter: Eslint/sort-keys  (#4845) (Na'aman Hirschfeld)
- 023c160 linter: Impl `Serialize` for `OxlintConfig` (#5594) (DonIsaac)
- 24d6a47 linter: Implement `eslint/no-invalid-regexp` (#5443) (Boshen)

### Bug Fixes

- af6d240 linter: Panic in consistent-function-scoping (#5613)
(DonIsaac)
- 54e2e76 linter: `react/no_set_state` + `react/no_string_refs` rules
find correct parent (#5615) (overlookmotel)
- 3b87ac4 linter: Fix no_unused_vars panic when encountering unicode
(#5582) (Boshen)

### Performance

- bfe9186 linter: Use `cow_replace` instead of `replace` (#5643)
(dalaoshu)
- e3ae5db linter: Use cow_to_ascii_lowercase/uppercase (#5637) (heygsc)
- a0370bf linter: Use cow_utils in no_script_url (#5633) (heygsc)
- 37e922c linter: `eslint/no_shadow_restricted_names` use
`run_on_symbol` (#5618) (overlookmotel)
- 0b7fccf linter: `react/no_set_state` + `react/no_string_refs` rules
reduce iteration over ancestors (#5616) (overlookmotel)
- 2c3f3fe linter: Make `jsx_key` slightly faster (#5585) (Boshen)
- cd81d12 linter: Add `should_run` to check path only once to
nextjs/no_typos (#5584) (Boshen)
- d18c896 rust: Use `cow_utils` instead (#5664) (dalaoshu)

### Documentation

- 64f9575 linter: Add plugin usage to example with configuration
(Boshen)
- 8c9179d linter: Fix typos (#5591) (Brian Donovan)

### Refactor

- 9e9435f linter: Add `LintFilter` (#5685) (DonIsaac)
- 4f70fe5 linter: Start internal/external split of LintPluginOptions
(#5660) (DonIsaac)
- 5ae9b48 linter: Start internal/external split of `OxlintOptions`
(#5659) (DonIsaac)
- c8bc6f0 linter: Use `std::ptr::eq` (#5649) (overlookmotel)
- a37c064 linter: Use `ContentHash` for `no_duplicate_case`; remove
`calculate_hash` (#5648) (Boshen)
- 0b3c1d7 linter: Start internal/external split of `OxlintConfig`
(#5595) (DonIsaac)
- 89bdf55 linter: Inline `Rule` trait default methods (#5619)
(overlookmotel)
- afea8d5 linter: Rename `Rule` trait method params (#5617)
(overlookmotel)
- 4e748b5 linter: Replace ast "compare by hash" to "compare by content"
(#5602) (dalaoshu)
- bac03e3 linter: Make fields of `LintServiceOptions` private (#5593)
(DonIsaac)
- 2661d8b linter: Jest prefer_strict_equal (#5588) (IWANABETHATGUY)
- 20d0068 oxlint: Move cli-related exports to `cli` module (#5139)
(DonIsaac)
- 067f9b5 semantic: Introduce `IsGlobalReference` trait (#5672)
(Boshen)- 26d9235 Enable clippy::ref_as_ptr (#5577) (夕舞八弦)

### Testing

- 8e79f8d linter: Add class method test cases for `oxc/no-async-await`
(#5550) (DonIsaac)
- 3835189 linter: Add test case for no_unused_vars in 3b87ac4 (Boshen)
- 5f27551 linter: Add a passing case to no_undef (#5580) (Boshen)

---------

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-12 13:56:38 +08:00
DonIsaac
9e9435f03b refactor(linter): add LintFilter (#5685)
Re-creation of #5329
2024-09-11 03:19:04 +00:00
DonIsaac
5ae9b48509 refactor(linter): start internal/external split of OxlintOptions (#5659)
re-creation of #5141
2024-09-10 03:19:04 +00:00
DonIsaac
20d006838e refactor(oxlint): move cli-related exports to cli module (#5139) 2024-09-08 15:29:37 +00:00
Boshen
63a830e08c
chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
DonIsaac
bac03e3b6c refactor(linter): make fields of LintServiceOptions private (#5593)
Re-creation of #5326
2024-09-08 03:10:02 +00:00
oxc-bot
16009c09fd
release: oxlint v0.9.3 (#5569)
## [0.9.3] - 2024-09-07

### Features

- be3a432 linter: Implement typescript/no-magic-numbers (#4745)
(Alexander S.)
- 09aa86d linter/eslint: Implement `sort-vars` rule (#5430) (Jelle van
der Waa)
- 2ec2f7d linter/eslint: Implement no-alert (#5535) (Edwin Lim)
- a786acf linter/import: Add no-dynamic-require rule (#5389) (Jelle van
der Waa)
- 4473779 linter/node: Implement no-exports-assign (#5370) (dalaoshu)
- b846432 linter/oxc: Add fixer for `erasing-op` (#5377) (camc314)
- aff2c71 linter/react: Implement `self-closing-comp` (#5415) (Jelle van
der Waa)

### Bug Fixes

- 0df1d9d ast, codegen, linter: Panics in fixers. (#5431) (rzvxa)
- cdd1a91 linter: Typescript/no-magic-numbers: remove double minus for
reporting negative bigint numbers (#5565) (Alexander S.)
- ff88c1f linter: Don't mark binding rest elements as unused in TS
function overloads (#5470) (Cam McHenry)
- 088733b linter: Handle loops in `getter-return` rule (#5517) (Cam
McHenry)
- 82c0a16 linter: `tree_shaking/no_side_effects_in_initialization`
handle JSX correctly (#5450) (overlookmotel)
- 6285a02 linter: `eslint/radix` rule correctly check for unbound
symbols (#5446) (overlookmotel)
- c8ab353 linter/tree-shaking: Align JSXMemberExpression's report
(#5548) (mysteryven)
- 5187f38 linter/tree-shaking: Detect the correct export symbol
resolution (#5467) (mysteryven)

### Performance

- 8170954 linter/react: Add should_run conditions for react rules
(#5402) (Jelle van der Waa)

### Documentation

- a540215 linter: Update docs `Examples` for linter rules (#5513)
(dalaoshu)
- 7414190 linter: Update docs `Example` for linter rules (#5479)
(heygsc)

### Refactor

- 0ac420d linter: Use meaningful names for diagnostic parameters (#5564)
(Don Isaac)
- 81a394d linter: Deduplicate code in `oxc/no-async-await` (#5549)
(DonIsaac)
- 979c16c linter: Reduce nested if statements in
eslint/no_this_before_super (#5485) (IWANABETHATGUY)
- 1d3e973 linter: Simplify `eslint/radix` rule (#5445) (overlookmotel)
- fdb8857 linter: Use "parsed pattern" in `no_div_regex` rule. (#5417)
(rzvxa)
- 2ccbd93 linter: `react/jsx_no_undef` rule `get_member_ident` do not
return Option (#5411) (overlookmotel)

### Styling

- 2a43fa4 linter: Introduce the writing style from PR #5491 and reduce
the if nesting (#5512) (dalaoshu)- d8b29e7 Add trailing line breaks to
JSON files (#5544) (overlookmotel)- 694f032 Add trailing line breaks to
`package.json` files (#5542) (overlookmotel)

### Testing

- 340b535 linter/no-unused-vars: Arrow functions in tagged templates
(#5510) (Don Isaac)
- af69393 linter/no-useless-spread: Ensure spreads on identifiers pass
(#5561) (DonIsaac)- dc92489 Add trailing line breaks to conformance
fixtures (#5541) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-07 12:28:46 +08:00
overlookmotel
d8b29e752a style: add trailing line breaks to JSON files (#5544)
For consistency with our `.editorconfig`.
2024-09-06 12:50:15 +00:00
dalaoshu
4473779074
feat(linter/node): implement no-exports-assign (#5370) 2024-09-03 07:53:14 -04:00
oxc-bot
953344dd42
Release oxlint v0.9.2 (#5401)
## [0.9.2] - 2024-09-02

### Features

- f81e8a1 linter: Add `oxc/no-async-endpoint-handlers` (#5364)
(DonIsaac)
- b103737 linter: Improve no-accumulating-spread (#5302) (camc314)
- 9c22ce9 linter: Add hyperlinks to diagnostic messages (#5318)
(DonIsaac)
- 1967c67 linter/eslint: Implement no-new-func (#5360) (dalaoshu)
- b867e5f linter/eslint-plugin-promise: Implement catch-or-return
(#5121) (Jelle van der Waa)
- 8d781e7 linter/oxc: Differentiate between array/object in
`no-accumulating-spread` loop diagnostic (#5375) (camc314)
- db55444 linter/oxc: Add fixer for `double-comparisons` (#5378)
(camc314)
- e5c755a linter/promise: Add `spec-only` rule (#5124) (Jelle van der
Waa)
- 4c0861f linter/unicorn: Add fixer for `prefer-type-error` (#5311)
(camc314)
- 084c2d1 linter/vitest: Implement prefer-to-be-object (#5321)
(dalaoshu)

### Bug Fixes

- 11b93af linter/unicorn: Consistent-function-scoping false positive on
assignment expression (#5312) (Arian94)

### Performance

- f052a6d linter: `react/jsx_no_undef` faster check for unbound
references (#5349) (overlookmotel)
- 05636b7 linter: Avoid unnecessary work in `jsx_a11y/anchor_is_valid`
rule (#5341) (overlookmotel)

### Refactor

- afb038e linter: `react/jsx_no_undef` use loop instead of recursion
(#5347) (overlookmotel)
- fe62687 linter: Simplify skipping JSX elements in
`unicorn/consistent_function_scoping` (#5351) (overlookmotel)
- 381d9fe linter: Shorten code in `react/jsx_no_useless_fragment`
(#5350) (overlookmotel)
- 83b9a82 linter: Fix indentation in
`nextjs/no_script_component_in_head` rule (#5338) (overlookmotel)
- 89f0188 linter: Improve docs for `react/jsx_no_target_blank` rule
(#5342) (overlookmotel)
- 57050ab linter: Shorten code in
`jsx_a11y/aria_activedescendant_has_tabindex` rule (#5340)
(overlookmotel)
- ed31d67 linter/jest: Fix indentation in code comment (#5372) (camc314)
- 2499cb9 linter/oxc: Update rule docs for `erasing-op` (#5376)
(camc314)
- 69493d2 linter/oxc: Improve diagnostic for `no-accumulating-spread` in
loops (#5374) (camc314)
- 024b585 linter/oxc: Improve code comment for `no-accumulating-spread`
(#5373) (camc314)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-02 20:30:22 +08:00
oxc-bot
53ff3493ef
Release oxlint v0.9.1 (#5316)
## [0.9.1] - 2024-08-29

### Features

- 6633972 linter: Add fixer for `no-empty` (#5276) (camc314)
- a58e448 linter/eslint: Add fixer to `no-var` (#5144) (camc314)
- a6e9769 linter/jsx-a11y: Add `label-has-associated-control` (#5163)
(Billy Levin)
- c8e8532 linter/unicorn: Add fixer to `throw-new-error` (#5275)
(camc314)
- 7ccde4b linter/unicorn: Add fixer to `prefer-date-now` (#5147)
(camc314)

### Bug Fixes

- 76e86f8 linter: Eslint-plugin-unicorn prefer-spread wrong linter
suggestion on variables of type string (#5265) (Arian94)
- b39544e linter/jest: Fixer for `prefer-jest-mocked` creates invalid
LHS expressions (#5243) (camc314)
- 9953fa5 linter/no-null: Incorrect fixer for `NullLiteral` within
`ReturnStatement` (#5247) (Dunqing)
- 318479e linter/no-unused-vars: Mark the class/function in the new
expression as used (#5306) (magic-akari)

### Refactor

- fa1d460 linter: Clean up Fixer and Message (#5308) (DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-29 13:04:52 +08:00
oxc-bot
2a001a043c
Release oxlint v0.9.0 (#5219)
## [0.9.0] - 2024-08-26

- 5946748 linter: [**BREAKING**] Parse and display syntax errors for
regular expressions (#5214) (Boshen)

- b894d3b linter: [**BREAKING**] Make `no-unused-vars` correctness
(#5081) (DonIsaac)

### Features

- 1ce9630 linter/config: Implement FromIterator for LintPluginOptions
(#5102) (DonIsaac)
- 34bfaf6 linter/react: Add fixer to `jsx-props-no-spread-multi` (#5145)
(camc314)
- 982bd6e linter/unicorn: Add fixer to `require-array-join-separator`
(#5152) (camc314)
- a6704bd linter/unicorn: Add fixer to `prefer-set-size` (#5149)
(camc314)
- ac7edcc linter/unicorn: Add fixer to `prefer-array-some` (#5153)
(camc314)
- 1d01aa3 linter/unicorn: Add partial fixer for `prefer-array-flat`
(#5143) (camc314)
- 22d57f9 linter/unicorn: Add fixer to `prefer-string-slice` (#5150)
(Cameron)
- 2fe4415 linter/unicorn: Add fixer to `no-redundant-roles` (#5146)
(Cameron)
- d35c6f5 linter/unicorn: Add fixer to `prefer-regexp-test` (#5151)
(Cameron)
- 27db769 linter/unicorn: Add fixer to `text-encoding-identifier-case`
(#5154) (Cameron)
- f7958c4 linter/unicorn: Add prefer-structured-clone (#5095) (Jelle van
der Waa)
- 004ffa0 linter/vitest: Implement `prefer-each` (#5203) (dalaoshu)

### Bug Fixes

- aaaf26c linter: Error in fixer for prefer-to-have-length (#5197)
(dalaoshu)
- 1f5b6b6 linter: Bug in fixer for prefer-to-have-length (#5164)
(dalaoshu)
- 7eb052e linter: `no-hex-escape` fixer removing regex flags (#5137)
(Cameron)
- 76c66b4 linter/max-lines: Point span to end of file for disable
directive to work (#5117) (Boshen)
- 8ff6f2c linter/no-unused-vars: Panic on UsingDeclarations (#5206)
(DonIsaac)
- d29042e linter/no-unused-vars: Function expression in implicit arrow
function return (#5155) (DonIsaac)
- 36e4a28 linter/no-unused-vars: Panic in variable declarator usage
checks (#5160) (DonIsaac)
- ba62a71 linter/react: Fixed false positive with missing key inside
React.Children.toArray() for fragments (#5133) (Earl Chase)
- fd1031a linter/unicorn: Breaking fixer in case statements for
`no-null` (#5176) (DonIsaac)
- 7b86ed6 linter/unicorn: Handle type casts and parens in `no-null`
(#5175) (Don Isaac)
- b629e16 linter/unicorn: Improve diagnostic message for `no-null`
(#5172) (DonIsaac)

### Performance
- ce454cf Use simdutf8 to validate UTF-8 when reading files (#5196)
(dalaoshu)

### Refactor

- 543cad6 codegen: Remove some pub APIs (Boshen)
- 0d3661a linter: Remove meaningless `span0` (#5209) (dalaoshu)
- 2a91ef1 linter: `eslint/no_redeclare` rule use `run_on_symbol` not
`run_once` (#5201) (overlookmotel)
- 33599b0 linter: Split options into multiple files (#5101) (DonIsaac)
- 7ab6152 linter/unicorn: Clean up `no-null` (#5174) (DonIsaac)

### Testing

- a877e5a linter/no-unused-vars: Ensure type annotations on property
accessors are considered used (#5183) (DonIsaac)
- 7886618 linter/unicorn: Add fixer tests for `no-null` (#5173)
(DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-26 16:50:15 +08:00
DonIsaac
b894d3b33e feat(linter)!: make no-unused-vars correctness (#5081)
closes #5080
2024-08-23 13:12:59 +00:00
oxc-bot
8ef85a43c0
Release oxlint v0.8.0 (#5104)
## [0.8.0] - 2024-08-23

- 5f4c9ab semantic: [**BREAKING**] Rename `SymbolTable::get_flag` to
`get_flags` (#5030) (overlookmotel)

- ce4d469 codegen: [**BREAKING**] Remove const generic `MINIFY` (#5001)
(Boshen)

- b2ff2df parser: [**BREAKING**] Remove builder pattern from `Parser`
struct (#5000) (Boshen)

- f88970b ast: [**BREAKING**] Change order of fields in CallExpression
(#4859) (Burlin)

### Features

- 2292606 linter: Typescript-eslint/no-wrapper-object-types (#5022)
(camc314)
- a0effab linter: Support more flexible config.globals values (#4990)
(Don Isaac)
- cdbfcfb linter: Start import fixer for eslint/no-unused-vars (#4849)
(DonIsaac)
- 915cb4d linter: Add dangerous fixer for oxc only used in recursion
(#4805) (camc314)
- 3f28c77 linter/eslint: Improve no-dupe-keys (#4943) (DonIsaac)
- e1582a5 linter/eslint: Improve no-duplicate-case rule (#4942)
(DonIsaac)
- f1e4611 linter/eslint-plugin-vitest: Implement no-conditional-in-test
(#4971) (dalaoshu)
- 14bf5d5 linter/eslint-plugin-vitest: Implement
no-restricted-vi-methods (#4956) (dalaoshu)
- ed9a1c4 linter/eslint-plugin-vitest: Implement
require-local-test-context-for-concurrent-snapshots (#4951) (dalaoshu)
- 7859f58 linter/eslint-plugin-vitest: Implement no-conditional-tests
(#4955) (dalaoshu)
- 841174f linter/no-unused-vars: Delete non-root arrows, skip `await`
(#5083) (Don Isaac)

### Bug Fixes

- 86d0c0c linter: Change consistent-function-scoping to suspicious
(#5010) (DonIsaac)
- 7b99386 linter: Missing closing ticks in some example blocks (#4994)
(DonIsaac)
- 9c64b12 linter: Improve no-zero-fractions rule for member expressions
and scientific notation (#4793) (Burlin)
- c43945c linter/consistent-function-scoping: Allow functions passed as
arguments (#5011) (Don Isaac)
- 9354779 linter/no-unused-vars: Give `argsIgnorePattern` the same
default behavior as `varsIgnorePattern` (#5018) (DonIsaac)
- 5a55dcf linter/no-unused-vars: `type` specifier not deleted for type
imports (#5029) (DonIsaac)
- 4081293 linter/no-unused-vars: Panic in fixer when removing
destructures (#4923) (Don Isaac)
- ddf83ff linter/react: Fixed false positive with missing key inside
React.Children.toArray() (#4945) (Earl Chase)
- 508644a linter/tree-shaking: Correct the calculation of `>>`, `<<` and
`>>>` (#4932) (mysteryven)
- e99836d linter/unicorn: Allow set spreading in no-useless-spread
(#4944) (Don Isaac)
- 5f8a7c2 oxlint: Rules in the configuration file are not being
correctly … (#4949) (dalaoshu)

### Documentation

- e331ca0 linter: Improve documentation for several rules (#4997)
(DonIsaac)
- cd9f1cd linter/consistent-function-scoping: Improve rule documentation
(#5015) (DonIsaac)

### Refactor

- eca6fdb linter: Move plugin options into separate struct (#5100)
(DonIsaac)
- 06f2d81 linter: Avoid unnecessary temp `Vec`s (#4963) (overlookmotel)
- 4cb8c37 linter: Move default_true to utils (#4947) (Don Isaac)
- ca70cc7 linter, mangler, parser, semantic, transformer, traverse,
wasm: Rename various `flag` vars to `flags` (#5028) (overlookmotel)
- 59d15c7 semantic: `root_unresolved_references` contain only
`ReferenceId` (#4959) (overlookmotel)

### Testing

- c21d735 linter/no-unused-vars: Add ignored destructuring test cases
(#4922) (Don Isaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-23 11:09:14 +08:00
oxc-bot
b3e189764f
Release oxlint v0.7.2 (#4909)
## [0.7.2] - 2024-08-15

### Features

- 97e38cd linter: Add fixer for unicorn/prefer-optional-catch-binding
(#4867) (heygsc)
- 93ae1c7 linter: Eslint-plugin-react jsx-props-no-spread-multi (#4866)
(keita hino)
- 0a23610 linter: Add fixer for unicorn/prefer-array-flat-map (#4844)
(heygsc)
- 13c7b1b linter/jsx-a11y: Add fixer for aria-unsupported-elements
(#4854) (DonIsaac)
- a6195a6 linter/jsx-a11y: Add fixer for anchor-has-content (#4852)
(DonIsaac)
- 4d28d03 task/website: Support render `subschemas.all_of` (#4800)
(mysteryven)

### Bug Fixes

- 21f5762 codegen: Minify large numbers (#4889) (Boshen)
- a08d7a7 linter/jsx-a11y: Reduce false negatives for html-has-lang
(#4855) (DonIsaac)
- a81ce3a linter/no-unused-vars: Do not delete function expressions when
fixing (#4848) (DonIsaac)

### Documentation

- 955a4b4 oxlint: Improve cli doc regarding fix and `-D all` (Boshen)

### Refactor

- 56f033c linter: Improve diagnostics for several jsx-a11y rules (#4853)
(DonIsaac)
- c53c210 linter/no-unused-vars: Split fixer logic into multiple files
(#4847) (DonIsaac)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-08-15 14:56:34 +08:00