-
Notifications
You must be signed in to change notification settings - Fork 161
feat(check): support --no-error-on-unmatched-pattern flag
#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
Open
fengmk2
wants to merge
6
commits into
refactor-cli-others
Choose a base branch
from
support-no-error-on-unmatched-pattern
base: refactor-cli-others
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+149
−26
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cdbb169
feat(check): support `--no-error-on-unmatched-pattern` flag
fengmk2 7681aed
refactor(check): improve clarity of suppress_unmatched branches
fengmk2 28c8a19
fix: correct typo `unparseable` → `unparsable`
fengmk2 6e051b8
fix(check): avoid swallowing real lint errors when suppress_unmatched…
fengmk2 35390df
test(check): verify real lint errors are not swallowed by suppress_un…
fengmk2 2703014
test(check): use vite.config.ts instead of .oxlintrc.json for lint rules
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) | ||
| pass: Found no warnings or lint errors in 0 files (<variable>ms, <variable> threads) | ||
|
|
||
| > vp check --no-error-on-unmatched-pattern src/ignored/index.js # explicit flag without --fix, should also pass | ||
| pass: Found no warnings or lint errors in 0 files (<variable>ms, <variable> threads) | ||
|
|
||
| > 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) | ||
| pass: Found no warnings or lint errors in 0 files (<variable>ms, <variable> threads) | ||
|
|
||
| [2]> vp check src/ignored/index.js # without --fix or explicit flag, should exit non-zero | ||
leaysgur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| error: Formatting could not start | ||
| Expected at least one target file | ||
|
|
||
| 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'; |
8 changes: 8 additions & 0 deletions
8
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,8 @@ | ||
| { | ||
| "commands": [ | ||
| "vp check --fix src/ignored/index.js # all files excluded by ignorePatterns, 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
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.