Commit graph

2808 commits

Author SHA1 Message Date
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
tudorbarbu
f7e15769da
feat(linter): eslint no-nonoctal-decimal-escape (#2428)
Rule
[source](https://github.com/eslint/eslint/blob/main/lib/rules/no-nonoctal-decimal-escape.js)
Rule
[tests](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-nonoctal-decimal-escape.js)

I created a basic sticky regex implementation based on what I could find
about it, since rust does not have support for that.
There might be a better place to keep it instead of this rule file

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-21 07:02:20 +00:00
Boshen
c76312359c
chore: enable the ignored valid_expect::test_1 test 2024-02-21 14:54:44 +08:00
alakhpc
9d69167d96
feat(linter) eslint: no-new-wrappers (#2413)
Part of: #479 

docs: https://eslint.org/docs/latest/rules/no-new-wrappers

I am unsure of what do do with 2 of the eslint tests that use
`languageOptions: { globals: { String: "off" } }` and `/* global
Boolean:off */`.

I've commented them out as of now.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-21 06:43:37 +00:00
Andrew McClenaghan
6b3b260dcc
feat(Codegen): Improve codegen (#2460)
This gets all the new TS types working to the same level TS output was
before and fixes a bunch of other codegen

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-21 14:41:57 +08:00
Dunqing
197fa16613
feat(semantic): add check for duplicate class elements in checker (#2455)
1. Remove the check implementation of the parser
2. Implement it to semantic checker
3. Support typescript's check for duplicate class elements

Support checking for duplicate class elements in semantic checker is
easier to support typescript checking rules.
2024-02-21 14:10:19 +08:00
Dunqing
65571d73a7
fix(vscode): incorrect diagnostic position (#2461)
fix: #2456
2024-02-21 12:11:16 +08:00
Yuto Yoshino
e7ce633d8c
linter: implement from_configuration for jsx-a11y anchor-is-valid (#2425)
- fix: #2361 

Created the `from_configuration` function to recognize links written
during testing as valid. This function takes a JSON configuration and
generates an `AnchorIsValidConfig` object, which determines whether
specific hrefs are valid. This change allows us to easily specify valid
hrefs in our tests, ensuring that our link validation logic works as
expected.
2024-02-20 20:17:10 +08:00
Boshen
a2c173de57
refactor: remove panic! from examples (#2454)
relates #2308
2024-02-20 16:18:39 +08:00
Dunqing
cd48e1e9d9
refactor(linter): simplify getting ImportDefaultSpecifier (#2453) 2024-02-20 16:16:02 +08:00
Boshen
d0d0d9d7bb
feat(diagnostics): implement json reporter (#2452) 2024-02-20 15:33:28 +08:00
Boshen
195d76e6a5
feat(cli,diagnostics): add json reporter (#2451) 2024-02-20 15:28:27 +08:00
Boshen
399c3a6234
feat(cli): add --format option (#2450) 2024-02-20 15:23:37 +08:00
Dunqing
2a2bb2b7dd
refactor(linter): improve implementation of no_dupe_class_members based on ClassTable (#2446) 2024-02-20 13:12:32 +08:00
Dunqing
950298d960
feat(semantic): add static property, ElementKind::Getter, ElementKind::Setter in ClassTable (#2445) 2024-02-20 13:07:48 +08:00