Alexander S.
9522d528f5
ci(editor): add type-check ( #7427 )
...
probably closes https://github.com/oxc-project/backlog/issues/135
2024-11-23 11:55:26 +08:00
Dunqing
4d6bd07afe
fix(transformer/async-generator-functions): correct all binding scope id ( #7425 )
...
Fixed a bunch of semantic errors by removing moving binding logic 😢 . This plugin constructs a complex `for-await` replacement so that I wrongly move to an incorrect scope.
2024-11-22 16:29:00 +00:00
Boshen
bb2c0c219b
refactor(transformer)!: return String as error instead of OxcDiagnostic ( #7424 )
2024-11-22 16:22:49 +00: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
overlookmotel
52784d2aea
refactor(transformer/optional-chaining): avoid multiple symbol lookups ( #7421 )
...
`IdentifierReference::is_global_reference` and `MaybeBoundIdentifier::from_identifier_reference` both look up the symbol for the identifier. Do this lookup only once, rather than twice.
2024-11-22 13:36:34 +00:00
overlookmotel
971c91a2e8
feat(traverse): add methods to BoundIdentifier + MaybeBoundIdentifier to create SimpleAssignmentTargets ( #7418 )
...
We had methods to create `AssignmentTarget`s. Add methods to create `SimpleAssignmentTarget`s too.
2024-11-22 12:31:29 +00:00
overlookmotel
eb39a50a2e
refactor(transformer/logic-assignment): shorten code ( #7419 )
...
Use `create_spanned_read_expression` instead of `create_spanned_expression`, as it's shorter than specifying `ReferenceFlags` manually.
2024-11-22 11:42:03 +00:00
overlookmotel
be5f843a12
docs(traverse): fix docs for BoundIdentifier + MaybeBoundIdentifier ( #7417 )
2024-11-22 10:58:34 +00:00
Dunqing
27b2268a6c
refactor(semantic)!: remove SymbolFlags::Export ( #7414 )
...
close : #7338
close : #7344
The `SymbolFlags::Export` is Initially used to solve `ExportSpecifier` that is not `IdentifierReference` that causes we cannot determine whether a Binding is not used everywhere by `Semantic`.
Since #3820 this problem is solved, so we don't need `SymbolFlags::Export` no longer. Also, removing this can help us easier to pass the `Semantic` check in `Transformer`
2024-11-22 09:17:37 +00:00
Dunqing
c90537f1f0
refactor(linter/only-used-in-recursion): improve implementation to remove using SymbolFlags::Export ( #7413 )
...
part of #7414
2024-11-22 09:17:36 +00:00
Dunqing
c8adc46a08
refactor(linter/no-unused-vars): improve implementation to remove using SymbolFlags::Export ( #7412 )
...
part of #7414
2024-11-22 09:17:35 +00:00
Dunqing
7ff9f13973
fix(transformer): correct all ReferenceFlags ( #7410 )
2024-11-22 09:10:55 +00:00
Dunqing
6f0fe38bff
fix(semantic)!: correct all ReferenceFlags::Write according to the spec ( #7388 )
...
close #7323
According to the specification re-design the JavaScript-part ReferenceFlags inferring approach.
* https://tc39.es/ecma262/#sec-assignment-operators-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-postfix-increment-operator-runtime-semantics-evaluation
* https://tc39.es/ecma262/#sec-runtime-semantics-restdestructuringassignmentevaluation
* ... See references of https://tc39.es/ecma262/#sec-putvalue
### Changes
1. The left-hand of `AssignmentExpression` is always `ReferenceFlags::Write`
```js
let a = 0;
console.log(a = 0);
^ Write only
```
2. The `argument` of `UpdateExpression` is always `ReferenceFlags::Read | Write`
```js
let a = 0;
a++;
^ Read and Write
```
This change might cause some trouble for `Minfier` to remove this code, because ‘a’ is not used elsewhere. I have taken a look at `esbuild` and `Terser`. Only the `Terser` can remove this code.
2024-11-22 06:08:30 +00:00
Dmitry Zakharov
6730e3effe
docs(linter): add more examples for unicorn/prefer-array-some ( #7411 )
2024-11-22 14:06:46 +08:00
overlookmotel
f4fda2dba6
test(transformer): add --debug option to transform conformance ( #7400 )
...
Add `--debug` command line option for transformer conformance runner, same as for `cargo coverage`. It prints the paths of test fixtures before running them.
2024-11-22 02:23:10 +00:00
no-yan
4ad26b952f
feat(linter): add no-promise-in-callback ( #7307 )
...
related: #4655
This PR implements a rule to detect Promises inside error-first
callbacks, preventing the mixed usage of callbacks and Promises.
Example of problematic code:
```javascript
a(function(err) { doThing().then(a) });
^^^^^^^^^^^^^^
```
[Original
implementation](266ddbb030/rules/no-promise-in-callback.js )
2024-11-22 10:21:26 +08:00
Dmitry Zakharov
9002e97e12
fix(linter): add proper support for findIndex and findLastIndex for unicorn/prefer-array-some ( #7405 )
...
closes #7404
2024-11-22 10:12:13 +08:00
Song Gao
f2cfed198b
chore: make editor respect space as indent ( #7401 )
...
#7337
Copy editrconfig from rust-analyzer
Tab is causing some trouble, and it seems a better choice to unify
indent style
This is part work of #7362 , split it to make meaningful change merged
quickly
2024-11-22 10:00:58 +08:00
oxc-bot
0918e520cf
release(crates): v0.37.0 ( #7399 )
2024-11-21 22:27:55 +08: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
1550ffc5b5
fix(tasks/lint_rules): map prefix node to n ( #7397 )
...
The `eslint-plugin-n` page is not showing any rules implemented.
2024-11-21 13:58:53 +00:00
Boshen
e91c2878d8
fix(linter): fix panic in react/no-array-index-key ( #7395 )
2024-11-21 13:35:21 +00:00
overlookmotel
c34d649176
refactor(linter): use scope_id etc methods ( #7394 )
...
Utilize the methods added in #7127 in `oxc_linter`.
2024-11-21 12:29:57 +00:00
Boshen
224775c056
feat(transformer): transform object rest spread ( #7003 )
...
https://babel.dev/docs/babel-plugin-transform-object-rest-spread
2024-11-21 11:33:26 +00:00
overlookmotel
b3d5802ef1
docs(syntax): more comments for ReferenceFlags ( #7392 )
...
Add more docs to `ReferenceFlags`, mainly to include the runtime test in https://github.com/oxc-project/oxc/issues/5165#issuecomment-2488333549 .
2024-11-21 11:20:28 +00:00
Dunqing
a32f5a73d3
fix(linter/no-array-index-key): compile error due to it uses a renamed API ( #7391 )
...
Fix: https://github.com/oxc-project/oxc/pull/6960#issuecomment-2490754348
2024-11-21 10:46:21 +00:00
BitterGourd
7f8747dd6a
feat(linter): implement react/no-array-index-key ( #6960 )
...
Implement not recommended rule `no-array-index-key` (#1022 )
2024-11-21 10:29:40 +00:00
IWANABETHATGUY
8cfea3c5b6
feat(oxc_cfg): add implicit return instruction ( #5568 )
...
1. Adding a new InstructionKind `ImplicitReturn`
2. Adding a new `ImplicitReturn` instruction for each function body,
just like biome

2024-11-21 16:18:51 +08:00
Dmitry Zakharov
be152c01c5
feat(linter): add typescript/no-require-imports rule ( #7315 )
2024-11-21 16:15:49 +08:00
DonIsaac
df143ca7bb
docs(linter): add docs for config settings ( #4827 )
2024-11-21 08:08:30 +00:00
DonIsaac
849489e8b4
feat(linter): add suggestion for no-console ( #4312 )
...
Part of #4179
2024-11-21 07:46:29 +00:00
Dmitry Zakharov
6d50ee01e4
chore: add vscode recommended extensions ( #6739 )
...
This will make it easier to contribute for newbie rust developers if
they not have proper extensions.
2024-11-21 15:46:05 +08:00
Boshen
5145a5009b
ci: remove oxc_sourcemap from wasm test because insta is not supported
2024-11-21 15:23:43 +08:00
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