Commit graph

3160 commits

Author SHA1 Message Date
underfin
8662f4f613
feat(sourcemap): add x_google_ignoreList (#2928) 2024-04-09 20:55:04 +08:00
underfin
5cb3991b67
feat(sourcemap): add sourceRoot (#2926) 2024-04-09 15:42:23 +08:00
Boshen
3e5530805d
Update issue templates 2024-04-09 14:54:46 +08:00
Boshen
0bada0bc93
Update issue templates (#2927) 2024-04-09 14:52:49 +08:00
Kalven Schraut
6eba02f472
fix(cli): if format is json do not print summary information (#2899) (#2925)
this allows the ability to redirect the stdout to so can create a valid
json file

this also matches with eslint's format option

closes #2899
2024-04-09 14:26:10 +08:00
Boshen
d65eab3b8b
feat(transformer): add react preset (#2921) 2024-04-09 12:39:33 +08:00
John Daly
5abbb0cada
fix(linter): import/no-cycle ignore type-only imports (#2924)
A fix for the work done in: https://github.com/oxc-project/oxc/pull/2905

The existing code checks if _all_ import entries in a ModuleRecord are
type-only, when determining if the ModuleRecord should be skipped when
checking for cycles. This is incorrect.

To demonstrate the problem: Running the `no-cycles` rule, with
`ignoreTypes` enabled, on the following example code will cause a cycle
to be reported between Module A and Module B

```typescript
// Module A
import type { Bar } from './b';
import { Baz } from './c'

// Module B
import type { Foo } from './a';

// Module C
export const Baz = 'baz';
```

The reason this is happening is because the import to Module C in Module
A is causing the `was_imported_as_type` variable to evaluate to `false`,
since the Module C import is not type-only.

What we actually want to do is skip visiting Module B entirely, by
checking if its import request from Module A is type-only.

This PR fixes the logic so that only the import entries for the next
ModuleRecord are considered when determining `was_imported_as_type`.
2024-04-09 12:38:15 +08:00
Wang Wenzhe
990eda61d7
feat(linter/tree-shaking): support part BinaryExpression (#2922) 2024-04-09 12:33:51 +08:00
Boshen
659e891615
ci: skip benchmark-napi because it is flaky (#2918)
The flakiness and all the noise produced by it is starting to hurt
maintenance because I can no longer tell if main or PR is failing
properly :-(

codspeed doesn't have the feature "let it run but don't report as error"
or "different thresholds on different benchmarks"
2024-04-08 19:21:57 +08:00
Boshen
79837bd410
Release @oxc-parser/wasm v0.1.0 2024-04-08 15:47:51 +08:00
Boshen
ab26099281
Publish @oxc-parser/wasm with web and node builds (#2916)
Co-authored-by: Saeid Zareie <saeid.za98@gmail.com>
2024-04-08 15:47:02 +08:00
Boshen
d43d404d61
fix: update lock file 2024-04-08 11:17:26 +08:00
Boshen
09452659e2
Release crates v0.12.2 2024-04-08 11:13:13 +08:00
Boshen
7066d55153
Release oxlint and vscode extension v0.2.16 2024-04-08 11:03:41 +08:00
renovate[bot]
cd6f4f1938
chore(deps): lock file maintenance rust crates (#2913) 2024-04-08 02:49:53 +00:00
renovate[bot]
1847329b43
chore(deps): lock file maintenance vscode npm packages (#2914) 2024-04-08 10:27:00 +08:00
Yuji Sugiura
a0fe504869
fix(tasks/lint_rules): Fix plugin-jest rules collector (#2915)
Fixes umbrella issue for
[`plugin-jest`](https://github.com/oxc-project/oxc/issues/492) to render
recommended rules section properly.

- - -

Along with sticking legacy ESLint.
Since `eslint@latest` is now v9 and it removed `Linter#defineRule()` and
`Linter#getRules()` which we use heavily...
2024-04-08 10:22:56 +08:00
underfin
96f02e6e21
feat(sourcemap): optional JSONSourceMap fileds (#2910)
Support optional JSONSourceMap fileds to support js side complex typing.
2024-04-07 23:32:12 +08:00
underfin
d87cf179a6
feat(sourcemap): add methods to mutate SourceMap (#2909) 2024-04-07 23:30:16 +08:00
underfin
74aca1c937
feat(sourcemap): add SourceMapBuilder file (#2908) 2024-04-07 23:29:25 +08:00
John Daly
6de1b77b1b
feat(linter/import): Add ignoreTypes option for the import/no-cycle rule (#2905)
Fixes: https://github.com/oxc-project/oxc/issues/2904

Adds an `ignoreTypes` option for the `import/no-cycle` rule, to ignore
imports that don't have any runtime effect.
2024-04-07 05:07:45 +00:00
Kalven Schraut
79e2c95e2d
fix(linter): handle self closing script tags in astro partial loader (#2017) (#2907)
Added tests to figure out what the problem from the issue was and
realize the self closing tag was not expected. Added code to handle this
case.

I am not that familiar with astro to know how common self closing script
tags are, their docs seem to use an opening and closing one for inline
scripts
https://docs.astro.build/en/guides/client-side-scripts/#load-external-scripts
2024-04-07 13:02:09 +08:00
Kalven Schraut
1cd5e7511b
fix(linter): svelte partial loader handle generics (#2875) (#2906)
While looking into this, I knew vue would have similar problems. Which
then led me to realize the generic case was handled already so I tried
abstract out the function so both the vue and svelte partial loaders
could reuse the code. Finally added some svelte test cases to prove this
resolved the issue.

I am a bit new to rust so if there was a better way to reuse the
find_script_closing_angle function open to suggestions.
2024-04-07 13:00:55 +08:00
Wang Wenzhe
65f38dc0db
fix(tasks/rulegen): read quasi in TaggedTemplateExpression (#2903) 2024-04-07 10:41:14 +08:00
Wang Wenzhe
b053d54b6f
feat(linter/tree-shaking): support try-catch and AwaitExpression (#2902) 2024-04-06 14:02:42 +08:00
Wang Wenzhe
59869d0a96
feat(linter/tree-shaking): check this in different environment (#2901) 2024-04-06 13:58:47 +08:00
Denis Gonchar
acb6eb2573
feat(linter): @typescript-eslint/prefer-for-of (#2789) 2024-04-06 13:31:31 +08:00
Don Isaac
1ea24ea0a7
fix(semantic): symbols inside functions and classes incorrectly flagged as exported (#2896)
# What This PR Does

Symbols declared inside exported functions and classes were being
incorrectly flagged with `SymbolFlags::Export`.

For example,
```ts
export function foo<T>(a: T) {
  let b = String(a)
  return b
}
```
`T`, `a`, and `b` were all flagged as exported.

## Further Work
It doesn't seem like exported enums and interfaces are being included in
`ModuleRecord`. Am I looking in the wrong place, or are they actually
missing?
2024-04-05 23:01:27 +08:00
Yuji Sugiura
aa63b6491f
feat(linter): Implement jsdoc/check-access (#2642)
Part of #1170, Finally... 🗻 

Some preparation PRs may be needed in advance.

- [x] settings.jsdoc #2706 
- [x] new struct design #2765
- [x] handle `Span` for diagnostics #2815

Implement plugin itself.

-
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/check-access.md
-
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/src/rules/checkAccess.js

I'll send a PR to make this plugin public after confirming that a few
more rules can be implemented without any problems.
2024-04-04 22:36:39 +08:00
Yuji Sugiura
6823482ad6
feat(linter): Implement jsdoc/empty-tags (#2893)
Part of #1170 

-
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/empty-tags.md
-
https://github.com/gajus/eslint-plugin-jsdoc/blob/main/src/rules/emptyTags.js
2024-04-04 10:33:33 +08:00
Boshen
fb2ebf462e
chore: fix clippy on unsafe comment 2024-04-03 19:57:21 +08:00
Boshen
feb3c90098
chore(parser): allow unsafe in examples 2024-04-03 19:40:02 +08:00
Boshen
366a7fb0d4
Release crates v0.11.2 2024-04-03 19:36:54 +08:00
Boshen
504698ab4a
chore: guard against unsafe code as much as possible. 2024-04-03 19:35:07 +08:00
underfin
ef4b898be8
chore: avoid unsafe code search original name (#2895)
close https://github.com/rolldown/rolldown/issues/716

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-04-03 11:34:21 +00:00
Boshen
54f7cd3978
Release crates v0.11.1 2024-04-03 16:57:52 +08:00
Boshen
a5196be341
chore: Rust v1.77.1 2024-04-03 16:50:29 +08:00
Boshen
ae4f474bab
ci: run cargo check with --all-features 2024-04-03 16:43:50 +08:00
underfin
114f68ea7c
refactor(codegen): make codegen sourcemap builder clearer (#2894)
Avoid `enable_sourcemap` appear multiply times.
2024-04-03 15:07:19 +08:00
cinchen
7bc638ee7d
feat(linter): eslint-plugin-jest/prefer-mock-promise-sorthand (#2864)
part of #492 

Rule Detail:
[link](https://github.com/jest-community/eslint-plugin-jest/blob/main/src/rules/prefer-mock-promise-shorthand.ts)
2024-04-03 12:17:34 +08:00
underfin
28fae2e80a
fix(sourcemap): using serde_json::to_string to quote sourcemap string (#2889) 2024-04-03 12:14:45 +08:00
Boshen
21a5e4433f
fix(transformer): add serde "derive" feature to fix compile error 2024-04-03 11:56:27 +08:00
underfin
64c4b825f1
chore: improve sourcemap visualizer (#2886)
The pr intend to improve `SourcemapVisualizer` log mapping.

- add the mapping for last token to final position of source
- fix token mapping
2024-04-03 10:45:00 +08:00
Wang Wenzhe
ce34829521
feat(linter/tree-shaking): support ThisExpression and NewExpression (#2890) 2024-04-03 10:43:09 +08:00
Don Isaac
d3eb1c3318
fix(semantic): flag function expressions with SymbolFlags::Function (#2891)
# What This PR Does

Consider the following code snippet

```js
const x = function y () {{
```

`y` will now be flagged with `SymbolFlags::Function`. This follow's
tsc's behavior.

- [Example in OXC
Playground](https://oxc-project.github.io/oxc/playground/?code=3YCAAICagICAgICAgICxG0qZRraXZOpcCHVsSRwDq2kRR0HprsTfRRT5WMw%2Ff2epoIA%3D)
- [Example in TypeScript AST
Viewer](https://ts-ast-viewer.com/#code/MYewdgzgLgBAHjAvDAZgVzMKBLcMCeAFAJQwDeAvgFBA)
2024-04-03 10:42:11 +08:00
Boshen
93897c530c
chore: bump syn to v2 (#2888) 2024-04-02 20:57:09 +08:00
Boshen
c767a2ede0
ci: fix ecosystem-ci build 2024-04-02 17:47:05 +08:00
Boshen
d63127d009
chore: only build the allocators in release mode because they are slow to build (60s) 2024-04-02 17:39:01 +08:00
Boshen
a0532adc65
chore: bump criterion2, which removes clap and 10s compile time 2024-04-02 16:48:40 +08:00
Boshen
4b28d46fc4
chore: fix typos by ignoring no_unknown_property.rs 2024-04-02 16:27:38 +08:00