-
Notifications
You must be signed in to change notification settings - Fork 164
feat(check): support --no-error-on-unmatched-pattern for fmt and lint
#1354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2f008c2
feat(check): support `--no-error-on-unmatched-pattern` flag
fengmk2 f60c9a7
refactor(check): improve clarity of suppress_unmatched branches
fengmk2 201555e
fix: correct typo `unparseable` → `unparsable`
fengmk2 d3e2e72
fix(check): avoid swallowing real lint errors when suppress_unmatched…
fengmk2 f4b5a0f
test(check): verify real lint errors are not swallowed by suppress_un…
fengmk2 53913e0
test(check): use vite.config.ts instead of .oxlintrc.json for lint rules
fengmk2 7be8a79
feat(check): pass --no-error-on-unmatched-pattern to oxlint natively
fengmk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
packages/cli/snap-tests/check-fix-lint-error-not-swallowed/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "check-fix-lint-error-not-swallowed", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/cli/snap-tests/check-fix-lint-error-not-swallowed/snap.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [1]> vp check --fix src/index.js # real lint error with --fix and paths (suppress_unmatched active), error must not be swallowed | ||
| error: Lint issues found | ||
| × eslint(no-eval): eval can be harmful. | ||
| ╭─[src/index.js:2:3] | ||
| 1 │ function hello() { | ||
| 2 │ eval("code"); | ||
| · ──── | ||
| 3 │ return "hello"; | ||
| ╰──── | ||
| help: Avoid eval(). For JSON parsing use JSON.parse(); for dynamic property access use bracket notation (obj[key]); for other cases refactor to avoid evaluating strings as code. | ||
|
|
||
| Found 1 error and 0 warnings in 1 file (<variable>ms, <variable> threads) |
6 changes: 6 additions & 0 deletions
6
packages/cli/snap-tests/check-fix-lint-error-not-swallowed/src/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| function hello() { | ||
| eval("code"); | ||
| return "hello"; | ||
| } | ||
|
|
||
| export { hello }; |
5 changes: 5 additions & 0 deletions
5
packages/cli/snap-tests/check-fix-lint-error-not-swallowed/steps.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "commands": [ | ||
| "vp check --fix src/index.js # real lint error with --fix and paths (suppress_unmatched active), error must not be swallowed" | ||
| ] | ||
| } |
7 changes: 7 additions & 0 deletions
7
packages/cli/snap-tests/check-fix-lint-error-not-swallowed/vite.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| export default { | ||
| lint: { | ||
| rules: { | ||
| "no-eval": "error", | ||
| }, | ||
| }, | ||
| }; |
5 changes: 5 additions & 0 deletions
5
packages/cli/snap-tests/check-fix-no-error-unmatched/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "check-fix-no-error-unmatched", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
16 changes: 16 additions & 0 deletions
16
packages/cli/snap-tests/check-fix-no-error-unmatched/snap.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| > vp check --fix src/ignored/index.js # all files excluded by ignorePatterns, should pass in --fix mode | ||
| pass: Formatting completed for checked files (<variable>ms) | ||
|
|
||
| > vp check --fix package.json # non-lintable file, should pass in --fix mode | ||
| pass: Formatting completed for checked files (<variable>ms) | ||
|
|
||
| > vp check --no-error-on-unmatched-pattern src/ignored/index.js # explicit flag without --fix, should also pass | ||
| > vp check --fix --no-error-on-unmatched-pattern src/ignored/index.js # both flags set, should pass | ||
| pass: Formatting completed for checked files (<variable>ms) | ||
|
|
||
| [2]> vp check src/ignored/index.js # without --fix or explicit flag, should exit non-zero | ||
|
leaysgur marked this conversation as resolved.
|
||
| error: Formatting could not start | ||
| Checking formatting... | ||
| Expected at least one target file. All matched files may have been excluded by ignore rules. | ||
|
|
||
| Formatting failed before analysis started | ||
2 changes: 2 additions & 0 deletions
2
packages/cli/snap-tests/check-fix-no-error-unmatched/src/ignored/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| // This file is excluded by both fmt and lint ignorePatterns. | ||
| export const hello = 'world'; |
9 changes: 9 additions & 0 deletions
9
packages/cli/snap-tests/check-fix-no-error-unmatched/steps.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "commands": [ | ||
| "vp check --fix src/ignored/index.js # all files excluded by ignorePatterns, should pass in --fix mode", | ||
| "vp check --fix package.json # non-lintable file, should pass in --fix mode", | ||
| "vp check --no-error-on-unmatched-pattern src/ignored/index.js # explicit flag without --fix, should also pass", | ||
| "vp check --fix --no-error-on-unmatched-pattern src/ignored/index.js # both flags set, should pass", | ||
| "vp check src/ignored/index.js # without --fix or explicit flag, should exit non-zero" | ||
| ] | ||
| } |
8 changes: 8 additions & 0 deletions
8
packages/cli/snap-tests/check-fix-no-error-unmatched/vite.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export default { | ||
| fmt: { | ||
| ignorePatterns: ['src/ignored/**/*'], | ||
| }, | ||
| lint: { | ||
| ignorePatterns: ['src/ignored/**/*'], | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "name": "lint-unmatched-pattern", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [1]> vp lint package.json # non-lintable file, should exit non-zero | ||
| No files found to lint. Please check your paths and ignore patterns. | ||
| Finished in <variable>ms on 0 files with <variable> rules using <variable> threads. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "commands": ["vp lint package.json # non-lintable file, should exit non-zero"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.