Commit graph

20 commits

Author SHA1 Message Date
Boshen
ae1f15ac1e
feat(linter): support eslint globals (#3038)
closes #3019
2024-04-20 23:01:59 +08:00
Dunqing
23651980d1
feat(cli): add tsconfig file validation in LintRunner (#2850) 2024-03-29 19:56:30 +08:00
fi3ework
ee5b9682ae
feat(linter): support read env from eslintrc (#2130)
## target

resolve #732 

## contexts

- globals definition from
https://github.com/sindresorhus/globals/blob/main/globals.json
- port https://github.com/eslint/eslintrc/blob/main/conf/environments.js
to derive environments
2024-01-26 10:43:44 +08:00
Boshen
68606c4d6d
fix(linter): keep rules disabled if the rule is not enabled in the config (#2031)
relates #1969
2024-01-15 05:32:51 +00:00
Boshen
fb5d0a740c
feat(linter): add support for same rule name but different plugin names (#1992)
e.g.

```
{
  "rules": {
    "semi": "off",
    "@typescript-eslint/semi": "error"
  }
}
```

closes #1975
2024-01-11 18:05:05 +08:00
Boshen
b7ea4e53fb
feat(linter): support vue generic component (#1989)
closes #1938
2024-01-11 15:48:56 +08:00
fi3ework
e0da12a868
fix(linter): allow eslintrc to add rule when overriding (#1984)
Fix a bug introduced in https://github.com/oxc-project/oxc/pull/1966.
Ideally, the rules in eslintrc should be merged into final rules as
described:

> The rules will start with the categories we apply, and then merge all
the configurations stated in the rules field.
>
> For example, if we begin with -D correctness with 80 rules, then
>
> "no-empty-file": "off" will remove the rule, yielding 79 rules
> "no-empty": "error" (restriction) will add the rule, yield 81 rules
> ""no-empty": ["error", { "allowEmptyCatch": true }]` add the rule's
configuration

However, the implementation did not include the newly added rules in the
eslintrc. As a test case and example, I added a new fixture to
`crates/oxc_cli/fixtures/no_undef`. No warn or deny will be found
without this PR.

This is my first Rust PR ever. Any nitpicking suggestions are welcome.
Thanks! 😊
2024-01-11 11:43:02 +08:00
Boshen
c2e8ef56a5
feat(linter): disable no-unused-labels for svelte (#1919) 2024-01-07 00:25:52 +08:00
Boshen
f2ed83ca3b
feat(linter): <script> part of svelte file (#1918)
closes #1914
2024-01-07 00:13:44 +08:00
Boshen
72615877dc
feat(linter): allow "-c" configuration (#1909)
closes #1693
2024-01-06 16:32:11 +08:00
Boshen
497a20796c
feat(linter): parse two script tags from vue (#1899) 2024-01-05 16:44:27 +08:00
Boshen
8a3eff1bee
feat(linter): parse multiple script tags in astro file (#1898) 2024-01-05 16:36:31 +08:00
Boshen
a63490c1c0
feat(linter): support astro front matter --- block (#1893)
closes #1702
2024-01-05 10:05:43 +08:00
Boshen
11ca5c2bad
feat(linter): do not lint when vue file has no js section (#1891) 2024-01-04 21:24:19 +08:00
Clark Fischer
d88d76fdb8
Prioritize ignored paths when linting (#1878)
As discussed in #1124

A common workflow is running `oxlint` automatically via something like
lint-staged, which passes all changed file paths explicitly as CLI
arguments. The ignore crate auto-whitelists explicit paths, overriding
anything defined in an ignore file, leading to files that should be
ignored causing CI and VC hooks to fail.

eslint avoids this issue by giving precedence to .eslintignore unless
you pass `--no-ignore`.

Since `ignore` doesn't really give much control over this, the most
effective solution seems to be filtering. ~~Once we've got a list of
files to be linted, we can compare each against the .eslintignore and
see if it really truly should be linted.~~

~~Unfortunately, this is sort of a naive solution. Ignored directories
will still be walked, then filtered out after the fact. Changing this
behavior at the walker level would affect the formatter, which probably
isn't desirable.~~ (edit: The performance impact has been mostly
resolved.)

Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
2024-01-04 03:44:10 +00:00
Wenzhe Wang
ec9598cefc
test(cli): add simple integration test for vue file (#1863) 2023-12-31 22:37:26 +08:00
Wenzhe Wang
0feeac540d
feat(lint): add partial loader register (#1760) 2023-12-31 22:19:27 +08:00
Wenzhe Wang
8f27a98468
feat(cli): support walk vue and astro (#1745) 2023-12-31 22:15:11 +08:00
Boshen
c88823244e
fix(cli): correct ignore-pattern behavior; add more cli tests (#796) 2023-08-26 00:03:49 +08:00
Boshen
4ee56576c7
feat(cli): add basic unit tests (#793) 2023-08-25 21:26:14 +08:00