Hiroshi Ogawa
3d66929fa2
fix(sourcemap): improve source map visualizer ( #7386 )
...
- Related https://github.com/rolldown/rolldown/issues/2737
Probably this is still an approximation of what
https://github.com/evanw/source-map-visualization does, but I tried to
get some ideas from it.
For comparison, I added an example from their site
https://evanw.github.io/source-map-visualization/ as a snapshot in
`crates/oxc_sourcemap/tests/fixtures/esbuild/visualizer.snap`. I'll
mention a few notable changes in the comments.
Snapshot change in rolldown repo can be found in
- https://github.com/rolldown/rolldown/pull/2829
2024-11-21 14:35:56 +08:00
Boshen
e6922df3bb
feat(parser): fix incorrect AST for x?.f<T>() ( #7387 )
2024-11-21 06:10:48 +00:00
Boshen
885e37f8eb
feat(transformer): Optional Chaining ( #6990 )
...
close : #6958
2024-11-21 03:12:18 +00:00
Boshen
0c1fb96760
fix(tasks/coverage): run runtime tasks concurrently to avoid timeout ( #7384 )
2024-11-21 03:05:20 +00:00
Alexander S.
466f395816
refactor(vscode): split ConfigService and Config ( #7376 )
...
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-21 09:57:09 +08:00
camchenry
8cebdc8129
feat(linter): allow appending plugins in override ( #7379 )
...
follow up to https://github.com/oxc-project/oxc/issues/6896
for improved compatibility with ESLint, this tries to match the behavior of plugin overrides so that plugins can be enabled for certain paths. this does not allow disabling plugins.
2024-11-21 01:46:28 +00:00
Zak
ad44cfa840
docs(linter): import/first options ( #7381 )
...
Fix the docs for
[import-first](https://oxc.rs/docs/guide/usage/linter/rules/import/first.html#import-first )
which mentions the option `"absolute-import"` rather than
`"absolute-first"`
2024-11-21 09:46:12 +08:00
overlookmotel
42496ed16f
chore: assign ast_tools to @overlookmotel code owner ( #7378 )
...
In the absence of Rez, it's mine! 😄
2024-11-21 00:01:02 +08:00
Boshen
f059b0e655
fix(ast)!: add missing ChainExpression from TSNonNullExpression ( #7377 )
...
closes #7375
* `foo?.bar!`
* `foo?.[bar]!`
`TSNonNullExpression` was not wrapped inside `ChainExpression`.
2024-11-20 15:54:28 +00:00
Boshen
ddb2ced5dd
chore: add CODEOWNERS ( #7374 )
2024-11-20 21:14:43 +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
Boshen
666b6c104c
fix(parser): add missing ChainExpression in optional TSInstantiationExpression ( #7371 )
2024-11-20 11:51:55 +00:00
Boshen
7bf970a4b6
refactor(linter)!: remove tree_shaking plugin ( #7372 )
...
This rule has been in `nursery` for a long time and I don't see it
coming out of `nursery` in the foreseeable future.
closes #7031
clsoes #7057
2024-11-20 11:46:29 +00:00
Boshen
6a98ef1a0c
feat(transformer): add CompilerAssumptions to TransformContext ( #7369 )
2024-11-20 09:27:29 +00:00
renovate[bot]
b3965bbff0
chore(deps): update npm packages ( #7364 )
2024-11-20 17:26:48 +08:00
Boshen
9b9d02078c
docs(semantic): document the meaning of ReferenceFlags::Read and Write ( #7368 )
...
closes #5165
2024-11-20 09:18:25 +00:00
Boshen
82773cb455
feat(codegen): remove underscore from bigint ( #7367 )
...
closes #7285
closes #7286
2024-11-20 09:08:51 +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.
5190b7fb28
test(editor): add test setup ( #7361 )
...
Tried it with `vitest`, but there was too many problems with `vscode`
integration.
That why I followed the official guide:
-
https://code.visualstudio.com/api/working-with-extensions/testing-extension#migrating-from-vscode
-
https://code.visualstudio.com/api/working-with-extensions/continuous-integration
2024-11-20 12:46:01 +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
overlookmotel
234c7b9fef
feat(traverse): implement GatherNodeParts for member expression types ( #7363 )
...
`GatherNodeParts` was missing support for these types as entry points for collection.
2024-11-20 03:58:48 +00:00
Dunqing
c587dd3cd6
fix(codegen): do not print parenthesis for in expression in ArrowFunctionExpression ( #7360 )
...
Please check out [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAACgpID0+ICIiIGluIHt9 )
2024-11-19 14:29:18 +00:00
Boshen
514878d927
fix(transform_conformance): only run exec tests when specified ( #7359 )
2024-11-19 13:13:11 +00:00
Boshen
d60801218e
feat(transform_conformance): snapshot our transformed outputs ( #7358 )
2024-11-19 12:49:44 +00:00
Boshen
84f3bf2f97
refactor(transform_conformance): clean up test execution code ( #7357 )
2024-11-19 12:22:42 +00:00
Boshen
d0e64fd80a
refactor(transform_conformance): remove TestCase trait ( #7356 )
2024-11-19 10:52:42 +00:00
Dunqing
6cfb5df9b9
feat(transformer): support generate proper binding name from ChainExpression ( #7326 )
2024-11-19 10:31:54 +00:00
Dunqing
58db9ef322
refactor(codegen): do not print unnecessary parentheses if both sides use the same logical operator ( #7325 )
...
As shown by the changing tests, we don't need to print parentheses for them.
### Comparison
In [esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAAAGEgPz8gKGIgPz8gKGMgPz8gZCkpOwooYSA/PyAoYiA/PyAoYyA/PyBkKSkpOwooYSB8fCAoYiB8fCBjKSkgfHwgZDsKYSB8fCAoYiB8fCAoYyB8fCBkKSk7CmEgJiYgKChiICYmIGMpICYmIGQp ), it will print parentheses as-is, in [SWC](https://play.swc.rs/?version=1.9.2&code=H4sIAAAAAAAAA0tUsLdX0EgCk8kgMkVT05pLIxGLMES8pgYkDiSTNTVBVIo1F5IgUDFIDKQ2UUFNTUEDKAykkjVBZIomAGEbiHtuAAAA&config=H4sIAAAAAAAAA1VQzW7DIAy%2B9ykin6tlyrHXTb3ttCdA1GmpACPbSIuqvPuAJml6w9%2Bv8ePQdXAXC6fuUZ5lSIYFeZsLIlNU81cQ0CmhWHZJ4biyKpVSztiQ%2BUmAGr6iVhPK8DkMsOJsoozEYd%2BQBb9xdBHPxF%2FeiJwd%2BossuVsVo7G68xXIhUSsv5TZYi27qSY59T1K%2BJBbn56W48vAOaoLTWuyUjDqLCz0%2FPYDTyRVNxovyw4QXHTjtF%2FdUiglIu%2FCKjXx6jf%2FYc1v6RDokhu5HL0etq5U0gLFu8BLuTZu6eDkZ7W3s8%2F%2FYy0r4MUBAAA%3D ), we have the same output now
2024-11-19 10:31:53 +00:00
Boshen
65f1e82bd8
refactor(transform_conformance): clean up some code ( #7354 )
2024-11-19 09:15:14 +00:00
Boshen
4c367b6746
chore(deps): update codecov/codecov-action action to v5 ( #7353 )
...
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 16:01:09 +08:00
overlookmotel
c335f92ada
perf(syntax): reorder operator enum variants ( #7351 )
...
Re-order enum variants of `AssignmentOperator`, `BinaryOperator` and `UnaryOperator`.
* `Exponential` moved to after `Remainder` (so with the rest of the arithmetic operators).
* `Shift*` operators follow arithmetic operators.
* `AssignmentOperator::Bitwise*` ops moved to before `Logical*` ops (so all ops which correspond to `BinaryOperator`s are together).
* `*Or` always before `*And`.
* Plus/Addition always before Minus/Subtraction.
The purpose is to make the various methods on these types maximally efficient:
1. Group together variants so that `AssignmentOperator::is_*` methods can be executed with the minimum number of operations (essentially `variant - min <= max`).
2. Align the variants of `AssignmentOperator` and `BinaryOperator` so that conversion methods added in #7350 become very cheap too (essentially `if variant - min <= max { Some(variant + offset) } else { None }`).
2024-11-19 01:23:28 +00:00
Dmitry Zakharov
bc0e72c1e2
fix(linter): handle user variables correctly for import/no_commonjs ( #7316 )
...
test case found in `typescript/no-require-imports`
2024-11-19 09:23:16 +08:00
Ryan Walker
1d9f528668
feat(linter): implement unicorn/prefer-string-raw lint rule ( #7335 )
...
Implements
[unicorn/refer-string-raw](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-raw.md )
for #684
2024-11-19 09:22:40 +08:00
overlookmotel
2534cdecb7
feat(syntax): add AssignmentOperator::to_logical_operator and to_binary_operator methods ( #7350 )
...
Add methods to convert `AssignmentOperator` to `LogicalOperator` or `BinaryOperator`. e.g. `+=` -> `+`, `&&=` -> `&&`.
2024-11-19 01:12:11 +00:00
overlookmotel
41a0e60c3e
refactor(ast)!: remove impl GetAddress for Function ( #7343 )
...
`impl GetAddress for Function` was added as a hack, in the absence of another way to get the `Address` of a `&Function` (https://github.com/oxc-project/backlog/issues/140 ).
Remove it, and use `Address:from_ptr` instead in JSX Refresh transform, which is only place using it.
2024-11-19 01:05:31 +00:00
Alexander S.
4b8aecc8ed
ci(editor): add lint and compile checks ( #7346 )
2024-11-19 09:05:19 +08:00
overlookmotel
b5a202711c
style(syntax): improve formatting ( #7349 )
...
Style nit. Adjust formatting.
2024-11-18 22:26:30 +00:00
dalaoshu
bf839c1dfa
fix(linter): false positive in jest/expect-expect ( #7341 )
...
closes #7237
2024-11-18 15:17:36 +00:00
leaysgur
167d2d560d
chore(docs): Replace TAB with SPACE to render markdown correctly ( #7337 )
...
Possibly fixes #7336
2024-11-18 11:54:33 +00:00
Boshen
7b83a3ddfa
chore(tasks/coverage): update runtime.snap
2024-11-18 18:01:49 +08:00
overlookmotel
c84e892380
perf(ast): AstBuilder::vec1 use Vec::from_array_in ( #7334 )
...
`AstBuilder::vec1` can use `Vec::from_array_in` rather than creating a `Vec` and then pushing to it. This should optimize better.
2024-11-18 02:35:46 +00:00
overlookmotel
510b95d6c4
perf(transformer): use AstBuilder::vec_from_array ( #7333 )
...
Use `AstBuilder::vec_from_array` introduced in #7331 in the transformer, in place of creating a `Vec` with `Vec::with_capacity` and then pushing values to it.
2024-11-18 02:35:46 +00:00
overlookmotel
39afb48025
feat(allocator): introduce Vec::from_array_in ( #7331 )
...
Because we lack specialization in stable Rust, `Vec::from_iter_in` is unable to take advantage of the fact that `[T; N]` has a statically knowable size.
Introduce `Vec::from_array_in` for this case, which should be able to create the `Vec` with a single static-sized memcpy, or may allow the compiler to see that it can construct the array directly in the arena, rather than construct on stack and then copy to the arena.
Also add a corresponding `AstBuilder::vec_from_array` method, and use it in various places in codebase.
2024-11-18 02:35:46 +00:00
overlookmotel
1938a1d6d9
refactor(isolated_declarations): do not copy Vec unnecessarily ( #7332 )
...
This function receives an owned `oxc_allocator::Vec`. No need to copy the contents to a new `Vec` with `AstBuilder::vec_from_iter`, can just use the original.
2024-11-18 02:28:38 +00:00
overlookmotel
44fd962fbb
perf(transformer/arrow-functions): move arguments transform checks to aid inlining ( #7322 )
...
Move the cheap "does arguments need to be transformed" checks introduced in #7321 into `enter_identifier_reference` and `enter_binding_identifier`, and mark those methods `#[inline]`. These hot paths can then usually execute without a function call.
This wins back the other half of the perf hit of #7234 .
2024-11-17 10:49:17 +00:00
overlookmotel
26d3e96aca
perf(transformer/arrow-functions): store state of whether arguments needs transform ( #7321 )
...
Track whether `arguments` needs to be transformed. If it doesn't, can skip expensive checks for whether `IdentifierReference`s and `BindingIdentifier`s names are `arguments` or not.
This recovers about half the performance hit of #7234 .
2024-11-17 10:49:16 +00:00
overlookmotel
871e19bea2
refactor(transformer/arrow-function): comments on possible improvement ( #7320 )
2024-11-17 10:07:35 +00:00
overlookmotel
ea08c1f495
refactor(transformer/arrow-function): reserve correct capacity for Vec ( #7319 )
2024-11-17 10:07:35 +00:00
overlookmotel
e09d2df448
perf(transformer/arrow-function): create super method binding names lazily ( #7313 )
...
Key `super` getter/setter hash map with original property name `&str`, instead of generated binding name. This allows a couple of improvements:
* Generate binding names for `super` getters/setters lazily, only when they're created, rather than every time you encounter a `super`.
* Don't allocate strings into arena which are never used as part of AST. Use `CompactString` for building those strings instead.
2024-11-17 10:07:34 +00:00
overlookmotel
5d853869eb
refactor(transformer/arrow-functions): use IndexMap for super getter/setters ( #7317 )
...
Generate getter/setter declarations in same order as Babel by using `IndexMap` instead of `HashMap` to store `super` getter/setter method details.
2024-11-17 10:07:34 +00:00