Commit graph

5459 commits

Author SHA1 Message Date
Boshen
508cbeafd5
chore(justfile): add just watch-oxlint 2024-09-09 16:57:51 +08:00
Boshen
6dcaae5cd8 chore(linter): move typescript/no-magic-numbers to eslint/no-magic-numbers (#5640)
closes #5614
2024-09-09 08:53:52 +00:00
leaysgur
41582ea00c fix(regular_expression): Improve RegExp to_string() results (#5635)
Hopefully fixes #5487

- `/^([a-zA-Z]+:)?[\p{L}0-9@/.\-_\\]+$/u`
- e3bc0ddcba/packages/cli-tools/src/launchEditor.ts (L53-L57)
2024-09-09 08:17:55 +00:00
heygsc
e3ae5dbb02
perf(linter): use cow_to_ascii_lowercase/uppercase (#5637)
part of #5586 

In addition, can a similar situation in the
[formatter](https://github.com/oxc-project/oxc/blob/main/crates/oxc_prettier/src/format/mod.rs#L1406-L1409)
be handled in this way?
2024-09-09 16:13:53 +08:00
DonIsaac
0b3c1d72a3 refactor(linter): start internal/external split of OxlintConfig (#5595)
Re-creation of #5140
2024-09-09 07:17:51 +00:00
overlookmotel
89bdf5536f refactor(linter): inline Rule trait default methods (#5619)
Hopefully compiler is already inlining these trivial/empty methods, but mark them `#[inline]` to make sure.
2024-09-09 07:13:55 +00:00
heygsc
a0370bf506
perf(linter): use cow_utils in no_script_url (#5633)
part of #5586 

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-09 15:06:50 +08:00
DonIsaac
023c1607b0 feat(linter): impl Serialize for OxlintConfig (#5594)
Re-creation of #5331
2024-09-09 05:13:19 +00:00
leaysgur
28aad281b6 fix(regular_expression): Handle - in /[\-]/u as escaped character (#5631)
Fixes #5487
2024-09-09 04:14:17 +00:00
DonIsaac
af6d240559 fix(linter): panic in consistent-function-scoping (#5613)
Closes #5608
2024-09-09 01:21:49 +00:00
overlookmotel
d22a9b72e0 refactor(semantic): SymbolTable::is_empty use is_empty (#5622)
Nit. `is_empty()` is sometimes more performant than `len() == 0`.
2024-09-09 01:07:34 +00:00
overlookmotel
1fa3e5687a refactor(semantic)!: rename SymbolTable::iter to symbol_ids (#5621)
`symbol_ids` is a more descriptive name.
2024-09-09 01:07:33 +00:00
overlookmotel
96a15526aa refactor(semantic)!: remove SymbolTable::iter_rev (#5620)
#5615 removed the only usage of this method, so it's now dead code.
2024-09-09 01:07:33 +00:00
overlookmotel
37e922c00f perf(linter): eslint/no_shadow_restricted_names use run_on_symbol (#5618)
This rule was implemented as a `run_once` method which just iterated over symbols. Implement using `run_on_symbol` instead to avoid the additional iteration.
2024-09-09 01:07:32 +00:00
overlookmotel
0b7fccf000 perf(linter): react/no_set_state + react/no_string_refs rules reduce iteration over ancestors (#5616)
`get_parent_es5_component` and `get_parent_es6_component` were always used together. Combine the two into a single function to only iterate over ancestors once, instead of twice.
2024-09-09 01:07:31 +00:00
overlookmotel
54e2e76d17 fix(linter): react/no_set_state + react/no_string_refs rules find correct parent (#5615)
`get_parent_es6_component` was finding *any* binding which is inside a class component, rather than parent of current node, leading to false positives.

The added test cases were not behaving correctly previously.
2024-09-09 01:07:31 +00:00
overlookmotel
2e367c999d test(traverse): enable tests for oxc_traverse crate (#5625)
Tests were disabled for some reason.
2024-09-09 00:18:44 +00:00
overlookmotel
afea8d5dea refactor(linter): rename Rule trait method params (#5617)
Makes no real difference. Just produces nicer naming hints in IDEs.
2024-09-08 18:36:36 +00:00
dalaoshu
4e748b5930
refactor(linter): replace ast "compare by hash" to "compare by content" (#5602)
relates #5600
2024-09-09 00:23:26 +08:00
DonIsaac
20d006838e refactor(oxlint): move cli-related exports to cli module (#5139) 2024-09-08 15:29:37 +00:00
Boshen
f49e6ebd41 fix(span): treat .js as module file (reverts the previous breaking change) (#5612)
As it turns out it's not ideal to treat `.js` as `script` in today's world anymore.

This makes https://github.com/oxc-project/oxlint-ecosystem-ci pass again.
2024-09-08 15:14:04 +00:00
overlookmotel
b3cbd56520 feat(span): format_compact_str! macro (#5610)
Add `format_compact_str!` macro to create a `CompactStr`, like `format!`.
2024-09-08 14:15:05 +00:00
overlookmotel
3d190a5728 refactor(span): move CompactStr into separate file (#5609)
Pure refactor. Split `atom.rs` into 2 files.
2024-09-08 14:15:04 +00:00
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