Commit graph

1437 commits

Author SHA1 Message Date
DonIsaac
8ff6f2cb86 fix(linter/no-unused-vars): panic on UsingDeclarations (#5206)
Closes #5202
2024-08-25 21:26:45 +00:00
camc314
982bd6ecb7 feat(linter/unicorn): add fixer to require-array-join-separator (#5152) 2024-08-25 21:07:17 +00:00
camc314
a6704bd293 feat(linter/unicorn): add fixer to prefer-set-size (#5149) 2024-08-25 21:04:10 +00:00
dalaoshu
aaaf26cee4
fix(linter): error in fixer for prefer-to-have-length (#5197)
closes #5195
2024-08-25 17:13:56 +01:00
camc314
ac7edccab3 feat(linter/unicorn): add fixer to prefer-array-some (#5153) 2024-08-25 13:25:12 +00:00
Boshen
543cad6370
refactor(codegen): remove some pub APIs 2024-08-25 13:32:55 +08:00
DonIsaac
a877e5a612 test(linter/no-unused-vars): ensure type annotations on property accessors are considered used (#5183) 2024-08-25 01:02:51 +00:00
camc314
1d01aa316f feat(linter/unicorn): add partial fixer for prefer-array-flat (#5143) 2024-08-24 22:58:38 +00:00
DonIsaac
fd1031abeb fix(linter/unicorn): breaking fixer in case statements for no-null (#5176) 2024-08-24 22:24:10 +00:00
Don Isaac
7b86ed61d1
fix(linter/unicorn): handle type casts and parens in no-null (#5175) 2024-08-24 18:18:52 -04:00
DonIsaac
7ab615220d refactor(linter/unicorn): clean up no-null (#5174) 2024-08-24 21:48:35 +00:00
DonIsaac
7886618e00 test(linter/unicorn): add fixer tests for no-null (#5173) 2024-08-24 21:48:34 +00:00
DonIsaac
b629e160db fix(linter/unicorn): improve diagnostic message for no-null (#5172)
This stack was made because of shortcomings I noticed while running `oxlint-eccosystem-ci` tests locally
2024-08-24 21:40:00 +00:00
camc314
dc9e1e233a fix(unicorn/linter) fix multiple false positives in no-useless-promise-resolve-reject (#5178)
more closely follows the implementation from unicorn's repo.

early returns if the parent is not a `return`, `yield`, or an arroy function

Closes #5125
Closes #5126
2024-08-24 21:03:31 +00:00
DonIsaac
d29042e7fc fix(linter/no-unused-vars): function expression in implicit arrow function return (#5155)
Fixes cases such as:
```ts
export const foo = () => function bar() {}
```
2024-08-24 15:49:56 +00:00
Cameron
147b37176b
fix(linter) fix bug in fixer for func names when function is async (#5167) 2024-08-24 11:30:56 -04:00
dalaoshu
1f5b6b6c82
fix(linter): bug in fixer for prefer-to-have-length (#5164) 2024-08-24 11:29:45 -04:00
Earl Chase
ba62a71975
fix(linter/react): Fixed false positive with missing key inside React.Children.toArray() for fragments (#5133)
Related: #4421 and #4945
2024-08-24 16:01:50 +08:00
DonIsaac
36e4a2875c fix(linter/no-unused-vars): panic in variable declarator usage checks (#5160)
Part of #5129
2024-08-24 04:49:30 +00:00
Cameron
22d57f9e5e
feat(linter/unicorn): add fixer to prefer-string-slice (#5150) 2024-08-23 21:37:35 -04:00
camc314
34bfaf6792 feat(linter/react): add fixer to jsx-props-no-spread-multi (#5145) 2024-08-23 23:43:53 +00:00
Cameron
2fe44153ac
feat(linter/unicorn): add fixer to no-redundant-roles (#5146) 2024-08-23 17:38:24 -04:00
Cameron
d35c6f5dfc
feat(linter/unicorn): add fixer to prefer-regexp-test (#5151) 2024-08-23 17:34:06 -04:00
Cameron
27db769b8a
feat(linter/unicorn): add fixer to text-encoding-identifier-case (#5154) 2024-08-23 17:29:19 -04:00
Cameron
7eb052e0d4
fix(linter): no-hex-escape fixer removing regex flags (#5137)
closes #5127
2024-08-23 20:32:34 +01:00
DonIsaac
1ce9630c72 feat(linter/config): implement FromIterator for LintPluginOptions (#5102)
Part of #5046
2024-08-23 18:55:58 +00:00
DonIsaac
33599b0064 refactor(linter): split options into multiple files (#5101) 2024-08-23 18:55:57 +00:00
camc314
56a68f542d fix(linter) fix bug in fixer for func-name (#5136)
closes #5128
2024-08-23 18:46:04 +00:00
DonIsaac
b894d3b33e feat(linter)!: make no-unused-vars correctness (#5081)
closes #5080
2024-08-23 13:12:59 +00:00
camc314
525d664aa9 fix(linter) false positive in jest/no-untyped-mock-factory (#5123)
part of https://github.com/oxc-project/oxc/issues/5103
2024-08-23 12:45:23 +00:00
camc314
b7ba9c01a1 fix(linter) fix bug in fixer for prefer-function-type when interface is exported (#5122)
part of https://github.com/oxc-project/oxc/issues/5103
2024-08-23 12:45:22 +00:00
Jelle van der Waa
f7958c4cc2
feat(linter/unicorn): add prefer-structured-clone (#5095) 2024-08-23 12:34:52 +01:00
Boshen
76c66b4326 fix(linter/max-lines): point span to end of file for disable directive to work (#5117)
closes #4101
2024-08-23 10:20:17 +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
DonIsaac
eca6fdbffe refactor(linter): move plugin options into separate struct (#5100)
Part of #5046
2024-08-23 00:01:21 +00:00
Don Isaac
841174f73c
feat(linter/no-unused-vars): delete non-root arrows, skip await (#5083)
This PR updates no-unused-var's fixer for `VariableDeclarator`s in two
ways:
1. Unused function expressions and arrow functions not declared in the
top scope
   will now be removed.
   ```ts
   // not deleted, no change
   const x = function() {}
   const y = (a) => a
   function z() {}

   // new behavior
   function foo() {            // <- not deleted
       const x = () => {}      // <- deleted
       const y = function() {} // <- this too
   }
   ```
2. Variables initialized to an `await` expression will not be deleted.
   ```ts
// unused await-initialized variables are often API calls with side
effects
   // in the real world; we don't want to delete these.
   const res = await createUser(data)
   ```
2024-08-22 11:48:27 -04:00
dalaoshu
f1e46116de
feat(linter/eslint-plugin-vitest): implement no-conditional-in-test (#4971)
Related to #4656
2024-08-22 08:15:32 +08:00
dalaoshu
14bf5d5177
feat(linter/eslint-plugin-vitest): implement no-restricted-vi-methods (#4956)
Related to #4656
2024-08-22 08:07:53 +08:00
Earl Chase
ddf83ff1b9
fix(linter/react): Fixed false positive with missing key inside React.Children.toArray() (#4945)
Closes: #4421 

Added three new functions in order to check if an element is inside of
React.Children.toArray.
Tests added for this fix are exactly the same as those used by
eslint-plugin-react.
2024-08-22 08:05:14 +08:00
DonIsaac
cd9f1cd278 docs(linter/consistent-function-scoping): improve rule documentation (#5015) 2024-08-21 00:47:17 +00:00
overlookmotel
5f4c9ab38e refactor(semantic)!: rename SymbolTable::get_flag to get_flags (#5030)
Part of #4991.
2024-08-21 00:19:58 +00:00
overlookmotel
ca70cc7c03 refactor(linter, mangler, parser, semantic, transformer, traverse, wasm): rename various flag vars to flags (#5028)
Part of #4991.
2024-08-21 00:19:58 +00:00
DonIsaac
9354779ad4 fix(linter/no-unused-vars): give argsIgnorePattern the same default behavior as varsIgnorePattern (#5018) 2024-08-21 00:15:10 +00:00
DonIsaac
5a55dcf39b fix(linter/no-unused-vars): type specifier not deleted for type imports (#5029)
fixes a bug in eslint/no-unused-vars where, when unused type imports were deleted, the `type` modifier was not.
2024-08-21 00:11:45 +00:00
camc314
2292606a1f feat(linter): typescript-eslint/no-wrapper-object-types (#5022) 2024-08-20 21:45:38 +00:00
Don Isaac
c43945c808
fix(linter/consistent-function-scoping): allow functions passed as arguments (#5011) 2024-08-20 17:00:50 -04:00
DonIsaac
86d0c0cb62 fix(linter): change consistent-function-scoping to suspicious (#5010) 2024-08-20 16:22:30 +00:00
Boshen
ce4d4698b4 feat(codegen)!: remove const generic MINIFY (#5001)
This is a premature optimization, makes the code complicated, and bloats the final binary size.

The minify option is moved to `CodegenOptions`
2024-08-20 08:13:27 +00:00
Boshen
b2ff2df5af refactor(parser)!: remove builder pattern from Parser struct (#5000)
part of #4455

use `with_options(ParseOptions { ..ParseOptions::default() })` API instead.
2024-08-20 07:40:25 +00:00
dalaoshu
ed9a1c499b
feat(linter/eslint-plugin-vitest): implement require-local-test-context-for-concurrent-snapshots (#4951)
Related to #4656

---------

Co-authored-by: Wang Wenzhe <mysteryven@gmail.com>
2024-08-20 13:41:35 +08:00