diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index ff9ece5e0c5..f037080d87a 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -28,8 +28,11 @@ jobs: uses: moonrepo/setup-rust@v0 with: components: rustfmt - - name: Run rustfmt - run: cargo fmt --all --check + bins: taplo-cli + - name: Run format + run: | + cargo fmt --all --check + taplo fmt -- --locked lint: name: Lint Rust Files @@ -115,7 +118,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 - name: Cache pnpm modules uses: actions/cache@v3 with: @@ -125,7 +128,7 @@ jobs: ${{ runner.os }}- - uses: pnpm/action-setup@v2.2.4 with: - version: 7 + version: 8 - name: Install wasm-pack uses: jetli/wasm-pack-action@v0.4.0 with: diff --git a/.github/workflows/pull_request_js.yml b/.github/workflows/pull_request_js.yml index 0eb1fb7006d..d83c03dc80f 100644 --- a/.github/workflows/pull_request_js.yml +++ b/.github/workflows/pull_request_js.yml @@ -47,7 +47,7 @@ jobs: ${{ runner.os }}- - uses: pnpm/action-setup@v2.2.4 with: - version: 7 + version: 8 - name: Install toolchain uses: moonrepo/setup-rust@v0 - name: Build WASM module for the web diff --git a/.github/workflows/release_cli.yml b/.github/workflows/release_cli.yml index 840961fb182..920e51490f5 100644 --- a/.github/workflows/release_cli.yml +++ b/.github/workflows/release_cli.yml @@ -89,7 +89,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 - name: Install Rust toolchain run: rustup target add ${{ matrix.target }} @@ -187,7 +187,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 registry-url: 'https://registry.npmjs.org' - name: Set release infos diff --git a/.github/workflows/release_js_api.yml b/.github/workflows/release_js_api.yml index 229dbe29a9d..63db5829a11 100644 --- a/.github/workflows/release_js_api.yml +++ b/.github/workflows/release_js_api.yml @@ -65,7 +65,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 - name: Install wasm-pack uses: jetli/wasm-pack-action@v0.4.0 @@ -81,7 +81,7 @@ jobs: ${{ runner.os }}- - uses: pnpm/action-setup@v2.2.4 with: - version: 7 + version: 8 - name: Set release infos if: needs.check.outputs.prerelease == 'true' @@ -133,7 +133,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 registry-url: 'https://registry.npmjs.org' - name: Set release infos diff --git a/.github/workflows/release_lsp.yml b/.github/workflows/release_lsp.yml index 6a65e74ac64..3f9077091fd 100644 --- a/.github/workflows/release_lsp.yml +++ b/.github/workflows/release_lsp.yml @@ -149,7 +149,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 - name: Update package.json version if: needs.check.outputs.prerelease == 'true' @@ -195,7 +195,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: 14.x + node-version: 18 registry-url: 'https://registry.npmjs.org' - name: Publish extension to Microsoft Marketplace (pre-release) diff --git a/.github/workflows/runtime.yml b/.github/workflows/runtime.yml index a608abaa1ac..5229aa89592 100644 --- a/.github/workflows/runtime.yml +++ b/.github/workflows/runtime.yml @@ -40,7 +40,7 @@ jobs: ${{ runner.os }}- - uses: pnpm/action-setup@v2.2.4 with: - version: 7 + version: 8 - name: Install toolchain uses: moonrepo/setup-rust@v0 - name: Install libraries @@ -55,4 +55,4 @@ jobs: pnpm --prefix npm/backend-jsonrpc run build - name: CI checks working-directory: npm/js-api - run: pnpm ci + run: pnpm run ci diff --git a/CHANGELOG.md b/CHANGELOG.md index af278b13a15..1089099f296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,11 @@ - Fixed the diagnostics emitted when running the `rome format` command; +- Rome doesn't warn anymore when discovering (possibly infinite) symbolic links between directories. + This fixes [#4193](https://github.com/rome/tools/issues/4193) which resulted in incorrect warnings + when a single file or directory was pointed at by multiple symbolic links. Symbolic links to other + symbolic links do still trigger warnings if they are too deeply nested. + ### Configuration #### Other changes @@ -142,6 +147,10 @@ if no error diagnostics are emitted. This rule recommends using `Number.isNaN` instead of the global and unsafe `isNaN` that attempts a type coercion. +- Add [`noUnsafeDeclarationMerging`](https://docs.rome.tools/lint/rules/noUnsafeDeclarationMerging/) + + This rule disallows declaration merging between an interface and a class. + - Add [`useArrowFunction`](https://docs.rome.tools/lint/rules/usearrowfunction/) This rule proposes turning function expressions into arrow functions. @@ -192,6 +201,20 @@ if no error diagnostics are emitted. - Fix [`noDuplicateCase`](https://docs.rome.tools/lint/rules/noDuplicateCase/) rule that erroneously reported as equals the strings literals `"'"` and `'"'` [#4706](https://github.com/rome/tools/issues/4706). +- Improve [`useEnumInitializers`](https://docs.rome.tools/lint/rules/useEnumInitializers/) + + The rule now reports all uninitialized members of an enum in a single diagnostic. + + Moreover, ambient enum declarations are now ignored. + This avoids reporting ambient enum declarations in _TypeScript_ declaration files. + + ```ts + declare enum Weather { + Rainy, + Sunny, + } + ``` + - Relax [`noBannedTypes`](https://docs.rome.tools/lint/rules/nobannedtypes/) and improve documentation The rule no longer reports a user type that reuses a banned type name. diff --git a/crates/rome_cli/src/configuration.rs b/crates/rome_cli/src/configuration.rs index 437df170af2..7e310486fc1 100644 --- a/crates/rome_cli/src/configuration.rs +++ b/crates/rome_cli/src/configuration.rs @@ -5,6 +5,7 @@ use rome_deserialize::json::deserialize_from_json_str; use rome_deserialize::Deserialized; use rome_diagnostics::{DiagnosticExt, Error, PrintDiagnostic}; use rome_fs::{FileSystem, OpenOptions}; +use rome_json_parser::JsonParserOptions; use rome_service::configuration::diagnostics::CantLoadExtendFile; use rome_service::configuration::ConfigurationPayload; use rome_service::{ @@ -72,7 +73,10 @@ impl LoadedConfiguration { ) })?; - let deserialized = deserialize_from_json_str::(content.as_str()); + let deserialized = deserialize_from_json_str::( + content.as_str(), + JsonParserOptions::default(), + ); deserialized_configurations.push(deserialized) } Ok(deserialized_configurations) diff --git a/crates/rome_cli/tests/commands/check.rs b/crates/rome_cli/tests/commands/check.rs index f3cfc1bede3..f19202be2e2 100644 --- a/crates/rome_cli/tests/commands/check.rs +++ b/crates/rome_cli/tests/commands/check.rs @@ -797,15 +797,11 @@ fn fs_error_dereferenced_symlink() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_broken_symlink"); + let root_path = temp_dir().join("check_rome_test_broken_symlink"); let subdir_path = root_path.join("prefix"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); - create_dir(subdir_path).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir_all(subdir_path).unwrap(); #[cfg(target_family = "unix")] { @@ -840,39 +836,28 @@ fn fs_error_dereferenced_symlink() { } #[test] -fn fs_error_infinite_symlink_exapansion() { +fn fs_error_infinite_symlink_expansion_to_dirs() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_infinite_symlink_exapansion"); + let root_path = temp_dir().join("check_rome_test_infinite_symlink_expansion_to_dirs"); let subdir1_path = root_path.join("prefix"); let subdir2_path = root_path.join("foo").join("bar"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); - create_dir(subdir1_path.clone()).unwrap(); - - create_dir_all(subdir2_path.clone()).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir_all(&subdir1_path).unwrap(); + create_dir_all(&subdir2_path).unwrap(); #[cfg(target_family = "unix")] { - symlink(subdir1_path.clone(), root_path.join("self_symlink1")).unwrap(); - symlink(subdir1_path, subdir2_path.join("self_symlink2")).unwrap(); + symlink(&subdir2_path, subdir1_path.join("symlink1")).unwrap(); + symlink(subdir1_path, subdir2_path.join("symlink2")).unwrap(); } #[cfg(target_os = "windows")] { - check_windows_symlink!(symlink_dir( - subdir1_path.clone(), - root_path.join("self_symlink1") - )); - check_windows_symlink!(symlink_dir( - subdir1_path, - subdir2_path.join("self_symlink2") - )); + check_windows_symlink!(symlink_dir(&subdir2_path, &subdir1_path.join("symlink1"))); + check_windows_symlink!(symlink_dir(subdir1_path, subdir2_path.join("symlink2"))); } let result = run_cli( @@ -887,13 +872,69 @@ fn fs_error_infinite_symlink_exapansion() { assert_cli_snapshot(SnapshotPayload::new( module_path!(), - "fs_error_infinite_symlink_expansion", + "fs_error_infinite_symlink_expansion_to_dirs", fs, console, result, )); } +#[test] +fn fs_error_infinite_symlink_expansion_to_files() { + let mut console = BufferConsole::default(); + + let root_path = temp_dir().join("check_rome_test_infinite_symlink_expansion_to_files"); + let subdir1_path = root_path.join("prefix"); + let subdir2_path = root_path.join("foo").join("bar"); + + let _ = remove_dir_all(&root_path); + create_dir_all(&subdir1_path).unwrap(); + create_dir_all(&subdir2_path).unwrap(); + + let symlink1_path = subdir1_path.join("symlink1"); + let symlink2_path = subdir2_path.join("symlink2"); + + #[cfg(target_family = "unix")] + { + symlink(&symlink2_path, &symlink1_path).unwrap(); + symlink(&symlink1_path, &symlink2_path).unwrap(); + } + + #[cfg(target_os = "windows")] + { + check_windows_symlink!(symlink_dir(&symlink2_path, &symlink1_path)); + check_windows_symlink!(symlink_dir(&symlink1_path, &symlink2_path)); + } + + let result = run_cli( + DynRef::Owned(Box::new(OsFileSystem)), + &mut console, + Args::from([("check"), (root_path.display().to_string().as_str())].as_slice()), + ); + + remove_dir_all(root_path).unwrap(); + + assert!(result.is_err(), "run_cli returned {result:?}"); + + // Don't use a snapshot here, since the diagnostics can be reported in + // arbitrary order: + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains("Deeply nested symlink expansion"))); + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains(&symlink1_path.display().to_string()))); + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains(&symlink2_path.display().to_string()))); +} + #[test] fn fs_error_read_only() { let mut fs = MemoryFileSystem::new_read_only(); @@ -970,28 +1011,27 @@ fn fs_error_unknown() { // │ └── test.js // ok // └── src // ├── symlink_testcase1_1 -> hidden_nested +// ├── symlink_testcase1_3 -> hidden_testcase1/test/test.js // └── symlink_testcase2 -> hidden_testcase2 #[test] fn fs_files_ignore_symlink() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_files_ignore_symlink"); + let root_path = temp_dir().join("check_rome_test_files_ignore_symlink"); let src_path = root_path.join("src"); let testcase1_path = root_path.join("hidden_testcase1"); let testcase1_sub_path = testcase1_path.join("test"); + let testcase1_sub_file_path = testcase1_sub_path.join("test.js"); let testcase2_path = root_path.join("hidden_testcase2"); let nested_path = root_path.join("hidden_nested"); let nested_sub_path = nested_path.join("test"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); - create_dir(src_path.clone()).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir(&root_path).unwrap(); + create_dir(&src_path).unwrap(); create_dir_all(testcase1_sub_path.clone()).unwrap(); create_dir(testcase2_path.clone()).unwrap(); create_dir_all(nested_sub_path.clone()).unwrap(); @@ -1000,27 +1040,32 @@ fn fs_files_ignore_symlink() { let symlink_testcase1_1_path = src_path.join("symlink_testcase1_1"); // hidden_nested/test/symlink_testcase1_2 let symlink_testcase1_2_path = nested_sub_path.join("symlink_testcase1_2"); + // src/symlink_testcase1_3 + let symlink_testcase1_3_path = src_path.join("symlink_testcase1_3"); // src/symlink_testcase2 let symlink_testcase2_path = src_path.join("symlink_testcase2"); #[cfg(target_family = "unix")] { - // src/test/symlink_testcase1_1 -> hidden_nested + // src/symlink_testcase1_1 -> hidden_nested symlink(nested_path, symlink_testcase1_1_path).unwrap(); // hidden_nested/test/symlink_testcase1_2 -> hidden_testcase1 symlink(testcase1_path, symlink_testcase1_2_path).unwrap(); + // src/symlink_testcase1_3 -> hidden_testcase1/test/test.js + symlink(testcase1_sub_file_path, symlink_testcase1_3_path).unwrap(); // src/symlink_testcase2 -> hidden_testcase2 - symlink(testcase2_path.clone(), symlink_testcase2_path).unwrap(); + symlink(&testcase2_path, symlink_testcase2_path).unwrap(); } #[cfg(target_os = "windows")] { - check_windows_symlink!(symlink_dir(nested_path.clone(), symlink_testcase1_1_path)); + check_windows_symlink!(symlink_dir(nested_path, symlink_testcase1_1_path)); + check_windows_symlink!(symlink_dir(testcase1_path, symlink_testcase1_2_path)); check_windows_symlink!(symlink_dir( - testcase1_path.clone(), - symlink_testcase1_2_path + testcase1_sub_file_path, + symlink_testcase1_3_path )); - check_windows_symlink!(symlink_dir(testcase2_path.clone(), symlink_testcase2_path)); + check_windows_symlink!(symlink_dir(&testcase2_path, symlink_testcase2_path)); } let config_path = root_path.join("rome.json"); diff --git a/crates/rome_cli/tests/commands/format.rs b/crates/rome_cli/tests/commands/format.rs index 4091095bac5..b5256255993 100644 --- a/crates/rome_cli/tests/commands/format.rs +++ b/crates/rome_cli/tests/commands/format.rs @@ -1866,7 +1866,7 @@ fn ignore_comments_error_when_allow_comments() { Args::from([("format"), file_path.as_os_str().to_str().unwrap()].as_slice()), ); - // assert!(result.is_ok(), "run_cli returned {result:?}"); + assert!(result.is_ok(), "run_cli returned {result:?}"); assert_cli_snapshot(SnapshotPayload::new( module_path!(), @@ -1876,3 +1876,78 @@ fn ignore_comments_error_when_allow_comments() { result, )); } + +#[test] +fn format_jsonc_files() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let code = r#" +/*test*/ [ + +/* some other comment*/1, 2, 3] + "#; + let file_path = Path::new("file.jsonc"); + fs.insert(file_path.into(), code.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + &mut console, + Args::from([("format"), file_path.as_os_str().to_str().unwrap()].as_slice()), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + assert_cli_snapshot(SnapshotPayload::new( + module_path!(), + "format_jsonc_files", + fs, + console, + result, + )); +} + +#[test] +fn treat_known_json_files_as_jsonc_files() { + let mut fs = MemoryFileSystem::default(); + let mut console = BufferConsole::default(); + + let code = r#" +/*test*/ [ + +/* some other comment*/1, 2, 3] + "#; + let ts = Path::new("files/typescript.json"); + fs.insert(ts.into(), code.as_bytes()); + let eslint = Path::new("files/.eslintrc.json"); + fs.insert(eslint.into(), code.as_bytes()); + let jshint = Path::new("files/.jshintrc"); + fs.insert(jshint.into(), code.as_bytes()); + let babel = Path::new("files/.babelrc"); + fs.insert(babel.into(), code.as_bytes()); + + let result = run_cli( + DynRef::Borrowed(&mut fs), + &mut console, + Args::from( + [ + ("format"), + ts.as_os_str().to_str().unwrap(), + eslint.as_os_str().to_str().unwrap(), + jshint.as_os_str().to_str().unwrap(), + babel.as_os_str().to_str().unwrap(), + ] + .as_slice(), + ), + ); + + assert!(result.is_ok(), "run_cli returned {result:?}"); + + assert_cli_snapshot(SnapshotPayload::new( + module_path!(), + "treat_known_json_files_as_jsonc_files", + fs, + console, + result, + )); +} diff --git a/crates/rome_cli/tests/commands/lint.rs b/crates/rome_cli/tests/commands/lint.rs index d3c7c15ff2a..34ae0be75b6 100644 --- a/crates/rome_cli/tests/commands/lint.rs +++ b/crates/rome_cli/tests/commands/lint.rs @@ -794,14 +794,11 @@ fn fs_error_dereferenced_symlink() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_broken_symlink"); + let root_path = temp_dir().join("lint_rome_test_broken_symlink"); let subdir_path = root_path.join("prefix"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir(&root_path).unwrap(); create_dir(subdir_path).unwrap(); #[cfg(target_family = "unix")] @@ -837,39 +834,28 @@ fn fs_error_dereferenced_symlink() { } #[test] -fn fs_error_infinite_symlink_exapansion() { +fn fs_error_infinite_symlink_expansion_to_dirs() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_infinite_symlink_exapansion"); + let root_path = temp_dir().join("lint_rome_test_infinite_symlink_expansion_to_dirs"); let subdir1_path = root_path.join("prefix"); let subdir2_path = root_path.join("foo").join("bar"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); - create_dir(subdir1_path.clone()).unwrap(); - - create_dir_all(subdir2_path.clone()).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir_all(&subdir1_path).unwrap(); + create_dir_all(&subdir2_path).unwrap(); #[cfg(target_family = "unix")] { - symlink(subdir1_path.clone(), root_path.join("self_symlink1")).unwrap(); - symlink(subdir1_path, subdir2_path.join("self_symlink2")).unwrap(); + symlink(&subdir2_path, subdir1_path.join("symlink1")).unwrap(); + symlink(subdir1_path, subdir2_path.join("symlink2")).unwrap(); } #[cfg(target_os = "windows")] { - check_windows_symlink!(symlink_dir( - subdir1_path.clone(), - root_path.join("self_symlink1") - )); - check_windows_symlink!(symlink_dir( - subdir1_path, - subdir2_path.join("self_symlink2") - )); + check_windows_symlink!(symlink_dir(&subdir2_path, &subdir1_path.join("symlink1"))); + check_windows_symlink!(symlink_dir(subdir1_path, subdir2_path.join("symlink2"))); } let result = run_cli( @@ -884,13 +870,69 @@ fn fs_error_infinite_symlink_exapansion() { assert_cli_snapshot(SnapshotPayload::new( module_path!(), - "fs_error_infinite_symlink_expansion", + "fs_error_infinite_symlink_expansion_to_dirs", fs, console, result, )); } +#[test] +fn fs_error_infinite_symlink_expansion_to_files() { + let mut console = BufferConsole::default(); + + let root_path = temp_dir().join("lint_rome_test_infinite_symlink_expansion_to_files"); + let subdir1_path = root_path.join("prefix"); + let subdir2_path = root_path.join("foo").join("bar"); + + let _ = remove_dir_all(&root_path); + create_dir_all(&subdir1_path).unwrap(); + create_dir_all(&subdir2_path).unwrap(); + + let symlink1_path = subdir1_path.join("symlink1"); + let symlink2_path = subdir2_path.join("symlink2"); + + #[cfg(target_family = "unix")] + { + symlink(&symlink2_path, &symlink1_path).unwrap(); + symlink(&symlink1_path, &symlink2_path).unwrap(); + } + + #[cfg(target_os = "windows")] + { + check_windows_symlink!(symlink_dir(&symlink2_path, &symlink1_path)); + check_windows_symlink!(symlink_dir(&symlink1_path, &symlink2_path)); + } + + let result = run_cli( + DynRef::Owned(Box::new(OsFileSystem)), + &mut console, + Args::from([("lint"), (root_path.display().to_string().as_str())].as_slice()), + ); + + remove_dir_all(root_path).unwrap(); + + assert!(result.is_err(), "run_cli returned {result:?}"); + + // Don't use a snapshot here, since the diagnostics can be reported in + // arbitrary order: + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains("Deeply nested symlink expansion"))); + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains(&symlink1_path.display().to_string()))); + assert!(console + .out_buffer + .iter() + .flat_map(|msg| msg.content.0.iter()) + .any(|node| node.content.contains(&symlink2_path.display().to_string()))); +} + #[test] fn fs_error_read_only() { let mut fs = MemoryFileSystem::new_read_only(); @@ -973,22 +1015,20 @@ fn fs_files_ignore_symlink() { let fs = MemoryFileSystem::default(); let mut console = BufferConsole::default(); - let root_path = temp_dir().join("rome_test_files_ignore_symlink"); + let root_path = temp_dir().join("lint_rome_test_files_ignore_symlink"); let src_path = root_path.join("src"); let testcase1_path = root_path.join("hidden_testcase1"); let testcase1_sub_path = testcase1_path.join("test"); + let testcase1_sub_file_path = testcase1_sub_path.join("test.js"); let testcase2_path = root_path.join("hidden_testcase2"); let nested_path = root_path.join("hidden_nested"); let nested_sub_path = nested_path.join("test"); - #[allow(unused_must_use)] - { - remove_dir_all(root_path.display().to_string().as_str()); - } - create_dir(root_path.display().to_string().as_str()).unwrap(); - create_dir(src_path.clone()).unwrap(); + let _ = remove_dir_all(&root_path); + create_dir(&root_path).unwrap(); + create_dir(&src_path).unwrap(); create_dir_all(testcase1_sub_path.clone()).unwrap(); create_dir(testcase2_path.clone()).unwrap(); create_dir_all(nested_sub_path.clone()).unwrap(); @@ -997,27 +1037,32 @@ fn fs_files_ignore_symlink() { let symlink_testcase1_1_path = src_path.join("symlink_testcase1_1"); // hidden_nested/test/symlink_testcase1_2 let symlink_testcase1_2_path = nested_sub_path.join("symlink_testcase1_2"); + // src/symlink_testcase1_3 + let symlink_testcase1_3_path = src_path.join("symlink_testcase1_3"); // src/symlink_testcase2 let symlink_testcase2_path = src_path.join("symlink_testcase2"); #[cfg(target_family = "unix")] { - // src/test/symlink_testcase1_1 -> hidden_nested + // src/symlink_testcase1_1 -> hidden_nested symlink(nested_path, symlink_testcase1_1_path).unwrap(); // hidden_nested/test/symlink_testcase1_2 -> hidden_testcase1 symlink(testcase1_path, symlink_testcase1_2_path).unwrap(); + // src/symlink_testcase1_3 -> hidden_testcase1/test/test.js + symlink(testcase1_sub_file_path, symlink_testcase1_3_path).unwrap(); // src/symlink_testcase2 -> hidden_testcase2 - symlink(testcase2_path.clone(), symlink_testcase2_path).unwrap(); + symlink(&testcase2_path, symlink_testcase2_path).unwrap(); } #[cfg(target_os = "windows")] { - check_windows_symlink!(symlink_dir(nested_path.clone(), symlink_testcase1_1_path)); + check_windows_symlink!(symlink_dir(nested_path, symlink_testcase1_1_path)); + check_windows_symlink!(symlink_dir(testcase1_path, symlink_testcase1_2_path)); check_windows_symlink!(symlink_dir( - testcase1_path.clone(), - symlink_testcase1_2_path + testcase1_sub_file_path, + symlink_testcase1_3_path )); - check_windows_symlink!(symlink_dir(testcase2_path.clone(), symlink_testcase2_path)); + check_windows_symlink!(symlink_dir(&testcase2_path, symlink_testcase2_path)); } let config_path = root_path.join("rome.json"); diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_dereferenced_symlink.snap b/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_dereferenced_symlink.snap index 1da9cdaf434..7c63cf0fb51 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_dereferenced_symlink.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_dereferenced_symlink.snap @@ -16,11 +16,11 @@ internalError/io ━━━━━━━━━━━━━━━━━━━━━ # Emitted Messages ```block -/rome_test_broken_symlink/broken_symlink internalError/fs ━━━━━━━━━━━━━━━━━━━━ +/check_rome_test_broken_symlink/broken_symlink internalError/fs ━━━━━━━━━━━━━━━━━━━━ ! Dereferenced symlink - i Rome encountered a file system entry that is a broken symbolic link: /rome_test_broken_symlink/broken_symlink + i Rome encountered a file system entry that is a broken symbolic link: /check_rome_test_broken_symlink/broken_symlink ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_infinite_symlink_expansion.snap b/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_infinite_symlink_expansion.snap deleted file mode 100644 index 4f93f54b559..00000000000 --- a/crates/rome_cli/tests/snapshots/main_commands_check/fs_error_infinite_symlink_expansion.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: crates/rome_cli/tests/snap_test.rs -expression: content ---- -# Termination Message - -```block -internalError/io ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - × No files were processed in the specified paths. - - - -``` - -# Emitted Messages - -```block -/rome_test_infinite_symlink_exapansion/prefix internalError/fs ━━━━━━━━━━━━━━━━━━━━ - - ! Infinite symlink expansion - - × Rome encountered a file system entry that leads to an infinite symbolic link expansion, causing an infinite cycle: /rome_test_infinite_symlink_exapansion/prefix - - -``` - -```block -/rome_test_infinite_symlink_exapansion/prefix internalError/fs ━━━━━━━━━━━━━━━━━━━━ - - ! Infinite symlink expansion - - × Rome encountered a file system entry that leads to an infinite symbolic link expansion, causing an infinite cycle: /rome_test_infinite_symlink_exapansion/prefix - - -``` - -```block -Checked 0 file(s) in