Commit graph

289 commits

Author SHA1 Message Date
Boshen
2ba18e073c
fix(benchmark): use different data sets for benchmark and minifier test 2023-09-02 20:56:45 +08:00
Boshen
56aaf31fb1
refactor(benchmark): use codspeed for all benchmarks (#839) 2023-09-02 20:35:48 +08:00
dependabot[bot]
8caf77300b
chore(deps): bump the dependencies group with 10 updates (#831) 2023-09-01 13:56:12 +08:00
Boshen
75af639d4a
chore(rust): remove unicode support from regex for smaller binary size (#823) 2023-09-01 12:42:58 +08:00
Boshen
00ed939cbc
feat(coverage): init git submodules if they are empty (#808)
closes #805
2023-08-29 13:35:32 +08:00
EliLichtblau
6a9d57061c
TSTypeName change identifer name to identifier reference (#804)
When initially written types were not in the symbol table. Now that
types are in the symbol table it makes sense given
```ts
type A = 1
type B = A
```
that you can get to the symbol id for for A from type B = A.

Please correct me if I'm wrong about how I implemented this. I also
verified that occurrence (I believe this is the correct word) behaves
how I would expect.

```ts
type RecursiveType = string | {[x: string]: RecursiveType}
```
Does populate a reference.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2023-08-28 11:42:21 +08:00
阿良仔
0fef2d317a
chore: proxy detection for all tasks (#801)
related PR: #740
2023-08-27 17:24:28 +08:00
Boshen
24c56a8b53
Revert "fix(tasks): use the current working directory if project rood is not found"
This reverts commit 971f597036.
2023-08-25 12:56:12 +08:00
Boshen
971f597036
fix(tasks): use the current working directory if project rood is not found 2023-08-25 12:27:55 +08:00
Boshen
2f0ff28f47
Rust 1.72.0 (#784) 2023-08-24 23:02:19 +08:00
Boshen
b2db6f7ef1
chore(benchmark): remove the measurement_time 2023-08-24 14:31:19 +08:00
EYHN
1781318f44
fix(rulegen): handle join('\n') style test code (#763)
# 1. Support join('\n')

I'm trying to run `just new-rule no-unexpected-multiline`, It found
rulegen not support test code pieced together using `array.json("\n")`,
like

```js
{
  code: [
      "const x = aaaa<",
      "  test",
      ">/*",
      "test",
      "*/`foo`"
  ].join("\n")
}
```

I found this kind of code widely in the eslint codebase, so it will be
great if we can support this.


![](https://github.com/web-infra-dev/oxc/assets/13579374/195ed4ba-1efb-4c3f-9e49-0ebdb5527506)

# 2. remove extra `,`

And I found when meet unsupported code, rulegen will generate an extra
`,`, so I added a filter at


45cf5fc3da/tasks/rulegen/src/main.rs (L363)

# 3. handle escape string

The escape `/` and trailing `/` in the javascript code will break
rulegen. example: `"\"abc\\\n(123)\""`

I made the following changes:

```diff
- test_code.replace('\n', "\n\t\t\t")
+ test_code.replace('\n', "\n\t\t\t").replace('\\', "\\\\").replace('\"', "\\\"")
```
2023-08-19 23:19:51 +08:00
Yunfei He
e7c2313817
feat(ast): add SymbolId and ReferenceId (#755)
Closes #510
2023-08-19 18:09:47 +08:00
阿良仔
5a73f0e1b5
feat(formatter): add EndOfLine (#747) 2023-08-17 19:04:23 +08:00
Kei Sakamoto
2fde2255f9
feat(linter): implement eslint-plugin-unicorn/no-instanceof-array (#752)
implement
[eslint-plugin-unicorn/no-instanceof-array](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-instanceof-array.md).
Related issue: #684
2023-08-17 17:08:03 +08:00
Devin-Yeung
c0b06a5700
feat(rulegen): automatically detect proxy (#740)
detect `HTTP_PROXY/HTTPS_PROXY/ALL_PROXY` environments automatically,
since visiting https://raw.githubusercontent.com sometimes need proxy,
upstream PR
[algesten/ureq#649](https://github.com/algesten/ureq/pull/649)
2023-08-15 13:32:09 +08:00
Sg
fae9a7c28b
feat(formatter): add "Quote Props" option (#652)
For #634. 



This PR prepares for the fix of #634, adding an option to formatter to
control whether to quote object properties. After this PR, the rulegen
script can use oxc-formatter to output JSON-like object literal.

The `Quote Props` option is from Prettier. For detail:
https://prettier.io/docs/en/options.html#quote-props

> Change when properties in objects are quoted.
> Valid options:
> "as-needed" - Only add quotes around object properties where required.
> "consistent" - If at least one property in an object requires quotes,
quote all properties.
> "preserve" - Respect the input use of quotes in object properties.

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2023-08-15 11:40:38 +08:00
Devin-Yeung
a041fbd96b
fix(rulegen): import thiserror correctly (#735)
close #734
2023-08-14 10:20:25 +08:00
Wenzhe Wang
0c645170a8
feat(linter): valid-describe-callback(eslint-plugin-jest) (#706) 2023-08-12 16:47:49 +08:00
Boshen
2f48bdf26f
fix(parser,semantic): make semantic own Trivias (#711)
closes #708

Making the parser return Rc<Trivias> is not a good API, and ideally
`Semantic` should just own `Trivias` so it can process or mutate it.
2023-08-10 15:30:32 +08:00
Alexandr Metreniuc
f8358a148a
feat(linter): @typescript-eslint/no-namespace (#703) 2023-08-09 23:02:24 +08:00
Wenzhe Wang
de110828cc
fix(task): update taggedTemplateExpression template (#676)
For generate test cases like:

```js
{
    code: dedent`
      afterAll(async (done) => {
        await myAsyncTask();
        done();
      });
    `,
    errors: [{ messageId: 'useAwaitInsteadOfCallback', line: 1, column: 17 }],
},
```
2023-08-02 11:46:15 +08:00
Don Isaac
e7d8d4ba46
feat(linter): enable module record builder 2023-08-02 11:44:27 +08:00
EliLichtblau
5e54bd0537
Adding types to the symbol table - consistent export type sample rule implemented (#667)
Fixes 11 TS conformance tests and 18 babel tests.

Adds types to the symbol table functionally conformant to TS behavior
but symbol flags implemented slightly differently.

Symbol redeclaration check is also not entirely conformant but fixing
this seems like a separate PR.

For testing purposes - consistent-export-type was also implemented
(WIP).
2023-07-31 12:33:47 +08:00
Matthew "strager" Glazar
ad00720d75 refactor: avoid unstable let_chains
The let_chains Rust feature is unstable, preventing Oxc from using a
stable Rust compiler. Refactor the code to avoid let_chains.
2023-07-27 09:44:57 +08:00
Boshen
a55ba5941c
refactor(benchmark): use iter_with_large_drop (#587)
This also removes `black_box`, since criterion always black boxes the values for us
2023-07-23 11:35:16 +08:00
Boshen
2330099a34
deps(rust): bump dependencies 2023-07-21 11:38:12 +08:00
Boshen
38e11956be
chore(rust): rust version 1.71.0 nightly 2023-07-13 23:10:10 +08:00
Don Isaac
fd899be4a9
feat(minifier): compress undefined variable declarations (#532) 2023-07-10 10:33:42 +08:00
Boshen
e25f6e2dd4
chore(rust): rust cargo fmt and fix clippy warnings 2023-07-04 15:41:30 +08:00
Wenzhe Wang
a0eba67ad9
feat(tasks): support init jest lint rule (#513) 2023-07-04 14:53:29 +08:00
Boshen
c5402c1cae
feat(linter): implement no-import-assign (nursery) 2023-07-01 11:20:31 +08:00
Boshen
06764f8574
chore(tasks): add swc-7187 test case 2023-06-30 16:41:52 +08:00
Boshen
9ca942ab2e
fix(tasks): save eslint files to the eslint/ directory 2023-06-28 20:48:51 +08:00
Wenzhe Wang
a32320646d
feat(minfier): try fold and or operator (#472) 2023-06-28 14:58:55 +08:00
阿良仔
1182985bb0
feat(minifier): implement try_fold_shift (#478)
* feat: implement `try_fold_shift`

* update minsize
2023-06-27 04:44:23 +08:00
Wenzhe Wang
cb94937ba6
feat(minifier): fold string string comparison (#471) 2023-06-26 22:37:50 +08:00
Wenzhe Wang
b8f5e3ad92
feat(minifier): try reduce void (#457) 2023-06-23 00:10:46 +08:00
Boshen
925cee20c1
feat(parser): parse TypeScript this function parameter (#464) 2023-06-20 21:56:28 +08:00
Boshen
d30735677b
refactor(semantic): merge semantic2 crate into semantic crate (#460) 2023-06-19 20:20:59 +08:00
Boshen
0d5db3d2f7
feat(benchmark): add bench semantic 2023-06-19 18:30:30 +08:00
Wenzhe Wang
5d10f96051
feat(minifier): try fold unary expression (#430) 2023-06-16 00:08:14 +08:00
u9g
db624da84d
Reimplement more of the closure var rename step (#447)
Co-authored-by: Boshen <boshenc@gmail.com>

closes #442
2023-06-15 23:37:04 +08:00
Boshen
bad8bfcf16
ci: run conformance tests and bail if there are outdated snapshots (#444) 2023-06-14 21:44:10 +08:00
Boshen
a79480b078
feat(minifier): separate mangler pass (#439) 2023-06-14 10:46:13 +08:00
Carter Snook
c0726e444f
feat(lexer): use linear lexing on WASM (#436)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-06-13 15:18:02 +08:00
Boshen
243e48ac09
fix(coverage): make ignoring "literals/regexp" work on Windows 2023-06-13 14:31:59 +08:00
Carter Snook
a518bcbb3b
fix(tasks/rulegen): use correct Span import (#433) 2023-06-12 11:09:02 +08:00
Boshen
5c91fd54e3
feat(minifier): print [-In] Context (#428) 2023-06-11 16:44:48 +08:00
Boshen
b26900f8c4
fix(rulegen): fix ureq not working without tls 2023-06-09 12:43:41 +08:00