Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com> Co-authored-by: sosukesuzuki <aosukeke@gmail.com>
- Loading branch information
1 parent
7bf1803
commit e3d1f0d
Showing
19 changed files
with
212 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,16 +1,4 @@ | ||
- id: prettier | ||
name: prettier | ||
entry: prettier --write --list-different | ||
entry: prettier --write --list-different --ignore-unknown | ||
language: node | ||
files: "\\.(\ | ||
css|less|scss\ | ||
|graphql|gql\ | ||
|html\ | ||
|js|jsx\ | ||
|json\ | ||
|md|markdown|mdown|mkdn\ | ||
|mdx\ | ||
|ts|tsx\ | ||
|vue\ | ||
|yaml|yml\ | ||
)$" |
This file contains 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,14 @@ | ||
#### Added `--ignore-unknown`(alias `-u`) flag ([#8829](https://github.com/prettier/prettier/pull/8829) by [@fisker](https://github.com/fisker)) | ||
|
||
```console | ||
# Prettier stable | ||
npx prettier * --check | ||
Checking formatting... | ||
foo.unknown[error] No parser could be inferred for file: foo.unknown | ||
All matched files use Prettier code style! | ||
|
||
# Prettier master | ||
npx prettier * --check --ignore-unknown | ||
Checking formatting... | ||
All matched files use Prettier code style! | ||
``` |
This file contains 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 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 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 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 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 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 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 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
69 changes: 69 additions & 0 deletions
69
tests_integration/__tests__/__snapshots__/ignore-unknown.js.snap
This file contains 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,69 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Ignored file (stderr) 1`] = `""`; | ||
|
||
exports[`Ignored file (stdout) 1`] = `""`; | ||
|
||
exports[`Ignored file (write) 1`] = `Array []`; | ||
|
||
exports[`None exist file (stderr) 1`] = ` | ||
"[error] No files matching the pattern were found: \\"non-exist-file\\". | ||
" | ||
`; | ||
|
||
exports[`None exist file (stdout) 1`] = `""`; | ||
|
||
exports[`None exist file (write) 1`] = `Array []`; | ||
|
||
exports[`Not matching pattern (stderr) 1`] = ` | ||
"[error] No files matching the pattern were found: \\"*.non-exist-pattern\\". | ||
" | ||
`; | ||
|
||
exports[`Not matching pattern (stdout) 1`] = `""`; | ||
|
||
exports[`Not matching pattern (write) 1`] = `Array []`; | ||
|
||
exports[`ignore-unknown alias (stdout) 1`] = ` | ||
"javascript.js | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown check (stderr) 1`] = ` | ||
"[warn] javascript.js | ||
[warn] Code style issues found in the above file(s). Forgot to run Prettier? | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown check (stdout) 1`] = ` | ||
"Checking formatting... | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown check (write) 1`] = `Array []`; | ||
|
||
exports[`ignore-unknown dir (stdout) 1`] = ` | ||
"javascript.js | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown pattern (stdout) 1`] = ` | ||
"javascript.js | ||
override.as-js-file | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown write (stdout) 1`] = ` | ||
"javascript.js | ||
" | ||
`; | ||
|
||
exports[`ignore-unknown write (write) 1`] = ` | ||
Array [ | ||
Object { | ||
"content": "const foo = \\"bar\\"; | ||
", | ||
"filename": "javascript.js", | ||
}, | ||
] | ||
`; |
This file contains 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,77 @@ | ||
"use strict"; | ||
|
||
const runPrettier = require("../runPrettier"); | ||
|
||
describe("ignore-unknown dir", () => { | ||
runPrettier("cli/ignore-unknown", [ | ||
".", | ||
"--ignore-unknown", | ||
"--list-different", | ||
]).test({ | ||
status: "non-zero", | ||
stderr: "", | ||
write: [], | ||
}); | ||
}); | ||
|
||
describe("ignore-unknown alias", () => { | ||
runPrettier("cli/ignore-unknown", [".", "-u", "--list-different"]).test({ | ||
status: "non-zero", | ||
stderr: "", | ||
write: [], | ||
}); | ||
}); | ||
|
||
describe("ignore-unknown pattern", () => { | ||
runPrettier("cli/ignore-unknown", [ | ||
"*", | ||
"--ignore-unknown", | ||
"--list-different", | ||
]).test({ | ||
status: "non-zero", | ||
stderr: "", | ||
write: [], | ||
}); | ||
}); | ||
|
||
describe("ignore-unknown write", () => { | ||
runPrettier("cli/ignore-unknown", [ | ||
".", | ||
"--ignore-unknown", | ||
"--write", | ||
"--list-different", | ||
]).test({ | ||
status: 0, | ||
stderr: "", | ||
}); | ||
}); | ||
|
||
describe("ignore-unknown check", () => { | ||
runPrettier("cli/ignore-unknown", [".", "--ignore-unknown", "--check"]).test({ | ||
status: 1, | ||
}); | ||
}); | ||
|
||
describe("None exist file", () => { | ||
runPrettier("cli/ignore-unknown", [ | ||
"non-exist-file", | ||
"--ignore-unknown", | ||
]).test({ | ||
status: 2, | ||
}); | ||
}); | ||
|
||
describe("Not matching pattern", () => { | ||
runPrettier("cli/ignore-unknown", [ | ||
"*.non-exist-pattern", | ||
"--ignore-unknown", | ||
]).test({ | ||
status: 2, | ||
}); | ||
}); | ||
|
||
describe("Ignored file", () => { | ||
runPrettier("cli/ignore-unknown", ["ignored.js", "--ignore-unknown"]).test({ | ||
status: 0, | ||
}); | ||
}); |
This file contains 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 @@ | ||
ignored.js |
This file contains 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,10 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*.as-js-file", | ||
"options": { | ||
"parser": "babel" | ||
} | ||
} | ||
] | ||
} |
Empty file.
This file contains 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 @@ | ||
const foo= "bar"; |
This file contains 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 @@ | ||
const foo= "bar"; |
1 change: 1 addition & 0 deletions
1
tests_integration/cli/ignore-unknown/unkown-file-extension.unknown
This file contains 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 @@ | ||
PRETTIER |
This file contains 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 @@ | ||
PRETTIER |