Dunqing
fd1c46ca9e
fix(isolated-declarations): infer failed if there are two setter/getter methods that need to be inferred ( #5967 )
2024-09-22 13:41:47 +00:00
Dunqing
c84bd28a9c
refactor(isolated-declarations): simplify to infer the getter and setter methods ( #5966 )
2024-09-22 13:02:46 +00:00
Dunqing
6df82eee28
fix(isolated-declarations): false positive for class private method that has arguments without type annotations ( #5964 )
...
close : #5874
2024-09-22 10:10:52 +00:00
Dunqing
6a9e71da46
fix(isolated-declarations): wrap TSFunctionType in parentheses if it is inside the TSUnionType ( #5963 )
2024-09-22 10:10:52 +00:00
camchenry
eed9ac7c46
fix(linter): include actual span size in no-regex-spaces diagnostic ( #5957 )
2024-09-22 04:45:40 +00:00
camchenry
a9a8e2ad41
refactor(linter): use regex parser in eslint/no-regex-spaces ( #5952 )
...
- part of https://github.com/oxc-project/oxc/issues/5416
Use the `oxc_regular_expression` parser to make these checks more robust. a few snapshots are updated because they now output more accurate diagnostics based on the regex AST. for example, `/ ?/` now correctly only highlights two spaces rather than three (because the last one is part of a quantifier)
2024-09-22 04:33:46 +00:00
DonIsaac
40c89c2c5f
fix(linter): move promise/avoid-new to style category ( #5961 )
2024-09-22 04:25:48 +00:00
DonIsaac
f1551d64bc
fix(semantic): ? on variable declaration type annotations is a syntax error ( #5956 )
...
Closes #5955
2024-09-22 00:01:47 +00:00
camchenry
05f592b834
refactor(linter): Use parsed patterns in unicorn/prefer-string-starts-ends-with ( #5949 )
...
- part of https://github.com/oxc-project/oxc/issues/5416
This change enhances the accuracy of the `prefer_string_starts_ends_with` rule by using the parsed regex patterns for analysis. It allows for more precise detection of patterns that can be replaced with `startsWith()` and `endsWith()` methods, reducing false positives and improving the overall effectiveness of the linter.
### What changed?
- Replaced the simple string-based regex analysis with a more robust AST-based approach.
- Removed the `is_simple_string` function as it's no longer needed.
2024-09-21 18:15:07 +00:00
camchenry
3273b64a0f
refactor(linter): Use parsed patterns for unicorn/prefer-string-replace-all rule ( #5943 )
...
- part of https://github.com/oxc-project/oxc/issues/5416
Replaces the `is_simple_string` method with a more robust check against the parsed terms from the regular expression.
2024-09-21 18:02:59 +00:00
Boshen
c477424bab
perf(mangler): use sort_unstable_by_key instead of sort_by ( #5948 )
2024-09-21 16:44:02 +00:00
Dunqing
4a62703d88
feat(isolated-declarations): handle export in the namespace correctly ( #5950 )
...
Previous I didn't follow the behavior of `TypeScript` to handle `export` in `namespace` as I thought no one used this
2024-09-21 16:39:58 +00:00
Alexander S.
463c24e5ec
fix(prettier): handle TSTypeLiteral as an object ( #5946 )
...
- [x] semi is optional with the right configuration
2024-09-21 23:27:12 +08:00
Boshen
f4aefb57d8
fix(codegen): print let[0] as (let)[0] ( #5947 )
2024-09-21 15:09:55 +00:00
overlookmotel
7085829885
docs(transformer): arrow function transform: comment about incomplete implementation ( #5945 )
2024-09-21 14:08:56 +00:00
overlookmotel
87323c6220
fix(transformer): arrow function transform: prevent stack getting out of sync ( #5941 )
...
Fix tiny bug in arrow function transform.
Similar to #5828 - cannot assume that other transforms haven't altered AST between `enter_*` and `exit_*`. In this case, pushing/popping to the stack cannot depend on `func.body.is_some()`, as that could change in between `enter_function` and `exit_function`.
2024-09-21 14:08:56 +00:00
overlookmotel
155d7fcba3
refactor(transformer): arrow function transform: ignore type fields when finding enclosing arrow function ( #5944 )
...
Follow-on after #5850 .
No need to check type fields of `Function` or `ArrowFunctionExpression` when tracing up ancestors from a `this` expression - these fields cannot contain a `ThisExpression`. https://github.com/oxc-project/oxc/pull/5850#pullrequestreview-2319531991
2024-09-21 09:41:34 +00:00
Boshen
9076deefca
feat(minifier): implement part of StatementFusion ( #5936 )
2024-09-21 09:24:01 +00:00
Dunqing
ff7d9c19c1
perf(transformer): arrow function transform: calculate whether this is in arrow function lazily ( #5850 )
...
I initially added `inside_arrow_function_stack` as we haven't got `TraverseCtx` in `Transformer`. Now we can use `ctx.current_scope_flags().is_arrow()` directly instead
2024-09-21 09:01:54 +00:00
Dunqing
ea32d5b156
fix(isolated-declarations): should print constructor assignments first ( #5934 )
2024-09-21 07:52:51 +00:00
overlookmotel
4e9e838838
fix(transformer): fix arrow function transform ( #5933 )
...
Fix arrow function transform's treatment of `this` within classes.
2024-09-21 07:48:18 +00:00
Boshen
12d4888120
chore(prettier): remove incorrect comment printing logic ( #5889 )
...
Remove the previous incorrect implementation, cc @leaysgur
2024-09-21 04:45:18 +00:00
Dunqing
a23879cb96
fix(semantic): analyze ReferenceFlags incorrectly when there are nested AssignmentTarget ( #5847 )
...
close : #5801
2024-09-21 04:13:24 +00:00
Dunqing
c3e0fb68c5
perf(semantic): simplify resetting ReferenceFlags in AssignmentExpression ( #5846 )
2024-09-21 04:13:23 +00:00
overlookmotel
15743344b1
test(transformer): add test for arrow function transform ( #5932 )
...
Add test for `this` in nested block inside arrow function.
2024-09-21 00:53:43 +00:00
camchenry
0f19848263
feat(linter): Implement no-unexpected-multiline rule ( #5911 )
...
- part of https://github.com/oxc-project/oxc/issues/479
The bulk of this rule is closely based on the logic from the original ESLint rule. One major difference between this implementation and the original though is the lack of a tokenizer. ESLint uses a proper tokenizer to find identifers, parentheses, brackets, and other tokens. For this rule, I opted to just manually search for the characters we might expect to find. I'm not sure how this will hold up in the real world, I expect it could lead to some missing cases potentially, but it at least works for all of the given test cases.
2024-09-20 23:05:02 +00:00
Boshen
e148c80fcb
fix(isolated_declarations): try fix fixtures
2024-09-21 01:27:56 +08:00
Boshen
9b3f763a49
fix(isolated_declarations): try fix new line issue
2024-09-21 01:14:40 +08:00
Boshen
ee748b0c05
fix(isolated_declarations): fix fixture spacing
2024-09-21 00:42:59 +08:00
Dunqing
0f96b59990
fix(isolated-declarations): missing print comments in class's private method ( #5931 )
2024-09-20 15:12:01 +00:00
Dunqing
8780c5440f
fix(isolated-declarations): do not union a undefined when the param type is any or unknown ( #5930 )
2024-09-20 15:12:01 +00:00
Boshen
d901772daa
feat(codegen): implement minify number from terser ( #5929 )
2024-09-20 14:42:28 +00:00
Boshen
6757c5829f
chore(transform_conformance): remove unused snapshots/typescript.snap.md
...
closes #5922
2024-09-20 22:41:41 +08:00
Dunqing
f07ff14876
fix(isolated-declarations): should not transform signature that has type annotation ( #5927 )
2024-09-20 14:19:04 +00:00
Dunqing
b6a9178075
fix(isolated-declarations): don't collect references when ExportNamedDeclaration has source ( #5926 )
2024-09-20 14:19:03 +00:00
Dunqing
756a571432
fix(isolated-declarations): missing empty export when has an export declare ( #5925 )
2024-09-20 14:19:02 +00:00
overlookmotel
b80a9eec7f
refactor(ast_tools): shorten code ( #5915 )
...
#5904 reduced the generated code for `Visit` trait. Shorten the codegen a little after that change.
2024-09-20 14:15:11 +00:00
overlookmotel
eadffb900e
test(conformance): move conformance snapshots into separate directory ( #5924 )
2024-09-20 12:30:39 +00:00
DonIsaac
ba7b01fbdf
refactor(linter): Add LinterBuilder ( #5714 )
...
This will replace `OxlintOptions` in an upstream PR. This also adds `plugins` to
`Oxlintrc`. This field gets respected by the builder, but not by
`OxlintOptions`.
2024-09-20 11:58:37 +00:00
overlookmotel
8ade793dfe
test(prettier): move prettier conformance snapshots into separate directory ( #5921 )
2024-09-20 11:34:13 +00:00
overlookmotel
bd318b1eec
test(transformer): join paths in cross-platform compatible way ( #5920 )
2024-09-20 11:30:12 +00:00
Dunqing
585b8151cd
chore(isolated-declarations): fix the example that doesn't report any isolated declarations errors ( #5918 )
2024-09-20 10:47:41 +00:00
overlookmotel
7d32d2086c
test(transformer): update transform conformance README ( #5919 )
...
Add reference to our additional tests + tidy up capitalization.
2024-09-20 11:46:44 +01:00
overlookmotel
9dac6dfb23
test(transformer): move transformer conformance snapshots into separate directory ( #5917 )
...
Move snapshots for transform conformance into a `snapshots` sub-folder.
2024-09-20 10:25:17 +00:00
Dunqing
67b42205a2
refactor(isolated-declarations): simplify handling VariableDeclaration transform ( #5916 )
2024-09-20 10:18:10 +00:00
Dunqing
2fd5c2a53b
refactor(isolated-declarations): pre-filter statements that do not need to be transformed ( #5909 )
...
We only transform `Declaration` and `ModuleDeclaration` in `IsolatedDeclaration`. We pre-filter statements that need to transform and then use `clone_in` which will avoid producing overhead for clone `Statements`.
2024-09-20 10:18:09 +00:00
Boshen
9b3cc36643
chore(minifier): add boilerplate for StatementFusion and ExploitAssigns ( #5914 )
2024-09-20 08:51:10 +00:00
Boshen
943bd76679
refactor(minifier): move tests to their src files ( #5912 )
2024-09-20 07:56:37 +00:00
Boshen
cbaeea6d02
refactor(minifier): clean up some tests ( #5910 )
2024-09-20 05:55:05 +00:00
Boshen
144611ef49
refactor(minifier): align ast pass names with closure compiler ( #5908 )
2024-09-20 05:20:07 +00:00