Commit graph

2822 commits

Author SHA1 Message Date
Dunqing
1519b9000b
fix(semantic): incorrect scope for switch statement (#2513)
close: #2501
2024-02-26 22:54:19 +08:00
Boshen
be6b8b7ce6
[BREAKING CHANGE] Change Atom to Atom<'a> to make it safe (#2497)
Part of #2295

This PR splits the `Atom` type into `Atom<'a>` and `CompactString`.

All the AST node strings now use `Atom<'a>` instead of `Atom` to signify
it belongs to the arena.

It is now up to the user to select which form of the string to use.

This PR essentially removes the really unsafe code 


93742f89e9/crates/oxc_span/src/atom.rs (L98-L107)

which can lead to 

![image](https://github.com/oxc-project/oxc/assets/1430279/8c513c4f-19b0-4b63-b61c-e07c187c95b5)
2024-02-26 19:34:40 +08:00
Boshen
4fabe66621
Publish crates v0.8.0 2024-02-26 19:01:51 +08:00
Boshen
a0f23baea7
Release oxlint and vscode extension v0.2.11 2024-02-26 18:41:04 +08:00
Boshen
d980b0bef2
Release napi oxc-parser@v0.6.0 2024-02-26 18:40:26 +08:00
keita hino
93742f89e9
fix(linter): Correct configuration file parsing for jsx-no-useless-fragment (#2512)
fix: #2484 

I fixed the configuration parsing for jsx-no-useless-fragment.
2024-02-26 15:49:50 +08:00
Dunqing
cd75c1ca59
feat(transformer/decorators): insert only one private in expression (#2486) 2024-02-26 15:48:47 +08:00
Dunqing
4c2e2bdf61
fix(semantic): add export symbol flag to identifiers in export declarations (#2508)
Related PR: #2335
2024-02-26 15:48:05 +08:00
Dunqing
432791679f
fix(codegen): remove redundant semicolon in PropertyDefinition (#2511) 2024-02-26 15:15:19 +08:00
Yuji Sugiura
f66fb886b3
fix(tasks/rulegen): Parse 'export default' test file for plugin-jsdoc (#2510) 2024-02-26 14:31:51 +08:00
Boshen
540f917f3a
refactor(ast): remove TSEnumBody (#2509) 2024-02-26 12:44:38 +08:00
Arnaud Barré
b8764a8eb8
Fix few serialization issues (#2506)
Re: #2463
2024-02-26 12:25:17 +08:00
renovate[bot]
0bdace187a
chore(deps): update website npm packages (#2505) 2024-02-26 10:38:26 +08:00
renovate[bot]
29b213eac7
chore(deps): update rust crates (#2503) 2024-02-26 10:38:11 +08:00
renovate[bot]
77f3ab0496
chore(deps): update vscode npm packages (#2504) 2024-02-26 10:37:25 +08:00
Dunqing
70295a5552
feat(ast): update arrow_expression to arrow_function_expression (#2496) 2024-02-25 14:39:34 +00:00
Boshen
fba66dcc75
fix(linter): improve import/no-named-as-default (#2494) 2024-02-25 21:24:08 +08:00
Boshen
f5aadc767f
feat(linter): handle cjs `module.exports = {} as default export (#2493) 2024-02-25 00:11:48 +08:00
Boshen
f64c7e04a3
feat(linter): handle cjs module.exports.foo = bar and exports.foo = bar (#2492) 2024-02-24 23:54:43 +08:00
Boshen
d0a9c465f7
feat(linter): handle top-level require for import plugin (#2491) 2024-02-24 21:48:23 +08:00
Yuji Sugiura
04f4621ed8
fix(semantic): Should return nearest JSDoc (#2490)
Follow up #2437 ( 🙇🏻 )
2024-02-24 20:35:57 +08:00
Boshen
ef5713d600
chore(linter): add tests no import/no-deprecated (#2489) 2024-02-24 17:50:30 +08:00
Boshen
3e1794d6c0
feat(syntax): implement Debug for ModuleRecord (#2488) 2024-02-24 17:34:42 +08:00
Yuji Sugiura
bc22ae569e
fix(semantic): Refactor jsdoc finding (#2437)
Partial fix for #168 

- [x] Fix general finding behavior for leading comments
- [x] Accept multiple jsdoc comments per node
- [x] Provide `get_one` and also `get_all` 
- [x] Add `iter_all()` for non-node related usage
- [x] Limit AST node kinds to parse
2024-02-24 17:24:01 +08:00
Alex Yip
696818ad08
feat(linter): implement @typescript-eslint/prefer-ts-expect-error (#2435)
Implement @typescript-eslint/prefer-ts-expect-error

Issue: https://github.com/oxc-project/oxc/issues/2180

Documentation:
https://typescript-eslint.io/rules/prefer-ts-expect-error/
Rule source:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/prefer-ts-expect-error.ts

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-24 09:23:50 +00:00
Boshen
7a796c4b5f
feat(ast): add TSModuleDeclaration.kind (#2487)
closes #2395
2024-02-24 17:09:31 +08:00
Boshen
5212f7b51e
fix(parser): fix missing end span from TSTypeAliasDeclaration (#2485)
closes #2483
2024-02-24 16:51:00 +08:00
Boshen
6aa8c2daee
feat(linter): initialize resolver lazily and automatically read tsconfig.json for now (#2482) 2024-02-23 23:19:33 +08:00
Boshen
135e56a401
feat(linter): ignore unsupported extensions in import/no_unresolved (#2481) 2024-02-23 23:11:43 +08:00
Dunqing
3d008abacb
feat(transformer/decorators): insert instanceBrand function (#2480) 2024-02-23 23:04:27 +08:00
Boshen
7f867221ca
feat(linter): handle built-in modules in import/no_unresolved (#2479) 2024-02-23 22:10:27 +08:00
Boshen
d741d72e17
fix(linter): fix import plugin hanging when ignored modules are imported (#2478)
`ModuleMap` needs to save all ignored modules,
the cache will wait for forever otherwise.

For example, previously when `.json` modules is imported,
`init_cache_state` will lock the thread forever because there are no
code path that lead `update_cache_state` to release the lock.
2024-02-23 22:04:31 +08:00
keita hino
015b2ee3ac
feat(linter): eslint-plugin-react void-dom-elements-no-children (#2477)
partof: https://github.com/oxc-project/oxc/issues/1022

docs:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/void-dom-elements-no-children.md
code:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/lib/rules/void-dom-elements-no-children.js
test:
https://github.com/jsx-eslint/eslint-plugin-react/blob/master/tests/lib/rules/void-dom-elements-no-children.js
2024-02-23 21:37:11 +08:00
Boshen
c5f67febc1
feat(linter): add boilerplate for eslint-plugin-import/no_duplicates (#2476) 2024-02-23 18:35:29 +08:00
Boshen
f1e364fee5
feat(linter): eslint-plugin-import/no_unresolved (#2475) 2024-02-23 18:27:57 +08:00
keita hino
35a0f895dc
fix(linter): Handle cases where createElement is an Identifier in is_create_element_call (#2474)
I fixed a false negative issue in the `is_create_element_call` function
where createElement was an Identifier.

https://github.com/oxc-project/oxc/blob/main/crates/oxc_linter/src/utils/react.rs#L13-L19

In the case of [eslint-plugin-react's button-has-type
rule](https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md),
the following triggers the expected errors:
```ts
// error
React.createElement("button")
// error
createElement("button")
```

However, with Oxlint, it behaves differently:
```ts
// error
React.createElement("button")
// false negative
createElement("button")
```
2024-02-23 15:55:28 +08:00
Boshen
2714a32970
feat(linter): continue working on no_cycle (#2471) 2024-02-23 05:16:30 +00:00
Dunqing
2628c97eda
feat(transformer/decorators): transform getter function (#2473) 2024-02-23 10:11:45 +08:00
Boshen
6527bfd249
feat(linter): add boilerplace code for import/namespace,no_deprecated,no_unused_modules (#2470) 2024-02-22 18:48:40 +08:00
Boshen
8ab667c90e
chore: assign all renovate bot changes to me 2024-02-21 23:22:41 +08:00
Boshen
91ea3ab29d
Release napi oxc-parser@v0.5.0 2024-02-21 23:08:54 +08:00
Boshen
6c6b542036
feat(napi): return comments (#2469) 2024-02-21 22:43:40 +08:00
Boshen
1634586934 refactor(ast): s/TSTypeOperatorType/TSTypeOperator to align with estree 2024-02-21 22:25:04 +08:00
Boshen
9087f71765 refactor(ast): s/TSThisKeyword/TSThisType to align with estree 2024-02-21 22:25:04 +08:00
Boshen
d08abc638e refactor(ast): s/NumberLiteral/NumericLiteral to align with estree 2024-02-21 21:41:08 +08:00
Boshen
e6b391a24f refactor(ast): s/ArrowExpression/ArrowFunctionExpression to align estree 2024-02-21 21:41:08 +08:00
zhangrunzhao
ff6a337453
feat(linter): typescript-eslint: prefer-function-type (#2337)
Ref: #2180 

- doc:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/prefer-function-type.md
- code:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/prefer-function-type.ts
- test:
https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/tests/rules/prefer-function-type.test.ts

Co-authored-by: 张润钊 <zhangrunzhao@bytedance.com>
2024-02-21 20:15:40 +08:00
Boshen
30392c96e8
Release oxlint and vscode extension v0.2.10 2024-02-21 18:10:37 +08:00
Boshen
35608c8eb1
chore: fix all docs 2024-02-21 18:06:37 +08:00
Boshen
4f22eaaf96
ci: check cargo doc for all crates 2024-02-21 18:03:49 +08:00