Ignore single files with @noformat / @noprettier (#17344)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Will Nayesandfisker authored and GitHub committed 2025-04-18 21:28:47 +08:00
1 parent 0ec06c1cc2
commit 21c6f43612
119 files changed
+1704 -68

No files matched your search

@@ -128,6 +128,8 @@ Other options:
--cache-location <path> Path to the cache file.
--cache-strategy <metadata|content>
Strategy for the cache to use for detecting changed files.
--check-ignore-pragma Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.
Defaults to false.
--no-color Do not colorize error messages.
--no-error-on-unmatched-pattern
Prevent errors when pattern is unmatched.
@@ -142,8 +144,7 @@ Other options:
--log-level <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
Defaults to false.
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
@@ -300,6 +301,8 @@ Other options:
--cache-location <path> Path to the cache file.
--cache-strategy <metadata|content>
Strategy for the cache to use for detecting changed files.
--check-ignore-pragma Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.
Defaults to false.
--no-color Do not colorize error messages.
--no-error-on-unmatched-pattern
Prevent errors when pattern is unmatched.
@@ -314,8 +317,7 @@ Other options:
--log-level <silent|error|warn|log|debug>
What level of logs to report.
Defaults to log.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
--require-pragma Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
Defaults to false.
--stdin-filepath <path> Path to the file to pretend that stdin comes from.
--support-info Print support information as JSON.
@@ -89,6 +89,18 @@ exports[`show detailed usage with --help check (stdout) 1`] = `
exports[`show detailed usage with --help check (write) 1`] = `[]`;
exports[`show detailed usage with --help check-ignore-pragma (stderr) 1`] = `""`;
exports[`show detailed usage with --help check-ignore-pragma (stdout) 1`] = `
"--check-ignore-pragma
Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.
Default: false"
`;
exports[`show detailed usage with --help check-ignore-pragma (write) 1`] = `[]`;
exports[`show detailed usage with --help color (stderr) 1`] = `""`;
exports[`show detailed usage with --help color (stdout) 1`] = `
@@ -564,8 +576,7 @@ exports[`show detailed usage with --help require-pragma (stderr) 1`] = `""`;
exports[`show detailed usage with --help require-pragma (stdout) 1`] = `
"--require-pragma
Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.
Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.
Default: false"
`;
@@ -35,6 +35,11 @@ exports[`schema 1`] = `
"description": "Print spaces between brackets.",
"type": "boolean",
},
"checkIgnorePragma": {
"default": false,
"description": "Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",
"type": "boolean",
},
"cursorOffset": {
"default": -1,
"description": "Print (to stderr) where a cursor at the given position would move to after formatting.",
@@ -404,8 +409,7 @@ The range will extend backwards to the start of the first line containing the se
},
"requirePragma": {
"default": false,
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment
in order for it to be formatted.",
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",
"type": "boolean",
},
"semi": {
@@ -106,6 +106,10 @@ exports[`API getSupportInfo() 1`] = `
"default": true,
"type": "boolean",
},
"checkIgnorePragma": {
"default": false,
"type": "boolean",
},
"cursorOffset": {
"default": -1,
"range": {
@@ -843,6 +847,14 @@ exports[`CLI --support-info (stdout) 1`] = `
"pluginDefaults": {},
"type": "boolean"
},
{
"category": "Special",
"default": false,
"description": "Check whether the file's first docblock comment contains '@noprettier' or '@noformat' to determine if it should be formatted.",
"name": "checkIgnorePragma",
"pluginDefaults": {},
"type": "boolean"
},
{
"category": "Special",
"default": -1,
@@ -1097,7 +1109,7 @@ exports[`CLI --support-info (stdout) 1`] = `
{
"category": "Special",
"default": false,
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment\\nin order for it to be formatted.",
"description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment in order for it to be formatted.",
"name": "requirePragma",
"pluginDefaults": {},
"type": "boolean"