Commit graph

5412 commits

Author SHA1 Message Date
Boshen
cd81d12624 perf(linter): add should_run to check path only once to nextjs/no_typos (#5584) 2024-09-07 13:03:23 +00:00
Boshen
3835189785
test(linter): add test case for no_unused_vars in 3b87ac4 2024-09-07 20:45:40 +08:00
Boshen
3b87ac48ce fix(linter): fix no_unused_vars panic when encountering unicode (#5582)
closes #4887
2024-09-07 12:37:51 +00:00
Boshen
5f275516eb test(linter): add a passing case to no_undef (#5580)
closes #2093
2024-09-07 11:08:26 +00:00
Boshen
1bc08e296e fix(coverage): parse babel unambiguously (#5579) 2024-09-07 10:49:00 +00:00
Boshen
43933912ce fix(coverage): parse typescript unambiguously (#5575) 2024-09-07 10:48:59 +00:00
Boshen
603817bef9 feat(oxc)!: add SourceType::Unambiguous; parse .js as unambiguous (#5557)
See https://babel.dev/docs/options#misc-options for background on `unambiguous`

Once `SourceType::Unambiguous` is parsed, it will correctly set the returned `Program::source_type` to either `module` or `script`.
2024-09-07 10:48:58 +00:00
IWANABETHATGUY
08d2b7d761 feat(oxc_wasm): add controlFlowDotString to oxc_wasm (#5571) 2024-09-07 10:41:00 +00:00
夕舞八弦
26d9235319
refactor: enable clippy::ref_as_ptr (#5577)
#5567 
`clippy::borrow_as_ptr` is also enabled in
`oxc_traverse/src/generated/walk.rs`.
2024-09-07 18:18:55 +08:00
rzvxa
c78a8507d1 refactor(ast_tools): only use type names to ignore fields in the DeriveContentHash. (#5573)
related to https://github.com/oxc-project/backlog/issues/107
2024-09-07 09:57:25 +00:00
rzvxa
db55fb0fce fix(ast_tools, ci): watch tasks/ast_tools instead of tasks/ast_codegen. (#5576)
I was so confused as to why the `AST Changes` step wasn't running at times. Turns out we weren't watching it at all😅

This means for a duration of time we weren't running the `AST Changes` step on PRs that edited only `ast_tools` that didn't update any side-effects.
2024-09-07 09:41:18 +00:00
rzvxa
7a6b64c3f0 refactor(ast_tools): remove unsafe code from logger. (#5574)
https://github.com/oxc-project/oxc/pull/5519#discussion_r1747097404
2024-09-07 09:03:26 +00:00
Boshen
7f7ed7b4dc
ci: add custom pnpm action (#5572) 2024-09-07 16:13:19 +08:00
Boshen
c796b77fa2
ci: use pnpm publish 2024-09-07 13:19:52 +08:00
Boshen
f5f3d08a51
build: use pnpm catalog 2024-09-07 13:15:43 +08:00
Boshen
f7912ad6c0
chore: remove unused pnpm-lock.yaml 2024-09-07 13:11:34 +08:00
Boshen
c4f169fa46
ci: fix publish vscode 2024-09-07 13:11:01 +08: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
505d06446b fix(transformer): JSX transform delete references for JSXClosingElements (#5560)
JSX transform delete old references which were used in `JSXClosingElement` before transformation.
2024-09-07 03:51:36 +00:00
overlookmotel
17226dd5f8 feat(traverse): add methods for deleting references (#5559)
Add `TraverseCtx::delete_reference` and `TraverseCtx::delete_reference_for_identifier` methods for deleting references.

These methods can't go on `SymbolTable` as they need access to both `ScopeTree` and `SymbolTable`, and they can't go on `Semantic` as we need them in transformer where we don't have a complete `Semantic`.
2024-09-07 03:51:35 +00:00
overlookmotel
642295c15a feat(semantic): add SymbolTable::delete_resolved_reference method (#5558)
Add `SymbolTable::delete_resolved_reference` method to delete a reference for a symbol.
2024-09-07 03:51:35 +00:00
overlookmotel
2da5ad19be feat(ast): add JSXElementName::get_identifier method (#5556)
Add `get_identifier` method for `JSXElementName`, `JSXMemberExpression` and `JSXMemberExpressionObject`, to get root object `IdentifierReference`. i.e. `Foo` in `<Foo>` or `<Foo.bar>`.
2024-09-07 03:51:34 +00:00
Alexander S.
cdd1a91754
fix(linter): typescript/no-magic-numbers: remove double minus for reporting negative bigint numbers (#5565)
@DonIsaac small bug I found after 10x review

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-07 11:48:24 +08:00
Don Isaac
0ac420d6f9
refactor(linter): use meaningful names for diagnostic parameters (#5564)
Also add `pending` fix labels to many rules.
2024-09-06 18:14:56 -04:00
Alexander S.
be3a432106
feat(linter): implement typescript/no-magic-numbers (#4745)
Linter rule: https://eslint.org/docs/latest/rules/no-magic-numbers
and: https://typescript-eslint.io/rules/no-magic-numbers/

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-09-06 20:52:13 +01:00
DonIsaac
af69393a1c test(linter/no-useless-spread): ensure spreads on identifiers pass (#5561)
Closes #5405
2024-09-06 19:03:16 +00:00
overlookmotel
ce71982567 refactor(transformer): shorten code in JSX transform (#5554)
Pure refactor. Just shorten code.
2024-09-06 18:15:58 +00:00
Boshen
28b934ca74 fix(coverage): apply always_strict to test262 and typescript per the specifcation (#5555)
This also removes the confusing `SourceType::always_strict` field.

I hacked it with `SourceType::always_strict`, but what we actually want is add `'use strict'`.

This is technically a breaking change but I don't expect anyone using this outside of oxc.

The snapshot has a large diff due to every single line shifting by 1 row :-/
2024-09-06 17:14:01 +00:00
Boshen
b06052501a refactor(semantic)!: remove source_type argument from SemanticBuilder::new (#5553)
Realized we can get the source type from the AST.

The next PR will introduce `unambiguous` to `SourceType` and directly set `Program::source_type` to either `script` or `module`.
2024-09-06 16:40:10 +00:00
Boshen
d62defb42d fix(codegen): do not print trailing commas for ArrayExpression (#5551)
closes #5532
2024-09-06 16:35:10 +00:00
leaysgur
dec139529d refactor(regular_expression): Align diagnostics (#5543)
Manage all diagnostics for LiteralParser, FlagsParser, PatternParser in one place, same message format.
2024-09-06 16:28:06 +00:00
DonIsaac
81a394d11d refactor(linter): deduplicate code in oxc/no-async-await (#5549) 2024-09-06 14:56:30 +00:00
mysteryven
c8ab353a68 fix(linter/tree-shaking): align JSXMemberExpression's report (#5548)
Follow up #5450.

[eslint-plugin-tree-shaking](463fa1f0be/src/rules/no-side-effects-in-initialization.ts (L673-L677)) just report on `JSXMemberExpression.property`

![CleanShot 2024-09-06 at 22 34 55@2x](https://github.com/user-attachments/assets/a8dbfe43-daf8-4b96-b812-8afff5939b34)
2024-09-06 14:43:40 +00:00
overlookmotel
14ee086182 refactor(ast): inline AstKind::as_* methods (#5547)
One would hope compiler will inline these trivial methods anyway, but mark them `#[inline]` to make sure.
2024-09-06 14:31:17 +00:00
overlookmotel
fefbbc1a5e
docs(sourcemap): add trailing newline to README (#5539)
For consistency with our `.editorconfig`.
2024-09-06 15:24:52 +01:00
Jelle van der Waa
09aa86dcbe
feat(linter/eslint): implement sort-vars rule (#5430) 2024-09-06 09:49:46 -04:00
overlookmotel
dc924892cc test: add trailing line breaks to conformance fixtures (#5541)
Continuation of #5537. Ensure all conformance fixture files have a trailing line break.
2024-09-06 12:55:17 +00: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
overlookmotel
694f032a3d style: add trailing line breaks to package.json files (#5542)
For consistency with our `.editorconfig`.
2024-09-06 12:43:44 +00:00
Edwin Lim
2ec2f7d829
feat(linter/eslint): implement no-alert (#5535)
Contributing to #479 !

Rule Details: [link](https://eslint.org/docs/latest/rules/no-alert)

Am new to the internals of parsers and linters so I kept the
implementation similar to ESLint's source code

Commented out the `globalThis` test cases in the pass array meant for
pre-ES2020 before `globalThis` was introduced, having clarified in the
Discord that it's ok to treat the built-in `globalThis` as always
present.

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-09-06 08:40:20 -04:00
overlookmotel
7414ff89b6 style(editors): add trailing newline to .prettierignore (#5540)
For consistency with our `.editorconfig`.
2024-09-06 12:23:15 +00:00
overlookmotel
87a79d9cd0 test(transformer): add trailing line breaks to conformance fixtures (#5537)
Currently whether conformance fixture files have trailing line breaks is inconsistent - some have them, some don't. Make all of them have a trailing line break.
2024-09-06 12:02:46 +00:00
overlookmotel
e18c2edfcb test(transformer): move RegExp transform conformance tests (#5536)
Rename transform conformance RegExp test fixtures folder from "esbuild-tests" to "regexp", to reflect that not all these tests are copied from ESBuild.
2024-09-06 12:02:45 +00:00
overlookmotel
9282647e6c docs(transformer): comment on RegExp transform for potential improvement (#5514)
I think it's correct that we could do better here. Or is there some difference in behavior between `RegExp(...)` and `new RegExp(...)`?
2024-09-06 12:02:44 +00:00
overlookmotel
758a10c515 refactor(transformer): RegExp transform reuse var (#5527)
Nit. Use local `flags` var instead of `regexp.regex.flags`.
2024-09-06 12:02:44 +00:00
overlookmotel
9b7ecc7ee7 fix(transformer): RegExp transform only set span on final expression (#5508) 2024-09-06 12:02:43 +00:00
Boshen
bb9d9d1481
feat(oxc): raise MSRV to v1.76.0 (Minimum Supported Rust Version) 2024-09-06 20:00:34 +08:00
overlookmotel
fad0a0548b refactor(transformer): RegExp transform unbox early (#5504)
Unbox the `RegExpLiteral` early to avoid all lookups thereafter going through the indirection of a `Box`.
2024-09-06 11:51:38 +00:00
overlookmotel
d1ece197c4 fix(transformer): RegExp transform handle Term::Quantifier (#5501)
`Term::Quantifier` contains a nested `Term` so we need to recurse into that `Term` to check if it contains any unsupported syntax.
2024-09-06 11:51:35 +00:00
Boshen
0c43d0cf8d
build: fix wasm publish 2024-09-06 19:39:13 +08:00