Commit graph

2490 commits

Author SHA1 Message Date
overlookmotel
ee949fc78d refactor(transformer): use is_identifier_part 2024-01-23 11:05:17 +08:00
overlookmotel
040ee192c4 refactor(transformer): use is_identifier_name from oxc_syntax 2024-01-23 11:05:17 +08:00
overlookmotel
bc7ea0bedb refactor(parser): make is_identifier methods consistent 2024-01-23 11:05:17 +08:00
overlookmotel
27aaff2bef
refactor(syntax): ASCII tables static not const (#2128)
A small nit: `ASCII_CONTINUE` is used in multiple places, so it's
preferable that it's a `static` not a `const` so it only gets included
in the binary once, rather than once for each usage.

Only makes a tiny difference on benchmarks (~0.1 ms), but change seems
worthwhile anyway just to be more "good practice".
2024-01-22 21:49:54 +08:00
Boshen
3ef631807d
Release oxlint 0.2.3-alpha.0 2024-01-22 20:07:27 +08:00
Boshen
e81e8c7124
ci: release oxlint with linux-{x64-gnu, arm64-gnu, x64-musl, arm64-musl} (#2126)
closes #1736
2024-01-22 19:56:27 +08:00
Valerii Smirnov
6d808a673c
feat(linter): linter-eslint-plugin-import/no-named-as-default (#2109)
#1117 

Code:
https://github.com/import-js/eslint-plugin-import/blob/main/src/rules/no-named-as-default.js
Tests:
https://github.com/import-js/eslint-plugin-import/blob/main/tests/src/rules/no-named-as-default.js
Docs:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default.md
2024-01-22 19:55:05 +08:00
Boshen
ad133ba647
chore: update snapshots 2024-01-22 19:16:09 +08:00
Boshen
a978639718
feat(cli): disallow path pointing to parent directories (#2125)
Linting parent directories introduces undefined behavior because
the intention is not clear. This is a future proof precaution.

closes #1887
2024-01-22 17:52:57 +08:00
Boshen
26571c72de
chore(just): change sync command to sync-submodules
This should avoid accidentally running the command
2024-01-22 17:45:13 +08:00
Boshen
d00c44c484
fix(linter): allow [...new Array(n)] in no-useless-spread (#2124)
closes #1735
2024-01-22 17:10:58 +08:00
Boshen
fe7c4d09d2
ci: improve ecosystem ci (#2099) 2024-01-22 17:05:25 +08:00
Boshen
d90db3afe0
feat(linter): promote no-new-array to correctness with better help message (#2123)
relates #1735
2024-01-22 16:57:57 +08:00
Hulk
20a34b5294
feat: introduce --react-perf-plugin CLI flag, update rules to correctness (#2119)
https://github.com/oxc-project/oxc/issues/2041#issuecomment-1903316240

Closes #2041
2024-01-22 16:45:32 +08:00
Boshen
69fecac733
feat(linter): eslint config jsonc support (#2121) 2024-01-22 16:19:31 +08:00
Yuji Sugiura
ce94714c31
feat(tasks): Enable tasks/lint_rules CI (#2118)
Part of #2020

👉🏻  See generated comment on #2117
2024-01-22 15:29:37 +08:00
Dunqing
766ca63aa0
refactor(ast): rename RestElement to BindingRestElement (#2116)
close: #2115
2024-01-22 14:28:35 +08:00
Dunqing
8bccdab2e9
refactor(semantic): add binder for FormalParameters and RestElement, replacing the binder for FormalParameters (#2114)
Similar with #2013.

This way we will be able to find the corresponding Ast accurately.

The snapshots look a little strange but the change is expected.
2024-01-22 14:23:39 +08:00
Hulk
5ca07bcb09
feat(linter): eslint-plugin-react-perf (#2086)
Relates #2041 

Closes #2042
Closes #2043
Closes #2044
Closes #2045
2024-01-22 13:53:48 +08:00
overlookmotel
4f59c4fdfc
refactor(syntax): reformat identifier byte tables (#2111)
Not a substantive change, just reformatting the ASCII byte tables in
`oxc_syntax`.

In my opinion, this makes them easier to read.
2024-01-22 13:45:12 +08:00
Yuji Sugiura
b88b8bbdad
feat(tasks): Implement lint_rules --update (#2113)
Part of #2020

- Implement GitHub REST API call part
- Clarify `--update` flag responsibility
2024-01-22 13:44:41 +08:00
kaykdm
b1608420cd
feat(linter): support eslint config in nextjs eslint (#2107)
related: https://github.com/oxc-project/oxc/issues/1929

Support Next.js eslint config settings.
- [custom settings
](https://nextjs.org/docs/app/building-your-application/configuring/eslint#custom-settings)
- also handle Next.js eslint rule name mapping

these are need before implementing [this
rule](https://nextjs.org/docs/messages/no-html-link-for-pages)
2024-01-22 11:39:39 +08:00
msdlisper
2228aa8ced
fix(linter): jsx_a11y/img-redundant linter enable test case(#2112)
Enables the case where `settings` is used.

Part of  #1141
2024-01-21 18:31:20 +00:00
overlookmotel
36c718ee82
feat(tasks): benchmarks for lexer (#2101)
This PR adds benchmarks for the lexer. I'm doing some work on optimizing
the lexer and I thought it'd be useful to see the effects of changes in
isolation, separate from the parser.

These benchmarks may not be ideal to keep long-term, but for now it'd be
useful.

In order to do so, it's necessary for `oxc_parser` crate to expose the
lexer, but have done that without adding it to the docs, and using an
alias `__lexer`.
2024-01-21 14:32:50 +00:00
cin
16b32616c4
feat(linter): eslint-plugin-jest: no-restricted-jest-methods (#2091)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/no-restricted-jest-methods.ts)

---------

Co-authored-by: Wenzhe Wang <mysteryven@gmail.com>
2024-01-21 17:00:48 +08:00
Wenzhe Wang
142f84f654
fix(linter): not use new_inline with flexible str (#2106) 2024-01-21 16:37:27 +08:00
cin
4adce6fb45
feat/linter: (eslint-plugin-jest): no-restricted-matchers (#2090)
Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/no-restricted-matchers.ts)
2024-01-21 16:06:00 +08:00
Cameron
51183b801c
fix(linter) panic in prefer-native-coercion-function (#2100)
closes #2098
2024-01-21 01:52:00 +08:00
Boshen
2fdfc4cf1a
Release oxlint and vscode extension v0.2.2 2024-01-20 23:04:47 +08:00
Boshen
59e29f286a
chore(parser): explain the reason for omitting "}" and ">" in jsx text lexer (#2097)
closes #2094
2024-01-20 23:03:44 +08:00
Boshen
3f2b48f1a9
refactor(parser): remove useless string builder from jsx text lexer (#2096)
relates #2094
2024-01-20 22:34:57 +08:00
Dunqing
8e43eeffe7
refactor(semantic): improve declare symbol logic in FormalParameters (#2088) 2024-01-20 20:59:11 +08:00
msdlisper
a36813405b
refactor(linter): perfect the scope linter (#2092)
perfect the scope linter for #1141
2024-01-20 10:46:35 +08:00
Boshen
2f5afff9bd
fix(parser): fix crash on TSTemplateLiteralType in function return position (#2089)
```
interface Helpers {
  inspect(): `~~~~\n${string}\n~~~~`;
}
```
2024-01-19 23:14:05 +08:00
Dunqing
721a869b6e
feat(linter): improve no_redeclare rule implementation (#2084) 2024-01-19 20:10:06 +08:00
Boshen
a9e2158362
Update README 2024-01-19 18:39:07 +08:00
Yuji Sugiura
2f1e1e2e46
feat/tasks: expose linter RULES and use it for listing (#2083)
Part of #2020 , follow up of #2081 .
2024-01-19 16:45:00 +08:00
Yuji Sugiura
60ab7121f8
(feat/tasks): refactor lint_rules for subsequent todos (#2081)
Part of #2020 

- Handle args and flags
- Split files
- Prettify CLI outputs
2024-01-19 15:10:49 +08:00
Dunqing
b5b2ef34af
feat(transformer/typescript): improve function parameters name (#2079) 2024-01-19 13:50:10 +08:00
Dunqing
7711f7abaf
feat(transformer/typescript): support only_remove_type_imports option (#2077) 2024-01-18 23:25:31 +08:00
Dunqing
f5bf5dece1
feat(transformer/typescript): support transform exported TSModuleBlock (#2076) 2024-01-18 23:20:26 +08:00
Dunqing
56ca8b6dfe
feat(transformer/typescript): support transform namespace (#2075) 2024-01-18 23:15:28 +08:00
Dunqing
2e78b918d1
refactor(transformer/typescript): move the ExportNamedDeclaration logic to its function (#2074) 2024-01-18 21:28:48 +08:00
Yuji Sugiura
85c98525d7
feat(tasks): introduce tasks/lint_rules (#2068)
Part of #2020
2024-01-18 21:22:29 +08:00
overlookmotel
0e32618664
refactor(parser): combine token kinds for skipped tokens (#2072)
Small optimization to the lexer.

Whitespace, line breaks, and comments are all skipped by
`read_next_token()`.

At present there's a different `Kind` for each, and `read_next_token()`
decides whether to skip with `matches!(kind, Kind::WhiteSpace |
Kind::NewLine | Kind::Comment | Kind::MultiLineComment)`.

These `Kind`s are used for no other purpose, so there seems little
reason to differentiate them.

This PR combines them all into `Kind::Skip`, so then the test of whether
to skip is reduced to `kind == Kind::Skip`.

Only produces ~0.3% performance bump on parser benchmarks. But, why
not?...
2024-01-18 21:14:12 +08:00
Valerii Smirnov
d7ecd21801
fix(linter): eslint-plugin-import no-named-as-default-member rule (#2071)
Fixed false positives and early return @mysteryven 
#1988

64de6e9265 (r1453429430)
2024-01-18 09:32:40 +08:00
Wenzhe Wang
29dc5e69ff
fix(codegen): add parenthesis in binary expression by precedence (#2067)
related ESBuild code:
f5f8ff895c/internal/js_printer/js_printer.go (L3348-L3371)
2024-01-17 23:01:42 +08:00
Wenzhe Wang
32349af691
chore(tasks): remove redundant directory after exec (#2069) 2024-01-17 17:35:15 +08:00
Dunqing
b89e84cc2d
feat(transformer/typescript): keep imports if import specifiers is empty (#2058) 2024-01-17 16:14:31 +08:00
Dunqing
24ac957660
fix(semantic): incorrect reference flag (#2057) 2024-01-17 16:08:31 +08:00