Commit graph

157 commits

Author SHA1 Message Date
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
Boshen
d0c4100ca8
chore(cli): the oxc_cli binary has no unit tests 2024-01-04 21:20:40 +08:00
Boshen
5b652fe1db
refactor(cli): improve the code around lint-staged handling (#1889) 2024-01-04 20:50:59 +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
Cameron
df29e8da72
fix(cli) skip run lint when --rules is passed (#1747)
not sure if there is a cleaner way to do this.

maybe change `check_options` to return an Option - none if no CliResult, Some if there is a cli result (something was incorrect or the cmd was handled)
2023-12-20 12:24:45 +08:00
Cameron
4ebb3fb218
fix(cli): conflict between --import-plugin and -D correctness (#1729)
closes #1727
2023-12-18 21:20:48 +08:00
Cameron
9275c749ca
feat(linter) Parse eslint configuration (#1146)
**DRAFT**

Adds support for parsing `eslint` configuration files.

Example: 
```sh
cargo run --bin=oxc_cli lint --config-path ./.eslintrc.json .
```

This isn't a full implementation of how eslint parses configs but should
be fine for now:

Currently supported `extends`:
 - `eslint:recommended` -> `eslint`
 - `plugin:react/recommended` -> `react`
 - `plugin:@typescript-eslint/recommended` -> `typescript`
 - `plugin:react-hooks/recommended` -> `react`
 - `plugin:unicorn/recommended` -> `unicorn`
 - `plugin:jest/recommended` -> `jest`

These defaults can _all_ be overridden by configuring the rule in the
`rules` section of the estlint config:

e.g.
```json
{
    "extends": [
        "eslint:recommended"
    ],
    "rules": {
        "eqeqeq": "off"
    },
}
```

This would enable of of the rules within the `eslint` group. But would
not enable `eqeqeq` as it is explicitly disabled

Note, we do not currently support the following:
 - supplying a `filter` and `config-path`
 - supplying a `plugin` and `config-path`
2023-12-14 16:29:27 +08:00
Boshen
064353c97e
feat(prettier): turn off preserve_parens and start working on need-parens (#1487) 2023-11-21 16:26:56 +00:00
Shannon Rothe
0b6b0b4854
feat(cli): add --deny-warnings flag (#1452)
See #1403

Terminates linting with an exit code of 1 if the `--deny-warnings` flag
is provided _and_ there is 1 or more warnings produced from the linting.
2023-11-21 10:08:10 +08:00
Boshen
1a576f60a8
refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
Boshen
73d6d40778
rust: do not compile libs and bins that do not have tests (#1342) 2023-11-16 13:35:24 +08:00
Boshen
5f316626f6
feat(prettier): add the basics of comment printing (#1313) 2023-11-14 12:32:03 +00:00
Boshen
4977ea1554
feat(cli): add basic prettier cli infrastructure (#1300) 2023-11-14 08:22:22 +00:00
Boshen
d82ba5b523
feat(cli): run oxlint with no file arguments (#1201)
closes #1190

See: `https://github.com/eslint/eslint/issues/14308`
2023-11-09 11:22:13 +08:00
Wenzhe Wang
c7598b22ff
chore(cli): move import_plugin into enable_plugins (#1158) 2023-11-06 09:00:36 +08:00
Wenzhe Wang
4e9260ec03
feat: basic enable plugin (#1154) 2023-11-05 21:46:30 +08:00
Boshen
6da5a3f216
feat(cli): print execution time in seconds when greater than 1 second (#1107) 2023-10-30 16:35:40 +08:00
Boshen
4e218331c2
refactor(cli): clean up code around codeowners (#1099) 2023-10-30 11:21:41 +08:00
u9g
1704a76f6f
Codeowners filtering (#1083)
closes #1066
2023-10-29 13:30:20 +08:00
Boshen
eaeb63072f
refactor(clippy): allow struct_excessive_bools 2023-10-16 15:18:07 +08:00
Boshen
bd99c7f174
chore(cli): remove cmd snapshot and building oxlint binary to speed up ci 2023-10-11 20:38:59 +08:00
Boshen
77dd0f1395
chore(cli): disable doc tests 2023-10-07 21:18:26 +08:00
Cameron
d5b70c3b2c
fix(cli): fix panic when no paths are provided (#944) 2023-09-30 21:05:55 +13:00
Jason Miller
a4c064795c
Fix: return 0 exit code when warnings<max_warnings (#933)
`oxlint --max-warnings 99999` should exit with success status code when
there are warnings but no errors found. Currently any warning or error
results in an exit status of 1.
2023-09-23 23:46:15 +12:00
Boshen
a6d8d05cd3
feat(cli): init miette everything else to reduce is_atty system calls 2023-09-14 22:46:06 +08:00
Boshen
9d7e1657e9
perf(cli): force terminal_links to reduce sys calls (#911)
terminal_links has auto detection on by default,
it will get repeatedly called from parser rewind
with a `is_atty` system call.

closes #906
2023-09-14 22:28:30 +08:00
Boshen
4faf3c7976
feat(resolver): add more tracing events to resolver (#907) 2023-09-14 15:34:51 +08:00
Boshen
ee54575ec1
feat(linter): add runner for import-plugin (#858) 2023-09-06 14:54:19 +08:00
Boshen
2b60b8a289
fix(linter): fix incorrect behaviour for "-D correctness -A rule-name" 2023-09-06 11:16:07 +08:00
Boshen
b89e931b33
fix(cli): spawn linting in another thread so diagnostics can be printed immediately 2023-09-06 10:21:32 +08:00
Boshen
b8808a81cf
feat(cli): use parallel walker for directory traversal (#860) 2023-09-05 15:17:44 +08:00
Boshen
6706541049
refactor(linter): remove complicated linter service setup 2023-09-03 18:14:05 +08:00
Boshen
b9bd5ff7ab
refactor(cli): collect all the paths before linting 2023-09-03 16:36:02 +08:00
Boshen
53b094e46c
chore: clean up deps (#840) 2023-09-02 21:34:24 +08:00
Boshen
693145107c
refactor(linter): less a global hashmap to reduce rule timer macro expansion (#822)
closes #819
2023-09-01 10:32:17 +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
Boshen
1b5ef7cdc8
refactor(cli): remove unused lint/error.rs (#792) 2023-08-25 16:46:26 +08:00
Boshen
592137586c
feat(cli): use insta_cmd for cli snapshot testing (#791)
closes #776
2023-08-25 16:26:34 +08:00
Boshen
cc862536f6
fix(cli): print timing after lint run 2023-08-21 11:51:15 +08:00
Boshen
03df8fcc68
refactor(cli): print the final result; fix plural on number of files 2023-08-21 11:51:15 +08:00