Commit graph

643 commits

Author SHA1 Message Date
Dunqing
51cecbb3ea
refactor(transformer/decorators): align the implementation of all versions (#2159) 2024-01-25 13:11:24 +08:00
Dunqing
7f89bfea0d
feat(transformer/decorators): support version 2023-05 (#2152) 2024-01-24 11:19:29 +08:00
Dunqing
04b401cbfd
feat(transformer/decorators): support transform the class decorators in export declaration (#2145) 2024-01-24 11:13:29 +08:00
Dunqing
9e598ff650
feat(transformer): add decorators plugin (#2139) 2024-01-24 11:09:19 +08:00
renovate[bot]
0be0a234ce
chore(deps): update cargo (#2138) 2024-01-23 14:48:04 +08:00
Yuji Sugiura
71173a9181
feat(tasks): Add @typescript-eslint to lint_rules CI task (#2134)
Part of #2020

- Add `@typescript-eslint` plugin rules
- w/ refactoring
  - Fix compile errors to add other plugins
  - Remove not intended unsupported rule in `eslint`

(Use #2117 for updating for a while?)
2024-01-23 12:29:55 +08:00
Boshen
ad133ba647
chore: update snapshots 2024-01-22 19:16:09 +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
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
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
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
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
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
Yuji Sugiura
85c98525d7
feat(tasks): introduce tasks/lint_rules (#2068)
Part of #2020
2024-01-18 21:22:29 +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
Dunqing
3413bb3884
feat(transformer/typescript): remove type-related exports (#2056) 2024-01-17 16:04:30 +08:00
Dunqing
95d741abd6
feat(transformer/typescript): remove type only imports/exports correctly (#2055) 2024-01-17 15:58:04 +08:00
Boshen
ae4e714713
refactor(linter): remove the LintSettings parameter from LintContext::new. (#2051) 2024-01-16 17:17:46 +08:00
Don Isaac
97b1984d74
build(linter): add new-react-perf rulegen task (#2040)
Adds a new linter rule generation task, `just new-react-perf-rule`, for
incorporating rules from
[eslint-plugin-react-perf](https://github.com/cvazac/eslint-plugin-react-perf)
into oxc.

Since this library has its own testing utilities and only 4 rules, I
didn't bother writing code to port over test cases. If we deem this
requisite I'll add this to the rulegen task.
2024-01-16 12:48:19 +08:00
Boshen
b0f4715df1
ci: disable codegen runtime tests for now
It seems to be unstable across node.js versions
2024-01-15 21:24:07 +08:00
Boshen
a69b76ab77
chore: update snapshots 2024-01-15 21:13:05 +08:00
Valerii Smirnov
c60c31521e
feat(linter): eslint-plugin-import no-named-as-default-member rule (#1988)
- Docs:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md
- Code:
https://github.com/import-js/eslint-plugin-import/blob/main/src/rules/no-named-as-default-member.js
- Tests:
https://github.com/import-js/eslint-plugin-import/blob/main/tests/src/rules/no-named-as-default-member.js
2024-01-15 11:03:04 +00:00
dependabot[bot]
21909fa962
chore(deps): bump the dependencies group with 3 updates (#2033) 2024-01-15 15:31:32 +08:00
Dunqing
6c7f983de5
feat(transformer/typescript): remove export specifier that import_kind is type (#2015) 2024-01-13 21:25:59 +08:00
magic-akari
869643b03b
fix(prettier): Correctly format call expression arguments (#2018) 2024-01-13 21:25:26 +08:00
Dunqing
ead4e8df1f
feat(transformer/typescript): remove import if only have type reference (#2001) 2024-01-13 08:52:14 +00:00
Boshen
b386177af2
refactor(linter): move away from tuples for test cases (#2011)
closes #1956
2024-01-13 16:23:16 +08:00
Boshen
39f026f3e2
chore(benchmark): remove custom allocators because they are flaky (#2004) 2024-01-12 16:05:47 +08:00
Dunqing
0a086860da
feat(ast): visit TSModuleReference (#1998)
### Failed cases:

* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elision-qualifiedname/input.ts
* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react/input.ts

We need to distinguish whether a reference is a type or a js variable
2024-01-11 23:29:29 +08:00
Dunqing
afb2c501f5
feat(transformer): support for transform TSImportEqualsDeclaration (#1994) 2024-01-11 23:24:28 +08:00
Dunqing
4e7b7dad78
feat(task): handle expected runtime error correctly (#1987) 2024-01-11 15:04:28 +08:00
Dunqing
6417d2ce9c
feat(task): test codegen runtime in run_async (#1980)
<img width="460" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/4f2d05a1-4d3e-422e-9722-0c77d4ff989d">
2024-01-11 14:59:29 +08:00
Dunqing
ee286a0a48
feat(task): support run async in suite (#1973) 2024-01-11 14:54:30 +08:00
Dunqing
633b21c5d2
feat(task): skips some cases we don't care about in codegen-runtime (#1986)
#1977
2024-01-11 14:50:39 +08:00
underfin
78b427bc50
feat(transform): support es2015 new target (#1967)
Here implementing the es2015 new target transform, see detail at
https://babel.dev/docs/babel-plugin-transform-template-new-target.

Here has three kinds need to be distinguished.

- `NewTargetKind::Method`, it from `AstKind::ObjectMethod` or
`AstKind::MethodDefinitionKind::Get/Set/Method`. It will be transformed
to `void 0`.
- `NewTargetKind::Constructor`, is from `
AstKind::MethodDefinitionKind::Constructor`. It will be transformed to
`this.constructor`.
- `NewTargetKind::Function`, is from ` AstKind::Function`, here the
function is not the above function. It will be transformed to `this
instanceof _target ? this.constructor : void 0`, here `_target` comes
from the function name or is created by scope uid ident.
2024-01-10 23:59:56 +08:00
Dunqing
fc7dbd9225
feat(task): codegen test262 runtime test (#1959) 2024-01-10 17:12:11 +08:00
Yuji Sugiura
8a7efc2c3b
feat(tasks): Add eslint-plugin-jsdoc rulegen (#1965)
Hello. 👋🏻 

This PR makes `just new-jsdoc-rule xxxx` command works.

---

Initially, I planned to implement some basic rules later.
However, after struggling for half a day, I realized that it would be
challenging for a beginner like me to do it now. 😓

Once I have looked for something else I can do, and/or read more into
the codebase, I hope to be able to try again at some point.
2024-01-09 21:37:24 +08:00
Dunqing
b50c5ec623
fix(parser): unexpected ts type annotation in get/set (#1942)
fix: https://github.com/oxc-project/oxc/issues/1939
2024-01-08 15:07:43 +08:00
Boshen
08438e04ba
refactor(parser): remove TokenValue::RegExp from Token (#1926)
This PR is part of #1880.

`Token` size is reduced from 48 to 40 bytes.

To reconstruct the regex pattern and flags within the parser , the regex
string is
re-parsed from the end by reading all valid flags.

In order to make things work nicely, the lexer will no longer recover
from a invalid regex.
2024-01-08 13:48:52 +08:00
Wenzhe Wang
f46ed71d8a
feat(tasks): add eslint-plugin-next rulegen (#1921)
closes: #1905

Support generate rules from
[eslint-plugin-next](https://nextjs.org/docs/app/building-your-application/configuring/eslint#eslint-plugin).
2024-01-07 10:23:22 +08:00
Dunqing
3b4fe0edfd
feat(semantic): allow reserved keyword defined in ts module block (#1907)
https://www.typescriptlang.org/play?target=99#code/PTAEAEBcEMCcHMCmkBcpEGcB2iAekAoECAWwHsATAVwBtE1MAmABkcYBpMd8CiwAHKgCNQAYzJYMkUAGUAKgCUAkgGE5AfQCyAeQAiAUXUA5AIKb9MtDOQAeAGQByKdEgBLUaCmwAfKAC8oPwAFgBm6hjIAISgAN58oAkJAESuJPx0JIhYkBhJ7PGJoCnZiLAh0KKIeQWJSXSQ1cSFSfwVANbQSI1gzfywrgBuLlX5TbV9ZJCIolMU3YVFgkI07vPNzm6ia7UAnq6INHOjYAC+ANy8ePxksNIx5wQU0zRwiKBY0JkYrZWgIWRkWKgAgJcSSaSpdKITLZDBoaBYHZnYGgiRSQLCFaieGI5EgsRoiElMoVeigBFIlGgIawUD1HGU-Fg9E-DpIBl41HgwL9IZTDlMwk8ybTWYCrnojbucUE7l7A4UAUnAhAA
2024-01-06 12:56:27 +08:00
Dunqing
6c5b22f728
refactor(semantic): improve ClassTable implmention and merge properties and methods to elements (#1902) 2024-01-05 18:38:51 +08:00
Boshen
97fa3934a6
deps(rust): bump deps (#1888) 2024-01-04 20:41:31 +08:00