From 5bb04801a2274ad59fb8ba86919c065508968ee3 Mon Sep 17 00:00:00 2001 From: Marcus Pettersen Irgens Date: Fri, 27 Sep 2024 13:53:37 +0200 Subject: [PATCH] Ignore files in the Jujutsu directory (#16684) Co-authored-by: fisker Cheung --- changelog_unreleased/cli/16684.md | 5 +++++ docs/ignore.md | 2 +- src/cli/expand-patterns.js | 2 +- tests/integration/__tests__/ignore-vcs-files.js | 1 + tests/integration/cli/ignore-vcs-files/.jj/file.js | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog_unreleased/cli/16684.md create mode 100644 tests/integration/cli/ignore-vcs-files/.jj/file.js diff --git a/changelog_unreleased/cli/16684.md b/changelog_unreleased/cli/16684.md new file mode 100644 index 000000000..2c73f878d --- /dev/null +++ b/changelog_unreleased/cli/16684.md @@ -0,0 +1,5 @@ +#### Ignore files in the Jujutsu directory (#16684 by @marcusirgens) + +The Jujutsu VCS uses the `.jj` directory, similarly to how Git uses `.git`. + +This change adds `.jj` to the list of directories which are silently ignored by prettier. diff --git a/docs/ignore.md b/docs/ignore.md index c28569e13..80d901682 100644 --- a/docs/ignore.md +++ b/docs/ignore.md @@ -24,7 +24,7 @@ coverage It’s recommended to have a `.prettierignore` in your project! This way you can run `prettier --write .` to make sure that everything is formatted (without mangling files you don’t want, or choking on generated files). And – your editor will know which files _not_ to format! -By default prettier ignores files in version control systems directories (".git", ".sl", ".svn" and ".hg") and `node_modules` (unless the [`--with-node-modules` CLI option](cli.md#--with-node-modules) is specified). Prettier will also follow rules specified in the ".gitignore" file if it exists in the same directory from which it is run. +By default prettier ignores files in version control systems directories (".git", ".jj", ".sl", ".svn" and ".hg") and `node_modules` (unless the [`--with-node-modules` CLI option](cli.md#--with-node-modules) is specified). Prettier will also follow rules specified in the ".gitignore" file if it exists in the same directory from which it is run. So by default it will be diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js index 9fc9ffad9..d53b9aa99 100644 --- a/src/cli/expand-patterns.js +++ b/src/cli/expand-patterns.js @@ -45,7 +45,7 @@ async function* expandPatterns(context) { */ async function* expandPatternsInternal(context) { // Ignores files in version control systems directories and `node_modules` - const silentlyIgnoredDirs = [".git", ".sl", ".svn", ".hg"]; + const silentlyIgnoredDirs = [".git", ".sl", ".svn", ".hg", ".jj"]; if (context.argv.withNodeModules !== true) { silentlyIgnoredDirs.push("node_modules"); } diff --git a/tests/integration/__tests__/ignore-vcs-files.js b/tests/integration/__tests__/ignore-vcs-files.js index c74f17633..7e80793cb 100644 --- a/tests/integration/__tests__/ignore-vcs-files.js +++ b/tests/integration/__tests__/ignore-vcs-files.js @@ -2,6 +2,7 @@ describe("ignores files in version control systems", () => { runCli("cli/ignore-vcs-files", [ ".svn/file.js", ".hg/file.js", + ".jj/file.js", "file.js", "-l", ]).test({ diff --git a/tests/integration/cli/ignore-vcs-files/.jj/file.js b/tests/integration/cli/ignore-vcs-files/.jj/file.js new file mode 100644 index 000000000..ad9a93a7c --- /dev/null +++ b/tests/integration/cli/ignore-vcs-files/.jj/file.js @@ -0,0 +1 @@ +'use strict';