Commit graph

5436 commits

Author SHA1 Message Date
Boshen
4a8aec1605 feat(span)!: change SourceType::js to SourceType::cjs and SourceType::mjs (#5606) 2024-09-08 14:11:02 +00:00
overlookmotel
1c051ae9ae docs(traverse): correct code comment 2 (#5607)
Numbering UIDs skips 1 i.e. `_foo`, `_foo2`, `_foo3`, etc. Correct comment to reflect this.
2024-09-08 09:36:03 +00:00
overlookmotel
2e24a15075 docs(traverse): correct code comment (#5604)
`name_is_unique` originally searched through references, but it doesn't any more, so this comment is outdated.
2024-09-08 09:03:01 +00:00
overlookmotel
97e99bd167 style(traverse): remove excess line break (#5603) 2024-09-08 08:57:01 +00:00
Boshen
63a830e08c
chore(dprint): format toml files (#5599)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-08 14:26:16 +08:00
Boshen
2386d7fca2
chore(dprint): format yaml files (#5598) 2024-09-08 14:05:46 +08:00
Boshen
0571a37022
chore(justfile): add dprint to just init 2024-09-08 14:02:24 +08:00
Boshen
553262842c
refactor(span): put types and impl in the same mod file 2024-09-08 14:00:25 +08:00
renovate[bot]
69da677f00
chore(deps): update crate-ci/typos action to v1.24.5 (#5596)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [crate-ci/typos](https://redirect.github.com/crate-ci/typos) | action
| patch | `v1.24.3` -> `v1.24.5` |

---

### Release Notes

<details>
<summary>crate-ci/typos (crate-ci/typos)</summary>

###
[`v1.24.5`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.24.5)

[Compare
Source](https://redirect.github.com/crate-ci/typos/compare/v1.24.4...v1.24.5)

#### \[1.24.5] - 2024-09-04

##### Features

-   *(action)* Support windows

###
[`v1.24.4`](https://redirect.github.com/crate-ci/typos/releases/tag/v1.24.4)

[Compare
Source](https://redirect.github.com/crate-ci/typos/compare/v1.24.3...v1.24.4)

#### \[1.24.4] - 2024-09-03

##### Fixes

-   Offer a correction for `grather`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC41OS4yIiwidXBkYXRlZEluVmVyIjoiMzguNTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-08 05:52:04 +00:00
Boshen
955e83ec41
ci: add dprint to autofix (#5597) 2024-09-08 13:46:30 +08:00
Boshen
dc741e471f
chore: do not format napi generated files 2024-09-08 13:42:15 +08:00
Boshen
c370694716
chore: fix npm/oxlint/configuration_schema.json mismatch 2024-09-08 13:34:53 +08:00
Boshen
d00a1f6511
chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
Boshen
be63a2cafc
chore: add dprint 2024-09-08 13:24:58 +08:00
Boshen
2fb8c202e6
refactor(justfile): remove wasm-pack and cargo-llvm-cov from just init
They are rarely used.
2024-09-08 12:47:45 +08:00
DonIsaac
8e79f8d72d test(linter): add class method test cases for oxc/no-async-await (#5550)
Adds tests for class and object methods. Diagnostics for the former have incorrect spans.

```javascript
class Foo {
   // span covers `() {}`
  async foo() {}
}
```
2024-09-08 03:15:01 +00:00
DonIsaac
bac03e3b6c refactor(linter): make fields of LintServiceOptions private (#5593)
Re-creation of #5326
2024-09-08 03:10:02 +00:00
underfin
aba9194ebc
feat(napi/transform): export react refresh options (#5533)
Co-authored-by: Boshen <boshenc@gmail.com>
2024-09-08 08:42:17 +08:00
Brian Donovan
8c9179d58a
docs(linter): fix typos (#5591) 2024-09-07 18:14:38 +01:00
IWANABETHATGUY
2661d8b505 refactor(linter): jest prefer_strict_equal (#5588)
simplify code
2024-09-07 16:44:27 +00:00
Boshen
40d0149a50
chore: commit message must have a scope 2024-09-08 00:43:12 +08:00
Boshen
919d17fc5c fix(transform_conformance): only print semantic mismatch errors when output is correct (#5589)
closes #5166

Had to rerun for mismatch errors :-/
2024-09-07 16:32:53 +00:00
Boshen
24d6a47f8b feat(linter): implement eslint/no-invalid-regexp (#5443)
closes #611

@leaysgur Kicking of `no-invalid-regexp`, feel free to take over and claim the bounty on #611 😁

I can continue if you wanna work on other stuff (getting confused in prettier land ;-))
2024-09-07 14:09:33 +00:00
Boshen
2c3f3fe9e4 perf(linter): make jsx_key slightly faster (#5585) 2024-09-07 14:03:26 +00:00
Boshen
cd81d12624 perf(linter): add should_run to check path only once to nextjs/no_typos (#5584) 2024-09-07 13:03:23 +00:00
Boshen
3835189785
test(linter): add test case for no_unused_vars in 3b87ac4 2024-09-07 20:45:40 +08:00
Boshen
3b87ac48ce fix(linter): fix no_unused_vars panic when encountering unicode (#5582)
closes #4887
2024-09-07 12:37:51 +00:00
Boshen
5f275516eb test(linter): add a passing case to no_undef (#5580)
closes #2093
2024-09-07 11:08:26 +00:00
Boshen
1bc08e296e fix(coverage): parse babel unambiguously (#5579) 2024-09-07 10:49:00 +00:00
Boshen
43933912ce fix(coverage): parse typescript unambiguously (#5575) 2024-09-07 10:48:59 +00:00
Boshen
603817bef9 feat(oxc)!: add SourceType::Unambiguous; parse .js as unambiguous (#5557)
See https://babel.dev/docs/options#misc-options for background on `unambiguous`

Once `SourceType::Unambiguous` is parsed, it will correctly set the returned `Program::source_type` to either `module` or `script`.
2024-09-07 10:48:58 +00:00
IWANABETHATGUY
08d2b7d761 feat(oxc_wasm): add controlFlowDotString to oxc_wasm (#5571) 2024-09-07 10:41:00 +00:00
夕舞八弦
26d9235319
refactor: enable clippy::ref_as_ptr (#5577)
#5567 
`clippy::borrow_as_ptr` is also enabled in
`oxc_traverse/src/generated/walk.rs`.
2024-09-07 18:18:55 +08:00
rzvxa
c78a8507d1 refactor(ast_tools): only use type names to ignore fields in the DeriveContentHash. (#5573)
related to https://github.com/oxc-project/backlog/issues/107
2024-09-07 09:57:25 +00:00
rzvxa
db55fb0fce fix(ast_tools, ci): watch tasks/ast_tools instead of tasks/ast_codegen. (#5576)
I was so confused as to why the `AST Changes` step wasn't running at times. Turns out we weren't watching it at all😅

This means for a duration of time we weren't running the `AST Changes` step on PRs that edited only `ast_tools` that didn't update any side-effects.
2024-09-07 09:41:18 +00:00
rzvxa
7a6b64c3f0 refactor(ast_tools): remove unsafe code from logger. (#5574)
https://github.com/oxc-project/oxc/pull/5519#discussion_r1747097404
2024-09-07 09:03:26 +00:00
Boshen
7f7ed7b4dc
ci: add custom pnpm action (#5572) 2024-09-07 16:13:19 +08:00
Boshen
c796b77fa2
ci: use pnpm publish 2024-09-07 13:19:52 +08:00
Boshen
f5f3d08a51
build: use pnpm catalog 2024-09-07 13:15:43 +08:00
Boshen
f7912ad6c0
chore: remove unused pnpm-lock.yaml 2024-09-07 13:11:34 +08:00
Boshen
c4f169fa46
ci: fix publish vscode 2024-09-07 13:11:01 +08:00
oxc-bot
16009c09fd
release: oxlint v0.9.3 (#5569)
## [0.9.3] - 2024-09-07

### Features

- be3a432 linter: Implement typescript/no-magic-numbers (#4745)
(Alexander S.)
- 09aa86d linter/eslint: Implement `sort-vars` rule (#5430) (Jelle van
der Waa)
- 2ec2f7d linter/eslint: Implement no-alert (#5535) (Edwin Lim)
- a786acf linter/import: Add no-dynamic-require rule (#5389) (Jelle van
der Waa)
- 4473779 linter/node: Implement no-exports-assign (#5370) (dalaoshu)
- b846432 linter/oxc: Add fixer for `erasing-op` (#5377) (camc314)
- aff2c71 linter/react: Implement `self-closing-comp` (#5415) (Jelle van
der Waa)

### Bug Fixes

- 0df1d9d ast, codegen, linter: Panics in fixers. (#5431) (rzvxa)
- cdd1a91 linter: Typescript/no-magic-numbers: remove double minus for
reporting negative bigint numbers (#5565) (Alexander S.)
- ff88c1f linter: Don't mark binding rest elements as unused in TS
function overloads (#5470) (Cam McHenry)
- 088733b linter: Handle loops in `getter-return` rule (#5517) (Cam
McHenry)
- 82c0a16 linter: `tree_shaking/no_side_effects_in_initialization`
handle JSX correctly (#5450) (overlookmotel)
- 6285a02 linter: `eslint/radix` rule correctly check for unbound
symbols (#5446) (overlookmotel)
- c8ab353 linter/tree-shaking: Align JSXMemberExpression's report
(#5548) (mysteryven)
- 5187f38 linter/tree-shaking: Detect the correct export symbol
resolution (#5467) (mysteryven)

### Performance

- 8170954 linter/react: Add should_run conditions for react rules
(#5402) (Jelle van der Waa)

### Documentation

- a540215 linter: Update docs `Examples` for linter rules (#5513)
(dalaoshu)
- 7414190 linter: Update docs `Example` for linter rules (#5479)
(heygsc)

### Refactor

- 0ac420d linter: Use meaningful names for diagnostic parameters (#5564)
(Don Isaac)
- 81a394d linter: Deduplicate code in `oxc/no-async-await` (#5549)
(DonIsaac)
- 979c16c linter: Reduce nested if statements in
eslint/no_this_before_super (#5485) (IWANABETHATGUY)
- 1d3e973 linter: Simplify `eslint/radix` rule (#5445) (overlookmotel)
- fdb8857 linter: Use "parsed pattern" in `no_div_regex` rule. (#5417)
(rzvxa)
- 2ccbd93 linter: `react/jsx_no_undef` rule `get_member_ident` do not
return Option (#5411) (overlookmotel)

### Styling

- 2a43fa4 linter: Introduce the writing style from PR #5491 and reduce
the if nesting (#5512) (dalaoshu)- d8b29e7 Add trailing line breaks to
JSON files (#5544) (overlookmotel)- 694f032 Add trailing line breaks to
`package.json` files (#5542) (overlookmotel)

### Testing

- 340b535 linter/no-unused-vars: Arrow functions in tagged templates
(#5510) (Don Isaac)
- af69393 linter/no-useless-spread: Ensure spreads on identifiers pass
(#5561) (DonIsaac)- dc92489 Add trailing line breaks to conformance
fixtures (#5541) (overlookmotel)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-09-07 12:28:46 +08:00
overlookmotel
505d06446b fix(transformer): JSX transform delete references for JSXClosingElements (#5560)
JSX transform delete old references which were used in `JSXClosingElement` before transformation.
2024-09-07 03:51:36 +00:00
overlookmotel
17226dd5f8 feat(traverse): add methods for deleting references (#5559)
Add `TraverseCtx::delete_reference` and `TraverseCtx::delete_reference_for_identifier` methods for deleting references.

These methods can't go on `SymbolTable` as they need access to both `ScopeTree` and `SymbolTable`, and they can't go on `Semantic` as we need them in transformer where we don't have a complete `Semantic`.
2024-09-07 03:51:35 +00:00
overlookmotel
642295c15a feat(semantic): add SymbolTable::delete_resolved_reference method (#5558)
Add `SymbolTable::delete_resolved_reference` method to delete a reference for a symbol.
2024-09-07 03:51:35 +00:00
overlookmotel
2da5ad19be feat(ast): add JSXElementName::get_identifier method (#5556)
Add `get_identifier` method for `JSXElementName`, `JSXMemberExpression` and `JSXMemberExpressionObject`, to get root object `IdentifierReference`. i.e. `Foo` in `<Foo>` or `<Foo.bar>`.
2024-09-07 03:51:34 +00:00
Alexander S.
cdd1a91754
fix(linter): typescript/no-magic-numbers: remove double minus for reporting negative bigint numbers (#5565)
@DonIsaac small bug I found after 10x review

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-07 11:48:24 +08:00
Don Isaac
0ac420d6f9
refactor(linter): use meaningful names for diagnostic parameters (#5564)
Also add `pending` fix labels to many rules.
2024-09-06 18:14:56 -04:00
Alexander S.
be3a432106
feat(linter): implement typescript/no-magic-numbers (#4745)
Linter rule: https://eslint.org/docs/latest/rules/no-magic-numbers
and: https://typescript-eslint.io/rules/no-magic-numbers/

---------

Co-authored-by: Don Isaac <donald.isaac@gmail.com>
2024-09-06 20:52:13 +01:00
DonIsaac
af69393a1c test(linter/no-useless-spread): ensure spreads on identifiers pass (#5561)
Closes #5405
2024-09-06 19:03:16 +00:00