Commit graph

5083 commits

Author SHA1 Message Date
dalaoshu
aaaf26cee4
fix(linter): error in fixer for prefer-to-have-length (#5197)
closes #5195
2024-08-25 17:13:56 +01:00
overlookmotel
f3e1662e4e improve(codegen): improve oxc_codegen example (#5198)
Improve `oxc_codegen` example to demonstrate best practice of resetting the allocator once the AST stored in it is no longer needed, before parsing another file.
2024-08-25 14:58:27 +00:00
Kevin Deng 三咲智子
8ebc23f84c
fix(ast): serialize TSParenthesizedType with camelCase (#5199) 2024-08-25 22:58:04 +08:00
Kevin Deng 三咲智子
bf49f339d0
chore: pin pnpm version & upgrade lockfile version (#5200) 2024-08-25 22:57:33 +08:00
camc314
ac7edccab3 feat(linter/unicorn): add fixer to prefer-array-some (#5153) 2024-08-25 13:25:12 +00:00
Dunqing
f8bb0222b3 fix(transformer/arrow-functions): remove SymbolFlags::ArrowFunction (#5190)
`ArrowFunction` has been transforming to `FunctionExpression`, So we should remove `SymbolFlags::ArrowFunction`
2024-08-25 10:27:00 +00:00
Dunqing
d9ba5ad022 fix(transformer/arrow-functions): correct scope for _this (#5189)
The `_this` will eventually be inserted into a `Program` or `Function`. So we have to go up to the corresponding `scope_id`
2024-08-25 10:26:59 +00:00
Dunqing
056c6679ec feat(transformer/arrow-functions): the output that uses this inside blocks doesn't match Babel (#5188)
Fixes 666282a13b/crates/oxc_transformer/src/es2015/arrow_functions.rs (L35-L62)
2024-08-25 10:26:57 +00:00
Dunqing
260c9d2712 refactor(transformer/es2015): move all entry points to implementation of Traverse trait (#5187) 2024-08-25 10:26:56 +00:00
Dunqing
d51a9549f7 docs(transformer): add documentation for arrow-functions plugin (#5186) 2024-08-25 10:26:54 +00:00
Kevin Deng 三咲智子
d22bd2082a
feat(module_lexer): distinguish for types-only imports and exports (#5184)
Co-authored-by: Boshen <boshenc@gmail.com>
2024-08-25 18:22:44 +08:00
overlookmotel
666282a13b refactor(ci): remove extraneous doc comment (#5185)
Replace doc comment with plain comment.
2024-08-25 07:39:38 +00:00
Boshen
543cad6370
refactor(codegen): remove some pub APIs 2024-08-25 13:32:55 +08:00
dalaoshu
72740b3f78
feat(isolated_declaration): support sourcemap option (#5170)
closes #4313
2024-08-25 13:32:47 +08:00
Boshen
1e8d3dde3b
chore: update .github/codecov.yml 2024-08-25 11:57:28 +08:00
DonIsaac
a877e5a612 test(linter/no-unused-vars): ensure type annotations on property accessors are considered used (#5183) 2024-08-25 01:02:51 +00:00
DonIsaac
49cd5db54f feat(ast,parser): add definite flag to AccessorProperty node (#5182) 2024-08-25 01:02:50 +00:00
DonIsaac
7dfd51a62b feat(parser): report class properties that are both definite and optional (#5181) 2024-08-25 01:02:49 +00:00
DonIsaac
a563968386 feat(parser): report errors on optional accessor properties (#5180) 2024-08-25 01:02:49 +00:00
DonIsaac
c2fa72571f feat(ast,parser): parse TSTypeAnnotations on AccessorProperty (#5179)
Closes #5177

While making this, I noticed an uncaught parse error for accessors: accessors cannot be optional. I'll add a fix for this in an up-stack PR.
2024-08-25 01:02:48 +00:00
camc314
1d01aa316f feat(linter/unicorn): add partial fixer for prefer-array-flat (#5143) 2024-08-24 22:58:38 +00:00
DonIsaac
fd1031abeb fix(linter/unicorn): breaking fixer in case statements for no-null (#5176) 2024-08-24 22:24:10 +00:00
Don Isaac
7b86ed61d1
fix(linter/unicorn): handle type casts and parens in no-null (#5175) 2024-08-24 18:18:52 -04:00
DonIsaac
7ab615220d refactor(linter/unicorn): clean up no-null (#5174) 2024-08-24 21:48:35 +00:00
DonIsaac
7886618e00 test(linter/unicorn): add fixer tests for no-null (#5173) 2024-08-24 21:48:34 +00:00
DonIsaac
b629e160db fix(linter/unicorn): improve diagnostic message for no-null (#5172)
This stack was made because of shortcomings I noticed while running `oxlint-eccosystem-ci` tests locally
2024-08-24 21:40:00 +00:00
camc314
dc9e1e233a fix(unicorn/linter) fix multiple false positives in no-useless-promise-resolve-reject (#5178)
more closely follows the implementation from unicorn's repo.

early returns if the parent is not a `return`, `yield`, or an arroy function

Closes #5125
Closes #5126
2024-08-24 21:03:31 +00:00
DonIsaac
d29042e7fc fix(linter/no-unused-vars): function expression in implicit arrow function return (#5155)
Fixes cases such as:
```ts
export const foo = () => function bar() {}
```
2024-08-24 15:49:56 +00:00
Cameron
147b37176b
fix(linter) fix bug in fixer for func names when function is async (#5167) 2024-08-24 11:30:56 -04:00
dalaoshu
1f5b6b6c82
fix(linter): bug in fixer for prefer-to-have-length (#5164) 2024-08-24 11:29:45 -04:00
Boshen
01c0c3e4b2 feat(transformer): add remaining options to transformer options (#5169)
closes #5168
2024-08-24 14:52:03 +00:00
Earl Chase
ba62a71975
fix(linter/react): Fixed false positive with missing key inside React.Children.toArray() for fragments (#5133)
Related: #4421 and #4945
2024-08-24 16:01:50 +08:00
Boshen
c96609151e
fix(coverage): fix cases where source_type is incorrectly set to script 2024-08-24 14:40:05 +08:00
Boshen
e4ca3d3901
chore(coverage): ignore annex-b/disabled tests 2024-08-24 14:20:06 +08:00
Boshen
12c21b2bfd
fix(coverage): do not run generated test cases when filter is applied 2024-08-24 14:03:54 +08:00
Boshen
7b1546bb66
fix(codegen): do not print comments when --minify 2024-08-24 13:49:34 +08:00
Boshen
0410314278
chore(codegen): improve examples 2024-08-24 13:38:19 +08:00
overlookmotel
eb71a32ee7 refactor(ci): transform conformance snapshot include when output mismatch (#5135)
Include "Output mismatch" in transform conformance snapshots when a test also fails due to scopes/symbols mismatches.

At present, many of the tests are failing on scopes/symbols mismatches, so it's hard to see from snapshots which also have an output mismatch. In particular, when working to fix scope mismatches, it's hard to notice if changes you make cause the output to be wrong. These extra messages make that visible.
2024-08-24 04:52:14 +00:00
overlookmotel
be42b1c76b fix(ci): transform conformance do not skip any errors (#5134)
Snapshots generated by transform conformance were missing a few errors (e.g. `declarations/const-enum/input.ts` at bottom of diff). Make sure all errors fail the test.
2024-08-24 04:52:11 +00:00
DonIsaac
36e4a2875c fix(linter/no-unused-vars): panic in variable declarator usage checks (#5160)
Part of #5129
2024-08-24 04:49:30 +00:00
Dunqing
e3561127fe
chore(semantic): remove accidentally left comment (#5162) 2024-08-24 00:41:01 -04:00
Boshen
d5a494023e refactor(semantic): rewrite handling of label statement errors (#5138)
This reverts the previous changes to handling labels so that all tests can pass.

This passes all false postivies found in `monitor-oxc` (node_modules/flow-parser/flow_parser.js)

As it turns out this requires less code and produces better diagnostics.
2024-08-24 02:37:49 +00:00
overlookmotel
960e1d5c60 refactor(ast): rename IdentifierReference::new_with_reference_id (#5157)
The old name `new_read` no longer makes sense as it doesn't set a read-only flag any more, since `flags` field was removed from `IdentifierReference`.
2024-08-24 02:34:18 +00:00
Cameron
22d57f9e5e
feat(linter/unicorn): add fixer to prefer-string-slice (#5150) 2024-08-23 21:37:35 -04:00
camc314
34bfaf6792 feat(linter/react): add fixer to jsx-props-no-spread-multi (#5145) 2024-08-23 23:43:53 +00:00
overlookmotel
5136f011d9 refactor(transformer): remove unnecessary type annotation (#5131)
Remove unnecessary type annotation introduced in #4925.
2024-08-23 23:10:38 +00:00
overlookmotel
f63b568c48 refactor(ast): remove #[non_exhaustive] attr from AstBuilder (#5130)
Partially revert #4925. That PR's description gave no explanation of why this attribute is desirable.
2024-08-23 23:04:28 +00:00
Cameron
2fe44153ac
feat(linter/unicorn): add fixer to no-redundant-roles (#5146) 2024-08-23 17:38:24 -04:00
Cameron
d35c6f5dfc
feat(linter/unicorn): add fixer to prefer-regexp-test (#5151) 2024-08-23 17:34:06 -04:00
Cameron
27db769b8a
feat(linter/unicorn): add fixer to text-encoding-identifier-case (#5154) 2024-08-23 17:29:19 -04:00