From 90a5ef5e343bedc0f6f5326b14b6851b71733bea Mon Sep 17 00:00:00 2001 From: scarf Date: Thu, 27 Apr 2023 12:02:36 +0900 Subject: feat(cli): flatten deno.json configuaration (#17799) --- cli/tests/testdata/fmt/deno.malformed.jsonc | 6 ++--- cli/tests/testdata/fmt/deno.malformed2.jsonc | 8 +++---- .../testdata/fmt/fmt_with_deprecated_config.out | 3 +++ .../testdata/fmt/fmt_with_malformed_config.out | 2 +- .../testdata/fmt/fmt_with_malformed_config2.out | 2 +- .../testdata/fmt/with_config/deno.deprecated.jsonc | 20 ++++++++++++++++ cli/tests/testdata/fmt/with_config/deno.jsonc | 28 ++++++++++------------ 7 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 cli/tests/testdata/fmt/fmt_with_deprecated_config.out create mode 100644 cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc (limited to 'cli/tests/testdata/fmt') diff --git a/cli/tests/testdata/fmt/deno.malformed.jsonc b/cli/tests/testdata/fmt/deno.malformed.jsonc index c6200c4ee..e326edb1f 100644 --- a/cli/tests/testdata/fmt/deno.malformed.jsonc +++ b/cli/tests/testdata/fmt/deno.malformed.jsonc @@ -1,9 +1,7 @@ { "fmt": { - "files": { - "include": ["fmt_with_config/"], - "exclude": ["fmt_with_config/b.ts"] - }, + "include": ["fmt_with_config/"], + "exclude": ["fmt_with_config/b.ts"], "dont_know_this_field": {}, "options": { "useTabs": true diff --git a/cli/tests/testdata/fmt/deno.malformed2.jsonc b/cli/tests/testdata/fmt/deno.malformed2.jsonc index 4d6e99ae2..e326edb1f 100644 --- a/cli/tests/testdata/fmt/deno.malformed2.jsonc +++ b/cli/tests/testdata/fmt/deno.malformed2.jsonc @@ -1,10 +1,8 @@ { "fmt": { - "files": { - "include": ["fmt_with_config/"], - "exclude": ["fmt_with_config/b.ts"], - "dont_know_this_field": {} - }, + "include": ["fmt_with_config/"], + "exclude": ["fmt_with_config/b.ts"], + "dont_know_this_field": {}, "options": { "useTabs": true } diff --git a/cli/tests/testdata/fmt/fmt_with_deprecated_config.out b/cli/tests/testdata/fmt/fmt_with_deprecated_config.out new file mode 100644 index 000000000..793fac1bc --- /dev/null +++ b/cli/tests/testdata/fmt/fmt_with_deprecated_config.out @@ -0,0 +1,3 @@ +Warning: "options" configuration is deprecated. Please use "flat" options instead. +Warning: "files" configuration is deprecated. Please use "include" and "exclude" instead. +Checked 2 files diff --git a/cli/tests/testdata/fmt/fmt_with_malformed_config.out b/cli/tests/testdata/fmt/fmt_with_malformed_config.out index 1a55613ef..c269053a6 100644 --- a/cli/tests/testdata/fmt/fmt_with_malformed_config.out +++ b/cli/tests/testdata/fmt/fmt_with_malformed_config.out @@ -1,4 +1,4 @@ error: Failed to parse "fmt" configuration Caused by: - unknown field `dont_know_this_field`, expected `options` or `files` + unknown field `dont_know_this_field`, expected one of `useTabs`, `lineWidth`, `indentWidth`, `singleQuote`, `proseWrap`, `semiColons`, `options`, `include`, `exclude`, `files` diff --git a/cli/tests/testdata/fmt/fmt_with_malformed_config2.out b/cli/tests/testdata/fmt/fmt_with_malformed_config2.out index 948b6b5b8..c269053a6 100644 --- a/cli/tests/testdata/fmt/fmt_with_malformed_config2.out +++ b/cli/tests/testdata/fmt/fmt_with_malformed_config2.out @@ -1,4 +1,4 @@ error: Failed to parse "fmt" configuration Caused by: - unknown field `dont_know_this_field`, expected `include` or `exclude` + unknown field `dont_know_this_field`, expected one of `useTabs`, `lineWidth`, `indentWidth`, `singleQuote`, `proseWrap`, `semiColons`, `options`, `include`, `exclude`, `files` diff --git a/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc b/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc new file mode 100644 index 000000000..e053233fd --- /dev/null +++ b/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc @@ -0,0 +1,20 @@ +{ + "fmt": { + "files": { + "include": [ + "./subdir/" + ], + "exclude": [ + "./subdir/b.ts" + ] + }, + "options": { + "useTabs": true, + "lineWidth": 40, + "indentWidth": 8, + "singleQuote": true, + "proseWrap": "always", + "semiColons": false + } + } +} diff --git a/cli/tests/testdata/fmt/with_config/deno.jsonc b/cli/tests/testdata/fmt/with_config/deno.jsonc index 44e3f9a99..ffd265dcd 100644 --- a/cli/tests/testdata/fmt/with_config/deno.jsonc +++ b/cli/tests/testdata/fmt/with_config/deno.jsonc @@ -1,20 +1,16 @@ { "fmt": { - "files": { - "include": [ - "./subdir/" - ], - "exclude": [ - "./subdir/b.ts" - ] - }, - "options": { - "useTabs": true, - "lineWidth": 40, - "indentWidth": 8, - "singleQuote": true, - "proseWrap": "always", - "semiColons": false - } + "include": [ + "./subdir/" + ], + "exclude": [ + "./subdir/b.ts" + ], + "useTabs": true, + "lineWidth": 40, + "indentWidth": 8, + "singleQuote": true, + "proseWrap": "always", + "semiColons": false } } -- cgit v1.2.3