From d1332b4c63072b9dd6701869aa8ac6d502cc7f66 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Wed, 27 Apr 2022 17:56:05 +0800 Subject: [PATCH 1/2] Set `printBasicPrototype: false` in snapshots (#12702) --- jest.config.js | 1 + .../__snapshots__/arg-parsing.js.snap | 12 +- .../__tests__/__snapshots__/check.js.snap | 10 +- .../__snapshots__/config-invalid.js.snap | 20 +- .../__snapshots__/config-resolution.js.snap | 20 +- .../__snapshots__/cursor-offset.js.snap | 4 +- .../__snapshots__/debug-check.js.snap | 10 +- .../__snapshots__/debug-print-ast.js.snap | 2 +- .../debug-print-comments.js.snap | 2 +- .../__snapshots__/early-exit.js.snap | 24 +- .../error-on-unmatched-pattern.js.snap | 8 +- .../__tests__/__snapshots__/file-info.js.snap | 28 +- .../__snapshots__/help-options.js.snap | 98 +++--- .../ignore-absolute-path.js.snap | 2 +- .../__snapshots__/ignore-emoji.js.snap | 4 +- .../ignore-in-subdirectories.js.snap | 12 +- .../__snapshots__/ignore-path.js.snap | 8 +- .../ignore-relative-path.js.snap | 2 +- .../__snapshots__/ignore-unknown.js.snap | 12 +- .../__snapshots__/ignore-vcs-files.js.snap | 2 +- .../__snapshots__/infer-parser.js.snap | 16 +- .../__snapshots__/invalid-ignore.js.snap | 2 +- .../__snapshots__/list-different.js.snap | 8 +- .../__tests__/__snapshots__/load-toml.js.snap | 8 +- .../__tests__/__snapshots__/loglevel.js.snap | 4 +- .../__snapshots__/parser-api.js.snap | 2 +- .../__snapshots__/patterns-glob.js.snap | 26 +- .../__tests__/__snapshots__/patterns.js.snap | 16 +- .../__snapshots__/piped-output.js.snap | 24 +- .../plugin-options-string.js.snap | 2 +- .../__snapshots__/plugin-options.js.snap | 4 +- .../__tests__/__snapshots__/schema.js.snap | 312 +++++++++--------- .../__snapshots__/skip-folders.js.snap | 4 +- .../__snapshots__/stdin-filepath.js.snap | 18 +- .../__snapshots__/support-info.js.snap | 134 ++++---- .../__snapshots__/syntax-error.js.snap | 2 +- .../with-config-precedence.js.snap | 24 +- .../__snapshots__/with-node-modules.js.snap | 10 +- .../with-parser-inference.js.snap | 6 +- .../__snapshots__/with-shebang.js.snap | 2 +- .../__tests__/__snapshots__/write.js.snap | 8 +- .../__tests__/plugin-resolution.js | 4 +- 42 files changed, 459 insertions(+), 458 deletions(-) diff --git a/jest.config.js b/jest.config.js index 39f8dc0dc..bfaf23c4e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -69,6 +69,7 @@ module.exports = { ], snapshotFormat: { escapeString: false, + printBasicPrototype: false, }, testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$", testPathIgnorePatterns, diff --git a/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap b/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap index 74cd8f0f7..2dc09e6ea 100644 --- a/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap +++ b/tests/integration/__tests__/__snapshots__/arg-parsing.js.snap @@ -2,7 +2,7 @@ exports[`allow overriding flags (stderr) 1`] = `""`; -exports[`allow overriding flags (write) 1`] = `Array []`; +exports[`allow overriding flags (write) 1`] = `[]`; exports[`boolean flags do not swallow the next argument (stderr) 1`] = `""`; @@ -11,7 +11,7 @@ exports[`boolean flags do not swallow the next argument (stdout) 1`] = ` " `; -exports[`boolean flags do not swallow the next argument (write) 1`] = `Array []`; +exports[`boolean flags do not swallow the next argument (write) 1`] = `[]`; exports[`deprecated option values are warned (stderr) 1`] = ` "[warn] --jsx-bracket-same-line is deprecated. @@ -23,7 +23,7 @@ exports[`deprecated option values are warned (stdout) 1`] = ` " `; -exports[`deprecated option values are warned (write) 1`] = `Array []`; +exports[`deprecated option values are warned (write) 1`] = `[]`; exports[`negated options work (stderr) 1`] = `""`; @@ -32,7 +32,7 @@ exports[`negated options work (stdout) 1`] = ` " `; -exports[`negated options work (write) 1`] = `Array []`; +exports[`negated options work (write) 1`] = `[]`; exports[`number file/dir (stdout) 1`] = ` "1/file-in-dir-named-1.js @@ -85,7 +85,7 @@ exports[`unknown negated options are warned (stdout) 1`] = ` " `; -exports[`unknown negated options are warned (write) 1`] = `Array []`; +exports[`unknown negated options are warned (write) 1`] = `[]`; exports[`unknown options are warned (stderr) 1`] = ` "[warn] Ignored unknown option --unknown. @@ -97,7 +97,7 @@ exports[`unknown options are warned (stdout) 1`] = ` " `; -exports[`unknown options are warned (write) 1`] = `Array []`; +exports[`unknown options are warned (write) 1`] = `[]`; exports[`unknown options not suggestion \`_\` (stderr) 1`] = ` "[warn] Ignored unknown option -a. Did you mean -c? diff --git a/tests/integration/__tests__/__snapshots__/check.js.snap b/tests/integration/__tests__/__snapshots__/check.js.snap index b5c69122a..dff357f96 100644 --- a/tests/integration/__tests__/__snapshots__/check.js.snap +++ b/tests/integration/__tests__/__snapshots__/check.js.snap @@ -12,7 +12,7 @@ exports[`--checks should print the number of files that need formatting (stdout) " `; -exports[`--checks should print the number of files that need formatting (write) 1`] = `Array []`; +exports[`--checks should print the number of files that need formatting (write) 1`] = `[]`; exports[`--checks works in CI just as in a non-TTY mode (stderr) 1`] = ` "[warn] unformatted.js @@ -36,10 +36,10 @@ exports[`--checks works in CI just as in a non-TTY mode (stdout) 2`] = ` " `; -exports[`--checks works in CI just as in a non-TTY mode (write) 1`] = `Array []`; +exports[`--checks works in CI just as in a non-TTY mode (write) 1`] = `[]`; -exports[`--checks works in CI just as in a non-TTY mode (write) 2`] = `Array []`; +exports[`--checks works in CI just as in a non-TTY mode (write) 2`] = `[]`; -exports[`checks stdin with --check (write) 1`] = `Array []`; +exports[`checks stdin with --check (write) 1`] = `[]`; -exports[`checks stdin with -c (alias for --check) (write) 1`] = `Array []`; +exports[`checks stdin with -c (alias for --check) (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/config-invalid.js.snap b/tests/integration/__tests__/__snapshots__/config-invalid.js.snap index eb8f9a690..15556a9fa 100644 --- a/tests/integration/__tests__/__snapshots__/config-invalid.js.snap +++ b/tests/integration/__tests__/__snapshots__/config-invalid.js.snap @@ -7,7 +7,7 @@ exports[`resolves external configuration from package.json (stderr) 1`] = ` exports[`resolves external configuration from package.json (stdout) 1`] = `""`; -exports[`resolves external configuration from package.json (write) 1`] = `Array []`; +exports[`resolves external configuration from package.json (write) 1`] = `[]`; exports[`show warning with kebab-case option key (stderr) 1`] = ` "[warn] Ignored unknown option { "print-width": 3 }. Did you mean printWidth? @@ -16,7 +16,7 @@ exports[`show warning with kebab-case option key (stderr) 1`] = ` exports[`show warning with kebab-case option key (stdout) 1`] = `""`; -exports[`show warning with kebab-case option key (write) 1`] = `Array []`; +exports[`show warning with kebab-case option key (write) 1`] = `[]`; exports[`show warning with unknown option (stderr) 1`] = ` "[warn] Ignored unknown option { hello: "world" }. @@ -25,7 +25,7 @@ exports[`show warning with unknown option (stderr) 1`] = ` exports[`show warning with unknown option (stdout) 1`] = `""`; -exports[`show warning with unknown option (write) 1`] = `Array []`; +exports[`show warning with unknown option (write) 1`] = `[]`; exports[`throw error for unsupported extension (stderr) 1`] = ` "[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: No loader specified for extension ".unsupported" @@ -34,15 +34,15 @@ exports[`throw error for unsupported extension (stderr) 1`] = ` exports[`throw error for unsupported extension (stdout) 1`] = `""`; -exports[`throw error for unsupported extension (write) 1`] = `Array []`; +exports[`throw error for unsupported extension (write) 1`] = `[]`; exports[`throw error with invalid config format (stdout) 1`] = `""`; exports[`throw error with invalid config format (stdout) 2`] = `""`; -exports[`throw error with invalid config format (write) 1`] = `Array []`; +exports[`throw error with invalid config format (write) 1`] = `[]`; -exports[`throw error with invalid config format (write) 2`] = `Array []`; +exports[`throw error with invalid config format (write) 2`] = `[]`; exports[`throw error with invalid config option (int) (stderr) 1`] = ` "[error] Invalid tabWidth value. Expected an integer, but received 0.5. @@ -51,7 +51,7 @@ exports[`throw error with invalid config option (int) (stderr) 1`] = ` exports[`throw error with invalid config option (int) (stdout) 1`] = `""`; -exports[`throw error with invalid config option (int) (write) 1`] = `Array []`; +exports[`throw error with invalid config option (int) (write) 1`] = `[]`; exports[`throw error with invalid config option (trailingComma) (stderr) 1`] = ` "[error] Invalid trailingComma value. Expected "all", "es5" or "none", but received "wow". @@ -60,7 +60,7 @@ exports[`throw error with invalid config option (trailingComma) (stderr) 1`] = ` exports[`throw error with invalid config option (trailingComma) (stdout) 1`] = `""`; -exports[`throw error with invalid config option (trailingComma) (write) 1`] = `Array []`; +exports[`throw error with invalid config option (trailingComma) (write) 1`] = `[]`; exports[`throw error with invalid config precedence option (configPrecedence) (stderr) 1`] = ` "[error] Invalid --config-precedence value. Expected "cli-override", "file-override" or "prefer-file", but received "option/configPrecedence". @@ -69,7 +69,7 @@ exports[`throw error with invalid config precedence option (configPrecedence) (s exports[`throw error with invalid config precedence option (configPrecedence) (stdout) 1`] = `""`; -exports[`throw error with invalid config precedence option (configPrecedence) (write) 1`] = `Array []`; +exports[`throw error with invalid config precedence option (configPrecedence) (write) 1`] = `[]`; exports[`throw error with invalid config target (directory) (stderr) 1`] = ` "[error] Invalid configuration file \`/tests/integration/cli/config/invalid\`: EISDIR: illegal operation on a directory, read @@ -78,4 +78,4 @@ exports[`throw error with invalid config target (directory) (stderr) 1`] = ` exports[`throw error with invalid config target (directory) (stdout) 1`] = `""`; -exports[`throw error with invalid config target (directory) (write) 1`] = `Array []`; +exports[`throw error with invalid config target (directory) (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/config-resolution.js.snap b/tests/integration/__tests__/__snapshots__/config-resolution.js.snap index bdec0cd3b..8cce4f521 100644 --- a/tests/integration/__tests__/__snapshots__/config-resolution.js.snap +++ b/tests/integration/__tests__/__snapshots__/config-resolution.js.snap @@ -93,7 +93,7 @@ function rcYaml() { " `; -exports[`CLI overrides take precedence (write) 1`] = `Array []`; +exports[`CLI overrides take precedence (write) 1`] = `[]`; exports[`accepts configuration from --config (stderr) 1`] = `""`; @@ -104,14 +104,14 @@ exports[`accepts configuration from --config (stdout) 1`] = ` " `; -exports[`accepts configuration from --config (write) 1`] = `Array []`; +exports[`accepts configuration from --config (write) 1`] = `[]`; exports[`prints error message when no file found with --find-config-path (stderr) 1`] = ` "[error] Can not find configure file for ".." " `; -exports[`prints error message when no file found with --find-config-path (write) 1`] = `Array []`; +exports[`prints error message when no file found with --find-config-path (write) 1`] = `[]`; exports[`resolves configuration file with --find-config-path file (stderr) 1`] = `""`; @@ -120,7 +120,7 @@ exports[`resolves configuration file with --find-config-path file (stdout) 1`] = " `; -exports[`resolves configuration file with --find-config-path file (write) 1`] = `Array []`; +exports[`resolves configuration file with --find-config-path file (write) 1`] = `[]`; exports[`resolves configuration from external files (stderr) 1`] = `""`; @@ -183,7 +183,7 @@ function rcYaml() { " `; -exports[`resolves configuration from external files (write) 1`] = `Array []`; +exports[`resolves configuration from external files (write) 1`] = `[]`; exports[`resolves configuration from external files and overrides by extname (stderr) 1`] = `""`; @@ -201,7 +201,7 @@ function packageTs() { " `; -exports[`resolves configuration from external files and overrides by extname (write) 1`] = `Array []`; +exports[`resolves configuration from external files and overrides by extname (write) 1`] = `[]`; exports[`resolves external configuration from package.json (stderr) 1`] = `""`; @@ -210,7 +210,7 @@ exports[`resolves external configuration from package.json (stdout) 1`] = ` " `; -exports[`resolves external configuration from package.json (write) 1`] = `Array []`; +exports[`resolves external configuration from package.json (write) 1`] = `[]`; exports[`resolves json configuration file with --find-config-path file (stderr) 1`] = `""`; @@ -219,7 +219,7 @@ exports[`resolves json configuration file with --find-config-path file (stdout) " `; -exports[`resolves json configuration file with --find-config-path file (write) 1`] = `Array []`; +exports[`resolves json configuration file with --find-config-path file (write) 1`] = `[]`; exports[`resolves toml configuration file with --find-config-path file (stderr) 1`] = `""`; @@ -228,7 +228,7 @@ exports[`resolves toml configuration file with --find-config-path file (stdout) " `; -exports[`resolves toml configuration file with --find-config-path file (write) 1`] = `Array []`; +exports[`resolves toml configuration file with --find-config-path file (write) 1`] = `[]`; exports[`resolves yaml configuration file with --find-config-path file (stderr) 1`] = `""`; @@ -237,4 +237,4 @@ exports[`resolves yaml configuration file with --find-config-path file (stdout) " `; -exports[`resolves yaml configuration file with --find-config-path file (write) 1`] = `Array []`; +exports[`resolves yaml configuration file with --find-config-path file (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap b/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap index 7f36dbfe7..21bce4862 100644 --- a/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap +++ b/tests/integration/__tests__/__snapshots__/cursor-offset.js.snap @@ -17,7 +17,7 @@ exports[`cursorOffset should not be affected by full-width character (stdout) 1` " `; -exports[`cursorOffset should not be affected by full-width character (write) 1`] = `Array []`; +exports[`cursorOffset should not be affected by full-width character (write) 1`] = `[]`; exports[`write cursorOffset to stderr with --cursor-offset (stderr) 1`] = ` "1 @@ -29,4 +29,4 @@ exports[`write cursorOffset to stderr with --cursor-offset (stdout) 1`] = " `; -exports[`write cursorOffset to stderr with --cursor-offset (write) 1`] = `Array []`; +exports[`write cursorOffset to stderr with --cursor-offset (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/debug-check.js.snap b/tests/integration/__tests__/__snapshots__/debug-check.js.snap index d0478b8b5..827da8185 100644 --- a/tests/integration/__tests__/__snapshots__/debug-check.js.snap +++ b/tests/integration/__tests__/__snapshots__/debug-check.js.snap @@ -1,8 +1,8 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`checks stdin with --debug-check (write) 1`] = `Array []`; +exports[`checks stdin with --debug-check (write) 1`] = `[]`; -exports[`doesn't crash when --debug-check is passed (write) 1`] = `Array []`; +exports[`doesn't crash when --debug-check is passed (write) 1`] = `[]`; exports[`should not exit non-zero for already prettified code with --debug-check + --check (stderr) 1`] = `""`; @@ -13,7 +13,7 @@ All matched files use Prettier code style! " `; -exports[`should not exit non-zero for already prettified code with --debug-check + --check (write) 1`] = `Array []`; +exports[`should not exit non-zero for already prettified code with --debug-check + --check (write) 1`] = `[]`; exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (stderr) 1`] = `""`; @@ -22,7 +22,7 @@ exports[`should not exit non-zero for already prettified code with --debug-check " `; -exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (write) 1`] = `Array []`; +exports[`should not exit non-zero for already prettified code with --debug-check + --list-different (write) 1`] = `[]`; exports[`show diff for 2+ error files with --debug-check (stderr) 1`] = ` "[error] a.debug-check: prettier(input) !== prettier(prettier(input)) @@ -52,4 +52,4 @@ exports[`show diff for 2+ error files with --debug-check (stderr) 1`] = ` exports[`show diff for 2+ error files with --debug-check (stdout) 1`] = `""`; -exports[`show diff for 2+ error files with --debug-check (write) 1`] = `Array []`; +exports[`show diff for 2+ error files with --debug-check (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/debug-print-ast.js.snap b/tests/integration/__tests__/__snapshots__/debug-print-ast.js.snap index 6e4781352..4a0ac898b 100644 --- a/tests/integration/__tests__/__snapshots__/debug-print-ast.js.snap +++ b/tests/integration/__tests__/__snapshots__/debug-print-ast.js.snap @@ -2,4 +2,4 @@ exports[`prints information for debugging AST --debug-print-ast (stdout) 1`] = `"{"type":"File","start":0,"end":18,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":18,"index":18}},"range":[0,18],"errors":[],"program":{"type":"Program","start":0,"end":18,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":18,"index":18}},"range":[0,18],"sourceType":"module","interpreter":null,"body":[{"type":"VariableDeclaration","start":0,"end":18,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":18,"index":18}},"range":[0,18],"declarations":[{"type":"VariableDeclarator","start":6,"end":17,"loc":{"start":{"line":1,"column":6,"index":6},"end":{"line":1,"column":17,"index":17}},"range":[6,17],"id":{"type":"Identifier","start":6,"end":9,"loc":{"start":{"line":1,"column":6,"index":6},"end":{"line":1,"column":9,"index":9},"identifierName":"foo"},"range":[6,9],"name":"foo"},"init":{"type":"StringLiteral","start":12,"end":17,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":17,"index":17}},"range":[12,17],"extra":{"rawValue":"foo","raw":"'foo'"},"value":"foo"}}],"kind":"const"}],"directives":[]},"comments":[],"tokens":[{"type":{"label":"const","keyword":"const","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"const","start":0,"end":5,"loc":{"start":{"line":1,"column":0,"index":0},"end":{"line":1,"column":5,"index":5}}},{"type":{"label":"name","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"foo","start":6,"end":9,"loc":{"start":{"line":1,"column":6,"index":6},"end":{"line":1,"column":9,"index":9}}},{"type":{"label":"=","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":true,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"=","start":10,"end":11,"loc":{"start":{"line":1,"column":10,"index":10},"end":{"line":1,"column":11,"index":11}}},{"type":{"label":"string","beforeExpr":false,"startsExpr":true,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"value":"foo","start":12,"end":17,"loc":{"start":{"line":1,"column":12,"index":12},"end":{"line":1,"column":17,"index":17}}},{"type":{"label":";","beforeExpr":true,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":17,"end":18,"loc":{"start":{"line":1,"column":17,"index":17},"end":{"line":1,"column":18,"index":18}}},{"type":{"label":"eof","beforeExpr":false,"startsExpr":false,"rightAssociative":false,"isLoop":false,"isAssign":false,"prefix":false,"postfix":false,"binop":null,"updateContext":null},"start":18,"end":18,"loc":{"start":{"line":1,"column":18,"index":18},"end":{"line":1,"column":18,"index":18}}}]}"`; -exports[`prints information for debugging AST --debug-print-ast (write) 1`] = `Array []`; +exports[`prints information for debugging AST --debug-print-ast (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap b/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap index fd5ce3845..c5980a035 100644 --- a/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap +++ b/tests/integration/__tests__/__snapshots__/debug-print-comments.js.snap @@ -48,4 +48,4 @@ exports[`prints information for debugging comment attachment with --debug-print- " `; -exports[`prints information for debugging comment attachment with --debug-print-comments (write) 1`] = `Array []`; +exports[`prints information for debugging comment attachment with --debug-print-comments (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/early-exit.js.snap b/tests/integration/__tests__/__snapshots__/early-exit.js.snap index ba09493f3..0daa6dcd4 100644 --- a/tests/integration/__tests__/__snapshots__/early-exit.js.snap +++ b/tests/integration/__tests__/__snapshots__/early-exit.js.snap @@ -9,7 +9,7 @@ exports[`show detailed usage with --help l (alias) (stdout) 1`] = ` " `; -exports[`show detailed usage with --help l (alias) (write) 1`] = `Array []`; +exports[`show detailed usage with --help l (alias) (write) 1`] = `[]`; exports[`show detailed usage with plugin options (automatic resolution) (stderr) 1`] = `""`; @@ -24,7 +24,7 @@ Plugin defaults: " `; -exports[`show detailed usage with plugin options (automatic resolution) (write) 1`] = `Array []`; +exports[`show detailed usage with plugin options (automatic resolution) (write) 1`] = `[]`; exports[`show detailed usage with plugin options (manual resolution) (stderr) 1`] = `""`; @@ -39,7 +39,7 @@ Plugin defaults: " `; -exports[`show detailed usage with plugin options (manual resolution) (write) 1`] = `Array []`; +exports[`show detailed usage with plugin options (manual resolution) (write) 1`] = `[]`; exports[`show usage with --help (stderr) 1`] = `""`; @@ -165,11 +165,11 @@ Other options: " `; -exports[`show usage with --help (write) 1`] = `Array []`; +exports[`show usage with --help (write) 1`] = `[]`; exports[`show version with --version (stderr) 1`] = `""`; -exports[`show version with --version (write) 1`] = `Array []`; +exports[`show version with --version (write) 1`] = `[]`; exports[`show warning with --help not-found (typo) (stderr) 1`] = ` "[warn] Unknown flag "parserr", did you mean "parser"? @@ -209,7 +209,7 @@ Valid options: " `; -exports[`show warning with --help not-found (typo) (write) 1`] = `Array []`; +exports[`show warning with --help not-found (typo) (write) 1`] = `[]`; exports[`throw error and show usage with something unexpected (stderr) 1`] = `""`; @@ -335,7 +335,7 @@ Other options: " `; -exports[`throw error and show usage with something unexpected (write) 1`] = `Array []`; +exports[`throw error and show usage with something unexpected (write) 1`] = `[]`; exports[`throw error with --check + --list-different (stderr) 1`] = ` "[error] Cannot use --check and --list-different together. @@ -344,7 +344,7 @@ exports[`throw error with --check + --list-different (stderr) 1`] = ` exports[`throw error with --check + --list-different (stdout) 1`] = `""`; -exports[`throw error with --check + --list-different (write) 1`] = `Array []`; +exports[`throw error with --check + --list-different (write) 1`] = `[]`; exports[`throw error with --file-info + multiple files (stderr) 1`] = ` "[error] Cannot use --file-info with multiple files @@ -353,7 +353,7 @@ exports[`throw error with --file-info + multiple files (stderr) 1`] = ` exports[`throw error with --file-info + multiple files (stdout) 1`] = `""`; -exports[`throw error with --file-info + multiple files (write) 1`] = `Array []`; +exports[`throw error with --file-info + multiple files (write) 1`] = `[]`; exports[`throw error with --find-config-path + multiple files (stderr) 1`] = ` "[error] Cannot use --find-config-path with multiple files @@ -362,7 +362,7 @@ exports[`throw error with --find-config-path + multiple files (stderr) 1`] = ` exports[`throw error with --find-config-path + multiple files (stdout) 1`] = `""`; -exports[`throw error with --find-config-path + multiple files (write) 1`] = `Array []`; +exports[`throw error with --find-config-path + multiple files (write) 1`] = `[]`; exports[`throw error with --help not-found (stderr) 1`] = ` "[error] Invalid --help value. Expected a flag, but received "not-found". @@ -371,7 +371,7 @@ exports[`throw error with --help not-found (stderr) 1`] = ` exports[`throw error with --help not-found (stdout) 1`] = `""`; -exports[`throw error with --help not-found (write) 1`] = `Array []`; +exports[`throw error with --help not-found (write) 1`] = `[]`; exports[`throw error with --write + --debug-check (stderr) 1`] = ` "[error] Cannot use --write and --debug-check together. @@ -380,4 +380,4 @@ exports[`throw error with --write + --debug-check (stderr) 1`] = ` exports[`throw error with --write + --debug-check (stdout) 1`] = `""`; -exports[`throw error with --write + --debug-check (write) 1`] = `Array []`; +exports[`throw error with --write + --debug-check (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap b/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap index 3c92dbe64..e8a274c60 100644 --- a/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap +++ b/tests/integration/__tests__/__snapshots__/error-on-unmatched-pattern.js.snap @@ -7,7 +7,7 @@ exports[`error on unmatched pattern (stderr) 1`] = ` exports[`error on unmatched pattern (stdout) 1`] = `""`; -exports[`error on unmatched pattern (write) 1`] = `Array []`; +exports[`error on unmatched pattern (write) 1`] = `[]`; exports[`error on unmatched pattern when 2nd glob has no match (stderr) 1`] = ` "[error] No files matching the pattern were found: "**/*.toml". @@ -23,7 +23,7 @@ hello: there " `; -exports[`error on unmatched pattern when 2nd glob has no match (write) 1`] = `Array []`; +exports[`error on unmatched pattern when 2nd glob has no match (write) 1`] = `[]`; exports[`no error on unmatched pattern (stderr) 1`] = `""`; @@ -32,7 +32,7 @@ exports[`no error on unmatched pattern (stdout) 1`] = ` " `; -exports[`no error on unmatched pattern (write) 1`] = `Array []`; +exports[`no error on unmatched pattern (write) 1`] = `[]`; exports[`no error on unmatched pattern when 2nd glob has no match (stderr) 1`] = `""`; @@ -45,4 +45,4 @@ hello: there " `; -exports[`no error on unmatched pattern when 2nd glob has no match (write) 1`] = `Array []`; +exports[`no error on unmatched pattern when 2nd glob has no match (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/file-info.js.snap b/tests/integration/__tests__/__snapshots__/file-info.js.snap index d10bc2c3a..e9d535992 100644 --- a/tests/integration/__tests__/__snapshots__/file-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/file-info.js.snap @@ -8,7 +8,7 @@ exports[`extracts file-info for a file in not_node_modules (stdout) 1`] = ` " `; -exports[`extracts file-info for a file in not_node_modules (write) 1`] = `Array []`; +exports[`extracts file-info for a file in not_node_modules (write) 1`] = `[]`; exports[`extracts file-info for a js file (stderr) 1`] = `""`; @@ -18,7 +18,7 @@ exports[`extracts file-info for a js file (stdout) 1`] = ` " `; -exports[`extracts file-info for a js file (write) 1`] = `Array []`; +exports[`extracts file-info for a js file (write) 1`] = `[]`; exports[`extracts file-info for a known markdown file with no extension (stderr) 1`] = `""`; @@ -28,7 +28,7 @@ exports[`extracts file-info for a known markdown file with no extension (stdout) " `; -exports[`extracts file-info for a known markdown file with no extension (write) 1`] = `Array []`; +exports[`extracts file-info for a known markdown file with no extension (write) 1`] = `[]`; exports[`extracts file-info for a markdown file (stderr) 1`] = `""`; @@ -38,7 +38,7 @@ exports[`extracts file-info for a markdown file (stdout) 1`] = ` " `; -exports[`extracts file-info for a markdown file (write) 1`] = `Array []`; +exports[`extracts file-info for a markdown file (write) 1`] = `[]`; exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (stderr) 1`] = `""`; @@ -48,7 +48,7 @@ exports[`extracts file-info with ignored=false for a file in node_modules when - " `; -exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (write) 1`] = `Array []`; +exports[`extracts file-info with ignored=false for a file in node_modules when --with-node-modules provided (write) 1`] = `[]`; exports[`extracts file-info with ignored=true for a file in .prettierignore (stderr) 1`] = `""`; @@ -58,7 +58,7 @@ exports[`extracts file-info with ignored=true for a file in .prettierignore (std " `; -exports[`extracts file-info with ignored=true for a file in .prettierignore (write) 1`] = `Array []`; +exports[`extracts file-info with ignored=true for a file in .prettierignore (write) 1`] = `[]`; exports[`extracts file-info with ignored=true for a file in a hand-picked .prettierignore (stderr) 1`] = `""`; @@ -68,7 +68,7 @@ exports[`extracts file-info with ignored=true for a file in a hand-picked .prett " `; -exports[`extracts file-info with ignored=true for a file in a hand-picked .prettierignore (write) 1`] = `Array []`; +exports[`extracts file-info with ignored=true for a file in a hand-picked .prettierignore (write) 1`] = `[]`; exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (stderr) 1`] = `""`; @@ -78,7 +78,7 @@ exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked " `; -exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (write) 1`] = `Array []`; +exports[`extracts file-info with inferredParser=foo when a plugin is hand-picked (write) 1`] = `[]`; exports[`extracts file-info with inferredParser=foo when plugins are autoloaded (stderr) 1`] = `""`; @@ -88,7 +88,7 @@ exports[`extracts file-info with inferredParser=foo when plugins are autoloaded " `; -exports[`extracts file-info with inferredParser=foo when plugins are autoloaded (write) 1`] = `Array []`; +exports[`extracts file-info with inferredParser=foo when plugins are autoloaded (write) 1`] = `[]`; exports[`extracts file-info with inferredParser=foo when plugins are loaded with --plugin-search-dir (stderr) 1`] = `""`; @@ -98,7 +98,7 @@ exports[`extracts file-info with inferredParser=foo when plugins are loaded with " `; -exports[`extracts file-info with inferredParser=foo when plugins are loaded with --plugin-search-dir (write) 1`] = `Array []`; +exports[`extracts file-info with inferredParser=foo when plugins are loaded with --plugin-search-dir (write) 1`] = `[]`; exports[`extracts file-info with inferredParser=null for file.foo (stderr) 1`] = `""`; @@ -108,7 +108,7 @@ exports[`extracts file-info with inferredParser=null for file.foo (stdout) 1`] = " `; -exports[`extracts file-info with inferredParser=null for file.foo (write) 1`] = `Array []`; +exports[`extracts file-info with inferredParser=null for file.foo (write) 1`] = `[]`; exports[`extracts file-info with with ignored=true for a file in node_modules (stderr) 1`] = `""`; @@ -118,7 +118,7 @@ exports[`extracts file-info with with ignored=true for a file in node_modules (s " `; -exports[`extracts file-info with with ignored=true for a file in node_modules (write) 1`] = `Array []`; +exports[`extracts file-info with with ignored=true for a file in node_modules (write) 1`] = `[]`; exports[`file-info should not try resolve config with --no-config (stdout) 1`] = ` "{ "ignored": false, "inferredParser": "babel" } @@ -134,7 +134,7 @@ exports[`file-info should try resolve config (stdout) 1`] = ` " `; -exports[`file-info should try resolve config (write) 1`] = `Array []`; +exports[`file-info should try resolve config (write) 1`] = `[]`; exports[`non-exists ignore path (stderr) 1`] = `""`; @@ -144,4 +144,4 @@ exports[`non-exists ignore path (stdout) 1`] = ` " `; -exports[`non-exists ignore path (write) 1`] = `Array []`; +exports[`non-exists ignore path (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/help-options.js.snap b/tests/integration/__tests__/__snapshots__/help-options.js.snap index 98fbd7470..a90130ce8 100644 --- a/tests/integration/__tests__/__snapshots__/help-options.js.snap +++ b/tests/integration/__tests__/__snapshots__/help-options.js.snap @@ -16,7 +16,7 @@ Default: always " `; -exports[`show detailed usage with --help arrow-parens (write) 1`] = `Array []`; +exports[`show detailed usage with --help arrow-parens (write) 1`] = `[]`; exports[`show detailed usage with --help bracket-same-line (stderr) 1`] = `""`; @@ -29,7 +29,7 @@ Default: false " `; -exports[`show detailed usage with --help bracket-same-line (write) 1`] = `Array []`; +exports[`show detailed usage with --help bracket-same-line (write) 1`] = `[]`; exports[`show detailed usage with --help bracket-spacing (stderr) 1`] = `""`; @@ -42,7 +42,7 @@ Default: true " `; -exports[`show detailed usage with --help bracket-spacing (write) 1`] = `Array []`; +exports[`show detailed usage with --help bracket-spacing (write) 1`] = `[]`; exports[`show detailed usage with --help check (stderr) 1`] = `""`; @@ -54,7 +54,7 @@ exports[`show detailed usage with --help check (stdout) 1`] = ` " `; -exports[`show detailed usage with --help check (write) 1`] = `Array []`; +exports[`show detailed usage with --help check (write) 1`] = `[]`; exports[`show detailed usage with --help color (stderr) 1`] = `""`; @@ -67,7 +67,7 @@ Default: true " `; -exports[`show detailed usage with --help color (write) 1`] = `Array []`; +exports[`show detailed usage with --help color (write) 1`] = `[]`; exports[`show detailed usage with --help config (stderr) 1`] = `""`; @@ -78,7 +78,7 @@ exports[`show detailed usage with --help config (stdout) 1`] = ` " `; -exports[`show detailed usage with --help config (write) 1`] = `Array []`; +exports[`show detailed usage with --help config (write) 1`] = `[]`; exports[`show detailed usage with --help config-precedence (stderr) 1`] = `""`; @@ -98,7 +98,7 @@ Default: cli-override " `; -exports[`show detailed usage with --help config-precedence (write) 1`] = `Array []`; +exports[`show detailed usage with --help config-precedence (write) 1`] = `[]`; exports[`show detailed usage with --help cursor-offset (stderr) 1`] = `""`; @@ -112,7 +112,7 @@ Default: -1 " `; -exports[`show detailed usage with --help cursor-offset (write) 1`] = `Array []`; +exports[`show detailed usage with --help cursor-offset (write) 1`] = `[]`; exports[`show detailed usage with --help editorconfig (stderr) 1`] = `""`; @@ -125,7 +125,7 @@ Default: true " `; -exports[`show detailed usage with --help editorconfig (write) 1`] = `Array []`; +exports[`show detailed usage with --help editorconfig (write) 1`] = `[]`; exports[`show detailed usage with --help embedded-language-formatting (stderr) 1`] = `""`; @@ -143,7 +143,7 @@ Default: auto " `; -exports[`show detailed usage with --help embedded-language-formatting (write) 1`] = `Array []`; +exports[`show detailed usage with --help embedded-language-formatting (write) 1`] = `[]`; exports[`show detailed usage with --help end-of-line (stderr) 1`] = `""`; @@ -164,7 +164,7 @@ Default: lf " `; -exports[`show detailed usage with --help end-of-line (write) 1`] = `Array []`; +exports[`show detailed usage with --help end-of-line (write) 1`] = `[]`; exports[`show detailed usage with --help file-info (stderr) 1`] = `""`; @@ -177,7 +177,7 @@ exports[`show detailed usage with --help file-info (stdout) 1`] = ` " `; -exports[`show detailed usage with --help file-info (write) 1`] = `Array []`; +exports[`show detailed usage with --help file-info (write) 1`] = `[]`; exports[`show detailed usage with --help find-config-path (stderr) 1`] = `""`; @@ -188,7 +188,7 @@ exports[`show detailed usage with --help find-config-path (stdout) 1`] = ` " `; -exports[`show detailed usage with --help find-config-path (write) 1`] = `Array []`; +exports[`show detailed usage with --help find-config-path (write) 1`] = `[]`; exports[`show detailed usage with --help help (stderr) 1`] = `""`; @@ -200,7 +200,7 @@ exports[`show detailed usage with --help help (stdout) 1`] = ` " `; -exports[`show detailed usage with --help help (write) 1`] = `Array []`; +exports[`show detailed usage with --help help (write) 1`] = `[]`; exports[`show detailed usage with --help html-whitespace-sensitivity (stderr) 1`] = `""`; @@ -219,7 +219,7 @@ Default: css " `; -exports[`show detailed usage with --help html-whitespace-sensitivity (write) 1`] = `Array []`; +exports[`show detailed usage with --help html-whitespace-sensitivity (write) 1`] = `[]`; exports[`show detailed usage with --help ignore-path (stderr) 1`] = `""`; @@ -232,7 +232,7 @@ Default: .prettierignore " `; -exports[`show detailed usage with --help ignore-path (write) 1`] = `Array []`; +exports[`show detailed usage with --help ignore-path (write) 1`] = `[]`; exports[`show detailed usage with --help ignore-unknown (stderr) 1`] = `""`; @@ -243,7 +243,7 @@ exports[`show detailed usage with --help ignore-unknown (stdout) 1`] = ` " `; -exports[`show detailed usage with --help ignore-unknown (write) 1`] = `Array []`; +exports[`show detailed usage with --help ignore-unknown (write) 1`] = `[]`; exports[`show detailed usage with --help insert-pragma (stderr) 1`] = `""`; @@ -256,7 +256,7 @@ Default: false " `; -exports[`show detailed usage with --help insert-pragma (write) 1`] = `Array []`; +exports[`show detailed usage with --help insert-pragma (write) 1`] = `[]`; exports[`show detailed usage with --help jsx-single-quote (stderr) 1`] = `""`; @@ -269,7 +269,7 @@ Default: false " `; -exports[`show detailed usage with --help jsx-single-quote (write) 1`] = `Array []`; +exports[`show detailed usage with --help jsx-single-quote (write) 1`] = `[]`; exports[`show detailed usage with --help list-different (stderr) 1`] = `""`; @@ -280,7 +280,7 @@ exports[`show detailed usage with --help list-different (stdout) 1`] = ` " `; -exports[`show detailed usage with --help list-different (write) 1`] = `Array []`; +exports[`show detailed usage with --help list-different (write) 1`] = `[]`; exports[`show detailed usage with --help loglevel (stderr) 1`] = `""`; @@ -301,7 +301,7 @@ Default: log " `; -exports[`show detailed usage with --help loglevel (write) 1`] = `Array []`; +exports[`show detailed usage with --help loglevel (write) 1`] = `[]`; exports[`show detailed usage with --help no-bracket-spacing (stderr) 1`] = `""`; @@ -312,7 +312,7 @@ exports[`show detailed usage with --help no-bracket-spacing (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-bracket-spacing (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-bracket-spacing (write) 1`] = `[]`; exports[`show detailed usage with --help no-color (stderr) 1`] = `""`; @@ -323,7 +323,7 @@ exports[`show detailed usage with --help no-color (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-color (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-color (write) 1`] = `[]`; exports[`show detailed usage with --help no-config (stderr) 1`] = `""`; @@ -334,7 +334,7 @@ exports[`show detailed usage with --help no-config (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-config (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-config (write) 1`] = `[]`; exports[`show detailed usage with --help no-editorconfig (stderr) 1`] = `""`; @@ -345,7 +345,7 @@ exports[`show detailed usage with --help no-editorconfig (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-editorconfig (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-editorconfig (write) 1`] = `[]`; exports[`show detailed usage with --help no-error-on-unmatched-pattern (stderr) 1`] = `""`; @@ -356,7 +356,7 @@ exports[`show detailed usage with --help no-error-on-unmatched-pattern (stdout) " `; -exports[`show detailed usage with --help no-error-on-unmatched-pattern (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-error-on-unmatched-pattern (write) 1`] = `[]`; exports[`show detailed usage with --help no-plugin-search (stderr) 1`] = `""`; @@ -367,7 +367,7 @@ exports[`show detailed usage with --help no-plugin-search (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-plugin-search (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-plugin-search (write) 1`] = `[]`; exports[`show detailed usage with --help no-semi (stderr) 1`] = `""`; @@ -378,7 +378,7 @@ exports[`show detailed usage with --help no-semi (stdout) 1`] = ` " `; -exports[`show detailed usage with --help no-semi (write) 1`] = `Array []`; +exports[`show detailed usage with --help no-semi (write) 1`] = `[]`; exports[`show detailed usage with --help parser (stderr) 1`] = `""`; @@ -415,7 +415,7 @@ Valid options: " `; -exports[`show detailed usage with --help parser (write) 1`] = `Array []`; +exports[`show detailed usage with --help parser (write) 1`] = `[]`; exports[`show detailed usage with --help plugin (stderr) 1`] = `""`; @@ -428,7 +428,7 @@ Default: [] " `; -exports[`show detailed usage with --help plugin (write) 1`] = `Array []`; +exports[`show detailed usage with --help plugin (write) 1`] = `[]`; exports[`show detailed usage with --help plugin-search-dir (stderr) 1`] = `""`; @@ -443,7 +443,7 @@ Default: [] " `; -exports[`show detailed usage with --help plugin-search-dir (write) 1`] = `Array []`; +exports[`show detailed usage with --help plugin-search-dir (write) 1`] = `[]`; exports[`show detailed usage with --help print-width (stderr) 1`] = `""`; @@ -456,7 +456,7 @@ Default: 80 " `; -exports[`show detailed usage with --help print-width (write) 1`] = `Array []`; +exports[`show detailed usage with --help print-width (write) 1`] = `[]`; exports[`show detailed usage with --help prose-wrap (stderr) 1`] = `""`; @@ -475,7 +475,7 @@ Default: preserve " `; -exports[`show detailed usage with --help prose-wrap (write) 1`] = `Array []`; +exports[`show detailed usage with --help prose-wrap (write) 1`] = `[]`; exports[`show detailed usage with --help quote-props (stderr) 1`] = `""`; @@ -494,7 +494,7 @@ Default: as-needed " `; -exports[`show detailed usage with --help quote-props (write) 1`] = `Array []`; +exports[`show detailed usage with --help quote-props (write) 1`] = `[]`; exports[`show detailed usage with --help range-end (stderr) 1`] = `""`; @@ -509,7 +509,7 @@ Default: Infinity " `; -exports[`show detailed usage with --help range-end (write) 1`] = `Array []`; +exports[`show detailed usage with --help range-end (write) 1`] = `[]`; exports[`show detailed usage with --help range-start (stderr) 1`] = `""`; @@ -524,7 +524,7 @@ Default: 0 " `; -exports[`show detailed usage with --help range-start (write) 1`] = `Array []`; +exports[`show detailed usage with --help range-start (write) 1`] = `[]`; exports[`show detailed usage with --help require-pragma (stderr) 1`] = `""`; @@ -538,7 +538,7 @@ Default: false " `; -exports[`show detailed usage with --help require-pragma (write) 1`] = `Array []`; +exports[`show detailed usage with --help require-pragma (write) 1`] = `[]`; exports[`show detailed usage with --help semi (stderr) 1`] = `""`; @@ -551,7 +551,7 @@ Default: true " `; -exports[`show detailed usage with --help semi (write) 1`] = `Array []`; +exports[`show detailed usage with --help semi (write) 1`] = `[]`; exports[`show detailed usage with --help single-attribute-per-line (stderr) 1`] = `""`; @@ -564,7 +564,7 @@ Default: false " `; -exports[`show detailed usage with --help single-attribute-per-line (write) 1`] = `Array []`; +exports[`show detailed usage with --help single-attribute-per-line (write) 1`] = `[]`; exports[`show detailed usage with --help single-quote (stderr) 1`] = `""`; @@ -577,7 +577,7 @@ Default: false " `; -exports[`show detailed usage with --help single-quote (write) 1`] = `Array []`; +exports[`show detailed usage with --help single-quote (write) 1`] = `[]`; exports[`show detailed usage with --help stdin-filepath (stderr) 1`] = `""`; @@ -588,7 +588,7 @@ exports[`show detailed usage with --help stdin-filepath (stdout) 1`] = ` " `; -exports[`show detailed usage with --help stdin-filepath (write) 1`] = `Array []`; +exports[`show detailed usage with --help stdin-filepath (write) 1`] = `[]`; exports[`show detailed usage with --help support-info (stderr) 1`] = `""`; @@ -599,7 +599,7 @@ exports[`show detailed usage with --help support-info (stdout) 1`] = ` " `; -exports[`show detailed usage with --help support-info (write) 1`] = `Array []`; +exports[`show detailed usage with --help support-info (write) 1`] = `[]`; exports[`show detailed usage with --help tab-width (stderr) 1`] = `""`; @@ -612,7 +612,7 @@ Default: 2 " `; -exports[`show detailed usage with --help tab-width (write) 1`] = `Array []`; +exports[`show detailed usage with --help tab-width (write) 1`] = `[]`; exports[`show detailed usage with --help trailing-comma (stderr) 1`] = `""`; @@ -631,7 +631,7 @@ Default: es5 " `; -exports[`show detailed usage with --help trailing-comma (write) 1`] = `Array []`; +exports[`show detailed usage with --help trailing-comma (write) 1`] = `[]`; exports[`show detailed usage with --help use-tabs (stderr) 1`] = `""`; @@ -644,7 +644,7 @@ Default: false " `; -exports[`show detailed usage with --help use-tabs (write) 1`] = `Array []`; +exports[`show detailed usage with --help use-tabs (write) 1`] = `[]`; exports[`show detailed usage with --help version (stderr) 1`] = `""`; @@ -655,7 +655,7 @@ exports[`show detailed usage with --help version (stdout) 1`] = ` " `; -exports[`show detailed usage with --help version (write) 1`] = `Array []`; +exports[`show detailed usage with --help version (write) 1`] = `[]`; exports[`show detailed usage with --help vue-indent-script-and-style (stderr) 1`] = `""`; @@ -668,7 +668,7 @@ Default: false " `; -exports[`show detailed usage with --help vue-indent-script-and-style (write) 1`] = `Array []`; +exports[`show detailed usage with --help vue-indent-script-and-style (write) 1`] = `[]`; exports[`show detailed usage with --help with-node-modules (stderr) 1`] = `""`; @@ -679,7 +679,7 @@ exports[`show detailed usage with --help with-node-modules (stdout) 1`] = ` " `; -exports[`show detailed usage with --help with-node-modules (write) 1`] = `Array []`; +exports[`show detailed usage with --help with-node-modules (write) 1`] = `[]`; exports[`show detailed usage with --help write (stderr) 1`] = `""`; @@ -690,4 +690,4 @@ exports[`show detailed usage with --help write (stdout) 1`] = ` " `; -exports[`show detailed usage with --help write (write) 1`] = `Array []`; +exports[`show detailed usage with --help write (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap index 32694e8e7..120016090 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-absolute-path.js.snap @@ -7,4 +7,4 @@ exports[`support absolute filename (stdout) 1`] = ` " `; -exports[`support absolute filename (write) 1`] = `Array []`; +exports[`support absolute filename (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap b/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap index f23c9e8b6..ea1e698c2 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-emoji.js.snap @@ -7,10 +7,10 @@ exports[`ignores file name contains emoji (stdout) 1`] = ` " `; -exports[`ignores file name contains emoji (write) 1`] = `Array []`; +exports[`ignores file name contains emoji (write) 1`] = `[]`; exports[`stdin (stderr) 1`] = `""`; exports[`stdin (stdout) 1`] = `".name { display: none; }"`; -exports[`stdin (write) 1`] = `Array []`; +exports[`stdin (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap b/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap index 42ee78196..ab13f5025 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-in-subdirectories.js.snap @@ -14,17 +14,17 @@ exports[`formats files when executing in a subdirectory (stdout) 2`] = ` " `; -exports[`formats files when executing in a subdirectory (write) 1`] = `Array []`; +exports[`formats files when executing in a subdirectory (write) 1`] = `[]`; -exports[`formats files when executing in a subdirectory (write) 2`] = `Array []`; +exports[`formats files when executing in a subdirectory (write) 2`] = `[]`; exports[`formats files when executing in a subdirectory and using stdin (stderr) 1`] = `""`; -exports[`formats files when executing in a subdirectory and using stdin (write) 1`] = `Array []`; +exports[`formats files when executing in a subdirectory and using stdin (write) 1`] = `[]`; exports[`ignore files when executing in a subdirectory and using stdin (stderr) 1`] = `""`; -exports[`ignore files when executing in a subdirectory and using stdin (write) 1`] = `Array []`; +exports[`ignore files when executing in a subdirectory and using stdin (write) 1`] = `[]`; exports[`ignores files when executing in a subdirectory (stderr) 1`] = `""`; @@ -34,6 +34,6 @@ exports[`ignores files when executing in a subdirectory (stdout) 1`] = `""`; exports[`ignores files when executing in a subdirectory (stdout) 2`] = `""`; -exports[`ignores files when executing in a subdirectory (write) 1`] = `Array []`; +exports[`ignores files when executing in a subdirectory (write) 1`] = `[]`; -exports[`ignores files when executing in a subdirectory (write) 2`] = `Array []`; +exports[`ignores files when executing in a subdirectory (write) 2`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-path.js.snap index b748a30d9..e5655fe8d 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-path.js.snap @@ -7,7 +7,7 @@ exports[`ignore file when using --debug-check (stdout) 1`] = ` " `; -exports[`ignore file when using --debug-check (write) 1`] = `Array []`; +exports[`ignore file when using --debug-check (write) 1`] = `[]`; exports[`ignore path (stderr) 1`] = `""`; @@ -16,7 +16,7 @@ exports[`ignore path (stdout) 1`] = ` " `; -exports[`ignore path (write) 1`] = `Array []`; +exports[`ignore path (write) 1`] = `[]`; exports[`outputs files as-is if no --write (stderr) 1`] = `""`; @@ -25,7 +25,7 @@ exports[`outputs files as-is if no --write (stdout) 1`] = ` " `; -exports[`outputs files as-is if no --write (write) 1`] = `Array []`; +exports[`outputs files as-is if no --write (write) 1`] = `[]`; exports[`support .prettierignore (stderr) 1`] = `""`; @@ -34,4 +34,4 @@ exports[`support .prettierignore (stdout) 1`] = ` " `; -exports[`support .prettierignore (write) 1`] = `Array []`; +exports[`support .prettierignore (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap b/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap index 5940187b2..6b1d6b92a 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-relative-path.js.snap @@ -9,4 +9,4 @@ level1-glob/shouldNotBeIgnored.js " `; -exports[`support relative paths (write) 1`] = `Array []`; +exports[`support relative paths (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap b/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap index 9f7ab764e..285b799cc 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-unknown.js.snap @@ -4,7 +4,7 @@ exports[`Ignored file (stderr) 1`] = `""`; exports[`Ignored file (stdout) 1`] = `""`; -exports[`Ignored file (write) 1`] = `Array []`; +exports[`Ignored file (write) 1`] = `[]`; exports[`None exist file (stderr) 1`] = ` "[error] No files matching the pattern were found: "non-exist-file". @@ -13,7 +13,7 @@ exports[`None exist file (stderr) 1`] = ` exports[`None exist file (stdout) 1`] = `""`; -exports[`None exist file (write) 1`] = `Array []`; +exports[`None exist file (write) 1`] = `[]`; exports[`Not matching pattern (stderr) 1`] = ` "[error] No files matching the pattern were found: "*.non-exist-pattern". @@ -22,7 +22,7 @@ exports[`Not matching pattern (stderr) 1`] = ` exports[`Not matching pattern (stdout) 1`] = `""`; -exports[`Not matching pattern (write) 1`] = `Array []`; +exports[`Not matching pattern (write) 1`] = `[]`; exports[`ignore-unknown alias (stdout) 1`] = ` "javascript.js @@ -40,7 +40,7 @@ exports[`ignore-unknown check (stdout) 1`] = ` " `; -exports[`ignore-unknown check (write) 1`] = `Array []`; +exports[`ignore-unknown check (write) 1`] = `[]`; exports[`ignore-unknown dir (stdout) 1`] = ` "javascript.js @@ -59,8 +59,8 @@ exports[`ignore-unknown write (stdout) 1`] = ` `; exports[`ignore-unknown write (write) 1`] = ` -Array [ - Object { +[ + { "content": "const foo = "bar"; ", "filename": "javascript.js", diff --git a/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap b/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap index c265128e8..612c4c62e 100644 --- a/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap +++ b/tests/integration/__tests__/__snapshots__/ignore-vcs-files.js.snap @@ -7,4 +7,4 @@ exports[`ignores files in version control systems (stdout) 1`] = ` " `; -exports[`ignores files in version control systems (write) 1`] = `Array []`; +exports[`ignores files in version control systems (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/infer-parser.js.snap b/tests/integration/__tests__/__snapshots__/infer-parser.js.snap index 44ca2f3e9..9e75d1a6c 100644 --- a/tests/integration/__tests__/__snapshots__/infer-parser.js.snap +++ b/tests/integration/__tests__/__snapshots__/infer-parser.js.snap @@ -46,8 +46,8 @@ exports[`--write and --check with unknown path and no parser multiple files (std `; exports[`--write and --check with unknown path and no parser multiple files (write) 1`] = ` -Array [ - Object { +[ + { "content": "foo(); ", "filename": "foo.js", @@ -77,8 +77,8 @@ exports[`--write and --list-different with unknown path and no parser multiple f `; exports[`--write and --list-different with unknown path and no parser multiple files (write) 1`] = ` -Array [ - Object { +[ + { "content": "foo(); ", "filename": "foo.js", @@ -102,8 +102,8 @@ exports[`--write with unknown path and no parser multiple files (stdout) 1`] = ` `; exports[`--write with unknown path and no parser multiple files (write) 1`] = ` -Array [ - Object { +[ + { "content": "foo(); ", "filename": "foo.js", @@ -117,13 +117,13 @@ exports[`--write with unknown path and no parser specific file (stderr) 1`] = ` `; exports[`API with no path and no parser prettier.check 1`] = ` -Array [ +[ "No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.", ] `; exports[`API with no path and no parser prettier.format 1`] = ` -Array [ +[ "No parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.", ] `; diff --git a/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap b/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap index f0ae71095..6cb6cf176 100644 --- a/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap +++ b/tests/integration/__tests__/__snapshots__/invalid-ignore.js.snap @@ -7,4 +7,4 @@ exports[`throw error with invalid ignore (stderr) 1`] = ` exports[`throw error with invalid ignore (stdout) 1`] = `""`; -exports[`throw error with invalid ignore (write) 1`] = `Array []`; +exports[`throw error with invalid ignore (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/list-different.js.snap b/tests/integration/__tests__/__snapshots__/list-different.js.snap index a4de14a0c..1fd48596b 100644 --- a/tests/integration/__tests__/__snapshots__/list-different.js.snap +++ b/tests/integration/__tests__/__snapshots__/list-different.js.snap @@ -14,10 +14,10 @@ exports[`--list-different works in CI just as in a non-TTY mode (stdout) 2`] = ` " `; -exports[`--list-different works in CI just as in a non-TTY mode (write) 1`] = `Array []`; +exports[`--list-different works in CI just as in a non-TTY mode (write) 1`] = `[]`; -exports[`--list-different works in CI just as in a non-TTY mode (write) 2`] = `Array []`; +exports[`--list-different works in CI just as in a non-TTY mode (write) 2`] = `[]`; -exports[`checks stdin with --list-different (write) 1`] = `Array []`; +exports[`checks stdin with --list-different (write) 1`] = `[]`; -exports[`checks stdin with -l (alias for --list-different) (write) 1`] = `Array []`; +exports[`checks stdin with -l (alias for --list-different) (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/load-toml.js.snap b/tests/integration/__tests__/__snapshots__/load-toml.js.snap index 75b5b616b..c0ef4d032 100644 --- a/tests/integration/__tests__/__snapshots__/load-toml.js.snap +++ b/tests/integration/__tests__/__snapshots__/load-toml.js.snap @@ -1,18 +1,18 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TOML loads toml successfully 1`] = ` -Object { - "database": Object { +{ + "database": { "connection_max": 5000, "enabled": true, - "ports": Array [ + "ports": [ 8001, 8001, 8002, ], "server": "192.168.1.1", }, - "owner": Object { + "owner": { "dob": 1979-05-27T15:32:00.000Z, "name": "Tom Preston-Werner", }, diff --git a/tests/integration/__tests__/__snapshots__/loglevel.js.snap b/tests/integration/__tests__/__snapshots__/loglevel.js.snap index f4030895b..e5d13422e 100644 --- a/tests/integration/__tests__/__snapshots__/loglevel.js.snap +++ b/tests/integration/__tests__/__snapshots__/loglevel.js.snap @@ -5,8 +5,8 @@ exports[`--write with --loglevel=silent doesn't log filenames (stderr) 1`] = `"" exports[`--write with --loglevel=silent doesn't log filenames (stdout) 1`] = `""`; exports[`--write with --loglevel=silent doesn't log filenames (write) 1`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", diff --git a/tests/integration/__tests__/__snapshots__/parser-api.js.snap b/tests/integration/__tests__/__snapshots__/parser-api.js.snap index 047ca6ac7..4ee558265 100644 --- a/tests/integration/__tests__/__snapshots__/parser-api.js.snap +++ b/tests/integration/__tests__/__snapshots__/parser-api.js.snap @@ -8,4 +8,4 @@ bar(); " `; -exports[`allows passing a string to resolve a parser (write) 1`] = `Array []`; +exports[`allows passing a string to resolve a parser (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap b/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap index d852e8b1d..f64e341d2 100644 --- a/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap +++ b/tests/integration/__tests__/__snapshots__/patterns-glob.js.snap @@ -9,7 +9,7 @@ b.js " `; -exports[`fixtures-1: Should match all files (write) 1`] = `Array []`; +exports[`fixtures-1: Should match all files (write) 1`] = `[]`; exports[`fixtures-1: Should match files except \`a.js\` (stderr) 1`] = `""`; @@ -19,7 +19,7 @@ b.js " `; -exports[`fixtures-1: Should match files except \`a.js\` (write) 1`] = `Array []`; +exports[`fixtures-1: Should match files except \`a.js\` (write) 1`] = `[]`; exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (stderr) 1`] = `""`; @@ -29,7 +29,7 @@ a.js " `; -exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (write) 1`] = `Array []`; +exports[`fixtures-2: Should match \`a.js\` and \`!b.js\` (write) 1`] = `[]`; exports[`fixtures-2: Should match all js files and all supported files in the '!dir.js' directory (stderr) 1`] = `""`; @@ -41,7 +41,7 @@ a.js " `; -exports[`fixtures-2: Should match all js files and all supported files in the '!dir.js' directory (write) 1`] = `Array []`; +exports[`fixtures-2: Should match all js files and all supported files in the '!dir.js' directory (write) 1`] = `[]`; exports[`fixtures-2: Should only match \`!b.js\` (stderr) 1`] = `""`; @@ -50,7 +50,7 @@ exports[`fixtures-2: Should only match \`!b.js\` (stdout) 1`] = ` " `; -exports[`fixtures-2: Should only match \`!b.js\` (write) 1`] = `Array []`; +exports[`fixtures-2: Should only match \`!b.js\` (write) 1`] = `[]`; exports[`fixtures-3: Should exclude \`.svn\` (existing) (stderr) 1`] = `""`; @@ -59,7 +59,7 @@ exports[`fixtures-3: Should exclude \`.svn\` (existing) (stdout) 1`] = ` " `; -exports[`fixtures-3: Should exclude \`.svn\` (existing) (write) 1`] = `Array []`; +exports[`fixtures-3: Should exclude \`.svn\` (existing) (write) 1`] = `[]`; exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (stderr) 1`] = `""`; @@ -68,7 +68,7 @@ exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (stdout) 1`] = ` " `; -exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (write) 1`] = `Array []`; +exports[`fixtures-3: Should exclude \`.svn\` (nonexisting) (write) 1`] = `[]`; exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/node_modules/in-node_modules.js\` (stderr) 1`] = `""`; @@ -79,7 +79,7 @@ outside.js " `; -exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/node_modules/in-node_modules.js\` (write) 1`] = `Array []`; +exports[`fixtures-3: Should match \`outside.js\`, \`dir/inside.js\` and \`dir/node_modules/in-node_modules.js\` (write) 1`] = `[]`; exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (stderr) 1`] = `""`; @@ -89,7 +89,7 @@ outside.js " `; -exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (write) 1`] = `Array []`; +exports[`fixtures-3: Should only match \`outside.js\` and \`dir/inside.js\` (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` #2 (stderr) 1`] = `""`; @@ -98,7 +98,7 @@ exports[`fixtures-4: Should match \`level-1.js\` #2 (stdout) 1`] = ` " `; -exports[`fixtures-4: Should match \`level-1.js\` #2 (write) 1`] = `Array []`; +exports[`fixtures-4: Should match \`level-1.js\` #2 (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` #3 (stderr) 1`] = `""`; @@ -107,7 +107,7 @@ exports[`fixtures-4: Should match \`level-1.js\` #3 (stdout) 1`] = ` " `; -exports[`fixtures-4: Should match \`level-1.js\` #3 (write) 1`] = `Array []`; +exports[`fixtures-4: Should match \`level-1.js\` #3 (write) 1`] = `[]`; exports[`fixtures-4: Should match \`level-1.js\` (stderr) 1`] = `""`; @@ -116,7 +116,7 @@ exports[`fixtures-4: Should match \`level-1.js\` (stdout) 1`] = ` " `; -exports[`fixtures-4: Should match \`level-1.js\` (write) 1`] = `Array []`; +exports[`fixtures-4: Should match \`level-1.js\` (write) 1`] = `[]`; exports[`should not ignore file paths contains object prototype keys (stderr) 1`] = `""`; @@ -125,4 +125,4 @@ exports[`should not ignore file paths contains object prototype keys (stdout) 1` " `; -exports[`should not ignore file paths contains object prototype keys (write) 1`] = `Array []`; +exports[`should not ignore file paths contains object prototype keys (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/patterns.js.snap b/tests/integration/__tests__/__snapshots__/patterns.js.snap index d2ebdb3c7..e8cd41646 100644 --- a/tests/integration/__tests__/__snapshots__/patterns.js.snap +++ b/tests/integration/__tests__/__snapshots__/patterns.js.snap @@ -10,7 +10,7 @@ other-directory/nested-directory/nested-directory-file.js " `; -exports[`multiple patterns (write) 1`] = `Array []`; +exports[`multiple patterns (write) 1`] = `[]`; exports[`multiple patterns by with ignore pattern, doesn't ignore node_modules with --with-node-modules flag (stderr) 1`] = `""`; @@ -23,7 +23,7 @@ regular-module.js " `; -exports[`multiple patterns by with ignore pattern, doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `Array []`; +exports[`multiple patterns by with ignore pattern, doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `[]`; exports[`multiple patterns by with ignore pattern, ignores node_modules by default (stderr) 1`] = `""`; @@ -35,7 +35,7 @@ regular-module.js " `; -exports[`multiple patterns by with ignore pattern, ignores node_modules by default (write) 1`] = `Array []`; +exports[`multiple patterns by with ignore pattern, ignores node_modules by default (write) 1`] = `[]`; exports[`multiple patterns by with ignore pattern, ignores node_modules by with ./**/*.js (stderr) 1`] = `""`; @@ -47,7 +47,7 @@ regular-module.js " `; -exports[`multiple patterns by with ignore pattern, ignores node_modules by with ./**/*.js (write) 1`] = `Array []`; +exports[`multiple patterns by with ignore pattern, ignores node_modules by with ./**/*.js (write) 1`] = `[]`; exports[`multiple patterns with ignore nested directories pattern (stderr) 1`] = `""`; @@ -59,7 +59,7 @@ regular-module.js " `; -exports[`multiple patterns with ignore nested directories pattern (write) 1`] = `Array []`; +exports[`multiple patterns with ignore nested directories pattern (write) 1`] = `[]`; exports[`multiple patterns with non exists pattern (stderr) 1`] = ` "[error] No files matching the pattern were found: "non-existent.js". @@ -72,7 +72,7 @@ directory/nested-directory/nested-directory-file.js " `; -exports[`multiple patterns with non exists pattern (write) 1`] = `Array []`; +exports[`multiple patterns with non exists pattern (write) 1`] = `[]`; exports[`multiple patterns, throw error and exit with non zero code on non existing files (stderr) 1`] = ` "[error] No files matching the pattern were found: "non-existent.js". @@ -82,10 +82,10 @@ exports[`multiple patterns, throw error and exit with non zero code on non exist exports[`multiple patterns, throw error and exit with non zero code on non existing files (stdout) 1`] = `""`; -exports[`multiple patterns, throw error and exit with non zero code on non existing files (write) 1`] = `Array []`; +exports[`multiple patterns, throw error and exit with non zero code on non existing files (write) 1`] = `[]`; exports[`no errors on empty patterns (stderr) 1`] = `""`; exports[`no errors on empty patterns (stdout) 1`] = `""`; -exports[`no errors on empty patterns (write) 1`] = `Array []`; +exports[`no errors on empty patterns (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/piped-output.js.snap b/tests/integration/__tests__/__snapshots__/piped-output.js.snap index 5ac545abd..da11285f7 100644 --- a/tests/integration/__tests__/__snapshots__/piped-output.js.snap +++ b/tests/integration/__tests__/__snapshots__/piped-output.js.snap @@ -16,9 +16,9 @@ All matched files use Prettier code style! " `; -exports[`no file diffs with --check + formatted file (write) 1`] = `Array []`; +exports[`no file diffs with --check + formatted file (write) 1`] = `[]`; -exports[`no file diffs with --check + formatted file (write) 2`] = `Array []`; +exports[`no file diffs with --check + formatted file (write) 2`] = `[]`; exports[`no file diffs with --list-different + formatted file (stderr) 1`] = `""`; @@ -28,9 +28,9 @@ exports[`no file diffs with --list-different + formatted file (stdout) 1`] = `"f exports[`no file diffs with --list-different + formatted file (stdout) 2`] = `""`; -exports[`no file diffs with --list-different + formatted file (write) 1`] = `Array []`; +exports[`no file diffs with --list-different + formatted file (write) 1`] = `[]`; -exports[`no file diffs with --list-different + formatted file (write) 2`] = `Array []`; +exports[`no file diffs with --list-different + formatted file (write) 2`] = `[]`; exports[`output with --check + unformatted differs when piped (stderr) 1`] = ` "[warn] unformatted.js @@ -55,8 +55,8 @@ exports[`output with --check + unformatted differs when piped (stdout) 2`] = ` `; exports[`output with --check + unformatted differs when piped (write) 1`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", @@ -65,8 +65,8 @@ Array [ `; exports[`output with --check + unformatted differs when piped (write) 2`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", @@ -89,8 +89,8 @@ exports[`output with --list-different + unformatted differs when piped (stdout) `; exports[`output with --list-different + unformatted differs when piped (write) 1`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", @@ -99,8 +99,8 @@ Array [ `; exports[`output with --list-different + unformatted differs when piped (write) 2`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", diff --git a/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap b/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap index aff5adf72..fe098f7aa 100644 --- a/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap +++ b/tests/integration/__tests__/__snapshots__/plugin-options-string.js.snap @@ -11,7 +11,7 @@ Default: bar " `; -exports[`show detailed external option with \`--help foo-string\` (write) 1`] = `Array []`; +exports[`show detailed external option with \`--help foo-string\` (write) 1`] = `[]`; exports[`show external options with \`--help\` 1`] = ` "Snapshot Diff: diff --git a/tests/integration/__tests__/__snapshots__/plugin-options.js.snap b/tests/integration/__tests__/__snapshots__/plugin-options.js.snap index 54ef10685..eef9fd7e2 100644 --- a/tests/integration/__tests__/__snapshots__/plugin-options.js.snap +++ b/tests/integration/__tests__/__snapshots__/plugin-options.js.snap @@ -36,7 +36,7 @@ Valid options: " `; -exports[`include plugin's parsers to the values of the \`parser\` option\` (write) 1`] = `Array []`; +exports[`include plugin's parsers to the values of the \`parser\` option\` (write) 1`] = `[]`; exports[`show detailed external option with \`--help foo-option\` (stderr) 1`] = `""`; @@ -54,7 +54,7 @@ Default: bar " `; -exports[`show detailed external option with \`--help foo-option\` (write) 1`] = `Array []`; +exports[`show detailed external option with \`--help foo-option\` (write) 1`] = `[]`; exports[`show external options with \`--help\` 1`] = ` "Snapshot Diff: diff --git a/tests/integration/__tests__/__snapshots__/schema.js.snap b/tests/integration/__tests__/__snapshots__/schema.js.snap index d73ae2338..520c9fa2f 100644 --- a/tests/integration/__tests__/__snapshots__/schema.js.snap +++ b/tests/integration/__tests__/__snapshots__/schema.js.snap @@ -1,274 +1,274 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`schema 1`] = ` -Object { +{ "$schema": "http://json-schema.org/draft-04/schema#", - "definitions": Object { - "optionsDefinition": Object { - "properties": Object { - "arrowParens": Object { + "definitions": { + "optionsDefinition": { + "properties": { + "arrowParens": { "default": "always", "description": "Include parentheses around a sole arrow function parameter.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Always include parens. Example: \`(x) => x\`", - "enum": Array [ + "enum": [ "always", ], }, - Object { + { "description": "Omit parens when possible. Example: \`x => x\`", - "enum": Array [ + "enum": [ "avoid", ], }, ], }, - "bracketSameLine": Object { + "bracketSameLine": { "default": false, "description": "Put > of opening tags on the last line instead of on a new line.", "type": "boolean", }, - "bracketSpacing": Object { + "bracketSpacing": { "default": true, "description": "Print spaces between brackets.", "type": "boolean", }, - "cursorOffset": Object { + "cursorOffset": { "default": -1, "description": "Print (to stderr) where a cursor at the given position would move to after formatting. This option cannot be used with --range-start and --range-end.", "type": "integer", }, - "embeddedLanguageFormatting": Object { + "embeddedLanguageFormatting": { "default": "auto", "description": "Control how Prettier formats quoted code embedded in the file.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Format embedded code if Prettier can automatically identify it.", - "enum": Array [ + "enum": [ "auto", ], }, - Object { + { "description": "Never automatically format embedded code.", - "enum": Array [ + "enum": [ "off", ], }, ], }, - "endOfLine": Object { + "endOfLine": { "default": "lf", "description": "Which end of line characters to apply.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos", - "enum": Array [ + "enum": [ "lf", ], }, - Object { + { "description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows", - "enum": Array [ + "enum": [ "crlf", ], }, - Object { + { "description": "Carriage Return character only (\\r), used very rarely", - "enum": Array [ + "enum": [ "cr", ], }, - Object { + { "description": "Maintain existing (mixed values within one file are normalised by looking at what's used after the first line)", - "enum": Array [ + "enum": [ "auto", ], }, ], }, - "filepath": Object { + "filepath": { "default": undefined, "description": "Specify the input filepath. This will be used to do parser inference.", "type": "string", }, - "htmlWhitespaceSensitivity": Object { + "htmlWhitespaceSensitivity": { "default": "css", "description": "How to handle whitespaces in HTML.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Respect the default value of CSS display property.", - "enum": Array [ + "enum": [ "css", ], }, - Object { + { "description": "Whitespaces are considered sensitive.", - "enum": Array [ + "enum": [ "strict", ], }, - Object { + { "description": "Whitespaces are considered insensitive.", - "enum": Array [ + "enum": [ "ignore", ], }, ], }, - "insertPragma": Object { + "insertPragma": { "default": false, "description": "Insert @format pragma into file's first docblock comment.", "type": "boolean", }, - "jsxSingleQuote": Object { + "jsxSingleQuote": { "default": false, "description": "Use single quotes in JSX.", "type": "boolean", }, - "parser": Object { - "anyOf": Array [ - Object { + "parser": { + "anyOf": [ + { "description": "Flow", - "enum": Array [ + "enum": [ "flow", ], }, - Object { + { "description": "JavaScript", - "enum": Array [ + "enum": [ "babel", ], }, - Object { + { "description": "Flow", - "enum": Array [ + "enum": [ "babel-flow", ], }, - Object { + { "description": "TypeScript", - "enum": Array [ + "enum": [ "babel-ts", ], }, - Object { + { "description": "TypeScript", - "enum": Array [ + "enum": [ "typescript", ], }, - Object { + { "description": "JavaScript", - "enum": Array [ + "enum": [ "acorn", ], }, - Object { + { "description": "JavaScript", - "enum": Array [ + "enum": [ "espree", ], }, - Object { + { "description": "JavaScript", - "enum": Array [ + "enum": [ "meriyah", ], }, - Object { + { "description": "CSS", - "enum": Array [ + "enum": [ "css", ], }, - Object { + { "description": "Less", - "enum": Array [ + "enum": [ "less", ], }, - Object { + { "description": "SCSS", - "enum": Array [ + "enum": [ "scss", ], }, - Object { + { "description": "JSON", - "enum": Array [ + "enum": [ "json", ], }, - Object { + { "description": "JSON5", - "enum": Array [ + "enum": [ "json5", ], }, - Object { + { "description": "JSON.stringify", - "enum": Array [ + "enum": [ "json-stringify", ], }, - Object { + { "description": "GraphQL", - "enum": Array [ + "enum": [ "graphql", ], }, - Object { + { "description": "Markdown", - "enum": Array [ + "enum": [ "markdown", ], }, - Object { + { "description": "MDX", - "enum": Array [ + "enum": [ "mdx", ], }, - Object { + { "description": "Vue", - "enum": Array [ + "enum": [ "vue", ], }, - Object { + { "description": "YAML", - "enum": Array [ + "enum": [ "yaml", ], }, - Object { + { "description": "Ember / Handlebars", - "enum": Array [ + "enum": [ "glimmer", ], }, - Object { + { "description": "HTML", - "enum": Array [ + "enum": [ "html", ], }, - Object { + { "description": "Angular", - "enum": Array [ + "enum": [ "angular", ], }, - Object { + { "description": "Lightning Web Components", - "enum": Array [ + "enum": [ "lwc", ], }, - Object { + { "description": "Custom parser", "type": "string", }, @@ -276,157 +276,157 @@ This option cannot be used with --range-start and --range-end.", "default": undefined, "description": "Which parser to use.", }, - "pluginSearchDirs": Object { - "default": Array [], + "pluginSearchDirs": { + "default": [], "description": "Custom directory that contains prettier plugins in node_modules subdirectory. Overrides default behavior when plugins are searched relatively to the location of Prettier. Multiple values are accepted.", - "oneOf": Array [ - Object { - "items": Object { + "oneOf": [ + { + "items": { "type": "string", }, "type": "array", }, - Object { + { "description": "Disable plugin autoloading.", - "enum": Array [ + "enum": [ false, ], }, ], }, - "plugins": Object { - "default": Array [], + "plugins": { + "default": [], "description": "Add a plugin. Multiple plugins can be passed as separate \`--plugin\`s.", - "items": Object { + "items": { "type": "string", }, "type": "array", }, - "printWidth": Object { + "printWidth": { "default": 80, "description": "The line length where Prettier will try wrap.", "type": "integer", }, - "proseWrap": Object { + "proseWrap": { "default": "preserve", "description": "How to wrap prose.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Wrap prose if it exceeds the print width.", - "enum": Array [ + "enum": [ "always", ], }, - Object { + { "description": "Do not wrap prose.", - "enum": Array [ + "enum": [ "never", ], }, - Object { + { "description": "Wrap prose as-is.", - "enum": Array [ + "enum": [ "preserve", ], }, ], }, - "quoteProps": Object { + "quoteProps": { "default": "as-needed", "description": "Change when properties in objects are quoted.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Only add quotes around object properties where required.", - "enum": Array [ + "enum": [ "as-needed", ], }, - Object { + { "description": "If at least one property in an object requires quotes, quote all properties.", - "enum": Array [ + "enum": [ "consistent", ], }, - Object { + { "description": "Respect the input use of quotes in object properties.", - "enum": Array [ + "enum": [ "preserve", ], }, ], }, - "rangeEnd": Object { + "rangeEnd": { "default": Infinity, "description": "Format code ending at a given character offset (exclusive). The range will extend forwards to the end of the selected statement. This option cannot be used with --cursor-offset.", "type": "integer", }, - "rangeStart": Object { + "rangeStart": { "default": 0, "description": "Format code starting at a given character offset. The range will extend backwards to the start of the first line containing the selected statement. This option cannot be used with --cursor-offset.", "type": "integer", }, - "requirePragma": Object { + "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.", "type": "boolean", }, - "semi": Object { + "semi": { "default": true, "description": "Print semicolons.", "type": "boolean", }, - "singleAttributePerLine": Object { + "singleAttributePerLine": { "default": false, "description": "Enforce single attribute per line in HTML, Vue and JSX.", "type": "boolean", }, - "singleQuote": Object { + "singleQuote": { "default": false, "description": "Use single quotes instead of double quotes.", "type": "boolean", }, - "tabWidth": Object { + "tabWidth": { "default": 2, "description": "Number of spaces per indentation level.", "type": "integer", }, - "trailingComma": Object { + "trailingComma": { "default": "es5", "description": "Print trailing commas wherever possible when multi-line.", - "oneOf": Array [ - Object { + "oneOf": [ + { "description": "Trailing commas where valid in ES5 (objects, arrays, etc.)", - "enum": Array [ + "enum": [ "es5", ], }, - Object { + { "description": "No trailing commas.", - "enum": Array [ + "enum": [ "none", ], }, - Object { + { "description": "Trailing commas wherever possible (including function arguments).", - "enum": Array [ + "enum": [ "all", ], }, ], }, - "useTabs": Object { + "useTabs": { "default": false, "description": "Indent with tabs instead of spaces.", "type": "boolean", }, - "vueIndentScriptAndStyle": Object { + "vueIndentScriptAndStyle": { "default": false, "description": "Indent script and style tags in Vue files.", "type": "boolean", @@ -434,48 +434,48 @@ in order for it to be formatted.", }, "type": "object", }, - "overridesDefinition": Object { - "properties": Object { - "overrides": Object { + "overridesDefinition": { + "properties": { + "overrides": { "description": "Provide a list of patterns to override prettier configuration.", - "items": Object { + "items": { "additionalProperties": false, - "properties": Object { - "excludeFiles": Object { + "properties": { + "excludeFiles": { "description": "Exclude these files from this override.", - "oneOf": Array [ - Object { + "oneOf": [ + { "type": "string", }, - Object { - "items": Object { + { + "items": { "type": "string", }, "type": "array", }, ], }, - "files": Object { + "files": { "description": "Include these files in this override.", - "oneOf": Array [ - Object { + "oneOf": [ + { "type": "string", }, - Object { - "items": Object { + { + "items": { "type": "string", }, "type": "array", }, ], }, - "options": Object { + "options": { "$ref": "#/definitions/optionsDefinition", "description": "The options to apply for this override.", "type": "object", }, }, - "required": Array [ + "required": [ "files", ], "type": "object", @@ -486,19 +486,19 @@ in order for it to be formatted.", "type": "object", }, }, - "oneOf": Array [ - Object { - "allOf": Array [ - Object { + "oneOf": [ + { + "allOf": [ + { "$ref": "#/definitions/optionsDefinition", }, - Object { + { "$ref": "#/definitions/overridesDefinition", }, ], "type": "object", }, - Object { + { "type": "string", }, ], diff --git a/tests/integration/__tests__/__snapshots__/skip-folders.js.snap b/tests/integration/__tests__/__snapshots__/skip-folders.js.snap index 26593103d..a5cedb9e7 100644 --- a/tests/integration/__tests__/__snapshots__/skip-folders.js.snap +++ b/tests/integration/__tests__/__snapshots__/skip-folders.js.snap @@ -6,7 +6,7 @@ b/file.js " `; -exports[`skip folders passed specifically (write) 1`] = `Array []`; +exports[`skip folders passed specifically (write) 1`] = `[]`; exports[`skips folders in glob (stdout) 1`] = ` "a/file.js @@ -14,4 +14,4 @@ b/file.js " `; -exports[`skips folders in glob (write) 1`] = `Array []`; +exports[`skips folders in glob (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap b/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap index ddb528da5..bd8822c04 100644 --- a/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap +++ b/tests/integration/__tests__/__snapshots__/stdin-filepath.js.snap @@ -18,9 +18,9 @@ exports[`apply editorconfig for stdin-filepath with a deep path (stdout) 2`] = ` " `; -exports[`apply editorconfig for stdin-filepath with a deep path (write) 1`] = `Array []`; +exports[`apply editorconfig for stdin-filepath with a deep path (write) 1`] = `[]`; -exports[`apply editorconfig for stdin-filepath with a deep path (write) 2`] = `Array []`; +exports[`apply editorconfig for stdin-filepath with a deep path (write) 2`] = `[]`; exports[`apply editorconfig for stdin-filepath with nonexistent directory (stderr) 1`] = `""`; @@ -31,7 +31,7 @@ exports[`apply editorconfig for stdin-filepath with nonexistent directory (stdou " `; -exports[`apply editorconfig for stdin-filepath with nonexistent directory (write) 1`] = `Array []`; +exports[`apply editorconfig for stdin-filepath with nonexistent directory (write) 1`] = `[]`; exports[`apply editorconfig for stdin-filepath with nonexistent file (stderr) 1`] = `""`; @@ -42,7 +42,7 @@ exports[`apply editorconfig for stdin-filepath with nonexistent file (stdout) 1` " `; -exports[`apply editorconfig for stdin-filepath with nonexistent file (write) 1`] = `Array []`; +exports[`apply editorconfig for stdin-filepath with nonexistent file (write) 1`] = `[]`; exports[`don’t apply editorconfig outside project for stdin-filepath with nonexistent directory (stderr) 1`] = `""`; @@ -53,7 +53,7 @@ exports[`don’t apply editorconfig outside project for stdin-filepath with none " `; -exports[`don’t apply editorconfig outside project for stdin-filepath with nonexistent directory (write) 1`] = `Array []`; +exports[`don’t apply editorconfig outside project for stdin-filepath with nonexistent directory (write) 1`] = `[]`; exports[`format correctly if stdin content compatible with stdin-filepath (stderr) 1`] = `""`; @@ -64,7 +64,7 @@ exports[`format correctly if stdin content compatible with stdin-filepath (stdou " `; -exports[`format correctly if stdin content compatible with stdin-filepath (write) 1`] = `Array []`; +exports[`format correctly if stdin content compatible with stdin-filepath (write) 1`] = `[]`; exports[`gracefully handle stdin-filepath with nonexistent directory (stderr) 1`] = `""`; @@ -75,11 +75,11 @@ exports[`gracefully handle stdin-filepath with nonexistent directory (stdout) 1` " `; -exports[`gracefully handle stdin-filepath with nonexistent directory (write) 1`] = `Array []`; +exports[`gracefully handle stdin-filepath with nonexistent directory (write) 1`] = `[]`; exports[`output file as-is if stdin-filepath matched patterns in ignore-path (stderr) 1`] = `""`; -exports[`output file as-is if stdin-filepath matched patterns in ignore-path (write) 1`] = `Array []`; +exports[`output file as-is if stdin-filepath matched patterns in ignore-path (write) 1`] = `[]`; exports[`throw error if stdin content incompatible with stdin-filepath (stderr) 1`] = ` "[error] abc.js: SyntaxError: Unexpected token (1:1) @@ -90,4 +90,4 @@ exports[`throw error if stdin content incompatible with stdin-filepath (stderr) exports[`throw error if stdin content incompatible with stdin-filepath (stdout) 1`] = `""`; -exports[`throw error if stdin content incompatible with stdin-filepath (write) 1`] = `Array []`; +exports[`throw error if stdin content incompatible with stdin-filepath (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/support-info.js.snap b/tests/integration/__tests__/__snapshots__/support-info.js.snap index 934e89e62..f016508d3 100644 --- a/tests/integration/__tests__/__snapshots__/support-info.js.snap +++ b/tests/integration/__tests__/__snapshots__/support-info.js.snap @@ -1,40 +1,40 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`API getSupportInfo() 1`] = ` -Object { - "languages": Object { - "Angular": Array [ +{ + "languages": { + "Angular": [ "angular", ], - "CSS": Array [ + "CSS": [ "css", ], - "Flow": Array [ + "Flow": [ "flow", "babel-flow", ], - "GraphQL": Array [ + "GraphQL": [ "graphql", ], - "HTML": Array [ + "HTML": [ "html", ], - "Handlebars": Array [ + "Handlebars": [ "glimmer", ], - "JSON": Array [ + "JSON": [ "json", ], - "JSON with Comments": Array [ + "JSON with Comments": [ "json", ], - "JSON.stringify": Array [ + "JSON.stringify": [ "json-stringify", ], - "JSON5": Array [ + "JSON5": [ "json5", ], - "JSX": Array [ + "JSX": [ "babel", "babel-flow", "babel-ts", @@ -43,7 +43,7 @@ Object { "espree", "meriyah", ], - "JavaScript": Array [ + "JavaScript": [ "babel", "acorn", "espree", @@ -53,75 +53,75 @@ Object { "flow", "typescript", ], - "Less": Array [ + "Less": [ "less", ], - "Lightning Web Components": Array [ + "Lightning Web Components": [ "lwc", ], - "MDX": Array [ + "MDX": [ "mdx", ], - "Markdown": Array [ + "Markdown": [ "markdown", ], - "PostCSS": Array [ + "PostCSS": [ "css", ], - "SCSS": Array [ + "SCSS": [ "scss", ], - "TSX": Array [ + "TSX": [ "typescript", "babel-ts", ], - "TypeScript": Array [ + "TypeScript": [ "typescript", "babel-ts", ], - "Vue": Array [ + "Vue": [ "vue", ], - "YAML": Array [ + "YAML": [ "yaml", ], }, - "options": Object { - "arrowParens": Object { - "choices": Array [ + "options": { + "arrowParens": { + "choices": [ "always", "avoid", ], "default": "always", "type": "choice", }, - "bracketSameLine": Object { + "bracketSameLine": { "default": false, "type": "boolean", }, - "bracketSpacing": Object { + "bracketSpacing": { "default": true, "type": "boolean", }, - "cursorOffset": Object { + "cursorOffset": { "default": -1, - "range": Object { + "range": { "end": Infinity, "start": -1, "step": 1, }, "type": "int", }, - "embeddedLanguageFormatting": Object { - "choices": Array [ + "embeddedLanguageFormatting": { + "choices": [ "auto", "off", ], "default": "auto", "type": "choice", }, - "endOfLine": Object { - "choices": Array [ + "endOfLine": { + "choices": [ "lf", "crlf", "cr", @@ -130,12 +130,12 @@ Object { "default": "lf", "type": "choice", }, - "filepath": Object { + "filepath": { "default": undefined, "type": "path", }, - "htmlWhitespaceSensitivity": Object { - "choices": Array [ + "htmlWhitespaceSensitivity": { + "choices": [ "css", "strict", "ignore", @@ -143,16 +143,16 @@ Object { "default": "css", "type": "choice", }, - "insertPragma": Object { + "insertPragma": { "default": false, "type": "boolean", }, - "jsxSingleQuote": Object { + "jsxSingleQuote": { "default": false, "type": "boolean", }, - "parser": Object { - "choices": Array [ + "parser": { + "choices": [ "flow", "babel", "babel-flow", @@ -180,25 +180,25 @@ Object { "default": undefined, "type": "choice", }, - "pluginSearchDirs": Object { - "default": Array [], + "pluginSearchDirs": { + "default": [], "type": "path", }, - "plugins": Object { - "default": Array [], + "plugins": { + "default": [], "type": "path", }, - "printWidth": Object { + "printWidth": { "default": 80, - "range": Object { + "range": { "end": Infinity, "start": 0, "step": 1, }, "type": "int", }, - "proseWrap": Object { - "choices": Array [ + "proseWrap": { + "choices": [ "always", "never", "preserve", @@ -206,8 +206,8 @@ Object { "default": "preserve", "type": "choice", }, - "quoteProps": Object { - "choices": Array [ + "quoteProps": { + "choices": [ "as-needed", "consistent", "preserve", @@ -215,51 +215,51 @@ Object { "default": "as-needed", "type": "choice", }, - "rangeEnd": Object { + "rangeEnd": { "default": Infinity, - "range": Object { + "range": { "end": Infinity, "start": 0, "step": 1, }, "type": "int", }, - "rangeStart": Object { + "rangeStart": { "default": 0, - "range": Object { + "range": { "end": Infinity, "start": 0, "step": 1, }, "type": "int", }, - "requirePragma": Object { + "requirePragma": { "default": false, "type": "boolean", }, - "semi": Object { + "semi": { "default": true, "type": "boolean", }, - "singleAttributePerLine": Object { + "singleAttributePerLine": { "default": false, "type": "boolean", }, - "singleQuote": Object { + "singleQuote": { "default": false, "type": "boolean", }, - "tabWidth": Object { + "tabWidth": { "default": 2, - "range": Object { + "range": { "end": Infinity, "start": 0, "step": 1, }, "type": "int", }, - "trailingComma": Object { - "choices": Array [ + "trailingComma": { + "choices": [ "es5", "none", "all", @@ -267,11 +267,11 @@ Object { "default": "es5", "type": "choice", }, - "useTabs": Object { + "useTabs": { "default": false, "type": "boolean", }, - "vueIndentScriptAndStyle": Object { + "vueIndentScriptAndStyle": { "default": false, "type": "boolean", }, @@ -1145,4 +1145,4 @@ exports[`CLI --support-info (stdout) 1`] = ` " `; -exports[`CLI --support-info (write) 1`] = `Array []`; +exports[`CLI --support-info (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/syntax-error.js.snap b/tests/integration/__tests__/__snapshots__/syntax-error.js.snap index 2edb43a4e..337d3602d 100644 --- a/tests/integration/__tests__/__snapshots__/syntax-error.js.snap +++ b/tests/integration/__tests__/__snapshots__/syntax-error.js.snap @@ -9,4 +9,4 @@ exports[`exits with non-zero code when input has a syntax error (stderr) 1`] = ` exports[`exits with non-zero code when input has a syntax error (stdout) 1`] = `""`; -exports[`exits with non-zero code when input has a syntax error (write) 1`] = `Array []`; +exports[`exits with non-zero code when input has a syntax error (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap b/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap index 4bb4d2895..f073f9135 100644 --- a/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-config-precedence.js.snap @@ -5,21 +5,21 @@ exports[`CLI --stdin-filepath works with --config-precedence cli-override (stdou " `; -exports[`CLI --stdin-filepath works with --config-precedence cli-override (write) 1`] = `Array []`; +exports[`CLI --stdin-filepath works with --config-precedence cli-override (write) 1`] = `[]`; exports[`CLI --stdin-filepath works with --config-precedence file-override (stdout) 1`] = ` "let x: keyof Y = foo(); " `; -exports[`CLI --stdin-filepath works with --config-precedence file-override (write) 1`] = `Array []`; +exports[`CLI --stdin-filepath works with --config-precedence file-override (write) 1`] = `[]`; exports[`CLI --stdin-filepath works with --config-precedence prefer-file (stdout) 1`] = ` "let x: keyof Y = foo(); " `; -exports[`CLI --stdin-filepath works with --config-precedence prefer-file (write) 1`] = `Array []`; +exports[`CLI --stdin-filepath works with --config-precedence prefer-file (write) 1`] = `[]`; exports[`CLI overrides are still applied when no config is found with --config-precedence file-override (stderr) 1`] = `""`; @@ -30,7 +30,7 @@ exports[`CLI overrides are still applied when no config is found with --config-p " `; -exports[`CLI overrides are still applied when no config is found with --config-precedence file-override (write) 1`] = `Array []`; +exports[`CLI overrides are still applied when no config is found with --config-precedence file-override (write) 1`] = `[]`; exports[`CLI overrides gets applied when no config exists with --config-precedence prefer-file (stderr) 1`] = `""`; @@ -43,7 +43,7 @@ exports[`CLI overrides gets applied when no config exists with --config-preceden " `; -exports[`CLI overrides gets applied when no config exists with --config-precedence prefer-file (write) 1`] = `Array []`; +exports[`CLI overrides gets applied when no config exists with --config-precedence prefer-file (write) 1`] = `[]`; exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (stderr) 1`] = `""`; @@ -60,7 +60,7 @@ module.exports = { " `; -exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (write) 1`] = `Array []`; +exports[`CLI overrides gets ignored when config exists with --config-precedence prefer-file (write) 1`] = `[]`; exports[`CLI overrides take lower precedence with --config-precedence file-override (stderr) 1`] = `""`; @@ -77,7 +77,7 @@ module.exports = { " `; -exports[`CLI overrides take lower precedence with --config-precedence file-override (write) 1`] = `Array []`; +exports[`CLI overrides take lower precedence with --config-precedence file-override (write) 1`] = `[]`; exports[`CLI overrides take precedence with --config-precedence cli-override (stderr) 1`] = `""`; @@ -172,7 +172,7 @@ function rcYaml() { " `; -exports[`CLI overrides take precedence with --config-precedence cli-override (write) 1`] = `Array []`; +exports[`CLI overrides take precedence with --config-precedence cli-override (write) 1`] = `[]`; exports[`CLI overrides take precedence without --config-precedence (stderr) 1`] = `""`; @@ -267,7 +267,7 @@ function rcYaml() { " `; -exports[`CLI overrides take precedence without --config-precedence (write) 1`] = `Array []`; +exports[`CLI overrides take precedence without --config-precedence (write) 1`] = `[]`; exports[`CLI validate options with --config-precedence cli-override (stderr) 1`] = ` "[error] Invalid printWidth value. Expected an integer, but received 0.5. @@ -276,7 +276,7 @@ exports[`CLI validate options with --config-precedence cli-override (stderr) 1`] exports[`CLI validate options with --config-precedence cli-override (stdout) 1`] = `""`; -exports[`CLI validate options with --config-precedence cli-override (write) 1`] = `Array []`; +exports[`CLI validate options with --config-precedence cli-override (write) 1`] = `[]`; exports[`CLI validate options with --config-precedence file-override (stderr) 1`] = ` "[error] Invalid printWidth value. Expected an integer, but received 0.5. @@ -285,7 +285,7 @@ exports[`CLI validate options with --config-precedence file-override (stderr) 1` exports[`CLI validate options with --config-precedence file-override (stdout) 1`] = `""`; -exports[`CLI validate options with --config-precedence file-override (write) 1`] = `Array []`; +exports[`CLI validate options with --config-precedence file-override (write) 1`] = `[]`; exports[`CLI validate options with --config-precedence prefer-file (stderr) 1`] = ` "[error] Invalid printWidth value. Expected an integer, but received 0.5. @@ -294,4 +294,4 @@ exports[`CLI validate options with --config-precedence prefer-file (stderr) 1`] exports[`CLI validate options with --config-precedence prefer-file (stdout) 1`] = `""`; -exports[`CLI validate options with --config-precedence prefer-file (write) 1`] = `Array []`; +exports[`CLI validate options with --config-precedence prefer-file (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap b/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap index 1ca8bad4a..7cf2d3fb3 100644 --- a/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-node-modules.js.snap @@ -10,7 +10,7 @@ regular-module.js " `; -exports[`doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `Array []`; +exports[`doesn't ignore node_modules with --with-node-modules flag (write) 1`] = `[]`; exports[`doesn't ignore node_modules with --with-node-modules flag for file list (stderr) 1`] = `""`; @@ -22,7 +22,7 @@ regular-module.js " `; -exports[`doesn't ignore node_modules with --with-node-modules flag for file list (write) 1`] = `Array []`; +exports[`doesn't ignore node_modules with --with-node-modules flag for file list (write) 1`] = `[]`; exports[`ignores node_modules by default (stderr) 1`] = `""`; @@ -32,7 +32,7 @@ regular-module.js " `; -exports[`ignores node_modules by default (write) 1`] = `Array []`; +exports[`ignores node_modules by default (write) 1`] = `[]`; exports[`ignores node_modules by default for file list (stderr) 1`] = `""`; @@ -42,7 +42,7 @@ regular-module.js " `; -exports[`ignores node_modules by default for file list (write) 1`] = `Array []`; +exports[`ignores node_modules by default for file list (write) 1`] = `[]`; exports[`ignores node_modules by with ./**/*.js (stderr) 1`] = `""`; @@ -52,4 +52,4 @@ regular-module.js " `; -exports[`ignores node_modules by with ./**/*.js (write) 1`] = `Array []`; +exports[`ignores node_modules by with ./**/*.js (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap b/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap index e3c050ee0..26f84ade7 100644 --- a/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-parser-inference.js.snap @@ -12,7 +12,7 @@ exports[`infers postcss parser (stdout) 1`] = ` " `; -exports[`infers postcss parser (write) 1`] = `Array []`; +exports[`infers postcss parser (write) 1`] = `[]`; exports[`infers postcss parser with --check (stderr) 1`] = `""`; @@ -22,10 +22,10 @@ All matched files use Prettier code style! " `; -exports[`infers postcss parser with --check (write) 1`] = `Array []`; +exports[`infers postcss parser with --check (write) 1`] = `[]`; exports[`infers postcss parser with --list-different (stderr) 1`] = `""`; exports[`infers postcss parser with --list-different (stdout) 1`] = `""`; -exports[`infers postcss parser with --list-different (write) 1`] = `Array []`; +exports[`infers postcss parser with --list-different (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/with-shebang.js.snap b/tests/integration/__tests__/__snapshots__/with-shebang.js.snap index f479a6255..b93745658 100644 --- a/tests/integration/__tests__/__snapshots__/with-shebang.js.snap +++ b/tests/integration/__tests__/__snapshots__/with-shebang.js.snap @@ -8,4 +8,4 @@ exports[`preserves shebang (stdout) 1`] = ` " `; -exports[`preserves shebang (write) 1`] = `Array []`; +exports[`preserves shebang (write) 1`] = `[]`; diff --git a/tests/integration/__tests__/__snapshots__/write.js.snap b/tests/integration/__tests__/__snapshots__/write.js.snap index 5571d6b88..c83ebede0 100644 --- a/tests/integration/__tests__/__snapshots__/write.js.snap +++ b/tests/integration/__tests__/__snapshots__/write.js.snap @@ -27,8 +27,8 @@ exports[`write file with --write + unformatted file (stdout) 1`] = ` `; exports[`write file with --write + unformatted file (write) 1`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", @@ -44,8 +44,8 @@ exports[`write file with -w + unformatted file (stdout) 1`] = ` `; exports[`write file with -w + unformatted file (write) 1`] = ` -Array [ - Object { +[ + { "content": "var x = 1; ", "filename": "unformatted.js", diff --git a/tests/integration/__tests__/plugin-resolution.js b/tests/integration/__tests__/plugin-resolution.js index 315850037..da596eb26 100644 --- a/tests/integration/__tests__/plugin-resolution.js +++ b/tests/integration/__tests__/plugin-resolution.js @@ -261,12 +261,12 @@ test("--no-plugin-search together with --plugin-search-dir", async () => { ]); expect(result1).toMatchInlineSnapshot(` - Object { + { "status": 1, "stderr": "[error] Cannot use --no-plugin-search and --plugin-search-dir together. ", "stdout": "", - "write": Array [], + "write": [], } `); expect(result2).toEqual(result1); From 9fbdcda5b17ca3e584dfc8394686279c419c077a Mon Sep 17 00:00:00 2001 From: HosokawaR <45098934+HosokawaR@users.noreply.github.com> Date: Wed, 27 Apr 2022 18:56:38 +0900 Subject: [PATCH 2/2] Print `as` instead of `:` for `babel-ts` parser (#12706) Co-authored-by: fisker Cheung --- changelog_unreleased/typescript/12706.md | 13 +++++++++++++ src/language-js/print/misc.js | 5 +++++ .../typescript/as/__snapshots__/jsfmt.spec.js.snap | 14 ++++++++++++++ tests/format/typescript/as/array-pattern.ts | 1 + 4 files changed, 33 insertions(+) create mode 100644 changelog_unreleased/typescript/12706.md create mode 100644 tests/format/typescript/as/array-pattern.ts diff --git a/changelog_unreleased/typescript/12706.md b/changelog_unreleased/typescript/12706.md new file mode 100644 index 000000000..8c21a8d0e --- /dev/null +++ b/changelog_unreleased/typescript/12706.md @@ -0,0 +1,13 @@ +#### Print `as` instead of `:` for `babel-ts` parser (#12706 by @HosokawaR) + + +```tsx +// Input +[x as any] = x; + +// Prettier stable +[x: any] = x; + +// Prettier main +[x as any] = x; +``` diff --git a/src/language-js/print/misc.js b/src/language-js/print/misc.js index 3d5a7d0f8..81514bee0 100644 --- a/src/language-js/print/misc.js +++ b/src/language-js/print/misc.js @@ -55,6 +55,11 @@ function printTypeAnnotation(path, options, print) { const parentNode = path.getParentNode(); + // Workaround for https://github.com/babel/babel/issues/14498 + if (parentNode.type === "ArrayPattern" && options.parser === "babel-ts") { + return [" as ", print("typeAnnotation")]; + } + const isFunctionDeclarationIdentifier = parentNode.type === "DeclareFunction" && parentNode.id === node; diff --git a/tests/format/typescript/as/__snapshots__/jsfmt.spec.js.snap b/tests/format/typescript/as/__snapshots__/jsfmt.spec.js.snap index bdfd027ec..27a91f18a 100644 --- a/tests/format/typescript/as/__snapshots__/jsfmt.spec.js.snap +++ b/tests/format/typescript/as/__snapshots__/jsfmt.spec.js.snap @@ -1,5 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`array-pattern.ts format 1`] = ` +====================================options===================================== +parsers: ["typescript"] +printWidth: 80 + | printWidth +=====================================input====================================== +[x as any] = x; + +=====================================output===================================== +[x as any] = x; + +================================================================================ +`; + exports[`as.ts format 1`] = ` ====================================options===================================== parsers: ["typescript"] diff --git a/tests/format/typescript/as/array-pattern.ts b/tests/format/typescript/as/array-pattern.ts new file mode 100644 index 000000000..364250a98 --- /dev/null +++ b/tests/format/typescript/as/array-pattern.ts @@ -0,0 +1 @@ +[x as any] = x;