diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a6d91e341e..9e30c81a5f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Rome changelog +## 0.9.1 + +### CLI + +- Fixes a regression where the arguments passed via CLI were ignored [#3175](https://github.com/rome/tools/issues/3175) +- Fixes a regression where the command `rome ci` was not correctly reading the configuration [#3167](https://github.com/rome/tools/issues/3167) + +### VSCode + +- Windows: fixes an issue where the extension could not load the configuration file [#3182](https://github.com/rome/tools/issues/3182) + ## 0.9.0 ### CLI diff --git a/crates/rome_cli/src/commands/check.rs b/crates/rome_cli/src/commands/check.rs index 3043292c76b..307cd524ccc 100644 --- a/crates/rome_cli/src/commands/check.rs +++ b/crates/rome_cli/src/commands/check.rs @@ -2,14 +2,11 @@ use crate::commands::format::apply_format_settings_from_cli; use crate::{execute_mode, CliSession, Execution, Termination, TraversalMode}; use rome_diagnostics::MAXIMUM_DISPLAYABLE_DIAGNOSTICS; use rome_service::load_config; -use rome_service::settings::WorkspaceSettings; use rome_service::workspace::{FixFileMode, UpdateSettingsParams}; /// Handler for the "check" command of the Rome CLI pub(crate) fn check(mut session: CliSession) -> Result<(), Termination> { let configuration = load_config(&session.app.fs, None)?; - let mut workspace_settings = WorkspaceSettings::default(); - let max_diagnostics: Option = session .args .opt_value_from_str("--max-diagnostics") @@ -31,13 +28,11 @@ pub(crate) fn check(mut session: CliSession) -> Result<(), Termination> { 20 }; - if let Some(configuration) = configuration { - session - .app - .workspace - .update_settings(UpdateSettingsParams { configuration })?; - } - apply_format_settings_from_cli(&mut session, &mut workspace_settings)?; + let configuration = apply_format_settings_from_cli(&mut session, configuration)?; + session + .app + .workspace + .update_settings(UpdateSettingsParams { configuration })?; let apply = session.args.contains("--apply"); let apply_suggested = session.args.contains("--apply-suggested"); diff --git a/crates/rome_cli/src/commands/ci.rs b/crates/rome_cli/src/commands/ci.rs index 8f3ca15cc61..29a1589f022 100644 --- a/crates/rome_cli/src/commands/ci.rs +++ b/crates/rome_cli/src/commands/ci.rs @@ -1,6 +1,5 @@ use crate::{execute_mode, CliSession, Execution, Termination, TraversalMode}; use rome_service::load_config; -use rome_service::settings::WorkspaceSettings; use rome_service::workspace::UpdateSettingsParams; use super::format::apply_format_settings_from_cli; @@ -8,15 +7,12 @@ use super::format::apply_format_settings_from_cli; /// Handler for the "ci" command of the Rome CLI pub(crate) fn ci(mut session: CliSession) -> Result<(), Termination> { let configuration = load_config(&session.app.fs, None)?; - let mut workspace_settings = WorkspaceSettings::default(); + let configuration = apply_format_settings_from_cli(&mut session, configuration)?; - if let Some(configuration) = configuration { - session - .app - .workspace - .update_settings(UpdateSettingsParams { configuration })?; - } - apply_format_settings_from_cli(&mut session, &mut workspace_settings)?; + session + .app + .workspace + .update_settings(UpdateSettingsParams { configuration })?; execute_mode(Execution::new(TraversalMode::CI), session) } diff --git a/crates/rome_cli/src/commands/format.rs b/crates/rome_cli/src/commands/format.rs index c548babda56..26508e99dea 100644 --- a/crates/rome_cli/src/commands/format.rs +++ b/crates/rome_cli/src/commands/format.rs @@ -1,5 +1,8 @@ use rome_formatter::IndentStyle; -use rome_service::{load_config, settings::WorkspaceSettings, workspace::UpdateSettingsParams}; +use rome_service::configuration::{ + FormatterConfiguration, JavascriptConfiguration, JavascriptFormatter, PlainIndentStyle, +}; +use rome_service::{load_config, workspace::UpdateSettingsParams, Configuration}; use std::path::PathBuf; use crate::execute::ReportMode; @@ -8,16 +11,12 @@ use crate::{execute_mode, CliSession, Execution, Termination, TraversalMode}; /// Handler for the "format" command of the Rome CLI pub(crate) fn format(mut session: CliSession) -> Result<(), Termination> { let configuration = load_config(&session.app.fs, None)?; - let mut workspace_settings = WorkspaceSettings::default(); + let configuration = apply_format_settings_from_cli(&mut session, configuration)?; - if let Some(configuration) = configuration { - session - .app - .workspace - .update_settings(UpdateSettingsParams { configuration })?; - } - - apply_format_settings_from_cli(&mut session, &mut workspace_settings)?; + session + .app + .workspace + .update_settings(UpdateSettingsParams { configuration })?; let is_write = session.args.contains("--write"); let ignore_errors = session.args.contains("--skip-errors"); @@ -67,8 +66,21 @@ pub(crate) fn format(mut session: CliSession) -> Result<(), Termination> { /// into the workspace settings pub(crate) fn apply_format_settings_from_cli( session: &mut CliSession, - workspace_settings: &mut WorkspaceSettings, -) -> Result<(), Termination> { + configuration: Option, +) -> Result { + let mut configuration = if let Some(configuration) = configuration { + configuration + } else { + Configuration { + formatter: Some(FormatterConfiguration::default()), + javascript: Some(JavascriptConfiguration { + formatter: Some(JavascriptFormatter::default()), + globals: None, + }), + ..Configuration::default() + } + }; + let size = session .args .opt_value_from_str("--indent-size") @@ -85,27 +97,29 @@ pub(crate) fn apply_format_settings_from_cli( source, })?; - match indent_style { - Some(IndentStyle::Tab) => { - workspace_settings.formatter.indent_style = Some(IndentStyle::Tab); - } - Some(IndentStyle::Space(default_size)) => { - workspace_settings.formatter.indent_style = - Some(IndentStyle::Space(size.unwrap_or(default_size))); - } - None => {} - } - - let quote_style = session + let line_width = session .args - .opt_value_from_str("--quote-style") + .opt_value_from_str("--line-width") .map_err(|source| Termination::ParseError { - argument: "--quote-style", + argument: "--line-width", source, })?; - if let Some(quote_style) = quote_style { - workspace_settings.languages.javascript.format.quote_style = Some(quote_style); + if let Some(formatter) = configuration.formatter.as_mut() { + match indent_style { + Some(IndentStyle::Tab) => { + formatter.indent_style = PlainIndentStyle::Tab; + } + Some(IndentStyle::Space(default_size)) => { + formatter.indent_style = PlainIndentStyle::Space; + formatter.indent_size = size.unwrap_or(default_size); + } + None => {} + } + + if let Some(line_width) = line_width { + formatter.line_width = line_width; + } } let quote_properties = session @@ -116,25 +130,26 @@ pub(crate) fn apply_format_settings_from_cli( source, })?; - if let Some(quote_properties) = quote_properties { - workspace_settings - .languages - .javascript - .format - .quote_properties = Some(quote_properties); - } - - let line_width = session + let quote_style = session .args - .opt_value_from_str("--line-width") + .opt_value_from_str("--quote-style") .map_err(|source| Termination::ParseError { - argument: "--line-width", + argument: "--quote-style", source, })?; + if let Some(javascript) = configuration + .javascript + .as_mut() + .and_then(|j| j.formatter.as_mut()) + { + if let Some(quote_properties) = quote_properties { + javascript.quote_properties = quote_properties; + } - if let Some(line_width) = line_width { - workspace_settings.formatter.line_width = Some(line_width); + if let Some(quote_style) = quote_style { + javascript.quote_style = quote_style; + } } - Ok(()) + Ok(configuration) } diff --git a/crates/rome_cli/src/commands/help.rs b/crates/rome_cli/src/commands/help.rs index 1ce73bce8d9..6c92049dfa8 100644 --- a/crates/rome_cli/src/commands/help.rs +++ b/crates/rome_cli/src/commands/help.rs @@ -40,7 +40,7 @@ const CHECK: Markup = markup! { const FORMAT_OPTIONS: Markup = markup! { " - ""--write"" Edit the files in place (beware!) instead of instead of printing the diff to the console + ""--write"" Edit the files in place (beware!) instead of printing the diff to the console ""--skip-errors"" Skip over files containing syntax errors instead of emitting an error diagnostic. ""--indent-style "" Change the indention character (default: tabs) ""--indent-size "" If the indentation style is set to spaces, determine how many spaces should be used for indentation (default: 2) diff --git a/crates/rome_cli/src/traversal.rs b/crates/rome_cli/src/traversal.rs index 1f065f2bcb5..d2f0422dd1c 100644 --- a/crates/rome_cli/src/traversal.rs +++ b/crates/rome_cli/src/traversal.rs @@ -556,15 +556,12 @@ fn process_file(ctx: &TraversalOptions, path: &Path, file_id: FileId) -> FileRes let can_format = ctx .can_format(&rome_path) .with_file_id_and_code(file_id, "IO")?; + let can_lint = ctx + .can_lint(&rome_path) + .with_file_id_and_code(file_id, "IO")?; let can_handle = match ctx.execution.traversal_mode() { - TraversalMode::Check { .. } => ctx - .can_lint(&rome_path) - .with_file_id_and_code(file_id, "IO")?, - TraversalMode::CI { .. } => { - ctx.can_lint(&rome_path) - .with_file_id_and_code(file_id, "IO")? - || can_format - } + TraversalMode::Check { .. } => can_lint, + TraversalMode::CI { .. } => can_lint || can_format, TraversalMode::Format { .. } => can_format, }; @@ -616,7 +613,7 @@ fn process_file(ctx: &TraversalOptions, path: &Path, file_id: FileId) -> FileRes return Ok(FileStatus::Ignored); } - let categories = if ctx.execution.is_format() { + let categories = if ctx.execution.is_format() || !can_lint { RuleCategories::SYNTAX } else { RuleCategories::SYNTAX | RuleCategories::LINT diff --git a/crates/rome_cli/tests/main.rs b/crates/rome_cli/tests/main.rs index 0172c0e4093..309ade47aa9 100644 --- a/crates/rome_cli/tests/main.rs +++ b/crates/rome_cli/tests/main.rs @@ -82,6 +82,27 @@ const NO_DEAD_CODE_ERROR: &str = r#"function f() { } "#; +const APPLY_QUOTE_STYLE_BEFORE: &str = r#" +let a = "something"; +let b = { + "hey": "hello" +};"#; + +const APPLY_QUOTE_STYLE_AFTER: &str = "let a = 'something'; +let b = {\n\t'hey': 'hello',\n};\n"; + +const CUSTOM_CONFIGURATION_BEFORE: &str = r#"function f() { + return { a, b } +}"#; + +const CUSTOM_CONFIGURATION_AFTER: &str = "function f() { + return { + a, + b, + }; +} +"; + mod check { use super::*; use crate::configs::{ @@ -540,6 +561,7 @@ mod check { mod ci { use super::*; + use crate::configs::{CONFIG_DISABLED_FORMATTER, CONFIG_LINTER_DISABLED}; use rome_fs::FileSystemExt; #[test] @@ -642,6 +664,72 @@ mod ci { assert_cli_snapshot(module_path!(), "ci_lint_error", fs, console); } + + #[test] + fn ci_does_not_run_formatter() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("rome.json"); + fs.insert(file_path.into(), CONFIG_DISABLED_FORMATTER.as_bytes()); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), UNFORMATTED.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + DynRef::Borrowed(&mut console), + Arguments::from_vec(vec![OsString::from("ci"), file_path.as_os_str().into()]), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, UNFORMATTED); + + drop(file); + assert_cli_snapshot(module_path!(), "ci_does_not_run_formatter", fs, console); + } + + #[test] + fn ci_does_not_run_linter() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("rome.json"); + fs.insert(file_path.into(), CONFIG_LINTER_DISABLED.as_bytes()); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), CUSTOM_FORMAT_BEFORE.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + DynRef::Borrowed(&mut console), + Arguments::from_vec(vec![OsString::from("ci"), file_path.as_os_str().into()]), + ); + + assert!(result.is_err(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, CUSTOM_FORMAT_BEFORE); + + drop(file); + assert_cli_snapshot(module_path!(), "ci_does_not_run_linter", fs, console); + } } mod format { @@ -758,6 +846,132 @@ mod format { assert_cli_snapshot(module_path!(), "formatter_lint_warning", fs, console); } + #[test] + fn applies_custom_configuration() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), CUSTOM_CONFIGURATION_BEFORE.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + DynRef::Borrowed(&mut console), + Arguments::from_vec(vec![ + OsString::from("format"), + OsString::from("--line-width"), + OsString::from("10"), + OsString::from("--indent-style"), + OsString::from("space"), + OsString::from("--indent-size"), + OsString::from("8"), + OsString::from("--write"), + file_path.as_os_str().into(), + ]), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, CUSTOM_CONFIGURATION_AFTER); + + drop(file); + assert_cli_snapshot(module_path!(), "applies_custom_configuration", fs, console); + } + + #[test] + fn applies_custom_configuration_over_config_file() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("rome.json"); + fs.insert(file_path.into(), CONFIG_FORMAT.as_bytes()); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), CUSTOM_CONFIGURATION_BEFORE.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + DynRef::Borrowed(&mut console), + Arguments::from_vec(vec![ + OsString::from("format"), + OsString::from("--line-width"), + OsString::from("10"), + OsString::from("--indent-style"), + OsString::from("space"), + OsString::from("--indent-size"), + OsString::from("8"), + OsString::from("--write"), + file_path.as_os_str().into(), + ]), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, CUSTOM_CONFIGURATION_AFTER); + + drop(file); + assert_cli_snapshot( + module_path!(), + "applies_custom_configuration_over_config_file", + fs, + console, + ); + } + + #[test] + fn applies_custom_quote_style() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let file_path = Path::new("file.js"); + fs.insert(file_path.into(), APPLY_QUOTE_STYLE_BEFORE.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + DynRef::Borrowed(&mut console), + Arguments::from_vec(vec![ + OsString::from("format"), + OsString::from("--quote-style"), + OsString::from("single"), + OsString::from("--quote-properties"), + OsString::from("preserve"), + OsString::from("--write"), + file_path.as_os_str().into(), + ]), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + let mut file = fs + .open(file_path) + .expect("formatting target file was removed by the CLI"); + + let mut content = String::new(); + file.read_to_string(&mut content) + .expect("failed to read file from memory FS"); + + assert_eq!(content, APPLY_QUOTE_STYLE_AFTER); + + drop(file); + assert_cli_snapshot(module_path!(), "applies_custom_quote_style", fs, console); + } + #[test] fn indent_style_parse_errors() { let mut console = BufferConsole::default(); diff --git a/crates/rome_cli/tests/snapshots/main_check/apply_noop.snap b/crates/rome_cli/tests/snapshots/main_check/apply_noop.snap index 2b9da6ddecf..d4f9f1a35c8 100644 --- a/crates/rome_cli/tests/snapshots/main_check/apply_noop.snap +++ b/crates/rome_cli/tests/snapshots/main_check/apply_noop.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `fix.js` diff --git a/crates/rome_cli/tests/snapshots/main_check/apply_ok.snap b/crates/rome_cli/tests/snapshots/main_check/apply_ok.snap index 2b9da6ddecf..d4f9f1a35c8 100644 --- a/crates/rome_cli/tests/snapshots/main_check/apply_ok.snap +++ b/crates/rome_cli/tests/snapshots/main_check/apply_ok.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `fix.js` diff --git a/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap b/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap index 7f47775cf2b..9855384667b 100644 --- a/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap +++ b/crates/rome_cli/tests/snapshots/main_check/downgrade_severity.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_check/lint_error.snap b/crates/rome_cli/tests/snapshots/main_check/lint_error.snap index f0f86a4aa06..b4ee7e844e7 100644 --- a/crates/rome_cli/tests/snapshots/main_check/lint_error.snap +++ b/crates/rome_cli/tests/snapshots/main_check/lint_error.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `check.js` diff --git a/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap b/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap index af2a9a8dbba..fd8cd032d4a 100644 --- a/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap +++ b/crates/rome_cli/tests/snapshots/main_check/maximum_diagnostics.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `check.js` diff --git a/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled.snap b/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled.snap index 239cd4cc6ec..6b462baaded 100644 --- a/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled.snap +++ b/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 148 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled_when_run_apply.snap b/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled_when_run_apply.snap index 239cd4cc6ec..6b462baaded 100644 --- a/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled_when_run_apply.snap +++ b/crates/rome_cli/tests/snapshots/main_check/no_lint_if_linter_is_disabled_when_run_apply.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 148 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_check/parse_error.snap b/crates/rome_cli/tests/snapshots/main_check/parse_error.snap index c9711a091ee..46a4e1f195f 100644 --- a/crates/rome_cli/tests/snapshots/main_check/parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_check/parse_error.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `check.js` diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_formatter.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_formatter.snap new file mode 100644 index 00000000000..ad13a9742ad --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_formatter.snap @@ -0,0 +1,24 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `rome.json` + +```json +{ + "formatter": { + "enabled": false + } +} + +``` + +## `file.js` + +```js + statement( ) +``` + +# Emitted Messages + + diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_linter.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_linter.snap new file mode 100644 index 00000000000..a0659a282a5 --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_does_not_run_linter.snap @@ -0,0 +1,38 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `rome.json` + +```json +{ + "linter": { + "enabled": false + } +} +``` + +## `file.js` + +```js + +function f() { +return { something } +} + +``` + +# Emitted Messages + +```block +file.js: error[CI]: File content differs from formatting output + | @@ -1,4 +1,3 @@ +0 | - +1 0 | function f() { +2 | - return { something } + 1 | + return { something }; +3 2 | } + +``` + + diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap index f4c2df12003..f7c082c10fa 100644 --- a/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_lint_error.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `ci.js` diff --git a/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap b/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap index 009e73f221e..7596ec854e4 100644 --- a/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap +++ b/crates/rome_cli/tests/snapshots/main_ci/ci_parse_error.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `ci.js` diff --git a/crates/rome_cli/tests/snapshots/main_ci/formatting_error.snap b/crates/rome_cli/tests/snapshots/main_ci/formatting_error.snap index 8e13621c21b..c6e57063b43 100644 --- a/crates/rome_cli/tests/snapshots/main_ci/formatting_error.snap +++ b/crates/rome_cli/tests/snapshots/main_ci/formatting_error.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `ci.js` diff --git a/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration.snap b/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration.snap new file mode 100644 index 00000000000..f88f56d0fd4 --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration.snap @@ -0,0 +1,19 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `file.js` + +```js +function f() { + return { + a, + b, + }; +} + +``` + +# Emitted Messages + + diff --git a/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration_over_config_file.snap b/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration_over_config_file.snap new file mode 100644 index 00000000000..b221afb59c1 --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_format/applies_custom_configuration_over_config_file.snap @@ -0,0 +1,33 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `rome.json` + +```json +{ + "formatter": { + "enabled": true, + "lineWidth": 160, + "indentStyle": "space", + "indentSize": 6 + } +} + +``` + +## `file.js` + +```js +function f() { + return { + a, + b, + }; +} + +``` + +# Emitted Messages + + diff --git a/crates/rome_cli/tests/snapshots/main_format/applies_custom_quote_style.snap b/crates/rome_cli/tests/snapshots/main_format/applies_custom_quote_style.snap new file mode 100644 index 00000000000..d95c9e6477d --- /dev/null +++ b/crates/rome_cli/tests/snapshots/main_format/applies_custom_quote_style.snap @@ -0,0 +1,17 @@ +--- +source: crates/rome_cli/tests/snap_test.rs +expression: content +--- +## `file.js` + +```js +let a = 'something'; +let b = { + 'hey': 'hello', +}; + +``` + +# Emitted Messages + + diff --git a/crates/rome_cli/tests/snapshots/main_format/does_not_format_if_disabled.snap b/crates/rome_cli/tests/snapshots/main_format/does_not_format_if_disabled.snap index 9aa32a46856..a4a6f133801 100644 --- a/crates/rome_cli/tests/snapshots/main_format/does_not_format_if_disabled.snap +++ b/crates/rome_cli/tests/snapshots/main_format/does_not_format_if_disabled.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_format/format_is_disabled.snap b/crates/rome_cli/tests/snapshots/main_format/format_is_disabled.snap index 46e7ba42783..d0cc3bc1a8f 100644 --- a/crates/rome_cli/tests/snapshots/main_format/format_is_disabled.snap +++ b/crates/rome_cli/tests/snapshots/main_format/format_is_disabled.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 148 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_format/format_stdin_successfully.snap b/crates/rome_cli/tests/snapshots/main_format/format_stdin_successfully.snap index c802107e646..182693a0d97 100644 --- a/crates/rome_cli/tests/snapshots/main_format/format_stdin_successfully.snap +++ b/crates/rome_cli/tests/snapshots/main_format/format_stdin_successfully.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- # Input messages diff --git a/crates/rome_cli/tests/snapshots/main_format/formatter_lint_warning.snap b/crates/rome_cli/tests/snapshots/main_format/formatter_lint_warning.snap index 3d2cf29ee86..6efe4255d87 100644 --- a/crates/rome_cli/tests/snapshots/main_format/formatter_lint_warning.snap +++ b/crates/rome_cli/tests/snapshots/main_format/formatter_lint_warning.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `format.js` diff --git a/crates/rome_cli/tests/snapshots/main_format/formatter_print.snap b/crates/rome_cli/tests/snapshots/main_format/formatter_print.snap index 3c4f9caf7a3..85a3c9d9f7e 100644 --- a/crates/rome_cli/tests/snapshots/main_format/formatter_print.snap +++ b/crates/rome_cli/tests/snapshots/main_format/formatter_print.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `format.js` diff --git a/crates/rome_cli/tests/snapshots/main_init/creates_config_file.snap b/crates/rome_cli/tests/snapshots/main_init/creates_config_file.snap index aedd391f70c..bb5de1b7955 100644 --- a/crates/rome_cli/tests/snapshots/main_init/creates_config_file.snap +++ b/crates/rome_cli/tests/snapshots/main_init/creates_config_file.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 147 expression: content --- ## `rome.json` diff --git a/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_check_mode.snap b/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_check_mode.snap index 0aed631d285..496f2eef149 100644 --- a/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_check_mode.snap +++ b/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_check_mode.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 148 expression: content --- ## `format.js` diff --git a/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_write.snap b/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_write.snap index e7a09c9c439..7da4033d926 100644 --- a/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_write.snap +++ b/crates/rome_cli/tests/snapshots/main_reporter_json/reports_formatter_write.snap @@ -1,6 +1,5 @@ --- source: crates/rome_cli/tests/snap_test.rs -assertion_line: 148 expression: content --- ## `format.js` diff --git a/crates/rome_lsp/src/session.rs b/crates/rome_lsp/src/session.rs index f570eedda42..4cfdbf271cf 100644 --- a/crates/rome_lsp/src/session.rs +++ b/crates/rome_lsp/src/session.rs @@ -14,7 +14,6 @@ use rome_service::workspace::{FeatureName, PullDiagnosticsParams, SupportsFeatur use rome_service::{load_config, Workspace}; use rome_service::{DynRef, RomeError}; use std::collections::HashMap; -use std::path::PathBuf; use std::sync::Arc; use std::sync::RwLock; use tokio::sync::Notify; @@ -176,7 +175,13 @@ impl Session { /// This function attempts to read the configuration from the root URI pub(crate) async fn update_configuration(&self) { let root_uri = self.root_uri.read().unwrap(); - let base_path = root_uri.as_ref().map(|uri| PathBuf::from(uri.path())); + let base_path = root_uri.as_ref().and_then(|root_uri| match root_uri.to_file_path() { + Ok(base_path) => Some(base_path), + Err(()) => { + error!("The Workspace root URI {root_uri:?} could not be parsed as a filesystem path"); + None + } + }); match load_config(&self.fs, base_path) { Ok(Some(configuration)) => { diff --git a/crates/rome_service/src/configuration/formatter.rs b/crates/rome_service/src/configuration/formatter.rs index 4f04d27dc59..181fd6ca69d 100644 --- a/crates/rome_service/src/configuration/formatter.rs +++ b/crates/rome_service/src/configuration/formatter.rs @@ -17,7 +17,7 @@ pub struct FormatterConfiguration { pub indent_style: PlainIndentStyle, /// The size of the indentation, 2 by default - indent_size: u8, + pub indent_size: u8, /// What's the max width of a line. Defaults to 80. #[serde( diff --git a/crates/rome_service/src/configuration/mod.rs b/crates/rome_service/src/configuration/mod.rs index 57bc7eb416b..9035b7345a4 100644 --- a/crates/rome_service/src/configuration/mod.rs +++ b/crates/rome_service/src/configuration/mod.rs @@ -3,9 +3,6 @@ //! The configuration is divided by "tool", and then it's possible to further customise it //! by language. The language might further options divided by tool. -use crate::configuration::formatter::FormatterConfiguration; -use crate::configuration::javascript::JavascriptConfiguration; -use crate::configuration::linter::LinterConfiguration; use crate::{DynRef, RomeError}; use rome_fs::{FileSystem, OpenOptions}; use serde::{Deserialize, Serialize}; @@ -18,7 +15,9 @@ mod formatter; mod javascript; pub mod linter; -pub use linter::{RuleConfiguration, Rules}; +pub use formatter::{FormatterConfiguration, PlainIndentStyle}; +pub use javascript::{JavascriptConfiguration, JavascriptFormatter}; +pub use linter::{LinterConfiguration, RuleConfiguration, Rules}; /// The configuration that is contained inside the file `rome.json` #[derive(Debug, Deserialize, Serialize)] diff --git a/editors/vscode/package.json b/editors/vscode/package.json index b0e6fe10e79..b6717a2d9bd 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -3,7 +3,7 @@ "publisher": "rome", "displayName": "Rome", "description": "Rome LSP VS Code Extension", - "version": "0.14.0", + "version": "0.14.1", "icon": "icon.png", "activationEvents": [ "onLanguage:javascript", diff --git a/npm/rome/package.json b/npm/rome/package.json index 85be128476d..1e10b599059 100644 --- a/npm/rome/package.json +++ b/npm/rome/package.json @@ -1,6 +1,6 @@ { "name": "rome", - "version": "0.9.0-next", + "version": "0.9.1-next", "bin": "bin/rome", "scripts": { "postinstall": "node scripts/postinstall.js", diff --git a/website/.eleventy.js b/website/.eleventy.js index 94bfc37b70a..3b0a02b3000 100644 --- a/website/.eleventy.js +++ b/website/.eleventy.js @@ -13,6 +13,7 @@ const terser = require("terser"); const CleanCSS = require("clean-css"); const htmlmin = require("html-minifier"); const { base64Encode } = require("./utils"); +const pluginRss = require("@11ty/eleventy-plugin-rss"); require("dotenv").config(); @@ -35,6 +36,7 @@ module.exports = function (eleventyConfig) { }); eleventyConfig.addPlugin(syntaxHighlight); + eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginTOC, { tags: ["h2", "h3", "h4"], @@ -198,6 +200,10 @@ module.exports = function (eleventyConfig) { return string.toLowerCase().replace(/\s/g, "-"); }); + eleventyConfig.addFilter("withAbsoluteUrl", function (string) { + return `https://rome.tools${string}`; + }); + eleventyConfig.addShortcode("romeVersion", function () { return "?.?.?"; }); diff --git a/website/package.json b/website/package.json index cb5d30a8d15..cd481040313 100644 --- a/website/package.json +++ b/website/package.json @@ -14,6 +14,7 @@ "@11ty/eleventy": "^1.0.1", "@11ty/eleventy-navigation": "^0.3.3", "@11ty/eleventy-plugin-syntaxhighlight": "^4.1.0", + "@11ty/eleventy-plugin-rss": "^1.2.0", "@types/markdown-it": "^12.2.3", "clean-css": "^4.2.4", "cross-env": "^7.0.3", diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml index 534199c2278..ee294475f0c 100644 --- a/website/pnpm-lock.yaml +++ b/website/pnpm-lock.yaml @@ -3,6 +3,7 @@ lockfileVersion: 5.4 specifiers: '@11ty/eleventy': ^1.0.1 '@11ty/eleventy-navigation': ^0.3.3 + '@11ty/eleventy-plugin-rss': ^1.2.0 '@11ty/eleventy-plugin-syntaxhighlight': ^4.1.0 '@types/markdown-it': ^12.2.3 '@types/node': ^18.6.1 @@ -30,6 +31,7 @@ dependencies: devDependencies: '@11ty/eleventy': 1.0.1 '@11ty/eleventy-navigation': 0.3.3 + '@11ty/eleventy-plugin-rss': 1.2.0 '@11ty/eleventy-plugin-syntaxhighlight': 4.1.0 '@types/markdown-it': 12.2.3 '@types/node': 18.6.1 @@ -44,7 +46,7 @@ devDependencies: markdown-it-header-sections: 1.0.0 markdown-it-imsize: 2.0.1 npm-run-all: 4.1.5 - rome: 0.7.0-next.f6510d6 + rome: 0.9.0-next sass: 1.54.0 terser: 4.8.0 ts-node: 10.7.0_trcaulukx5kvbq5axchldtacau @@ -62,6 +64,16 @@ packages: dependency-graph: 0.11.0 dev: true + /@11ty/eleventy-plugin-rss/1.2.0: + resolution: {integrity: sha512-YzFnSH/5pObcFnqZ2sAQ782WmpOZHj1+xB9ydY/0j7BZ2jUNahn53VmwCB/sBRwXA/Fbwwj90q1MLo01Ru0UaQ==} + dependencies: + debug: 4.3.4 + posthtml: 0.16.6 + posthtml-urls: 1.0.0 + transitivePeerDependencies: + - supports-color + dev: true + /@11ty/eleventy-plugin-syntaxhighlight/4.1.0: resolution: {integrity: sha512-bLpV8DKFZRgh0kToh8JPCjABfalL5ydyP6rxj/aUgrlR2v9TheLGRNqoKMhfgwUETOas2nMo/rd7sCE4kSvBNQ==} dependencies: @@ -179,54 +191,72 @@ packages: fastq: 1.13.0 dev: true - /@rometools/cli-darwin-arm64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-pGXWFPwsZrjcExZu3CGh3pLaM3dJAgC4az2t9MfBEhyjHK6KHCh1EMGAjre2sbFEOmxtaz+UoBDqritG0HJR1w==} + /@rometools/cli-darwin-arm64/0.9.0-next: + resolution: {integrity: sha512-DoqyJZoDI2lOFEJP8fIKLOGd+vG6cGvqsb5SnEBtyx6utumO1HeFhBXfhFS1zOU8A4eNE1eTdFVDeGjs6J/hYQ==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /@rometools/cli-darwin-x64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-MpJn9mRGZYbupr4QUaVexdhcFKyMIzS0whXpa6xLTt9Oikm0ZYQBUyhULWnLd1i1tkjlMDfIm07H00nYbfMwpA==} + /@rometools/cli-darwin-x64/0.9.0-next: + resolution: {integrity: sha512-Imt1C/lwltDQMC0GUt/DfOeCa6tjkfvO94oXKf0WmzXzPXAOP1wT4vxne9A6pSH5h35yfW+abrByLRkro1SDPw==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /@rometools/cli-linux-arm64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-aaKOaTAYOQRbalTwKmhzOH5e08BWtuk4lNpD7TdH4kklK/+IfY3zbw6C6FTHIYGfvC5jZRMLSLO8oFW+9b0PXA==} + /@rometools/cli-linux-arm64/0.9.0-next: + resolution: {integrity: sha512-d0KPHo7cK84ZrEqwXOXHg6LNYLACcezZyxZwzEyNnia4eRtpA3kG5EXdoayR0rFpfIMwTzUUWqSmYhfppMDcvA==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /@rometools/cli-linux-x64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-1hFyT5s/9jL0uXeHZCEg18aPj//bB29z5vgNVBJS+SIvFyfNIGbRZOts5vu8ioF+h8n57KhLb4j3NumcAL/mzg==} + /@rometools/cli-linux-x64/0.9.0-next: + resolution: {integrity: sha512-m1E/kGvSAexdaSwhDmTLjKBLawHEtY/bxgVCwyVaPG+sk4QCB7/4YZyQzLQxMJ1cJ+RFUYESdh1CP/KN0ZWtFw==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /@rometools/cli-win32-arm64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-knoxoYEpxVHlySOnDHW7RWnqW9o0APpMCr8ZGKyXHwGEQiOIjCoIVIxQ6jyj5U5sGwtMetNJgZ8lWSdMZkeHxA==} + /@rometools/cli-win32-arm64/0.9.0-next: + resolution: {integrity: sha512-7lTx/l/EqF7ecntugjK0LCICFTyXnswZ/h2WT8chctkPjLJvlimqXWlC9Sem4KbNIjNPpO8gW3pmvNQlUGyWag==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /@rometools/cli-win32-x64/0.7.0-next.f6510d6: - resolution: {integrity: sha512-ntx0aSAZzLf82ezsCHLAoCEKJ91AiMpyVeD3ZtXExba3qiX1nW047LavAL0WTxbZ/E66uLdZEmXSfciEh7DFHQ==} + /@rometools/cli-win32-x64/0.9.0-next: + resolution: {integrity: sha512-Xey8/xIaSq9i9TS11L4osUIRUiA7qwmRiu86CPwACclzcucWa2ySf11jWmjiZKxgDl1O1YaxcZDHef88zZcGPA==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true + /@rometools/wasm-bundler/0.9.0-next: + resolution: {integrity: sha512-ieC7g99orV/WLqvC1pupu1O5WMyE0YggT2mvmjXn5CUXh+iNI7ZD4d2XfFiiGNQFUs96FrNaypK7M1Nc1kC65w==} + requiresBuild: true + dev: true + optional: true + + /@rometools/wasm-nodejs/0.9.0-next: + resolution: {integrity: sha512-zTZLVALA/tm7D1SeW08t9TytB4Rx9s++pYU8/yc7wN/sEnWuE2QbHvnfrzRlMsw6K+k27HLCyJOfak3rAZOpvw==} + requiresBuild: true + dev: true + optional: true + + /@rometools/wasm-web/0.9.0-next: + resolution: {integrity: sha512-8mRIbOtK+XWLbMBJoERHZ/RKyZSiOOquPK2DrMuKxzPnW8bGuK/4EvIImPGgoGYzTXNJFSprboQpaE+gvBmB8w==} + requiresBuild: true + dev: true + optional: true + /@sindresorhus/slugify/1.1.2: resolution: {integrity: sha512-V9nR/W0Xd9TSGXpZ4iFUcFGhuOJtZX82Fzxj1YISlbSgKvIiNa7eLEZrT0vAraPOt++KHauIVNYgGRgjc13dXA==} engines: {node: '>=10'} @@ -369,6 +399,8 @@ packages: reduce: 1.0.2 semver: 5.7.1 tunnel-agent: 0.6.0 + transitivePeerDependencies: + - supports-color dev: true /ansi-regex/2.1.1: @@ -400,6 +432,10 @@ packages: color-convert: 2.0.1 dev: true + /any-promise/0.1.0: + resolution: {integrity: sha512-lqzY9o+BbeGHRCOyxQkt/Tgvz0IZhTmQiA+LxQW8wSNpcTbj8K+0cZiSEvbpNZZP9/11Gy7dnLO3GNWUXO4d1g==} + dev: true + /anymatch/3.1.2: resolution: {integrity: sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==} engines: {node: '>= 8'} @@ -839,6 +875,8 @@ packages: finalhandler: 1.1.0 parseurl: 1.3.3 utils-merge: 1.0.1 + transitivePeerDependencies: + - supports-color dev: true /constantinople/4.0.1: @@ -925,6 +963,11 @@ packages: /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: true @@ -1011,6 +1054,8 @@ packages: stack-utils: 1.0.2 to-factory: 1.0.0 zepto: 1.2.0 + transitivePeerDependencies: + - supports-color dev: true /doctypes/1.1.0: @@ -1337,6 +1382,8 @@ packages: parseurl: 1.3.3 statuses: 1.3.1 unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color dev: true /follow-redirects/1.14.9_debug@4.3.2: @@ -1615,6 +1662,11 @@ packages: entities: 3.0.1 dev: true + /http-equiv-refresh/1.0.0: + resolution: {integrity: sha512-TScO04soylRN9i/QdOdgZyhydXg9z6XdaGzEyOgDKycePeDeTT4KvigjBcI+tgfTlieLWauGORMq5F1eIDa+1w==} + engines: {node: '>= 0.10'} + dev: true + /http-errors/1.6.3: resolution: {integrity: sha512-lks+lVC8dgGyh97jxvxeYTWQFvh4uw4yC12gVl63Cg30sjPX4wuGcdkICVXDAESr6OJGjqGA8Iz5mkeN6zlD7A==} engines: {node: '>= 0.6'} @@ -1774,6 +1826,10 @@ packages: is-extglob: 2.1.1 dev: true + /is-json/2.0.1: + resolution: {integrity: sha512-6BEnpVn1rcf3ngfmViLM6vjUjGErbdrL4rwlv+u1NO1XO8kqT4YGL8+19Q+Z/bas8tY90BTWMk2+fW1g6hQjbA==} + dev: true + /is-negative-zero/2.0.2: resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} engines: {node: '>= 0.4'} @@ -1992,6 +2048,10 @@ packages: hasBin: true dev: true + /list-to-array/1.1.0: + resolution: {integrity: sha512-+dAZZ2mM+/m+vY9ezfoueVvrgnHIGi5FvgSymbIgJOFwiznWyA59mav95L+Mc6xPtL3s9gm5eNTlNtxJLbNM1g==} + dev: true + /load-json-file/4.0.0: resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} engines: {node: '>=4'} @@ -2370,6 +2430,10 @@ packages: json-parse-better-errors: 1.0.2 dev: true + /parse-srcset/1.0.2: + resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==} + dev: true + /parse5-htmlparser2-tree-adapter/6.0.1: resolution: {integrity: sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==} dependencies: @@ -2462,6 +2526,38 @@ packages: is-number-like: 1.0.8 dev: true + /posthtml-parser/0.11.0: + resolution: {integrity: sha512-QecJtfLekJbWVo/dMAA+OSwY79wpRmbqS5TeXvXSX+f0c6pW4/SE6inzZ2qkU7oAMCPqIDkZDvd/bQsSFUnKyw==} + engines: {node: '>=12'} + dependencies: + htmlparser2: 7.2.0 + dev: true + + /posthtml-render/3.0.0: + resolution: {integrity: sha512-z+16RoxK3fUPgwaIgH9NGnK1HKY9XIDpydky5eQGgAFVXTCSezalv9U2jQuNV+Z9qV1fDWNzldcw4eK0SSbqKA==} + engines: {node: '>=12'} + dependencies: + is-json: 2.0.1 + dev: true + + /posthtml-urls/1.0.0: + resolution: {integrity: sha512-CMJ0L009sGQVUuYM/g6WJdscsq6ooAwhUuF6CDlYPMLxKp2rmCYVebEU+wZGxnQstGJhZPMvXsRhtqekILd5/w==} + engines: {node: '>= 4'} + dependencies: + http-equiv-refresh: 1.0.0 + list-to-array: 1.1.0 + parse-srcset: 1.0.2 + promise-each: 2.2.0 + dev: true + + /posthtml/0.16.6: + resolution: {integrity: sha512-JcEmHlyLK/o0uGAlj65vgg+7LIms0xKXe60lcDOTU7oVX/3LuEuLwrQpW3VJ7de5TaFKiW4kWkaIpJL42FEgxQ==} + engines: {node: '>=12.0.0'} + dependencies: + posthtml-parser: 0.11.0 + posthtml-render: 3.0.0 + dev: true + /pretty/2.0.0: resolution: {integrity: sha512-G9xUchgTEiNpormdYBl+Pha50gOUovT18IvAe7EYMZ1/f9W/WWMPRn+xI68yXNMUk3QXHDwo/1wV/4NejVNe1w==} engines: {node: '>=0.10.0'} @@ -2481,6 +2577,12 @@ packages: engines: {node: '>= 0.6.0'} dev: true + /promise-each/2.2.0: + resolution: {integrity: sha512-67roqt1k3QDA41DZ8xi0V+rF3GoaMiX7QilbXu0vXimut+9RcKBNZ/t60xCRgcsihmNUsEjh48xLfNqOrKblUg==} + dependencies: + any-promise: 0.1.0 + dev: true + /promise/7.3.1: resolution: {integrity: sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==} dependencies: @@ -2731,6 +2833,8 @@ packages: dependencies: debug: 2.6.9 minimatch: 3.0.4 + transitivePeerDependencies: + - supports-color dev: true /reusify/1.0.4: @@ -2745,18 +2849,21 @@ packages: glob: 7.2.0 dev: true - /rome/0.7.0-next.f6510d6: - resolution: {integrity: sha512-vg8juqZlOr5Xlj+aNcNdiKH6r5heyLCSqaMbh5BgV312vyYrM6Nm4KMFH1G/F+WFiAPweKc+GKG0G+/Z37NsfQ==} + /rome/0.9.0-next: + resolution: {integrity: sha512-Ggk0vGhYmeFEAMdd9gTtsmGKGIGa5ldet/GJDRgtW/7gZYP7HYNizJcf5N4uwZHn0/hjgFvguWB2BEHsHGTivA==} engines: {node: '>=14.*'} hasBin: true requiresBuild: true optionalDependencies: - '@rometools/cli-darwin-arm64': 0.7.0-next.f6510d6 - '@rometools/cli-darwin-x64': 0.7.0-next.f6510d6 - '@rometools/cli-linux-arm64': 0.7.0-next.f6510d6 - '@rometools/cli-linux-x64': 0.7.0-next.f6510d6 - '@rometools/cli-win32-arm64': 0.7.0-next.f6510d6 - '@rometools/cli-win32-x64': 0.7.0-next.f6510d6 + '@rometools/cli-darwin-arm64': 0.9.0-next + '@rometools/cli-darwin-x64': 0.9.0-next + '@rometools/cli-linux-arm64': 0.9.0-next + '@rometools/cli-linux-x64': 0.9.0-next + '@rometools/cli-win32-arm64': 0.9.0-next + '@rometools/cli-win32-x64': 0.9.0-next + '@rometools/wasm-bundler': 0.9.0-next + '@rometools/wasm-nodejs': 0.9.0-next + '@rometools/wasm-web': 0.9.0-next dev: true /run-parallel/1.2.0: @@ -2836,6 +2943,8 @@ packages: on-finished: 2.3.0 range-parser: 1.2.1 statuses: 1.4.0 + transitivePeerDependencies: + - supports-color dev: true /serve-index/1.9.1: @@ -2849,6 +2958,8 @@ packages: http-errors: 1.6.3 mime-types: 2.1.35 parseurl: 1.3.3 + transitivePeerDependencies: + - supports-color dev: true /serve-static/1.13.2: @@ -2859,6 +2970,8 @@ packages: escape-html: 1.0.3 parseurl: 1.3.3 send: 0.16.2 + transitivePeerDependencies: + - supports-color dev: true /server-destroy/1.0.1: diff --git a/website/src/_includes/docs/formatter.md b/website/src/_includes/docs/formatter.md index 062d7cb6d0f..98f9aa2ae5f 100644 --- a/website/src/_includes/docs/formatter.md +++ b/website/src/_includes/docs/formatter.md @@ -52,7 +52,7 @@ USAGE: INPUTS can be one or more filesystem path, each pointing to a single file or an entire directory to be searched recursively for supported files OPTIONS: - --write Edit the files in place (beware!) instead of instead of printing the diff to the console + --write Edit the files in place (beware!) instead of printing the diff to the console --skip-errors Skip over files containing syntax errors instead of emitting an error diagnostic. --indent-style Change the indention character (default: tabs) --indent-size If the indentation style is set to spaces, determine how many spaces should be used for indentation (default: 2) diff --git a/website/src/_includes/docs/linter.md b/website/src/_includes/docs/linter.md index 40c1f59b442..1cdad382d9e 100644 --- a/website/src/_includes/docs/linter.md +++ b/website/src/_includes/docs/linter.md @@ -45,8 +45,51 @@ At the moment only a few rules are implemented as the linting / analysis infrast **See the full [list of rules](/docs/lint/rules).** -All rules are enabled by default, and cannot be disabled. [Suppressions](#suppressions) can be used to hide specific lint errors. +All rules are enabled by default, and cannot be disabled. [Suppression](#lint-suppression) can be used to hide specific lint errors. [VS Code extension]: https://marketplace.visualstudio.com/items?itemName=rome.rome [release page]: https://github.com/rome/tools/releases + + +### Lint suppression + +There are times when a developer wants to ignore a lint rule for a specific line of the code. + +You can achieve this by adding a suppression comment above the line that is triggering the lint diagnostic. + +Suppression comments have the following format: + +```js +// rome-ignore lint: +// rome-ignore lint(js/noDebugger): +``` + +Where +- `rome-ignore` is the start of a suppression comment; +- `lint:` suppresses the linter; +- `(js/noDebugger)`: **optional**, group and name of the rule you want to suppress; +- `` explanation why the rule is disabled + +Here's an example: + +```ts +// rome-ignore lint: reason +declare const Foo: number; +// rome-ignore lint(js/noUnusedVariables): reason +declare const Bar: number; +``` + + +### Code fixes + +Lint rules may provide automatic code fixes. Rome distinguishes between two types of fixes: + +* safe fixes +* suggested fixes + +Safe fixes are guaranteed to not change the semantics of your code, +and can be applied without explicit review. + +Suggested fixes may change the semantics of your program, and it's, +therefore, advised to manually review the changes. \ No newline at end of file diff --git a/website/src/blog/feed.liquid b/website/src/blog/feed.liquid new file mode 100644 index 00000000000..fa2bf405f87 --- /dev/null +++ b/website/src/blog/feed.liquid @@ -0,0 +1,31 @@ +---json +{ + "permalink": "feed.xml", + "eleventyExcludeFromCollections": true, + "metadata": { + "title": "Rome's blog posts", + "language": "en", + "url": "https://rome.tools/" + } +} +--- + + + {{ metadata.title }} + + + {{ collections.posts | getNewestCollectionItemDate | dateToRfc3339 }} + {{ metadata.url }} + {% for post in collections.post reversed %} + + {{ post.data.author_name }} + + + {{ post.data.title }} + + {{ post.date | dateToRfc3339 }} + {{ post.url | url }} + {{ post.data.description }} + + {%- endfor %} + \ No newline at end of file diff --git a/xtask/bench/src/features/formatter.rs b/xtask/bench/src/features/formatter.rs index c74b179166e..c7c9d1e617a 100644 --- a/xtask/bench/src/features/formatter.rs +++ b/xtask/bench/src/features/formatter.rs @@ -52,7 +52,6 @@ pub fn run_format(root: &JsSyntaxNode, source_type: SourceType) -> Printed { print_diff(stats, dhat::HeapStats::get()); } - #[allow(clippy::let_and_return)] printed }