From d4f8b93be440625d076c1433a56776e3504779ef Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Wed, 15 Jan 2025 21:08:06 +0100 Subject: [PATCH 1/7] feat(config): add the `includes` field --- Cargo.lock | 2 + crates/biome_cli/src/commands/rage.rs | 7 ++ .../biome_cli/src/execute/migrate/prettier.rs | 1 + .../biome_cli/tests/cases/config_extends.rs | 4 +- crates/biome_cli/tests/cases/diagnostics.rs | 2 +- .../biome_cli/tests/cases/included_files.rs | 10 +- .../biome_cli/tests/cases/linter_domains.rs | 2 +- .../tests/cases/overrides_formatter.rs | 54 +++++----- .../biome_cli/tests/cases/overrides_linter.rs | 40 +++---- .../tests/cases/overrides_organize_imports.rs | 4 +- crates/biome_cli/tests/commands/format.rs | 12 +-- crates/biome_cli/tests/commands/lint.rs | 8 +- crates/biome_cli/tests/commands/rage.rs | 2 +- crates/biome_cli/tests/main.rs | 2 +- .../extends_config_merge_overrides.snap | 7 +- ...es_according_to_set_diagnostics_level.snap | 5 +- .../does_handle_only_included_files.snap | 5 +- ...ncluded_files_if_overridden_by_ignore.snap | 5 +- ...les_if_overridden_by_ignore_formatter.snap | 5 +- ..._files_if_overridden_by_ignore_linter.snap | 5 +- ...les_if_overridden_by_organize_imports.snap | 4 +- .../enable_test_rules_via_overrides.snap | 4 +- ...w_trailing_commas_on_well_known_files.snap | 4 +- .../complex_enable_disable_overrides.snap | 7 +- ...disallow_comments_on_well_known_files.snap | 5 +- ...e_included_file_and_disable_formatter.snap | 7 +- ...nclude_file_with_different_formatting.snap | 7 +- ..._different_formatting_and_all_of_them.snap | 7 +- ...include_file_with_different_languages.snap | 9 +- ...include_file_with_different_overrides.snap | 7 +- ...t_change_formatting_language_settings.snap | 5 +- ...change_formatting_language_settings_2.snap | 5 +- .../does_not_change_formatting_settings.snap | 5 +- .../does_not_conceal_previous_overrides.snap | 7 +- ...files_when_config_override_is_present.snap | 5 +- ...es_default_formatter_for_package_json.snap | 4 +- .../overrides_grit_formatting_options.snap | 4 +- ...s_last_formatter_enabled_into_account.snap | 7 +- ...ndle_included_file_and_disable_linter.snap | 7 +- ...erent_linting_and_applies_all_of_them.snap | 7 +- ...include_file_with_different_overrides.snap | 7 +- ...oes_include_file_with_different_rules.snap | 5 +- .../does_merge_all_overrides.snap | 9 +- .../does_not_change_linting_settings.snap | 5 +- .../does_not_conceal_overrides_globals.snap | 7 +- .../does_override_groupe_recommended.snap | 5 +- .../does_override_recommended.snap | 5 +- .../does_override_the_rules.snap | 5 +- ...ended_when_override_global_recommened.snap | 5 +- ...dividually_diabled_rules_in_overrides.snap | 5 +- ...akes_last_linter_enabled_into_account.snap | 7 +- ...ded_file_and_disable_organize_imports.snap | 6 +- ...at_ignored_file_in_included_directory.snap | 5 +- ...at_json_trailing_commas_overrides_all.snap | 4 +- ...t_json_trailing_commas_overrides_none.snap | 5 +- .../include_ignore_cascade.snap | 7 +- .../include_vcs_ignore_cascade.snap | 5 +- ..._process_changed_file_if_its_included.snap | 5 +- ...y_process_staged_file_if_its_included.snap | 5 +- .../with_formatter_configuration.snap | 5 +- .../main_configuration/override_globals.snap | 5 +- crates/biome_configuration/Cargo.toml | 1 + .../src/analyzer/assist/mod.rs | 10 +- .../src/analyzer/assists/mod.rs | 48 +++++++++ .../src/analyzer/linter/mod.rs | 8 +- crates/biome_configuration/src/formatter.rs | 14 ++- crates/biome_configuration/src/lib.rs | 6 ++ .../src/organize_imports.rs | 50 +++++++++ crates/biome_configuration/src/overrides.rs | 9 +- .../invalid/files_extraneous_field.json.snap | 2 + .../formatter_extraneous_field.json.snap | 1 + .../invalid/formatter_quote_style.json.snap | 1 + .../invalid/overrides/incorrect_key.json.snap | 1 + .../tests/valid/overrides/top_level_keys.json | 1 + crates/biome_glob/src/lib.rs | 2 +- .../lint/style/use_filenaming_convention.rs | 2 +- .../src/lint/style/use_naming_convention.rs | 2 +- .../ok/many_empty_strings.js.snap | 1 + crates/biome_lsp/tests/server.rs | 2 +- crates/biome_service/Cargo.toml | 1 + crates/biome_service/src/file_handlers/css.rs | 30 ++---- .../src/file_handlers/graphql.rs | 30 ++---- .../biome_service/src/file_handlers/grit.rs | 30 ++---- .../biome_service/src/file_handlers/html.rs | 10 +- .../src/file_handlers/javascript.rs | 30 ++---- .../biome_service/src/file_handlers/json.rs | 30 ++---- crates/biome_service/src/projects.rs | 39 +++++-- crates/biome_service/src/settings.rs | 100 ++++++++++-------- crates/biome_service/src/workspace/server.rs | 16 ++- .../@biomejs/backend-jsonrpc/src/workspace.ts | 35 ++++-- .../@biomejs/biome/configuration_schema.json | 38 +++++-- 91 files changed, 573 insertions(+), 393 deletions(-) create mode 100644 crates/biome_configuration/src/analyzer/assists/mod.rs create mode 100644 crates/biome_configuration/src/organize_imports.rs diff --git a/Cargo.lock b/Cargo.lock index 27d243e9e72e..44f311ebb3f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -226,6 +226,7 @@ dependencies = [ "biome_diagnostics", "biome_flags", "biome_formatter", + "biome_glob", "biome_graphql_analyze", "biome_graphql_syntax", "biome_html_formatter", @@ -1222,6 +1223,7 @@ dependencies = [ "biome_diagnostics", "biome_formatter", "biome_fs", + "biome_glob", "biome_graphql_analyze", "biome_graphql_formatter", "biome_graphql_parser", diff --git a/crates/biome_cli/src/commands/rage.rs b/crates/biome_cli/src/commands/rage.rs index d21cdf730137..33b477a0dc36 100644 --- a/crates/biome_cli/src/commands/rage.rs +++ b/crates/biome_cli/src/commands/rage.rs @@ -254,6 +254,12 @@ impl Display for RageConfiguration<'_> { .collect::>() .join(", ") }); + let includes = formatter_configuration.includes.map(|list| { + list.iter() + .map(|s| s.to_string()) + .collect::>() + .join(", ") + }); markup! ( {Section("Formatter")} {KeyValuePair("Format with errors", markup!({DisplayOption(configuration.get_formatter_configuration().format_with_errors)}))} @@ -265,6 +271,7 @@ impl Display for RageConfiguration<'_> { {KeyValuePair("Bracket spacing", markup!({DisplayOption(formatter_configuration.bracket_spacing)}))} {KeyValuePair("Ignore", markup!({DisplayOption(ignore)}))} {KeyValuePair("Include", markup!({DisplayOption(include)}))} + {KeyValuePair("Includes", markup!({DisplayOption(includes)}))} ).fmt(fmt)?; let javascript_formatter_configuration = diff --git a/crates/biome_cli/src/execute/migrate/prettier.rs b/crates/biome_cli/src/execute/migrate/prettier.rs index 09e702786fd8..9507ac98aee3 100644 --- a/crates/biome_cli/src/execute/migrate/prettier.rs +++ b/crates/biome_cli/src/execute/migrate/prettier.rs @@ -208,6 +208,7 @@ impl TryFrom for biome_configuration::Configuration { format_with_errors: Some(false.into()), ignore: None, include: None, + includes: None, enabled: Some(true.into()), // editorconfig support is intentionally set to true, because prettier always reads the editorconfig file // see: https://github.com/prettier/prettier/issues/15255 diff --git a/crates/biome_cli/tests/cases/config_extends.rs b/crates/biome_cli/tests/cases/config_extends.rs index 5b0b3eb2bd46..09266feea2d8 100644 --- a/crates/biome_cli/tests/cases/config_extends.rs +++ b/crates/biome_cli/tests/cases/config_extends.rs @@ -332,7 +332,7 @@ fn extends_config_merge_overrides() { shared.into(), r#"{ "overrides": [{ - "include": ["**/*.js"], + "includes": ["**/*.js"], "linter": { "rules": { "suspicious": { "noDebugger": "off" } } } }] }"#, @@ -344,7 +344,7 @@ fn extends_config_merge_overrides() { r#"{ "extends": ["shared.json"], "overrides": [{ - "include": ["**/*.js"], + "includes": ["**/*.js"], "linter": { "rules": { "correctness": { "noUnusedVariables": "error" } } } }] }"#, diff --git a/crates/biome_cli/tests/cases/diagnostics.rs b/crates/biome_cli/tests/cases/diagnostics.rs index 1f8e9e746a10..f298a9dc10c8 100644 --- a/crates/biome_cli/tests/cases/diagnostics.rs +++ b/crates/biome_cli/tests/cases/diagnostics.rs @@ -16,7 +16,7 @@ fn logs_the_appropriate_messages_according_to_set_diagnostics_level() { file_path.into(), r#"{ "files": { - "include": ["test.js"] + "includes": ["test.js"] }, "linter": { "rules": { diff --git a/crates/biome_cli/tests/cases/included_files.rs b/crates/biome_cli/tests/cases/included_files.rs index 2d432cf7f7a9..36aea57e8f40 100644 --- a/crates/biome_cli/tests/cases/included_files.rs +++ b/crates/biome_cli/tests/cases/included_files.rs @@ -24,7 +24,7 @@ fn does_handle_only_included_files() { fs.insert( file_path.into(), r#"{ - "files": { "include": ["test.js"] } + "files": { "includes": ["test.js"] } } "# .as_bytes(), @@ -65,7 +65,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore() { fs.insert( file_path.into(), r#"{ - "files": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "files": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } "# .as_bytes(), @@ -106,7 +106,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore_formatter() { fs.insert( file_path.into(), r#"{ - "formatter": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "formatter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } "# .as_bytes(), @@ -147,7 +147,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore_linter() { fs.insert( file_path.into(), r#"{ - "linter": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "linter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } "# .as_bytes(), @@ -190,7 +190,7 @@ fn does_not_handle_included_files_if_overridden_by_organize_imports() { r#"{ "formatter": { "enabled": false }, "linter": { "enabled": false }, - "assist": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "assist": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } "# .as_bytes(), diff --git a/crates/biome_cli/tests/cases/linter_domains.rs b/crates/biome_cli/tests/cases/linter_domains.rs index 5412862c529f..8ab6b1f9407c 100644 --- a/crates/biome_cli/tests/cases/linter_domains.rs +++ b/crates/biome_cli/tests/cases/linter_domains.rs @@ -129,7 +129,7 @@ fn enable_test_rules_via_overrides() { } }, "overrides": [{ - "include": ["test1.js"], + "includes": ["test1.js"], "linter": { "domains": { "test": "all" diff --git a/crates/biome_cli/tests/cases/overrides_formatter.rs b/crates/biome_cli/tests/cases/overrides_formatter.rs index 8e3b2f329ce8..83c497b5ecf8 100644 --- a/crates/biome_cli/tests/cases/overrides_formatter.rs +++ b/crates/biome_cli/tests/cases/overrides_formatter.rs @@ -37,9 +37,9 @@ fn does_handle_included_file_and_disable_formatter() { file_path.into(), r#"{ "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, - "overrides": [{ "include": ["special/**"], "formatter": { "enabled": false } }] + "overrides": [{ "includes": ["special/**"], "formatter": { "enabled": false } }] } "# @@ -80,7 +80,7 @@ fn does_include_file_with_different_formatting() { fs.insert( file_path.into(), r#"{ - "overrides": [{ "include": ["special/**"], "formatter": { "lineWidth": 20 } }] + "overrides": [{ "includes": ["special/**"], "formatter": { "lineWidth": 20 } }] } "# @@ -122,8 +122,8 @@ fn does_include_file_with_different_formatting_and_all_of_them() { file_path.into(), r#"{ "overrides": [ - { "include": ["special/**"], "formatter": { "lineWidth": 130 } }, - { "include": ["special/**"], "formatter": { "lineWidth": 20 } } + { "includes": ["special/**"], "formatter": { "lineWidth": 130 } }, + { "includes": ["special/**"], "formatter": { "lineWidth": 20 } } ] } @@ -166,8 +166,8 @@ fn does_include_file_with_different_overrides() { file_path.into(), r#"{ "overrides": [ - { "include": ["test.js"], "formatter": { "lineWidth": 20 } }, - { "include": ["test2.js"], "formatter": { "lineWidth": 20, "indentStyle": "space" } } + { "includes": ["test.js"], "formatter": { "lineWidth": 20 } }, + { "includes": ["test2.js"], "formatter": { "lineWidth": 20, "indentStyle": "space" } } ] } @@ -219,9 +219,9 @@ fn complex_enable_disable_overrides() { } }, "overrides": [ - { "include": ["formatted.js"], "formatter": { "enabled": true } }, + { "includes": ["formatted.js"], "formatter": { "enabled": true } }, { - "include": ["dirty.js"], + "includes": ["dirty.js"], "linter": { "rules": { "performance": { @@ -278,9 +278,9 @@ fn does_include_file_with_different_languages() { file_path.into(), r#"{ "overrides": [ - { "include": ["test.js"], "formatter": { "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "single" } } }, - { "include": ["test2.js"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "javascript": { "formatter": { "semicolons": "asNeeded" } } }, - { "include": ["test.css"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "css": { "formatter": { "quoteStyle": "single" } } } + { "includes": ["test.js"], "formatter": { "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "single" } } }, + { "includes": ["test2.js"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "javascript": { "formatter": { "semicolons": "asNeeded" } } }, + { "includes": ["test.css"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "css": { "formatter": { "quoteStyle": "single" } } } ] } "# @@ -335,15 +335,15 @@ fn does_include_file_with_different_languages_and_files() { file_path.into(), r#"{ "overrides": [ - { "include": ["test.js"], "formatter": { "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "single" } } }, + { "includes": ["test.js"], "formatter": { "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "single" } } }, { - "include": ["test2.js"], + "includes": ["test2.js"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "javascript": { "formatter": { "semicolons": "asNeeded" } }, "json": { "formatter": { "indentStyle": "space", "lineWidth": 20, "indentWidth": 4 } } }, { - "include": ["test3.json"], + "includes": ["test3.json"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "json": { "formatter": { "indentStyle": "space", "lineWidth": 20, "indentWidth": 4 } } } @@ -408,7 +408,7 @@ fn does_not_change_formatting_settings() { r#"{ "formatter": { "lineWidth": 20, "indentStyle": "space" }, "overrides": [ - { "include": ["test.js"], "linter": { "enabled": false } } + { "includes": ["test.js"], "linter": { "enabled": false } } ] } @@ -452,7 +452,7 @@ fn does_not_change_formatting_language_settings() { r#"{ "javascript": { "formatter": { "quoteStyle": "single" } }, "overrides": [ - { "include": ["test.js"], "linter": { "enabled": false } } + { "includes": ["test.js"], "linter": { "enabled": false } } ] } @@ -496,7 +496,7 @@ fn does_not_change_formatting_language_settings_2() { r#"{ "javascript": { "formatter": { "lineWidth": 20 } }, "overrides": [ - { "include": ["test.js"], "linter": { "enabled": false } } + { "includes": ["test.js"], "linter": { "enabled": false } } ] } @@ -540,8 +540,8 @@ fn does_not_conceal_previous_overrides() { r#"{ "javascript": { "formatter": { "quoteStyle": "single" } }, "overrides": [ - { "include": ["*.js"], "javascript": { "formatter": { "quoteStyle": "double" } } }, - { "include": ["test.js"], "javascript": { "formatter": { "indentWidth": 4 } } } + { "includes": ["*.js"], "javascript": { "formatter": { "quoteStyle": "double" } } }, + { "includes": ["test.js"], "javascript": { "formatter": { "indentWidth": 4 } } } ] }"# .as_bytes(), @@ -578,10 +578,10 @@ fn takes_last_formatter_enabled_into_account() { r#"{ "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "formatter": { "enabled": false } }, { - "include": ["*.js"], + "includes": ["*.js"], "formatter": { "enabled": true } } ] @@ -617,7 +617,7 @@ fn does_not_override_well_known_special_files_when_config_override_is_present() r#"{ "overrides": [ { - "include": [ + "includes": [ "**/*.json" ], "formatter": { "enabled": false } @@ -673,7 +673,7 @@ fn allow_trailing_commas_on_well_known_files() { }, "overrides": [ { - "include": [ + "includes": [ "**/*.json" ], "json": { "parser": { "allowTrailingCommas": true } } @@ -741,7 +741,7 @@ fn disallow_comments_on_well_known_files() { }, "overrides": [ { - "include": [ + "includes": [ "**/*.json" ], "json": { "parser": { "allowComments": false } } @@ -785,7 +785,7 @@ fn overrides_default_formatter_for_package_json() { r#"{ "overrides": [ { - "include": ["package.json"], + "includes": ["package.json"], "json": { "formatter": { "expand": "followSource" } } } ] @@ -825,7 +825,7 @@ fn overrides_grit_formatting_options() { }, "overrides": [ { - "include": [ + "includes": [ "file.grit" ], "grit": { "formatter": { "indentStyle": "space", "indentWidth": 8 } } diff --git a/crates/biome_cli/tests/cases/overrides_linter.rs b/crates/biome_cli/tests/cases/overrides_linter.rs index 0aafb8d2146b..16cff74d68f2 100644 --- a/crates/biome_cli/tests/cases/overrides_linter.rs +++ b/crates/biome_cli/tests/cases/overrides_linter.rs @@ -23,9 +23,9 @@ fn does_handle_included_file_and_disable_linter() { file_path.into(), r#"{ "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, - "overrides": [{ "include": ["special/**"], "linter": { "enabled": false } }] + "overrides": [{ "includes": ["special/**"], "linter": { "enabled": false } }] } "# @@ -66,7 +66,7 @@ fn does_include_file_with_different_rules() { fs.insert( file_path.into(), r#"{ - "overrides": [{ "include": ["special/**"], "linter": { "rules": { + "overrides": [{ "includes": ["special/**"], "linter": { "rules": { "suspicious": { "noDebugger": "off" } } } }] } @@ -111,7 +111,7 @@ fn does_include_file_with_different_linting_and_applies_all_of_them() { r#"{ "overrides": [ { - "include": [ + "includes": [ "special/**" ], "linter": { @@ -123,7 +123,7 @@ fn does_include_file_with_different_linting_and_applies_all_of_them() { } }, { - "include": [ + "includes": [ "special/**" ], "linter": { @@ -177,7 +177,7 @@ fn does_include_file_with_different_overrides() { r#"{ "overrides": [ { - "include": [ + "includes": [ "test.js" ], "linter": { @@ -189,7 +189,7 @@ fn does_include_file_with_different_overrides() { } }, { - "include": [ + "includes": [ "test2.js" ], "linter": { @@ -243,7 +243,7 @@ fn does_override_the_rules() { r#"{ "overrides": [ { - "include": [ + "includes": [ "test.js" ], "linter": { @@ -303,7 +303,7 @@ fn does_not_change_linting_settings() { } }, "overrides": [ - { "include": ["test.js"], "formatter": { "enabled": false } } + { "includes": ["test.js"], "formatter": { "enabled": false } } ] } @@ -352,7 +352,7 @@ fn does_override_recommended() { }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "recommended": false @@ -406,7 +406,7 @@ fn does_override_groupe_recommended() { }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { @@ -462,7 +462,7 @@ fn does_preserve_group_recommended_when_override_global_recommened() { }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "recommended": true @@ -516,7 +516,7 @@ fn does_preserve_individually_diabled_rules_in_overrides() { }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": {} @@ -570,7 +570,7 @@ fn does_merge_all_overrides() { }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "rules": { "suspicious": { @@ -579,7 +579,7 @@ fn does_merge_all_overrides() { } } }, { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { @@ -588,7 +588,7 @@ fn does_merge_all_overrides() { } } }, { - "include": ["test3.js"] + "includes": ["test3.js"] } ] }"# @@ -631,10 +631,10 @@ fn does_not_conceal_overrides_globals() { }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "javascript": { "globals": ["GLOBAL_VAR"] } }, { - "include": ["*.js"] + "includes": ["*.js"] } ] }"# @@ -672,10 +672,10 @@ fn takes_last_linter_enabled_into_account() { }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "enabled": false } }, { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "enabled": true } } ] diff --git a/crates/biome_cli/tests/cases/overrides_organize_imports.rs b/crates/biome_cli/tests/cases/overrides_organize_imports.rs index 4db99c26475b..959aede0a308 100644 --- a/crates/biome_cli/tests/cases/overrides_organize_imports.rs +++ b/crates/biome_cli/tests/cases/overrides_organize_imports.rs @@ -19,9 +19,9 @@ fn does_handle_included_file_and_disable_organize_imports() { file_path.into(), r#"{ "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, - "overrides": [{ "include": ["special/**"], "assist": { "enabled": false } }] + "overrides": [{ "includes": ["special/**"], "assist": { "enabled": false } }] } "# diff --git a/crates/biome_cli/tests/commands/format.rs b/crates/biome_cli/tests/commands/format.rs index 93e1c7b6229e..9205e912e287 100644 --- a/crates/biome_cli/tests/commands/format.rs +++ b/crates/biome_cli/tests/commands/format.rs @@ -1421,7 +1421,7 @@ fn does_not_format_ignored_directories() { fn does_not_format_ignored_file_in_included_directory() { let config = r#"{ "formatter": { - "include": ["src"], + "includes": ["src/**"], "ignore": ["src/file2.js"] } }"#; @@ -1469,11 +1469,11 @@ fn include_ignore_cascade() { // - `file4.js` is not included at top-level let config = r#"{ "files": { - "include": ["file1.js", "file2.js", "file3.js"], + "includes": ["file1.js", "file2.js", "file3.js"], "ignore": ["file2.js"] }, "formatter": { - "include": ["file1.js", "file2.js"], + "includes": ["file1.js", "file2.js"], "ignore": ["file3.js"] } }"#; @@ -1939,7 +1939,7 @@ fn include_vcs_ignore_cascade() { "ignore": ["file2.js"] }, "formatter": { - "include": ["file1.js", "file2.js", "file4.js"], + "includes": ["file1.js", "file2.js", "file4.js"], "ignore": ["file3.js"] } }"#; @@ -2315,7 +2315,7 @@ fn format_json_trailing_commas_overrides_all() { "formatter": { "trailingCommas": "none" } }, "overrides": [{ - "include": ["file.json"], + "includes": ["file.json"], "json": { "formatter": { "trailingCommas": "all" } } @@ -2358,7 +2358,7 @@ fn format_json_trailing_commas_overrides_none() { "formatter": { "trailingCommas": "all" } }, "overrides": [{ - "include": ["file.json"], + "includes": ["file.json"], "json": { "formatter": { "trailingCommas": "none" } } diff --git a/crates/biome_cli/tests/commands/lint.rs b/crates/biome_cli/tests/commands/lint.rs index aa5d349a0e1b..2f7cbccd9421 100644 --- a/crates/biome_cli/tests/commands/lint.rs +++ b/crates/biome_cli/tests/commands/lint.rs @@ -1100,7 +1100,7 @@ fn include_files_in_subdir() { let mut console = BufferConsole::default(); let config = r#"{ "files": { - "include": ["./**/*.js"] + "includes": ["**/*.js"] } }"#; @@ -1143,7 +1143,7 @@ fn include_files_in_symlinked_subdir() { let mut console = BufferConsole::default(); let config = r#"{ "files": { - "include": ["./**/*.js"] + "includes": ["**/*.js"] } }"#; @@ -2548,7 +2548,7 @@ fn should_only_process_changed_file_if_its_included() { r#" { "files": { - "include": ["file.js"] + "includes": ["file.js"] }, "vcs": { "defaultBranch": "main" @@ -2763,7 +2763,7 @@ fn should_only_process_staged_file_if_its_included() { r#" { "files": { - "include": ["file.js"] + "includes": ["file.js"] }, "vcs": { "defaultBranch": "main" diff --git a/crates/biome_cli/tests/commands/rage.rs b/crates/biome_cli/tests/commands/rage.rs index bb1241af2a15..427e801595e0 100644 --- a/crates/biome_cli/tests/commands/rage.rs +++ b/crates/biome_cli/tests/commands/rage.rs @@ -202,7 +202,7 @@ fn with_formatter_configuration() { "attributePosition": "multiline", "enabled": true, "formatWithErrors": true, - "include": [ + "includes": [ "**/*.html", "**/*.css", "**/*.js", diff --git a/crates/biome_cli/tests/main.rs b/crates/biome_cli/tests/main.rs index c5477e4aac27..7f4397734c46 100644 --- a/crates/biome_cli/tests/main.rs +++ b/crates/biome_cli/tests/main.rs @@ -293,7 +293,7 @@ mod configuration { "globals": ["React"] }, "overrides": [{ - "include": ["tests"], + "includes": ["tests/**"], "javascript": { "globals": ["test", "it"] } diff --git a/crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_merge_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_merge_overrides.snap index e99dfea4254d..ee99083339fd 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_merge_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_config_extends/extends_config_merge_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -9,7 +10,7 @@ expression: content "extends": ["shared.json"], "overrides": [ { - "include": ["**/*.js"], + "includes": ["**/*.js"], "linter": { "rules": { "correctness": { "noUnusedVariables": "error" } } } } ] @@ -21,7 +22,7 @@ expression: content ```json { "overrides": [{ - "include": ["**/*.js"], + "includes": ["**/*.js"], "linter": { "rules": { "suspicious": { "noDebugger": "off" } } } }] } diff --git a/crates/biome_cli/tests/snapshots/main_cases_diagnostics/logs_the_appropriate_messages_according_to_set_diagnostics_level.snap b/crates/biome_cli/tests/snapshots/main_cases_diagnostics/logs_the_appropriate_messages_according_to_set_diagnostics_level.snap index 199f3214a454..69e6e1770910 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_diagnostics/logs_the_appropriate_messages_according_to_set_diagnostics_level.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_diagnostics/logs_the_appropriate_messages_according_to_set_diagnostics_level.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["test.js"] + "includes": ["test.js"] }, "linter": { "rules": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_handle_only_included_files.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_handle_only_included_files.snap index 52be5e9ca353..25a5b6fa0d01 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_handle_only_included_files.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_handle_only_included_files.snap @@ -1,12 +1,13 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "files": { "include": ["test.js"] } + "files": { "includes": ["test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap index 142b225c049f..7b36e072f27b 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap @@ -1,12 +1,13 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "files": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "files": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap index 602cf9c1ab1f..ee454d7d2efd 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap @@ -1,12 +1,13 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "formatter": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "formatter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap index 5283f072c195..23ce460a41d9 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap @@ -1,12 +1,13 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "linter": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "linter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap index 6236618990c9..c14765b5daa9 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -9,7 +9,7 @@ snapshot_kind: text { "formatter": { "enabled": false }, "linter": { "enabled": false }, - "assist": { "include": ["test.js", "test2.js"], "ignore": ["test.js"] } + "assist": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_linter_domains/enable_test_rules_via_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_linter_domains/enable_test_rules_via_overrides.snap index 354e58d42d46..6afe4c5fd7d4 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_linter_domains/enable_test_rules_via_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_linter_domains/enable_test_rules_via_overrides.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -14,7 +14,7 @@ snapshot_kind: text }, "overrides": [ { - "include": ["test1.js"], + "includes": ["test1.js"], "linter": { "domains": { "test": "all" diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/allow_trailing_commas_on_well_known_files.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/allow_trailing_commas_on_well_known_files.snap index 83b93b28c684..21ca80ef7e05 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/allow_trailing_commas_on_well_known_files.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/allow_trailing_commas_on_well_known_files.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -13,7 +13,7 @@ snapshot_kind: text }, "overrides": [ { - "include": ["**/*.json"], + "includes": ["**/*.json"], "json": { "parser": { "allowTrailingCommas": true } } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/complex_enable_disable_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/complex_enable_disable_overrides.snap index bd9d4cfa4873..a43c758a45d9 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/complex_enable_disable_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/complex_enable_disable_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,9 +16,9 @@ expression: content } }, "overrides": [ - { "include": ["formatted.js"], "formatter": { "enabled": true } }, + { "includes": ["formatted.js"], "formatter": { "enabled": true } }, { - "include": ["dirty.js"], + "includes": ["dirty.js"], "linter": { "rules": { "performance": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/disallow_comments_on_well_known_files.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/disallow_comments_on_well_known_files.snap index d53d5abca5a5..ada59ee2eac5 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/disallow_comments_on_well_known_files.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/disallow_comments_on_well_known_files.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -12,7 +13,7 @@ expression: content }, "overrides": [ { - "include": ["**/*.json"], + "includes": ["**/*.json"], "json": { "parser": { "allowComments": false } } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_handle_included_file_and_disable_formatter.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_handle_included_file_and_disable_formatter.snap index ce9b430d9671..3404820bc95a 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_handle_included_file_and_disable_formatter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_handle_included_file_and_disable_formatter.snap @@ -1,16 +1,17 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, "overrides": [ - { "include": ["special/**"], "formatter": { "enabled": false } } + { "includes": ["special/**"], "formatter": { "enabled": false } } ] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting.snap index 3f4076061238..af9295eb378b 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting.snap @@ -1,12 +1,15 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "overrides": [{ "include": ["special/**"], "formatter": { "lineWidth": 20 } }] + "overrides": [ + { "includes": ["special/**"], "formatter": { "lineWidth": 20 } } + ] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting_and_all_of_them.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting_and_all_of_them.snap index 39bbffcddb2a..1ff27390d719 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting_and_all_of_them.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_formatting_and_all_of_them.snap @@ -1,14 +1,15 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "overrides": [ - { "include": ["special/**"], "formatter": { "lineWidth": 130 } }, - { "include": ["special/**"], "formatter": { "lineWidth": 20 } } + { "includes": ["special/**"], "formatter": { "lineWidth": 130 } }, + { "includes": ["special/**"], "formatter": { "lineWidth": 20 } } ] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_languages.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_languages.snap index 2182f160cd0d..a69cb198a47a 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_languages.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_languages.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,17 +9,17 @@ expression: content { "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "formatter": { "lineWidth": 120 }, "javascript": { "formatter": { "quoteStyle": "single" } } }, { - "include": ["test2.js"], + "includes": ["test2.js"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "javascript": { "formatter": { "semicolons": "asNeeded" } } }, { - "include": ["test.css"], + "includes": ["test.css"], "formatter": { "lineWidth": 120, "indentStyle": "space" }, "css": { "formatter": { "quoteStyle": "single" } } } diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_overrides.snap index f3bbb3a0b678..0405595202b9 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_include_file_with_different_overrides.snap @@ -1,15 +1,16 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "overrides": [ - { "include": ["test.js"], "formatter": { "lineWidth": 20 } }, + { "includes": ["test.js"], "formatter": { "lineWidth": 20 } }, { - "include": ["test2.js"], + "includes": ["test2.js"], "formatter": { "lineWidth": 20, "indentStyle": "space" } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings.snap index 48e2c36d5870..674f6a7351de 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "javascript": { "formatter": { "quoteStyle": "single" } }, - "overrides": [{ "include": ["test.js"], "linter": { "enabled": false } }] + "overrides": [{ "includes": ["test.js"], "linter": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings_2.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings_2.snap index fcf15491134d..f20c9c7ca6bf 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings_2.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_language_settings_2.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "javascript": { "formatter": { "lineWidth": 20 } }, - "overrides": [{ "include": ["test.js"], "linter": { "enabled": false } }] + "overrides": [{ "includes": ["test.js"], "linter": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_settings.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_settings.snap index de3ffcb5d0b5..66c0733b8965 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_settings.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_change_formatting_settings.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "formatter": { "lineWidth": 20, "indentStyle": "space" }, - "overrides": [{ "include": ["test.js"], "linter": { "enabled": false } }] + "overrides": [{ "includes": ["test.js"], "linter": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_conceal_previous_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_conceal_previous_overrides.snap index 8d8a0e7a96c4..946389eb7861 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_conceal_previous_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_conceal_previous_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -9,11 +10,11 @@ expression: content "javascript": { "formatter": { "quoteStyle": "single" } }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "javascript": { "formatter": { "quoteStyle": "double" } } }, { - "include": ["test.js"], + "includes": ["test.js"], "javascript": { "formatter": { "indentWidth": 4 } } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_override_well_known_special_files_when_config_override_is_present.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_override_well_known_special_files_when_config_override_is_present.snap index 010822088545..6f1bf5ec8d08 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_override_well_known_special_files_when_config_override_is_present.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/does_not_override_well_known_special_files_when_config_override_is_present.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "include": ["**/*.json"], + "includes": ["**/*.json"], "formatter": { "enabled": false } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_default_formatter_for_package_json.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_default_formatter_for_package_json.snap index c26fc15a6b4f..0e0dbc986760 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_default_formatter_for_package_json.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_default_formatter_for_package_json.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -9,7 +9,7 @@ snapshot_kind: text { "overrides": [ { - "include": ["package.json"], + "includes": ["package.json"], "json": { "formatter": { "expand": "followSource" } } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_grit_formatting_options.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_grit_formatting_options.snap index 2337721e0808..7a9edc5e4aec 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_grit_formatting_options.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/overrides_grit_formatting_options.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -12,7 +12,7 @@ snapshot_kind: text }, "overrides": [ { - "include": ["file.grit"], + "includes": ["file.grit"], "grit": { "formatter": { "indentStyle": "space", "indentWidth": 8 } } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/takes_last_formatter_enabled_into_account.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/takes_last_formatter_enabled_into_account.snap index 2a2c1f345cc7..d04e90ad08f9 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/takes_last_formatter_enabled_into_account.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_formatter/takes_last_formatter_enabled_into_account.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,11 +9,11 @@ expression: content { "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "formatter": { "enabled": false } }, { - "include": ["*.js"], + "includes": ["*.js"], "formatter": { "enabled": true } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_handle_included_file_and_disable_linter.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_handle_included_file_and_disable_linter.snap index b2c4b720335c..cead69cd1638 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_handle_included_file_and_disable_linter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_handle_included_file_and_disable_linter.snap @@ -1,15 +1,16 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, - "overrides": [{ "include": ["special/**"], "linter": { "enabled": false } }] + "overrides": [{ "includes": ["special/**"], "linter": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_linting_and_applies_all_of_them.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_linting_and_applies_all_of_them.snap index 3a60169a34f6..ace5f4e87c7c 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_linting_and_applies_all_of_them.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_linting_and_applies_all_of_them.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "include": ["special/**"], + "includes": ["special/**"], "linter": { "rules": { "suspicious": { @@ -18,7 +19,7 @@ expression: content } }, { - "include": ["special/**"], + "includes": ["special/**"], "linter": { "rules": { "suspicious": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_overrides.snap index 1a6143f91d0a..aadbd5b423e1 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { @@ -18,7 +19,7 @@ expression: content } }, { - "include": ["test2.js"], + "includes": ["test2.js"], "linter": { "rules": { "complexity": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_rules.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_rules.snap index 403b9385cf01..6e7f248114a2 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_rules.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_include_file_with_different_rules.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "include": ["special/**"], + "includes": ["special/**"], "linter": { "rules": { "suspicious": { "noDebugger": "off" } diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_merge_all_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_merge_all_overrides.snap index dcf2bb913786..ecb249d7da00 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_merge_all_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_merge_all_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,7 +16,7 @@ expression: content }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "rules": { "suspicious": { @@ -25,7 +26,7 @@ expression: content } }, { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { @@ -35,7 +36,7 @@ expression: content } }, { - "include": ["test3.js"] + "includes": ["test3.js"] } ] } diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_change_linting_settings.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_change_linting_settings.snap index 5398177801df..9d99fc74fd79 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_change_linting_settings.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_change_linting_settings.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -13,7 +14,7 @@ expression: content } } }, - "overrides": [{ "include": ["test.js"], "formatter": { "enabled": false } }] + "overrides": [{ "includes": ["test.js"], "formatter": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_conceal_overrides_globals.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_conceal_overrides_globals.snap index bbc99aea195a..0f7d2c742d2b 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_conceal_overrides_globals.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_not_conceal_overrides_globals.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,11 +16,11 @@ expression: content }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "javascript": { "globals": ["GLOBAL_VAR"] } }, { - "include": ["*.js"] + "includes": ["*.js"] } ] } diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_groupe_recommended.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_groupe_recommended.snap index d3de7684ec41..c0bc7c8bfe9b 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_groupe_recommended.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_groupe_recommended.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,7 +16,7 @@ expression: content }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_recommended.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_recommended.snap index af7cbe3c7af3..2c73f9a2b03e 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_recommended.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_recommended.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -13,7 +14,7 @@ expression: content }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "recommended": false diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_the_rules.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_the_rules.snap index 4151505a49b4..38d80379d8aa 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_the_rules.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_override_the_rules.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": { diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_group_recommended_when_override_global_recommened.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_group_recommended_when_override_global_recommened.snap index 90ca9c99d6e5..772b1831afb1 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_group_recommended_when_override_global_recommened.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_group_recommended_when_override_global_recommened.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,7 +16,7 @@ expression: content }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "recommended": true diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_individually_diabled_rules_in_overrides.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_individually_diabled_rules_in_overrides.snap index 33dee09769b6..a85b0175affb 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_individually_diabled_rules_in_overrides.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/does_preserve_individually_diabled_rules_in_overrides.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,7 +16,7 @@ expression: content }, "overrides": [ { - "include": ["test.js"], + "includes": ["test.js"], "linter": { "rules": { "suspicious": {} diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/takes_last_linter_enabled_into_account.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/takes_last_linter_enabled_into_account.snap index 88cdc11e7694..2bc8f8390f8e 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/takes_last_linter_enabled_into_account.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_linter/takes_last_linter_enabled_into_account.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,11 +16,11 @@ expression: content }, "overrides": [ { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "enabled": false } }, { - "include": ["*.js"], + "includes": ["*.js"], "linter": { "enabled": true } } ] diff --git a/crates/biome_cli/tests/snapshots/main_cases_overrides_organize_imports/does_handle_included_file_and_disable_organize_imports.snap b/crates/biome_cli/tests/snapshots/main_cases_overrides_organize_imports/does_handle_included_file_and_disable_organize_imports.snap index 813751dacbf9..f30d89624c9c 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_overrides_organize_imports/does_handle_included_file_and_disable_organize_imports.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_overrides_organize_imports/does_handle_included_file_and_disable_organize_imports.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -8,9 +8,9 @@ snapshot_kind: text ```json { "files": { - "include": ["test.js", "special/**"] + "includes": ["test.js", "special/**"] }, - "overrides": [{ "include": ["special/**"], "assist": { "enabled": false } }] + "overrides": [{ "includes": ["special/**"], "assist": { "enabled": false } }] } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap index d1e1821b5e61..68b772fbc135 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "formatter": { - "include": ["src"], + "includes": ["src/**"], "ignore": ["src/file2.js"] } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_all.snap b/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_all.snap index c1660c939454..1eaa0758d252 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_all.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_all.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -13,7 +13,7 @@ snapshot_kind: text }, "overrides": [ { - "include": ["file.json"], + "includes": ["file.json"], "json": { "formatter": { "trailingCommas": "all" } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_none.snap b/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_none.snap index c7d74a69f6b0..f36a4af52a52 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_none.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/format_json_trailing_commas_overrides_none.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -12,7 +13,7 @@ expression: content }, "overrides": [ { - "include": ["file.json"], + "includes": ["file.json"], "json": { "formatter": { "trailingCommas": "none" } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap b/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap index 15ab07867204..366d6b021b1e 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap @@ -1,17 +1,18 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["file1.js", "file2.js", "file3.js"], + "includes": ["file1.js", "file2.js", "file3.js"], "ignore": ["file2.js"] }, "formatter": { - "include": ["file1.js", "file2.js"], + "includes": ["file1.js", "file2.js"], "ignore": ["file3.js"] } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap b/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap index af3163f1e532..9fb86dda18ba 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -15,7 +16,7 @@ expression: content "ignore": ["file2.js"] }, "formatter": { - "include": ["file1.js", "file2.js", "file4.js"], + "includes": ["file1.js", "file2.js", "file4.js"], "ignore": ["file3.js"] } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_changed_file_if_its_included.snap b/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_changed_file_if_its_included.snap index e0d47d3d6458..240f00d44a6c 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_changed_file_if_its_included.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_changed_file_if_its_included.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["file.js"] + "includes": ["file.js"] }, "vcs": { "defaultBranch": "main" diff --git a/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_staged_file_if_its_included.snap b/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_staged_file_if_its_included.snap index e0d47d3d6458..240f00d44a6c 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_staged_file_if_its_included.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_lint/should_only_process_staged_file_if_its_included.snap @@ -1,13 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "files": { - "include": ["file.js"] + "includes": ["file.js"] }, "vcs": { "defaultBranch": "main" diff --git a/crates/biome_cli/tests/snapshots/main_commands_rage/with_formatter_configuration.snap b/crates/biome_cli/tests/snapshots/main_commands_rage/with_formatter_configuration.snap index edde299682dc..bb022eabb32b 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_rage/with_formatter_configuration.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_rage/with_formatter_configuration.snap @@ -11,7 +11,7 @@ snapshot_kind: text "attributePosition": "multiline", "enabled": true, "formatWithErrors": true, - "include": [ + "includes": [ "**/*.html", "**/*.css", "**/*.js", @@ -87,7 +87,8 @@ Formatter: Attribute position: Multiline Bracket spacing: unset Ignore: configuration-schema.json - Include: **/*.html, **/*.css, **/*.js, **/*.ts, **/*.tsx, **/*.jsx, **/*.json, **/*.md + Include: unset + Includes: **/*.html, **/*.css, **/*.js, **/*.ts, **/*.tsx, **/*.jsx, **/*.json, **/*.md JavaScript Formatter: Enabled: true diff --git a/crates/biome_cli/tests/snapshots/main_configuration/override_globals.snap b/crates/biome_cli/tests/snapshots/main_configuration/override_globals.snap index 736beaa703a2..6eb35ccb9ceb 100644 --- a/crates/biome_cli/tests/snapshots/main_configuration/override_globals.snap +++ b/crates/biome_cli/tests/snapshots/main_configuration/override_globals.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -19,7 +20,7 @@ expression: content }, "overrides": [ { - "include": ["tests"], + "includes": ["tests/**"], "javascript": { "globals": ["test", "it"] } diff --git a/crates/biome_configuration/Cargo.toml b/crates/biome_configuration/Cargo.toml index bdac3e496f83..e8590ef8e756 100644 --- a/crates/biome_configuration/Cargo.toml +++ b/crates/biome_configuration/Cargo.toml @@ -22,6 +22,7 @@ biome_deserialize_macros = { workspace = true } biome_diagnostics = { workspace = true, features = ["serde_ini", "oxc_resolver"] } biome_flags = { workspace = true } biome_formatter = { workspace = true, features = ["serde"] } +biome_glob = { workspace = true } biome_graphql_analyze = { workspace = true } biome_graphql_syntax = { workspace = true } biome_html_formatter = { workspace = true, features = ["serde"] } diff --git a/crates/biome_configuration/src/analyzer/assist/mod.rs b/crates/biome_configuration/src/analyzer/assist/mod.rs index f521386d438e..1c2410240c40 100644 --- a/crates/biome_configuration/src/analyzer/assist/mod.rs +++ b/crates/biome_configuration/src/analyzer/assist/mod.rs @@ -22,17 +22,23 @@ pub struct AssistConfiguration { #[serde(skip_serializing_if = "Option::is_none")] pub actions: Option, - /// A list of Unix shell style patterns. The formatter will ignore files/folders that will + /// A list of Unix shell style patterns. Biome will ignore files/folders that will /// match these patterns. #[bpaf(hide, pure(Default::default()))] #[serde(skip_serializing_if = "Option::is_none")] pub ignore: Option>>, - /// A list of Unix shell style patterns. The formatter will include files/folders that will + /// A list of Unix shell style patterns. Biome will include files/folders that will /// match these patterns. #[bpaf(hide, pure(Default::default()))] #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>>, + + /// A list of glob patterns. Biome will include files/folders that will + /// match these patterns. + #[bpaf(hide, pure(Default::default()))] + #[serde(skip_serializing_if = "Option::is_none")] + pub includes: Option>, } impl AssistConfiguration { diff --git a/crates/biome_configuration/src/analyzer/assists/mod.rs b/crates/biome_configuration/src/analyzer/assists/mod.rs new file mode 100644 index 000000000000..39a5205ecca8 --- /dev/null +++ b/crates/biome_configuration/src/analyzer/assists/mod.rs @@ -0,0 +1,48 @@ +mod actions; + +pub use crate::analyzer::assists::actions::*; +use biome_deserialize::StringSet; +use biome_deserialize_macros::{Deserializable, Merge, Partial}; +use bpaf::Bpaf; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Eq, Partial, PartialEq, Serialize)] +#[partial(derive(Bpaf, Clone, Deserializable, Eq, Merge, PartialEq))] +#[partial(cfg_attr(feature = "schema", derive(schemars::JsonSchema)))] +#[partial(serde(deny_unknown_fields, rename_all = "camelCase"))] +pub struct AssistsConfiguration { + /// Whether Biome should enable assists via LSP. + #[partial(bpaf(long("assists-enabled"), argument("true|false")))] + pub enabled: bool, + + /// Whether Biome should fail in CLI if the assists were not applied to the code. + #[partial(bpaf(pure(Default::default()), optional, hide))] + pub actions: Actions, + + /// A list of Unix shell style patterns. Biome will ignore files/folders that will + /// match these patterns. + #[partial(bpaf(hide))] + pub ignore: StringSet, + + /// A list of Unix shell style patterns. Biome will include files/folders that will + /// match these patterns. + #[partial(bpaf(hide))] + pub include: StringSet, + + /// A list of glob patterns. Biome will include files/folders that will + /// match these patterns. + #[partial(bpaf(pure(Default::default()), hide))] + pub includes: Vec, +} + +impl Default for AssistsConfiguration { + fn default() -> Self { + Self { + enabled: true, + actions: Actions::default(), + ignore: StringSet::default(), + include: StringSet::default(), + includes: Default::default(), + } + } +} diff --git a/crates/biome_configuration/src/analyzer/linter/mod.rs b/crates/biome_configuration/src/analyzer/linter/mod.rs index 53c791650eee..af27133c54b1 100644 --- a/crates/biome_configuration/src/analyzer/linter/mod.rs +++ b/crates/biome_configuration/src/analyzer/linter/mod.rs @@ -33,12 +33,18 @@ pub struct LinterConfiguration { #[serde(skip_serializing_if = "Option::is_none")] pub ignore: Option>>, - /// A list of Unix shell style patterns. The formatter will include files/folders that will + /// A list of Unix shell style patterns. The analyzer will include files/folders that will /// match these patterns. #[bpaf(hide, pure(Default::default()))] #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>>, + /// A list of glob patterns. The analyzer will handle only those files/folders that will + /// match these patterns. + #[bpaf(pure(Default::default()), hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub includes: Option>, + /// An object where the keys are the names of the domains, and the values are boolean. `true` to turn-on the rules that /// belong to that domain, `false` to turn them off #[bpaf(hide, pure(Default::default()))] diff --git a/crates/biome_configuration/src/formatter.rs b/crates/biome_configuration/src/formatter.rs index 779c24b5df69..705108ca3387 100644 --- a/crates/biome_configuration/src/formatter.rs +++ b/crates/biome_configuration/src/formatter.rs @@ -83,6 +83,12 @@ pub struct FormatterConfiguration { #[bpaf(hide, pure(Default::default()))] #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>>, + + /// A list of glob patterns. The formatter will include files/folders that will + /// match these patterns. + #[bpaf(pure(Default::default()), hide)] + #[serde(skip_serializing_if = "Option::is_none")] + pub includes: Option>, } impl FormatterConfiguration { @@ -121,12 +127,4 @@ impl FormatterConfiguration { pub fn use_editorconfig_resolved(&self) -> bool { self.use_editorconfig.unwrap_or_default().into() } - - pub fn ignore_resolved(&self) -> Vec> { - self.ignore.clone().unwrap_or_default() - } - - pub fn include_resolved(&self) -> Vec> { - self.include.clone().unwrap_or_default() - } } diff --git a/crates/biome_configuration/src/lib.rs b/crates/biome_configuration/src/lib.rs index 839c4ca7f8a9..ba82353aef2a 100644 --- a/crates/biome_configuration/src/lib.rs +++ b/crates/biome_configuration/src/lib.rs @@ -356,6 +356,12 @@ pub struct FilesConfiguration { #[bpaf(hide, pure(Default::default()))] #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>>, + + /// A list of glob patterns. Biome will handle only those files/folders that will + /// match these patterns. + #[bpaf(hide, pure(Default::default()))] + #[serde(skip_serializing_if = "Option::is_none")] + pub includes: Option>, } pub struct ConfigurationPayload { diff --git a/crates/biome_configuration/src/organize_imports.rs b/crates/biome_configuration/src/organize_imports.rs new file mode 100644 index 000000000000..a03de8663ecc --- /dev/null +++ b/crates/biome_configuration/src/organize_imports.rs @@ -0,0 +1,50 @@ +use biome_deserialize::StringSet; +use biome_deserialize_macros::{Deserializable, Merge, Partial}; +use bpaf::Bpaf; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Eq, Partial, PartialEq, Serialize)] +#[partial(derive(Bpaf, Clone, Deserializable, Eq, Merge, PartialEq))] +#[partial(cfg_attr(feature = "schema", derive(schemars::JsonSchema)))] +#[partial(serde(rename_all = "camelCase", default, deny_unknown_fields))] +pub struct OrganizeImports { + /// Enables the organization of imports + #[partial(bpaf(hide))] + pub enabled: bool, + + /// A list of Unix shell style patterns. The import organizer will ignore files/folders that will + /// match these patterns. + #[partial(bpaf(hide))] + pub ignore: StringSet, + + /// A list of Unix shell style patterns. The import organizer will include files/folders that will + /// match these patterns. + #[partial(bpaf(hide))] + pub include: StringSet, + + /// A list of glob patterns. The import organizer will include files/folders that will + /// match these patterns. + #[partial(bpaf(pure(Default::default()), hide))] + pub includes: Vec, +} + +impl Default for OrganizeImports { + fn default() -> Self { + Self { + enabled: true, + ignore: Default::default(), + include: Default::default(), + includes: Default::default(), + } + } +} + +impl PartialOrganizeImports { + pub const fn is_disabled(&self) -> bool { + matches!(self.enabled, Some(false)) + } + + pub const fn is_enabled(&self) -> bool { + !self.is_disabled() + } +} diff --git a/crates/biome_configuration/src/overrides.rs b/crates/biome_configuration/src/overrides.rs index c011018e7d5c..abc66c934e78 100644 --- a/crates/biome_configuration/src/overrides.rs +++ b/crates/biome_configuration/src/overrides.rs @@ -34,16 +34,21 @@ impl FromStr for Overrides { #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] #[serde(rename_all = "camelCase", default, deny_unknown_fields)] pub struct OverridePattern { - /// A list of Unix shell style patterns. The formatter will ignore files/folders that will + /// A list of Unix shell style patterns. Biome will ignore files/folders that will /// match these patterns. #[serde(skip_serializing_if = "Option::is_none")] pub ignore: Option>>, - /// A list of Unix shell style patterns. The formatter will include files/folders that will + /// A list of Unix shell style patterns. Biome will include files/folders that will /// match these patterns. #[serde(skip_serializing_if = "Option::is_none")] pub include: Option>>, + /// A list of glob patterns. Biome will include files/folders that will + /// match these patterns. + #[serde(skip_serializing_if = "Option::is_none")] + pub includes: Option>, + /// Specific configuration for the JavaScript language #[serde(skip_serializing_if = "Option::is_none")] pub javascript: Option, diff --git a/crates/biome_configuration/tests/invalid/files_extraneous_field.json.snap b/crates/biome_configuration/tests/invalid/files_extraneous_field.json.snap index b144da9f9ff0..fc8eaf8c2411 100644 --- a/crates/biome_configuration/tests/invalid/files_extraneous_field.json.snap +++ b/crates/biome_configuration/tests/invalid/files_extraneous_field.json.snap @@ -1,6 +1,7 @@ --- source: crates/biome_service/tests/spec_tests.rs expression: files_extraneous_field.json +snapshot_kind: text --- files_extraneous_field.json:3:3 deserialize ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -19,3 +20,4 @@ files_extraneous_field.json:3:3 deserialize ━━━━━━━━━━━━ - ignoreUnknown - ignore - include + - includes diff --git a/crates/biome_configuration/tests/invalid/formatter_extraneous_field.json.snap b/crates/biome_configuration/tests/invalid/formatter_extraneous_field.json.snap index 25e5faadae0b..27b8b57e2487 100644 --- a/crates/biome_configuration/tests/invalid/formatter_extraneous_field.json.snap +++ b/crates/biome_configuration/tests/invalid/formatter_extraneous_field.json.snap @@ -28,3 +28,4 @@ formatter_extraneous_field.json:3:3 deserialize ━━━━━━━━━━ - useEditorconfig - ignore - include + - includes diff --git a/crates/biome_configuration/tests/invalid/formatter_quote_style.json.snap b/crates/biome_configuration/tests/invalid/formatter_quote_style.json.snap index aaae7457feb9..34576e8a927e 100644 --- a/crates/biome_configuration/tests/invalid/formatter_quote_style.json.snap +++ b/crates/biome_configuration/tests/invalid/formatter_quote_style.json.snap @@ -28,3 +28,4 @@ formatter_quote_style.json:3:9 deserialize ━━━━━━━━━━━━ - useEditorconfig - ignore - include + - includes diff --git a/crates/biome_configuration/tests/invalid/overrides/incorrect_key.json.snap b/crates/biome_configuration/tests/invalid/overrides/incorrect_key.json.snap index ecc258318506..1444d0e4496d 100644 --- a/crates/biome_configuration/tests/invalid/overrides/incorrect_key.json.snap +++ b/crates/biome_configuration/tests/invalid/overrides/incorrect_key.json.snap @@ -18,6 +18,7 @@ incorrect_key.json:4:4 deserialize ━━━━━━━━━━━━━━━ - ignore - include + - includes - javascript - json - css diff --git a/crates/biome_configuration/tests/valid/overrides/top_level_keys.json b/crates/biome_configuration/tests/valid/overrides/top_level_keys.json index 5dfaed105db7..95add2114099 100644 --- a/crates/biome_configuration/tests/valid/overrides/top_level_keys.json +++ b/crates/biome_configuration/tests/valid/overrides/top_level_keys.json @@ -3,6 +3,7 @@ { "ignore": [], "include": [], + "includes": [], "javascript": {}, "json": {}, "css": {} diff --git a/crates/biome_glob/src/lib.rs b/crates/biome_glob/src/lib.rs index 2791a47d09d7..bd42efecb537 100644 --- a/crates/biome_glob/src/lib.rs +++ b/crates/biome_glob/src/lib.rs @@ -255,7 +255,7 @@ impl biome_deserialize::Deserializable for Glob { #[cfg(feature = "schema")] impl schemars::JsonSchema for Glob { fn schema_name() -> String { - "Regex".to_string() + "Glob".to_string() } fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { diff --git a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs index 6a7818503cad..0cd21989737e 100644 --- a/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs +++ b/crates/biome_js_analyze/src/lint/style/use_filenaming_convention.rs @@ -48,7 +48,7 @@ declare_lint_rule! { /// { /// "overrides": [ /// { - /// "include": ["test/**/*"], + /// "includes": ["test/**/*"], /// "linter": { /// "rules": { /// "style": { diff --git a/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs b/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs index 11112641192b..835bbbf447dc 100644 --- a/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs +++ b/crates/biome_js_analyze/src/lint/style/use_naming_convention.rs @@ -307,7 +307,7 @@ declare_lint_rule! { /// // ... /// "overrides": [ /// { - /// "include": ["typings/*.d.ts"], + /// "includes": ["typings/*.d.ts"], /// "linter": { /// "rules": { /// "style": { diff --git a/crates/biome_js_parser/tests/js_test_suite/ok/many_empty_strings.js.snap b/crates/biome_js_parser/tests/js_test_suite/ok/many_empty_strings.js.snap index 4fef657ca43c..bb065f491ed1 100644 --- a/crates/biome_js_parser/tests/js_test_suite/ok/many_empty_strings.js.snap +++ b/crates/biome_js_parser/tests/js_test_suite/ok/many_empty_strings.js.snap @@ -1,6 +1,7 @@ --- source: crates/biome_js_parser/tests/spec_test.rs expression: snapshot +snapshot_kind: text --- ## Input diff --git a/crates/biome_lsp/tests/server.rs b/crates/biome_lsp/tests/server.rs index fb42c6104c29..1c73b89c105a 100644 --- a/crates/biome_lsp/tests/server.rs +++ b/crates/biome_lsp/tests/server.rs @@ -1861,7 +1861,7 @@ async fn does_not_pull_action_for_disabled_rule_in_override_issue_2782() -> Resu }, "overrides": [ { - "include": ["*.ts", "*.tsx"], + "includes": ["**/*.ts", "**/*.tsx"], "linter": { "rules": { "style": { diff --git a/crates/biome_service/Cargo.toml b/crates/biome_service/Cargo.toml index e235dc6b8de9..38e43cef2d25 100644 --- a/crates/biome_service/Cargo.toml +++ b/crates/biome_service/Cargo.toml @@ -26,6 +26,7 @@ biome_deserialize = { workspace = true } biome_diagnostics = { workspace = true, features = ["camino"] } biome_formatter = { workspace = true, features = ["serde"] } biome_fs = { workspace = true, features = ["serde"] } +biome_glob = { workspace = true } biome_graphql_analyze = { workspace = true } biome_graphql_formatter = { workspace = true } biome_graphql_parser = { workspace = true } diff --git a/crates/biome_service/src/file_handlers/css.rs b/crates/biome_service/src/file_handlers/css.rs index 308652faa78a..295eb4ff4699 100644 --- a/crates/biome_service/src/file_handlers/css.rs +++ b/crates/biome_service/src/file_handlers/css.rs @@ -239,15 +239,9 @@ impl ServiceLanguage for CssLanguage { pattern.languages.css.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -274,15 +268,9 @@ impl ServiceLanguage for CssLanguage { pattern.languages.css.assist.enabled, pattern.assist.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -309,15 +297,9 @@ impl ServiceLanguage for CssLanguage { pattern.languages.css.linter.enabled, pattern.linter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/file_handlers/graphql.rs b/crates/biome_service/src/file_handlers/graphql.rs index 66616269d189..ce818a8d7ff0 100644 --- a/crates/biome_service/src/file_handlers/graphql.rs +++ b/crates/biome_service/src/file_handlers/graphql.rs @@ -182,15 +182,9 @@ impl ServiceLanguage for GraphqlLanguage { pattern.languages.graphql.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -217,15 +211,9 @@ impl ServiceLanguage for GraphqlLanguage { pattern.languages.graphql.assist.enabled, pattern.assist.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -252,15 +240,9 @@ impl ServiceLanguage for GraphqlLanguage { pattern.languages.graphql.linter.enabled, pattern.linter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/file_handlers/grit.rs b/crates/biome_service/src/file_handlers/grit.rs index fe9fbb073a14..8cc6dfadbd82 100644 --- a/crates/biome_service/src/file_handlers/grit.rs +++ b/crates/biome_service/src/file_handlers/grit.rs @@ -153,15 +153,9 @@ impl ServiceLanguage for GritLanguage { pattern.languages.grit.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -188,15 +182,9 @@ impl ServiceLanguage for GritLanguage { pattern.languages.grit.assist.enabled, pattern.assist.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -223,15 +211,9 @@ impl ServiceLanguage for GritLanguage { pattern.languages.grit.linter.enabled, pattern.linter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/file_handlers/html.rs b/crates/biome_service/src/file_handlers/html.rs index 0a3aa1f15f54..bf68fc8f4d92 100644 --- a/crates/biome_service/src/file_handlers/html.rs +++ b/crates/biome_service/src/file_handlers/html.rs @@ -153,15 +153,9 @@ impl ServiceLanguage for HtmlLanguage { pattern.languages.html.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/file_handlers/javascript.rs b/crates/biome_service/src/file_handlers/javascript.rs index 5fe8ab06ab08..a9c21c261b71 100644 --- a/crates/biome_service/src/file_handlers/javascript.rs +++ b/crates/biome_service/src/file_handlers/javascript.rs @@ -367,15 +367,9 @@ impl ServiceLanguage for JsLanguage { pattern.languages.javascript.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -402,15 +396,9 @@ impl ServiceLanguage for JsLanguage { pattern.languages.javascript.assist.enabled, pattern.assist.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -437,15 +425,9 @@ impl ServiceLanguage for JsLanguage { pattern.languages.javascript.linter.enabled, pattern.linter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/file_handlers/json.rs b/crates/biome_service/src/file_handlers/json.rs index 7f09dd5392c9..84efbe730370 100644 --- a/crates/biome_service/src/file_handlers/json.rs +++ b/crates/biome_service/src/file_handlers/json.rs @@ -221,15 +221,9 @@ impl ServiceLanguage for JsonLanguage { pattern.languages.json.formatter.enabled, pattern.formatter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -256,15 +250,9 @@ impl ServiceLanguage for JsonLanguage { pattern.languages.json.assist.enabled, pattern.assist.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); @@ -291,15 +279,9 @@ impl ServiceLanguage for JsonLanguage { pattern.languages.json.linter.enabled, pattern.linter.enabled, ) - .and_then(|enabled| { + .filter(|_| { // Then check whether the path satisfies - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { - Some(enabled) - } else { - None - } + pattern.is_file_included(path) }) }); diff --git a/crates/biome_service/src/projects.rs b/crates/biome_service/src/projects.rs index da7f702773b4..49e8f4ca92dd 100644 --- a/crates/biome_service/src/projects.rs +++ b/crates/biome_service/src/projects.rs @@ -174,27 +174,52 @@ impl Projects { }; let settings = &project_data.settings; - let (feature_included_files, feature_ignored_files) = match feature { + let (feature_includes_files, feature_included_files, feature_ignored_files) = match feature + { FeatureKind::Format => { let formatter = &settings.formatter; - (&formatter.included_files, &formatter.ignored_files) + ( + &formatter.includes_files, + &formatter.included_files, + &formatter.ignored_files, + ) } FeatureKind::Lint => { let linter = &settings.linter; - (&linter.included_files, &linter.ignored_files) + ( + &linter.includes_files, + &linter.included_files, + &linter.ignored_files, + ) } FeatureKind::Assist => { let assists = &settings.assist; - (&assists.included_files, &assists.ignored_files) + ( + &assists.includes_files, + &assists.included_files, + &assists.ignored_files, + ) } // TODO: enable once the configuration is available FeatureKind::Search => return false, // There is no search-specific config. FeatureKind::Debug => return false, }; - let is_feature_included = feature_included_files.is_empty() - || is_dir(path) - || feature_included_files.matches_path(path); + + let mut is_feature_included = true; + if !feature_includes_files.is_empty() { + let candidate_path = biome_glob::CandidatePath::new(&path); + is_feature_included = if is_dir(path) { + candidate_path.matches_directory_with_exceptions(feature_includes_files) + } else { + candidate_path.matches_with_exceptions(feature_includes_files) + }; + } + if !feature_included_files.is_empty() { + is_feature_included = + is_feature_included && (is_dir(path) || feature_included_files.matches_path(path)); + }; + !is_feature_included || feature_ignored_files.matches_path(path) } } diff --git a/crates/biome_service/src/settings.rs b/crates/biome_service/src/settings.rs index 1f310ef8c2d5..d774a6934560 100644 --- a/crates/biome_service/src/settings.rs +++ b/crates/biome_service/src/settings.rs @@ -149,7 +149,7 @@ impl Settings { for pattern in overrides.patterns.iter() { let pattern_rules = pattern.linter.rules.as_ref(); if let Some(pattern_rules) = pattern_rules { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { result = if let Some(mut result) = result.take() { // Override rules result.to_mut().merge_with(pattern_rules.clone()); @@ -173,7 +173,7 @@ impl Settings { for pattern in overrides.patterns.iter() { let pattern_rules = pattern.linter.domains.as_ref(); if let Some(pattern_rules) = pattern_rules { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { result = if let Some(mut result) = result.take() { // Override rules result.to_mut().merge_with(pattern_rules.clone()); @@ -195,7 +195,7 @@ impl Settings { for pattern in overrides.patterns.iter() { let pattern_rules = pattern.assist.actions.as_ref(); if let Some(pattern_rules) = pattern_rules { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { result = if let Some(mut result) = result.take() { // Override rules result.to_mut().merge_with(pattern_rules.clone()); @@ -241,6 +241,8 @@ pub struct FormatSettings { pub ignored_files: Matcher, /// List of included paths/files pub included_files: Matcher, + /// List of included paths/files + pub includes_files: Box<[biome_glob::Glob]>, } impl FormatSettings { @@ -297,6 +299,9 @@ pub struct LinterSettings { /// List of included paths/files to match pub included_files: Matcher, + /// List of included paths/files + pub includes_files: Box<[biome_glob::Glob]>, + /// Rule domains pub domains: Option>, } @@ -334,6 +339,9 @@ pub struct AssistSettings { /// List of included paths/files to match pub included_files: Matcher, + + /// List of included paths/files + pub includes_files: Box<[biome_glob::Glob]>, } impl AssistSettings { @@ -591,6 +599,9 @@ pub struct FilesSettings { /// List of paths/files to matcher pub included_files: Matcher, + /// List of included paths/files + pub includes_files: Box<[biome_glob::Glob]>, + /// Files not recognized by Biome should not emit a diagnostic pub ignore_unknown: Option, } @@ -622,6 +633,7 @@ fn to_file_settings( config.ignore.as_deref(), )?, included_files: Matcher::from_globs(working_directory, config.include.as_deref())?, + includes_files: config.includes.unwrap_or_default().into(), ignore_unknown: config.ignore_unknown, }) } else { @@ -743,9 +755,7 @@ impl WorkspaceSettingsHandle { .rev() .find_map(|pattern| { if let Some(enabled) = pattern.formatter.format_with_errors { - if pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) - { + if pattern.is_file_included(path) { return Some(enabled); } } @@ -764,26 +774,6 @@ pub struct OverrideSettings { } impl OverrideSettings { - /// Checks whether at least one override excludes the provided `path` - pub fn is_path_excluded(&self, path: &Utf8Path) -> Option { - for pattern in &self.patterns { - if pattern.exclude.matches_path(path) { - return Some(true); - } - } - None - } - /// Checks whether at least one override include the provided `path` - pub fn is_path_included(&self, path: &Utf8Path) -> Option { - for pattern in &self.patterns { - if pattern.include.matches_path(path) { - return Some(true); - } - } - None - } - // #endregion - /// It scans the current override rules and return the formatting options that of the first override is matched pub fn override_js_format_options( &self, @@ -791,7 +781,7 @@ impl OverrideSettings { mut options: JsFormatOptions, ) -> JsFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_js_format_options(&mut options); } } @@ -808,9 +798,7 @@ impl OverrideSettings { // Reverse the traversal as only the last override takes effect .rev() .find_map(|pattern| { - if pattern.languages.javascript.globals.is_some() - && pattern.include.matches_path(path) - && !pattern.exclude.matches_path(path) + if pattern.languages.javascript.globals.is_some() && pattern.is_file_included(path) { pattern.languages.javascript.globals.clone() } else { @@ -827,7 +815,7 @@ impl OverrideSettings { // Reverse the traversal as only the last override takes effect .rev() .find_map(|pattern| { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.languages.javascript.environment.jsx_runtime } else { None @@ -842,7 +830,7 @@ impl OverrideSettings { mut options: GritFormatOptions, ) -> GritFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_grit_format_options(&mut options); } } @@ -855,7 +843,7 @@ impl OverrideSettings { mut options: HtmlFormatOptions, ) -> HtmlFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_html_format_options(&mut options); } } @@ -868,7 +856,7 @@ impl OverrideSettings { mut options: JsParserOptions, ) -> JsParserOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_js_parser_options(&mut options); } } @@ -881,7 +869,7 @@ impl OverrideSettings { mut options: JsonParserOptions, ) -> JsonParserOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_json_parser_options(&mut options); } } @@ -895,7 +883,7 @@ impl OverrideSettings { mut options: CssParserOptions, ) -> CssParserOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_css_parser_options(&mut options); } } @@ -911,7 +899,7 @@ impl OverrideSettings { mut options: CssFormatOptions, ) -> CssFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_css_format_options(&mut options); } } @@ -925,7 +913,7 @@ impl OverrideSettings { mut options: JsonParserOptions, ) -> JsonParserOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_json_parser_options(&mut options); } } @@ -939,7 +927,7 @@ impl OverrideSettings { mut options: JsonFormatOptions, ) -> JsonFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_json_format_options(&mut options); } } @@ -957,12 +945,13 @@ impl OverrideSettings { mut options: GraphqlFormatOptions, ) -> GraphqlFormatOptions { for pattern in self.patterns.iter() { - if pattern.include.matches_path(path) && !pattern.exclude.matches_path(path) { + if pattern.is_file_included(path) { pattern.apply_overrides_to_graphql_format_options(&mut options); } } options } + // #endregion /// Retrieves the options of lint rules that have been overridden pub fn override_analyzer_rules( @@ -971,7 +960,7 @@ impl OverrideSettings { mut analyzer_rules: AnalyzerRules, ) -> AnalyzerRules { for pattern in self.patterns.iter() { - if !pattern.exclude.matches_path(path) && pattern.include.matches_path(path) { + if pattern.is_file_included(path) { if let Some(rules) = pattern.linter.rules.as_ref() { push_to_analyzer_rules( rules, @@ -1025,8 +1014,9 @@ impl OverrideSettings { #[derive(Clone, Debug, Default)] pub struct OverrideSettingPattern { - pub exclude: Matcher, - pub include: Matcher, + exclude: Matcher, + include: Matcher, + includes: Box<[biome_glob::Glob]>, /// Formatter settings applied to all files in the workspaces pub formatter: OverrideFormatSettings, /// Linter settings applied to all files in the workspace @@ -1038,6 +1028,23 @@ pub struct OverrideSettingPattern { } impl OverrideSettingPattern { + /// Returns `true` if this override settings concerns `file_path`. + /// + /// Note that only path to regular files should be passed. + /// This function doesn't take directories into account. + pub fn is_file_included(&self, file_path: &Utf8Path) -> bool { + if self.exclude.matches_path(file_path) { + return false; + } + self.include.matches_path(file_path) + || if !self.includes.is_empty() { + let candidate_path = biome_glob::CandidatePath::new(&file_path); + candidate_path.matches_with_exceptions(&self.includes) + } else { + false + } + } + fn apply_overrides_to_js_format_options(&self, options: &mut JsFormatOptions) { let js_formatter = &self.languages.javascript.formatter; let formatter = &self.formatter; @@ -1311,6 +1318,7 @@ pub fn to_override_settings( languages.html = to_html_language_settings(html, ¤t_settings.languages.html); let pattern_setting = OverrideSettingPattern { + includes: pattern.includes.unwrap_or_default().into(), include: Matcher::from_globs(working_directory.clone(), pattern.include.as_deref())?, exclude: Matcher::from_globs(working_directory.clone(), pattern.ignore.as_deref())?, formatter, @@ -1441,6 +1449,7 @@ pub fn to_format_settings( bracket_spacing: conf.bracket_spacing, ignored_files: Matcher::from_globs(working_directory.clone(), conf.ignore.as_deref())?, included_files: Matcher::from_globs(working_directory, conf.include.as_deref())?, + includes_files: conf.includes.unwrap_or_default().into(), }) } @@ -1467,6 +1476,7 @@ impl TryFrom for FormatSettings { format_with_errors: conf.format_with_errors, ignored_files: Matcher::empty(), included_files: Matcher::empty(), + includes_files: Default::default(), }) } } @@ -1480,6 +1490,7 @@ pub fn to_linter_settings( rules: conf.rules, ignored_files: Matcher::from_globs(working_directory.clone(), conf.ignore.as_deref())?, included_files: Matcher::from_globs(working_directory.clone(), conf.include.as_deref())?, + includes_files: conf.includes.unwrap_or_default().into(), domains: conf.domains, }) } @@ -1493,6 +1504,7 @@ impl TryFrom for LinterSettings { rules: conf.rules, ignored_files: Matcher::empty(), included_files: Matcher::empty(), + includes_files: Default::default(), domains: conf.domains, }) } @@ -1507,6 +1519,7 @@ pub fn to_assist_settings( actions: conf.actions, ignored_files: Matcher::from_globs(working_directory.clone(), conf.ignore.as_deref())?, included_files: Matcher::from_globs(working_directory.clone(), conf.include.as_deref())?, + includes_files: conf.includes.unwrap_or_default().into(), }) } @@ -1519,6 +1532,7 @@ impl TryFrom for AssistSettings { actions: conf.actions, ignored_files: Matcher::empty(), included_files: Matcher::empty(), + includes_files: Default::default(), }) } } diff --git a/crates/biome_service/src/workspace/server.rs b/crates/biome_service/src/workspace/server.rs index 9c01f2cbb4cd..f35eae5ad6cd 100644 --- a/crates/biome_service/src/workspace/server.rs +++ b/crates/biome_service/src/workspace/server.rs @@ -483,9 +483,19 @@ impl WorkspaceServer { return false; }; - let is_included = files_settings.included_files.is_empty() - || is_dir(path) - || files_settings.included_files.matches_path(path); + let mut is_included = true; + if !files_settings.includes_files.is_empty() { + let candidate_path = biome_glob::CandidatePath::new(&path); + is_included = if is_dir(path) { + candidate_path.matches_directory_with_exceptions(&files_settings.includes_files) + } else { + candidate_path.matches_with_exceptions(&files_settings.includes_files) + }; + } + if !files_settings.included_files.is_empty() { + is_included = + is_included && (is_dir(path) || files_settings.included_files.matches_path(path)) + }; !is_included || files_settings.ignored_files.matches_path(path) diff --git a/packages/@biomejs/backend-jsonrpc/src/workspace.ts b/packages/@biomejs/backend-jsonrpc/src/workspace.ts index b5a2605dbb27..b7bd679f86fa 100644 --- a/packages/@biomejs/backend-jsonrpc/src/workspace.ts +++ b/packages/@biomejs/backend-jsonrpc/src/workspace.ts @@ -98,13 +98,17 @@ export interface AssistConfiguration { */ enabled?: Bool; /** - * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns. + * A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns. */ ignore?: string[]; /** - * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns. + * A list of Unix shell style patterns. Biome will include files/folders that will match these patterns. */ include?: string[]; + /** + * A list of glob patterns. Biome will include files/folders that will match these patterns. + */ + includes?: Glob[]; } /** * Options applied to CSS files @@ -147,6 +151,10 @@ export interface FilesConfiguration { * A list of Unix shell style patterns. Biome will handle only those files/folders that will match these patterns. */ include?: string[]; + /** + * A list of glob patterns. Biome will handle only those files/folders that will match these patterns. + */ + includes?: Glob[]; /** * The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons. Defaults to 1 MiB */ @@ -181,6 +189,10 @@ export interface FormatterConfiguration { * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns. */ include?: string[]; + /** + * A list of glob patterns. The formatter will include files/folders that will match these patterns. + */ + includes?: Glob[]; /** * The indent style. */ @@ -314,9 +326,13 @@ export interface LinterConfiguration { */ ignore?: string[]; /** - * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns. + * A list of Unix shell style patterns. The analyzer will include files/folders that will match these patterns. */ include?: string[]; + /** + * A list of glob patterns. The analyzer will handle only those files/folders that will match these patterns. + */ + includes?: Glob[]; /** * List of rules */ @@ -359,6 +375,7 @@ export interface Actions { recommended?: boolean; source?: Source; } +export type Glob = string; /** * Options that changes how the CSS assist behaves */ @@ -768,13 +785,17 @@ export interface OverridePattern { */ html?: HtmlConfiguration; /** - * A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns. + * A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns. */ ignore?: string[]; /** - * A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns. + * A list of Unix shell style patterns. Biome will include files/folders that will match these patterns. */ include?: string[]; + /** + * A list of glob patterns. Biome will include files/folders that will match these patterns. + */ + includes?: Glob[]; /** * Specific configuration for the JavaScript language */ @@ -2611,7 +2632,7 @@ export interface RuleWithFixOptions_for_NoDoubleEqualsOptions { */ options: NoDoubleEqualsOptions; } -export type ImportGroup = PredefinedImportGroup | Regex; +export type ImportGroup = PredefinedImportGroup | Glob; /** * Used to identify the kind of code action emitted by a rule */ @@ -2834,7 +2855,6 @@ export type PredefinedImportGroup = | ":bun:" | ":node:" | ":types:"; -export type Regex = string; export type DependencyAvailability = boolean | string[]; export interface Hook { /** @@ -2865,6 +2885,7 @@ For example, for React's `useRef()` hook the value would be `true`, while for `u export type Accessibility = "noPublic" | "explicit" | "none"; export type ConsistentArrayType = "shorthand" | "generic"; export type FilenameCases = FilenameCase[]; +export type Regex = string; export interface Convention { /** * String cases to enforce diff --git a/packages/@biomejs/biome/configuration_schema.json b/packages/@biomejs/biome/configuration_schema.json index a69c7c7a30fe..7da573bac89e 100644 --- a/packages/@biomejs/biome/configuration_schema.json +++ b/packages/@biomejs/biome/configuration_schema.json @@ -398,14 +398,19 @@ "anyOf": [{ "$ref": "#/definitions/Bool" }, { "type": "null" }] }, "ignore": { - "description": "A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.", + "description": "A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns.", "type": ["array", "null"], "items": { "type": "string" } }, "include": { - "description": "A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.", + "description": "A list of Unix shell style patterns. Biome will include files/folders that will match these patterns.", "type": ["array", "null"], "items": { "type": "string" } + }, + "includes": { + "description": "A list of glob patterns. Biome will include files/folders that will match these patterns.", + "type": ["array", "null"], + "items": { "$ref": "#/definitions/Glob" } } }, "additionalProperties": false @@ -1390,6 +1395,11 @@ "type": ["array", "null"], "items": { "type": "string" } }, + "includes": { + "description": "A list of glob patterns. Biome will handle only those files/folders that will match these patterns.", + "type": ["array", "null"], + "items": { "$ref": "#/definitions/Glob" } + }, "maxSize": { "description": "The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons. Defaults to 1 MiB", "anyOf": [{ "$ref": "#/definitions/MaxSize" }, { "type": "null" }] @@ -1469,6 +1479,11 @@ "type": ["array", "null"], "items": { "type": "string" } }, + "includes": { + "description": "A list of glob patterns. The formatter will include files/folders that will match these patterns.", + "type": ["array", "null"], + "items": { "$ref": "#/definitions/Glob" } + }, "indentStyle": { "description": "The indent style.", "anyOf": [{ "$ref": "#/definitions/IndentStyle" }, { "type": "null" }] @@ -1492,6 +1507,7 @@ }, "additionalProperties": false }, + "Glob": { "type": "string" }, "GraphqlAssistConfiguration": { "description": "Options that changes how the GraphQL linter behaves", "type": "object", @@ -1807,7 +1823,7 @@ "ImportGroup": { "anyOf": [ { "$ref": "#/definitions/PredefinedImportGroup" }, - { "$ref": "#/definitions/Regex" } + { "$ref": "#/definitions/Glob" } ] }, "IndentScriptAndStyle": { @@ -2258,10 +2274,15 @@ "items": { "type": "string" } }, "include": { - "description": "A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.", + "description": "A list of Unix shell style patterns. The analyzer will include files/folders that will match these patterns.", "type": ["array", "null"], "items": { "type": "string" } }, + "includes": { + "description": "A list of glob patterns. The analyzer will handle only those files/folders that will match these patterns.", + "type": ["array", "null"], + "items": { "$ref": "#/definitions/Glob" } + }, "rules": { "description": "List of rules", "anyOf": [{ "$ref": "#/definitions/Rules" }, { "type": "null" }] @@ -3018,15 +3039,20 @@ ] }, "ignore": { - "description": "A list of Unix shell style patterns. The formatter will ignore files/folders that will match these patterns.", + "description": "A list of Unix shell style patterns. Biome will ignore files/folders that will match these patterns.", "type": ["array", "null"], "items": { "type": "string" } }, "include": { - "description": "A list of Unix shell style patterns. The formatter will include files/folders that will match these patterns.", + "description": "A list of Unix shell style patterns. Biome will include files/folders that will match these patterns.", "type": ["array", "null"], "items": { "type": "string" } }, + "includes": { + "description": "A list of glob patterns. Biome will include files/folders that will match these patterns.", + "type": ["array", "null"], + "items": { "$ref": "#/definitions/Glob" } + }, "javascript": { "description": "Specific configuration for the JavaScript language", "anyOf": [ From 682496e3ff489d3010bcb25675e6660dcf39014c Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Sat, 18 Jan 2025 15:31:28 +0100 Subject: [PATCH 2/7] docs: add changeset --- .changeset/introduce_includes.md | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .changeset/introduce_includes.md diff --git a/.changeset/introduce_includes.md b/.changeset/introduce_includes.md new file mode 100644 index 000000000000..51b04b77fbfc --- /dev/null +++ b/.changeset/introduce_includes.md @@ -0,0 +1,42 @@ +--- +cli: minor +--- + +# Introduce `includes` + +Biome allow users to `include` and `ignore` files in its configuration using glob patterns. + +For example, in the following configuration, all files of the `src` directory are checked except the ones ending with the extension `.test.js`. + +```json +{ + "files": { + "include": ["src/**"], + "ignore": ["**/*.test.js"] + } +} +``` + +Some Biome users have requested the ability to ignore a set of files except some of the files. +With the current system, this is not possible because `include` is always applied before `ignore`. + +Also, many Biome users [reported](https://github.com/biomejs/biome/issues/2421) [issues](https://github.com/biomejs/biome/issues/3345) with the behavior of the glob patterns. +Notably: + +- `src/**` is interpreted as `**/src/**` +- `*.js` is interpreted as `**/*.js` + +To solve all these issues, we introduce a new field `includes`, which replaces both `include` and `ignore`. +`includes` accepts an array of glob patterns with a stricter and more intuitive behavior than the previous glob pattern format. +A glob starting with a `!` is an exception. +This replaces `ignore` patterns. + +The previous configuration must be updated as follows: + +```json +{ + "files": { + "includes": ["src/**", "!**/*.test.js"] + } +} +``` From abe70bf7ab57c3f81f099da075abf536ba5ef335 Mon Sep 17 00:00:00 2001 From: Victorien Elvinger Date: Sat, 18 Jan 2025 16:24:58 +0100 Subject: [PATCH 3/7] test: use includes instead of ignore --- .../tests/cases/biome_json_support.rs | 12 +-- .../biome_cli/tests/cases/included_files.rs | 25 ++----- .../biome_cli/tests/cases/protected_files.rs | 2 +- crates/biome_cli/tests/commands/check.rs | 68 ++++++++--------- crates/biome_cli/tests/commands/ci.rs | 20 ++--- crates/biome_cli/tests/commands/format.rs | 75 +++++++++++-------- crates/biome_cli/tests/commands/lint.rs | 57 +++++++------- crates/biome_cli/tests/commands/rage.rs | 6 +- crates/biome_cli/tests/configs.rs | 59 --------------- .../biome_json_is_not_ignored.snap | 5 +- ...ncluded_files_if_overridden_by_ignore.snap | 4 +- ...les_if_overridden_by_ignore_formatter.snap | 4 +- ..._files_if_overridden_by_ignore_linter.snap | 4 +- ...les_if_overridden_by_organize_imports.snap | 2 +- ...process_ignored_file_from_cli_verbose.snap | 5 +- .../applies_organize_imports_bug_4552.snap | 4 +- ...ies_organize_imports_for_ignored_file.snap | 4 +- ..._if_files_are_listed_in_ignore_option.snap | 12 +-- .../no_lint_when_file_is_ignored.snap | 10 +-- ...agnostics_for_files_ignored_by_linter.snap | 4 +- ...handles_ignored_and_not_ignored_files.snap | 8 +- ..._if_files_are_listed_in_ignore_option.snap | 12 +-- .../does_not_format_ignored_directories.snap | 20 ++--- ...at_ignored_file_in_included_directory.snap | 3 +- .../does_not_format_ignored_files.snap | 10 +-- ...on_t_format_ignored_known_jsonc_files.snap | 5 +- .../include_ignore_cascade.snap | 6 +- .../include_vcs_ignore_cascade.snap | 5 +- .../override_don_t_affect_ignored_files.snap | 5 +- ...at_files_in_folders_ignored_by_linter.snap | 4 +- .../fs_files_ignore_symlink.snap | 10 +++ ..._if_files_are_listed_in_ignore_option.snap | 12 +-- .../no_lint_when_file_is_ignored.snap | 10 +-- ...cess_ignored_file_even_if_its_changed.snap | 11 +-- ...ocess_ignored_file_even_if_its_staged.snap | 11 +-- .../with_formatter_configuration.snap | 10 +-- crates/biome_lsp/tests/server.rs | 2 +- crates/biome_service/src/workspace/server.rs | 1 - 38 files changed, 220 insertions(+), 307 deletions(-) create mode 100644 crates/biome_cli/tests/snapshots/main_commands_lint/fs_files_ignore_symlink.snap diff --git a/crates/biome_cli/tests/cases/biome_json_support.rs b/crates/biome_cli/tests/cases/biome_json_support.rs index 830268fb1e85..b1215dc6cd51 100644 --- a/crates/biome_cli/tests/cases/biome_json_support.rs +++ b/crates/biome_cli/tests/cases/biome_json_support.rs @@ -205,12 +205,12 @@ fn biome_json_is_not_ignored() { fs.insert( Utf8PathBuf::from("biome.json"), r#"{ - "files": { "ignore": ["*.json"] }, - "formatter": { - "enabled": false - } -} -"# + "files": { "includes": ["**", "!*.json"] }, + "formatter": { + "enabled": false + } + } + "# .as_bytes(), ); diff --git a/crates/biome_cli/tests/cases/included_files.rs b/crates/biome_cli/tests/cases/included_files.rs index 36aea57e8f40..bedf9f4a8de6 100644 --- a/crates/biome_cli/tests/cases/included_files.rs +++ b/crates/biome_cli/tests/cases/included_files.rs @@ -64,11 +64,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - r#"{ - "files": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} -"# - .as_bytes(), + r#"{ "files": { "includes": ["test.js", "test2.js", "!test.js"] } }"#.as_bytes(), ); let test = Utf8Path::new("test.js"); @@ -105,11 +101,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore_formatter() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - r#"{ - "formatter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} -"# - .as_bytes(), + r#"{ "formatter": { "includes": ["test.js", "test2.js", "!test.js"] } }"#.as_bytes(), ); let test = Utf8Path::new("test.js"); @@ -146,9 +138,7 @@ fn does_not_handle_included_files_if_overridden_by_ignore_linter() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - r#"{ - "linter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} + r#"{ "linter": { "includes": ["test.js", "test2.js", "!test.js"] } } "# .as_bytes(), ); @@ -188,11 +178,10 @@ fn does_not_handle_included_files_if_overridden_by_organize_imports() { fs.insert( file_path.into(), r#"{ - "formatter": { "enabled": false }, - "linter": { "enabled": false }, - "assist": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} -"# + "formatter": { "enabled": false }, + "linter": { "enabled": false }, + "assist": { "includes": ["test.js", "test2.js", "!test.js"] } + }"# .as_bytes(), ); diff --git a/crates/biome_cli/tests/cases/protected_files.rs b/crates/biome_cli/tests/cases/protected_files.rs index 48bc03e96db8..5254170e4a58 100644 --- a/crates/biome_cli/tests/cases/protected_files.rs +++ b/crates/biome_cli/tests/cases/protected_files.rs @@ -165,7 +165,7 @@ fn not_process_ignored_file_from_cli_verbose() { let file_path1 = Utf8Path::new("biome.json"); fs.insert( file_path1.into(), - r#"{ "files": { "ignore": ["package.json"] } }"#.as_bytes(), + r#"{ "files": { "includes": ["**", "!package.json"] } }"#.as_bytes(), ); let (fs, result) = run_cli( diff --git a/crates/biome_cli/tests/commands/check.rs b/crates/biome_cli/tests/commands/check.rs index 116215e4a8be..ea7d97689019 100644 --- a/crates/biome_cli/tests/commands/check.rs +++ b/crates/biome_cli/tests/commands/check.rs @@ -1,8 +1,7 @@ use crate::configs::{ - CONFIG_FILE_SIZE_LIMIT, CONFIG_IGNORE_SYMLINK, CONFIG_LINTER_DISABLED, - CONFIG_LINTER_DISABLED_JSONC, CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC, CONFIG_LINTER_IGNORED_FILES, - CONFIG_LINTER_SUPPRESSED_GROUP, CONFIG_LINTER_SUPPRESSED_RULE, - CONFIG_LINTER_UPGRADE_DIAGNOSTIC, CONFIG_RECOMMENDED_GROUP, + CONFIG_FILE_SIZE_LIMIT, CONFIG_LINTER_DISABLED, CONFIG_LINTER_DISABLED_JSONC, + CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC, CONFIG_LINTER_SUPPRESSED_GROUP, + CONFIG_LINTER_SUPPRESSED_RULE, CONFIG_LINTER_UPGRADE_DIAGNOSTIC, CONFIG_RECOMMENDED_GROUP, }; use crate::snap_test::{assert_file_contents, markup_to_string, SnapshotPayload}; use crate::{ @@ -649,7 +648,10 @@ fn no_lint_when_file_is_ignored() { let mut console = BufferConsole::default(); let file_path = Utf8Path::new("biome.json"); - fs.insert(file_path.into(), CONFIG_LINTER_IGNORED_FILES.as_bytes()); + fs.insert( + file_path.into(), + r#"{ "linter": { "includes": ["**", "!test.js"] } }"#.as_bytes(), + ); let file_path = Utf8Path::new("test.js"); fs.insert(file_path.into(), FIX_BEFORE.as_bytes()); @@ -688,14 +690,9 @@ fn no_lint_if_files_are_listed_in_ignore_option() { fs.insert( file_path.into(), r#"{ - "files": { - "ignore": ["test1.js"] - }, - "linter": { - "enabled": true, - "ignore": ["test2.js"] - } -}"# + "files": { "includes": ["**", "!test1.js"] }, + "linter": { "includes": ["**", "!test2.js"] } + }"# .as_bytes(), ); @@ -1027,7 +1024,9 @@ fn fs_files_ignore_symlink() { let config_path = root_path.join("biome.json"); let mut config_file = File::create(config_path).unwrap(); config_file - .write_all(CONFIG_IGNORE_SYMLINK.as_bytes()) + .write_all( + r#"{ "files": { "includes": ["**", "!**/symlink_testcase2/**/*.ts"] } }"#.as_bytes(), + ) .unwrap(); let files: [Utf8PathBuf; 4] = [ @@ -1504,16 +1503,16 @@ fn applies_organize_imports_bug_4552() { let config = r#"{ "assist": { - "enabled": true, - "ignore": ["index.ts"] + "enabled": true, + "includes": ["**", "!index.ts"] }, "linter": { - "enabled": true, - "rules": { - "recommended": true - } + "enabled": true, + "rules": { + "recommended": true + } } -}"#; + }"#; let file_path = Utf8Path::new("biome.json"); fs.insert(file_path.into(), config.as_bytes()); @@ -1607,7 +1606,7 @@ fn dont_applies_organize_imports_for_ignored_file() { let mut fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let rome_json = r#"{ "assist": { "enabled": true, "ignore": ["check.js"] } }"#; + let rome_json = r#"{ "assist": { "enabled": true, "includes": ["**", "!check.js"] } }"#; let config_path = Utf8Path::new("biome.json"); fs.insert(config_path.into(), rome_json.as_bytes()); @@ -2612,19 +2611,18 @@ fn should_show_formatter_diagnostics_for_files_ignored_by_linter() { fs.insert( biome_json.into(), r#"{ - "$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", - "assist": { - "enabled": true - }, - "linter": { - "ignore": ["build/**"], - "enabled": true, - "rules": { - "recommended": true - } - } -} - "#, + "$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", + "assist": { + "enabled": true + }, + "linter": { + "enabled": true, + "includes": ["**", "!build/**"], + "rules": { + "recommended": true + } + } + }"#, ); let (fs, result) = run_cli( diff --git a/crates/biome_cli/tests/commands/ci.rs b/crates/biome_cli/tests/commands/ci.rs index 806efa85e696..24b1e7545134 100644 --- a/crates/biome_cli/tests/commands/ci.rs +++ b/crates/biome_cli/tests/commands/ci.rs @@ -845,16 +845,16 @@ fn correctly_handles_ignored_and_not_ignored_files() { fs.insert( configuration.into(), r#"{ - "linter": { - "ignore": ["/linter-ignored/**"] - }, - "formatter": { - "ignore": ["/formatter-ignored/**"] - }, - "files": { - "ignore": ["/globally-ignored/**"] - } - }"#, + "linter": { + "includes": ["**", "!/linter-ignored/**"] + }, + "formatter": { + "includes": ["**", "!/formatter-ignored/**"] + }, + "files": { + "includes": ["**", "!/globally-ignored/**"] + } + }"#, ); let file_path1 = Utf8Path::new("/formatter-ignored/test.js"); diff --git a/crates/biome_cli/tests/commands/format.rs b/crates/biome_cli/tests/commands/format.rs index 9205e912e287..250ecb05c1b1 100644 --- a/crates/biome_cli/tests/commands/format.rs +++ b/crates/biome_cli/tests/commands/format.rs @@ -1,7 +1,6 @@ use crate::configs::{ - CONFIG_DISABLED_FORMATTER, CONFIG_FILE_SIZE_LIMIT, CONFIG_FORMAT, - CONFIG_FORMATTER_AND_FILES_IGNORE, CONFIG_FORMATTER_IGNORED_DIRECTORIES, - CONFIG_FORMATTER_IGNORED_FILES, CONFIG_FORMAT_JSONC, CONFIG_ISSUE_3175_1, CONFIG_ISSUE_3175_2, + CONFIG_DISABLED_FORMATTER, CONFIG_FILE_SIZE_LIMIT, CONFIG_FORMAT, CONFIG_FORMAT_JSONC, + CONFIG_ISSUE_3175_1, CONFIG_ISSUE_3175_2, }; use crate::snap_test::{assert_file_contents, markup_to_string, SnapshotPayload}; use crate::{ @@ -1281,7 +1280,10 @@ fn does_not_format_ignored_files() { let mut console = BufferConsole::default(); let mut fs = MemoryFileSystem::default(); let file_path = Utf8Path::new("biome.json"); - fs.insert(file_path.into(), CONFIG_FORMATTER_IGNORED_FILES.as_bytes()); + fs.insert( + file_path.into(), + r#"{ "formatter": { "includes": ["**/*.js", "!test.js"] } }"#.as_bytes(), + ); let file_path = Utf8Path::new("test.js"); fs.insert(file_path.into(), UNFORMATTED.as_bytes()); @@ -1313,7 +1315,11 @@ fn does_not_format_if_files_are_listed_in_ignore_option() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - CONFIG_FORMATTER_AND_FILES_IGNORE.as_bytes(), + r#"{ + "files": { "includes": ["**", "!test1.js"] }, + "formatter": { "includes": ["**", "!test2.js"] } + }"# + .as_bytes(), ); let file_path_test1 = Utf8Path::new("test1.js"); @@ -1371,7 +1377,21 @@ fn does_not_format_ignored_directories() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - CONFIG_FORMATTER_IGNORED_DIRECTORIES.as_bytes(), + r#"{ + "formatter": { + "includes": [ + "**", + "!test1.js", + "!test2.js", + "!test3/**/*", + "!/test4/**/*", + "!test5/**/*", + "!**/test6/*.js", + "!**/*.test7.js" + ] + } + }"# + .as_bytes(), ); const FILES: [(&str, bool); 9] = [ @@ -1421,8 +1441,7 @@ fn does_not_format_ignored_directories() { fn does_not_format_ignored_file_in_included_directory() { let config = r#"{ "formatter": { - "includes": ["src/**"], - "ignore": ["src/file2.js"] + "includes": ["src/**", "!src/file2.js"] } }"#; let files = [("src/file1.js", true), ("src/file2.js", false)]; @@ -1469,12 +1488,10 @@ fn include_ignore_cascade() { // - `file4.js` is not included at top-level let config = r#"{ "files": { - "includes": ["file1.js", "file2.js", "file3.js"], - "ignore": ["file2.js"] + "includes": ["file1.js", "file2.js", "file3.js", "!file2.js"] }, "formatter": { - "includes": ["file1.js", "file2.js"], - "ignore": ["file3.js"] + "includes": ["file1.js", "file2.js", "!file3.js"] } }"#; let files = [ @@ -1936,11 +1953,10 @@ fn include_vcs_ignore_cascade() { "useIgnoreFile": true }, "files": { - "ignore": ["file2.js"] + "includes": ["**", "!file2.js"] }, "formatter": { - "includes": ["file1.js", "file2.js", "file4.js"], - "ignore": ["file3.js"] + "includes": ["file1.js", "file2.js", "file4.js", "!file3.js"] } }"#; let files = [ @@ -2842,7 +2858,7 @@ const a = { fn override_don_t_affect_ignored_files() { let config = r#"{ "overrides": [{ - "ignore": ["file2.js"] + "includes": ["**", "!file2.js"] }] }"#; let files = [("file1.js", true), ("file2.js", true)]; @@ -2923,7 +2939,7 @@ fn don_t_format_ignored_known_jsonc_files() { let config = r#"{ "files": { "ignoreUnknown": true, - "ignore": [".eslintrc"] + "includes": ["**", "!.eslintrc"] } }"#; let files = [(".eslintrc", false)]; @@ -3287,19 +3303,18 @@ fn should_format_files_in_folders_ignored_by_linter() { fs.insert( biome_json.into(), r#"{ - "$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", - "assist": { - "enabled": true - }, - "linter": { - "ignore": ["**/build"], - "enabled": true, - "rules": { - "recommended": true - } - } -} - "#, + "$schema": "https://biomejs.dev/schemas/1.6.1/schema.json", + "assist": { + "enabled": true + }, + "linter": { + "includes": ["**", "!**/build"], + "enabled": true, + "rules": { + "recommended": true + } + } + }"#, ); let (fs, result) = run_cli( diff --git a/crates/biome_cli/tests/commands/lint.rs b/crates/biome_cli/tests/commands/lint.rs index 2f7cbccd9421..b6ef41b11b6a 100644 --- a/crates/biome_cli/tests/commands/lint.rs +++ b/crates/biome_cli/tests/commands/lint.rs @@ -1,7 +1,6 @@ use crate::configs::{ - CONFIG_FILE_SIZE_LIMIT, CONFIG_IGNORE_SYMLINK, CONFIG_LINTER_AND_FILES_IGNORE, - CONFIG_LINTER_DISABLED, CONFIG_LINTER_DISABLED_JSONC, CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC, - CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC_INFO, CONFIG_LINTER_IGNORED_FILES, + CONFIG_FILE_SIZE_LIMIT, CONFIG_LINTER_DISABLED, CONFIG_LINTER_DISABLED_JSONC, + CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC, CONFIG_LINTER_DOWNGRADE_DIAGNOSTIC_INFO, CONFIG_LINTER_SUPPRESSED_GROUP, CONFIG_LINTER_SUPPRESSED_RULE, CONFIG_LINTER_UPGRADE_DIAGNOSTIC, CONFIG_RECOMMENDED_GROUP, }; @@ -669,7 +668,10 @@ fn no_lint_when_file_is_ignored() { let mut console = BufferConsole::default(); let file_path = Utf8Path::new("biome.json"); - fs.insert(file_path.into(), CONFIG_LINTER_IGNORED_FILES.as_bytes()); + fs.insert( + file_path.into(), + r#"{ "linter": { "includes": ["**", "!test.js"] } }"#.as_bytes(), + ); let file_path = Utf8Path::new("test.js"); fs.insert(file_path.into(), FIX_BEFORE.as_bytes()); @@ -705,7 +707,14 @@ fn no_lint_if_files_are_listed_in_ignore_option() { let mut console = BufferConsole::default(); let file_path = Utf8Path::new("biome.json"); - fs.insert(file_path.into(), CONFIG_LINTER_AND_FILES_IGNORE.as_bytes()); + fs.insert( + file_path.into(), + r#"{ + "files": { "includes": ["**", "!test1.js"] }, + "linter": { "includes": ["**", "!test2.js"] } + }"# + .as_bytes(), + ); let file_path_test1 = Utf8Path::new("test1.js"); fs.insert(file_path_test1.into(), FIX_BEFORE.as_bytes()); @@ -1050,7 +1059,9 @@ fn fs_files_ignore_symlink() { let config_path = root_path.join("biome.json"); let mut config_file = File::create(config_path).unwrap(); config_file - .write_all(CONFIG_IGNORE_SYMLINK.as_bytes()) + .write_all( + r#"{ "files": { "includes": ["**", "!**/symlink_testcase2/**/*.ts"] } }"#.as_bytes(), + ) .unwrap(); let files: [Utf8PathBuf; 4] = [ @@ -1201,11 +1212,7 @@ fn include_files_in_symlinked_subdir() { fn ignore_file_in_subdir_in_symlinked_dir() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let config = r#"{ - "files": { - "ignore": ["./symlink/subdir/file.js"] - } - }"#; + let config = r#"{ "files": { "includes": ["**", "!symlink/subdir/file.js"] } }"#; let root_path = Utf8PathBuf::from_path_buf(temp_dir()) .unwrap() @@ -2600,16 +2607,10 @@ fn should_not_process_ignored_file_even_if_its_changed() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - r#" -{ - "files": { - "ignore": ["file.js"] - }, - "vcs": { - "defaultBranch": "main" - } -} - "# + r#"{ + "files": { "includes": ["**", "!file.js"] }, + "vcs": { "defaultBranch": "main" } + }"# .as_bytes(), ); @@ -2809,16 +2810,10 @@ fn should_not_process_ignored_file_even_if_its_staged() { let file_path = Utf8Path::new("biome.json"); fs.insert( file_path.into(), - r#" -{ - "files": { - "ignore": ["file.js"] - }, - "vcs": { - "defaultBranch": "main" - } -} - "# + r#"{ + "files": { "includes": ["**", "!file.js"] }, + "vcs": { "defaultBranch": "main" } + }"# .as_bytes(), ); diff --git a/crates/biome_cli/tests/commands/rage.rs b/crates/biome_cli/tests/commands/rage.rs index 427e801595e0..9a628ca40774 100644 --- a/crates/biome_cli/tests/commands/rage.rs +++ b/crates/biome_cli/tests/commands/rage.rs @@ -210,13 +210,13 @@ fn with_formatter_configuration() { "**/*.tsx", "**/*.jsx", "**/*.json", - "**/*.md" + "**/*.md", + "!configuration-schema.json" ], "indentStyle": "space", "indentWidth": 2, "lineEnding": "lf", - "lineWidth": 120, - "ignore": ["configuration-schema.json"] + "lineWidth": 120 }, "javascript": { "formatter": { diff --git a/crates/biome_cli/tests/configs.rs b/crates/biome_cli/tests/configs.rs index db07b2a8bc7a..efa48efb444c 100644 --- a/crates/biome_cli/tests/configs.rs +++ b/crates/biome_cli/tests/configs.rs @@ -205,67 +205,8 @@ pub const CONFIG_ISSUE_3175_2: &str = r#"{ } }"#; -pub const CONFIG_FORMATTER_IGNORED_FILES: &str = r#"{ - "formatter": { - "enabled": true, - "ignore": ["test.js"] - } -} -"#; - -pub const CONFIG_FORMATTER_AND_FILES_IGNORE: &str = r#"{ - "files": { - "ignore": ["test1.js"] - }, - "formatter": { - "enabled": true, - "ignore": ["test2.js"] - } -}"#; - -pub const CONFIG_FORMATTER_IGNORED_DIRECTORIES: &str = r#"{ - "formatter": { - "ignore": [ - "test1.js", - "test2.js", - "test3/**/*", - "/test4/**/*", - "test5/**/*", - "**/test6/*.js", - "*.test7.js" - ] - } -} -"#; - -pub const CONFIG_LINTER_IGNORED_FILES: &str = r#"{ - "linter": { - "enabled": true, - "ignore": ["test.js"] - } -} -"#; - -pub const CONFIG_LINTER_AND_FILES_IGNORE: &str = r#"{ - "files": { - "ignore": ["test1.js"] - }, - "linter": { - "enabled": true, - "ignore": ["test2.js"] - } -}"#; - pub const CONFIG_FILE_SIZE_LIMIT: &str = r#"{ "files": { "maxSize": 16 } }"#; - -pub const CONFIG_IGNORE_SYMLINK: &str = r#"{ - "files": { - "ignore": [ - "symlink_testcase2/**/*.ts" - ] - } -}"#; diff --git a/crates/biome_cli/tests/snapshots/main_cases_biome_json_support/biome_json_is_not_ignored.snap b/crates/biome_cli/tests/snapshots/main_cases_biome_json_support/biome_json_is_not_ignored.snap index ab2a71f84b96..11cfed795469 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_biome_json_support/biome_json_is_not_ignored.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_biome_json_support/biome_json_is_not_ignored.snap @@ -1,12 +1,13 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "files": { "ignore": ["*.json"] }, + "files": { "includes": ["**", "!*.json"] }, "formatter": { "enabled": false } diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap index 7b36e072f27b..ce69099272b1 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore.snap @@ -6,9 +6,7 @@ snapshot_kind: text ## `biome.json` ```json -{ - "files": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} +{ "files": { "includes": ["test.js", "test2.js", "!test.js"] } } ``` ## `test.js` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap index ee454d7d2efd..9af914f14324 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_formatter.snap @@ -6,9 +6,7 @@ snapshot_kind: text ## `biome.json` ```json -{ - "formatter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} +{ "formatter": { "includes": ["test.js", "test2.js", "!test.js"] } } ``` ## `test.js` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap index 23ce460a41d9..be3f03e0cade 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_ignore_linter.snap @@ -6,9 +6,7 @@ snapshot_kind: text ## `biome.json` ```json -{ - "linter": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } -} +{ "linter": { "includes": ["test.js", "test2.js", "!test.js"] } } ``` ## `test.js` diff --git a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap index c14765b5daa9..34a9dda5eff6 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_included_files/does_not_handle_included_files_if_overridden_by_organize_imports.snap @@ -9,7 +9,7 @@ snapshot_kind: text { "formatter": { "enabled": false }, "linter": { "enabled": false }, - "assist": { "includes": ["test.js", "test2.js"], "ignore": ["test.js"] } + "assist": { "includes": ["test.js", "test2.js", "!test.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_cases_protected_files/not_process_ignored_file_from_cli_verbose.snap b/crates/biome_cli/tests/snapshots/main_cases_protected_files/not_process_ignored_file_from_cli_verbose.snap index 30b7e954fd62..05d6264d57b2 100644 --- a/crates/biome_cli/tests/snapshots/main_cases_protected_files/not_process_ignored_file_from_cli_verbose.snap +++ b/crates/biome_cli/tests/snapshots/main_cases_protected_files/not_process_ignored_file_from_cli_verbose.snap @@ -1,11 +1,12 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json -{ "files": { "ignore": ["package.json"] } } +{ "files": { "includes": ["**", "!package.json"] } } ``` ## `other.json` diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/applies_organize_imports_bug_4552.snap b/crates/biome_cli/tests/snapshots/main_commands_check/applies_organize_imports_bug_4552.snap index 974876d4e273..c02266d75d3b 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_check/applies_organize_imports_bug_4552.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_check/applies_organize_imports_bug_4552.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -9,7 +9,7 @@ snapshot_kind: text { "assist": { "enabled": true, - "ignore": ["index.ts"] + "includes": ["**", "!index.ts"] }, "linter": { "enabled": true, diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/dont_applies_organize_imports_for_ignored_file.snap b/crates/biome_cli/tests/snapshots/main_commands_check/dont_applies_organize_imports_for_ignored_file.snap index d5c337e2e8d4..28d4029a1fed 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_check/dont_applies_organize_imports_for_ignored_file.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_check/dont_applies_organize_imports_for_ignored_file.snap @@ -1,12 +1,12 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` ```json -{ "assist": { "enabled": true, "ignore": ["check.js"] } } +{ "assist": { "enabled": true, "includes": ["**", "!check.js"] } } ``` ## `check.js` diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_if_files_are_listed_in_ignore_option.snap b/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_if_files_are_listed_in_ignore_option.snap index 3cba1f64926b..bc84b2ade6d5 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_if_files_are_listed_in_ignore_option.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_if_files_are_listed_in_ignore_option.snap @@ -1,18 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "files": { - "ignore": ["test1.js"] - }, - "linter": { - "enabled": true, - "ignore": ["test2.js"] - } + "files": { "includes": ["**", "!test1.js"] }, + "linter": { "includes": ["**", "!test2.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_when_file_is_ignored.snap b/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_when_file_is_ignored.snap index 865cf81f6ddb..4306b22b6ec1 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_when_file_is_ignored.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_check/no_lint_when_file_is_ignored.snap @@ -1,16 +1,12 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json -{ - "linter": { - "enabled": true, - "ignore": ["test.js"] - } -} +{ "linter": { "includes": ["**", "!test.js"] } } ``` ## `test.js` diff --git a/crates/biome_cli/tests/snapshots/main_commands_check/should_show_formatter_diagnostics_for_files_ignored_by_linter.snap b/crates/biome_cli/tests/snapshots/main_commands_check/should_show_formatter_diagnostics_for_files_ignored_by_linter.snap index 215f52754db0..7f179352f6ea 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_check/should_show_formatter_diagnostics_for_files_ignored_by_linter.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_check/should_show_formatter_diagnostics_for_files_ignored_by_linter.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -12,8 +12,8 @@ snapshot_kind: text "enabled": true }, "linter": { - "ignore": ["build/**"], "enabled": true, + "includes": ["**", "!build/**"], "rules": { "recommended": true } diff --git a/crates/biome_cli/tests/snapshots/main_commands_ci/correctly_handles_ignored_and_not_ignored_files.snap b/crates/biome_cli/tests/snapshots/main_commands_ci/correctly_handles_ignored_and_not_ignored_files.snap index dca01052425c..43c89e7de6ed 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_ci/correctly_handles_ignored_and_not_ignored_files.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_ci/correctly_handles_ignored_and_not_ignored_files.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -8,13 +8,13 @@ snapshot_kind: text ```json { "linter": { - "ignore": ["/linter-ignored/**"] + "includes": ["**", "!/linter-ignored/**"] }, "formatter": { - "ignore": ["/formatter-ignored/**"] + "includes": ["**", "!/formatter-ignored/**"] }, "files": { - "ignore": ["/globally-ignored/**"] + "includes": ["**", "!/globally-ignored/**"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_if_files_are_listed_in_ignore_option.snap b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_if_files_are_listed_in_ignore_option.snap index 3154e56fa42a..d965f01d7f62 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_if_files_are_listed_in_ignore_option.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_if_files_are_listed_in_ignore_option.snap @@ -1,18 +1,14 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { - "files": { - "ignore": ["test1.js"] - }, - "formatter": { - "enabled": true, - "ignore": ["test2.js"] - } + "files": { "includes": ["**", "!test1.js"] }, + "formatter": { "includes": ["**", "!test2.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_directories.snap b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_directories.snap index 04aa3b036ac7..f633dba26732 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_directories.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_directories.snap @@ -1,20 +1,22 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json { "formatter": { - "ignore": [ - "test1.js", - "test2.js", - "test3/**/*", - "/test4/**/*", - "test5/**/*", - "**/test6/*.js", - "*.test7.js" + "includes": [ + "**", + "!test1.js", + "!test2.js", + "!test3/**/*", + "!/test4/**/*", + "!test5/**/*", + "!**/test6/*.js", + "!**/*.test7.js" ] } } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap index 68b772fbc135..4a2b20c8a67a 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_file_in_included_directory.snap @@ -8,8 +8,7 @@ snapshot_kind: text ```json { "formatter": { - "includes": ["src/**"], - "ignore": ["src/file2.js"] + "includes": ["src/**", "!src/file2.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_files.snap b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_files.snap index c3f5f9b46abf..12f12b2c292a 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_files.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/does_not_format_ignored_files.snap @@ -1,16 +1,12 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` ```json -{ - "formatter": { - "enabled": true, - "ignore": ["test.js"] - } -} +{ "formatter": { "includes": ["**/*.js", "!test.js"] } } ``` ## `test.js` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/don_t_format_ignored_known_jsonc_files.snap b/crates/biome_cli/tests/snapshots/main_commands_format/don_t_format_ignored_known_jsonc_files.snap index e72b28805bf0..d959f8d026a1 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/don_t_format_ignored_known_jsonc_files.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/don_t_format_ignored_known_jsonc_files.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "files": { "ignoreUnknown": true, - "ignore": [".eslintrc"] + "includes": ["**", "!.eslintrc"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap b/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap index 366d6b021b1e..4c085bbab069 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/include_ignore_cascade.snap @@ -8,12 +8,10 @@ snapshot_kind: text ```json { "files": { - "includes": ["file1.js", "file2.js", "file3.js"], - "ignore": ["file2.js"] + "includes": ["file1.js", "file2.js", "file3.js", "!file2.js"] }, "formatter": { - "includes": ["file1.js", "file2.js"], - "ignore": ["file3.js"] + "includes": ["file1.js", "file2.js", "!file3.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap b/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap index 9fb86dda18ba..f3b2b54b3775 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/include_vcs_ignore_cascade.snap @@ -13,11 +13,10 @@ snapshot_kind: text "useIgnoreFile": true }, "files": { - "ignore": ["file2.js"] + "includes": ["**", "!file2.js"] }, "formatter": { - "includes": ["file1.js", "file2.js", "file4.js"], - "ignore": ["file3.js"] + "includes": ["file1.js", "file2.js", "file4.js", "!file3.js"] } } ``` diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/override_don_t_affect_ignored_files.snap b/crates/biome_cli/tests/snapshots/main_commands_format/override_don_t_affect_ignored_files.snap index 02fc794f715f..c61ae2df8ab4 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/override_don_t_affect_ignored_files.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/override_don_t_affect_ignored_files.snap @@ -1,6 +1,7 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) +snapshot_kind: text --- ## `biome.json` @@ -8,7 +9,7 @@ expression: content { "overrides": [ { - "ignore": ["file2.js"] + "includes": ["**", "!file2.js"] } ] } diff --git a/crates/biome_cli/tests/snapshots/main_commands_format/should_format_files_in_folders_ignored_by_linter.snap b/crates/biome_cli/tests/snapshots/main_commands_format/should_format_files_in_folders_ignored_by_linter.snap index ad078ad7daed..e351e49034be 100644 --- a/crates/biome_cli/tests/snapshots/main_commands_format/should_format_files_in_folders_ignored_by_linter.snap +++ b/crates/biome_cli/tests/snapshots/main_commands_format/should_format_files_in_folders_ignored_by_linter.snap @@ -1,6 +1,6 @@ --- source: crates/biome_cli/tests/snap_test.rs -expression: content +expression: redactor(content) snapshot_kind: text --- ## `biome.json` @@ -12,7 +12,7 @@ snapshot_kind: text "enabled": true }, "linter": { - "ignore": ["**/build"], + "includes": ["**", "!**/build"], "enabled": true, "rules": { "recommended": true diff --git a/crates/biome_cli/tests/snapshots/main_commands_lint/fs_files_ignore_symlink.snap b/crates/biome_cli/tests/snapshots/main_commands_lint/fs_files_ignore_symlink.snap new file mode 100644 index 000000000000..68e04ae4c266 --- /dev/null +++ b/crates/biome_cli/tests/snapshots/main_commands_lint/fs_files_ignore_symlink.snap @@ -0,0 +1,10 @@ +--- +source: crates/biome_cli/tests/snap_test.rs +expression: redactor(content) +snapshot_kind: text +--- +# Emitted Messages + +```block +Checked 2 files in