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/snapshots/main_commands_rage/with_formatter_configuration.snap b/crates/biome_cli/tests/snapshots/main_commands_rage/with_formatter_configuration.snap index edde299682dc..039620a5c6f4 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 @@ -88,6 +88,7 @@ Formatter: Bracket spacing: unset Ignore: configuration-schema.json Include: **/*.html, **/*.css, **/*.js, **/*.ts, **/*.tsx, **/*.jsx, **/*.json, **/*.md + Includes: unset JavaScript Formatter: Enabled: true 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_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_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/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..4eadd005d56b 100644 --- a/crates/biome_service/src/settings.rs +++ b/crates/biome_service/src/settings.rs @@ -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 { @@ -1441,6 +1453,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 +1480,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 +1494,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 +1508,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 +1523,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 +1536,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": [