DonIsaac
b1af73db81
fix(semantic): do not create a global symbol for declare global {} ( #6040 )
...
Re-creation of #6004 to unblock it from down-stack PRs. @Boshen has already reviewed the previous PR and determined this to be correct behavior.
2024-09-25 08:46:00 +00:00
DonIsaac
f866781f49
feat(semantic): check for type annotations on left side of for..in and for..of iterators ( #6043 )
2024-09-25 02:51:17 +00:00
DonIsaac
8b2e9aa744
feat(semantic): check for JSDoc types in TS type annotations ( #6042 )
...
Closes #5982
2024-09-25 02:35:59 +00:00
Cam McHenry
65d8f9e8fe
perf(linter, ast-tools, coverage): Use FxHashSet instead of std::collections::HashSet ( #6001 )
2024-09-24 19:29:08 +08:00
Boshen
28da77195b
feat(transformer): do not transform ** with bigint literals ( #6023 )
...
part of #5822
They will produce runtime errors.
2024-09-24 10:33:02 +00:00
Boshen
0658576718
fix(paresr): do not report missing initializer error in ambient context ( #6020 )
...
closes #5958
2024-09-24 09:04:09 +00:00
Boshen
c8682e9fcb
fix(semantic,codegen,transformer): handle definite ! operator in variable declarator ( #6019 )
...
closes #5999
2024-09-24 08:32:05 +00:00
Boshen
5c323a2105
feat(minifier): loop compressor passes ( #6013 )
2024-09-24 03:09:35 +00:00
camchenry
02d5637dbc
perf(ast-tools): use FxHashMap over std::collections::HashMap ( #5997 )
2024-09-23 18:28:54 +00:00
camchenry
b240b42eb9
fix(rulegen): handle raw string literals correctly ( #5991 )
...
Currently, we are not handling raw string literals correctly and just translating them as normal Rust string literals, which causes compile errors and also misses some cases. This PR updates it so that we detect usage of `String.raw` and translate it as a Rust raw string literal.
Before:
<img width="867" alt="Screenshot 2024-09-23 at 10 02 21 AM" src="https://github.com/user-attachments/assets/7c042537-d6c2-4141-a119-0ed846bce59d ">
After:
<img width="832" alt="Screenshot 2024-09-23 at 10 01 27 AM" src="https://github.com/user-attachments/assets/759f6647-a675-42eb-b39d-c0e88f689536 ">
2024-09-23 16:24:19 +00:00
Boshen
0a2f68756f
refactor(minifier): move dce conditional expression to RemoveDeadCode ( #5971 )
...
This is aligned to closure compiler
2024-09-23 10:22:00 +00:00
DonIsaac
d24985ed51
feat(linter): add oxc-security/api-keys ( #5906 )
...
## What This PR does
Adds a new `oxc-security/api-key` rule that scans for hard-coded API keys.
It is broken up into "secret rules", where each one is responsible for finding a different kind of key. It is architecturally identical to how lint rules themselves. This PR also includes the first of these rules, for AWS access key IDs.
Logic and rules are based on [keyhunter](https://github.com/Donisaac/keyhunter ). I've licensed that repo under GNU GPLv3, but it's my code and I can do what I want with it 😈 (read: I'm fine with it being MIT for oxc).
This PR is a complete feature in its own right, but does not represent the end of this work. See https://github.com/oxc-project/backlog/issues/116 to track overall progress.
2024-09-22 22:39:56 +00:00
DonIsaac
74d8714d5a
feat(semantic): add help message for invalid let x?: number ( #5969 )
2024-09-22 15:59:49 +00:00
Boshen
612f638bcd
chore: change just c to run cargo conformance
2024-09-22 23:50:30 +08: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
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
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
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
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
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
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
camchenry
f4fac0f488
refactor(ast): remove .iter() where not needed ( #5904 )
...
this is just an experiment, I noticed while profiling these code paths came up a number of times:
<img width="1077" alt="Screenshot 2024-09-19 at 8 32 51 PM" src="https://github.com/user-attachments/assets/d0f4d703-c456-4344-8f57-81f0b3f491a0 ">
2024-09-20 02:41:49 +00:00
Alexander S.
65c337a071
feat(prettier): improve ts compatibility ( #5900 )
2024-09-20 10:40:31 +08:00
overlookmotel
4d5c4f6cad
fix(transformer): fix reference flags in logical assignment operator transform ( #5903 )
2024-09-20 01:26:55 +00:00
overlookmotel
d335a6760e
fix(transformer): fix references in logical assignment operator transform ( #5896 )
...
Re-use existing reference, rather than creating a new one.
2024-09-20 01:26:53 +00:00
overlookmotel
cab441c572
test(transformer): fix JSX test options ( #5895 )
...
Fix a test by setting correct options.
2024-09-20 01:26:52 +00:00
overlookmotel
9758c1a5cc
fix(transformer): JSX source: add var _jsxFileName statement ( #5894 )
...
Fix JSX source transform when run alone without main JSX transform.
The added test case is same as one of Babel's exec test cases, but the exec test fails due to `transformAsync` not being present.
2024-09-20 01:26:52 +00:00
Boshen
84a5816d03
feat(isolated_declarations): add stripInternal ( #5878 )
...
closes #3906
closes #5687
closes #3958
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-09-19 23:14:47 +08:00
Boshen
db4f16a98f
refactor(semantic): call with_trivias before build_with_jsdoc ( #5875 )
2024-09-19 04:12:57 +00:00
Alexander S.
4e37d18b2e
feat(prettier): start supporting tsx syntax ( #5866 )
...
Look at first: #5864
the only merge conflict for this PR should then be the ts snap file.
If you want, you can also skip the other PR and merge this one directly
:)
2024-09-19 09:40:07 +08:00
overlookmotel
0c8733df23
test(transformer): clean up identation in test fixtures ( #5863 )
...
Not sure how added up with mix of tabs and spaces.
2024-09-18 15:19:59 +00:00
overlookmotel
c96b712f6b
refactor(syntax)!: remove SymbolFlags::ArrowFunction ( #5857 )
...
`SymbolFlags::ArrowFunction` is an oddity, as whether a symbol is an arrow function is not statically knowable. In the following cases, `f` symbol did not have `ArrowFunction` flag set:
```js
const {f} = {f: () => {}};
```
```js
let f = 123;
f = () => {};
```
`SymbolFlags::ArrowFunction` is therefore not particularly useful, and possibly misleading. Having it complicates the transformer, and it's not used anywhere in Oxc.
This PR removes it.
2024-09-18 14:03:03 +00:00
overlookmotel
2e93548816
ci(transformer): enable arrow function transform in transformer benchmark ( #5851 )
2024-09-18 11:08:27 +00:00
overlookmotel
ef8dcc9d4d
test(transformer): more tests for arrow function transform ( #5849 )
2024-09-18 09:46:58 +00:00
overlookmotel
49ee1dcff2
fix(transformer): arrow function transform handle this in arrow function in class static block ( #5848 )
...
Class static blocks also hold a `this` binding.
2024-09-18 09:46:57 +00:00
Alexander S.
31da9bce3f
feat(prettier): class improvements part 2 ( #5838 )
2024-09-18 11:07:51 +08:00
Alexander S.
c6d97e9366
feat(prettier): improve ts class output ( #5835 )
...
please look first at #5834 :)
2024-09-17 17:33:35 -04:00
Alexander S.
6d9ccdda92
feat(prettier): support TSMappedType ( #5834 )
2024-09-17 16:25:51 -04:00
Boshen
5901d2a0f1
fix(codegen): various spacing issues ( #5820 )
2024-09-17 09:03:28 +00:00
Alexander S.
18e4ac22ad
feat(prettier): improve TSInterfaceDeclaration ( #5817 )
...
last one for today :)
---------
Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-09-17 14:41:33 +08:00
DonIsaac
a438743191
refactor(linter): move OxlintConfig to Oxlintrc ( #5707 )
2024-09-17 05:15:37 +00:00