Skip to content

Commit 7375b81

Browse files
Avoiding ignoring files as we go, for now, as it can be problematic in some cases
1 parent 8b539fe commit 7375b81

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

package-lock.json

+7-29
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"specialist": "^1.4.0",
5151
"tiny-editorconfig": "^1.0.0",
5252
"tiny-jsonc": "^1.0.1",
53-
"tiny-readdir-glob-gitignore": "^1.0.2",
53+
"tiny-readdir-glob": "^1.22.24",
5454
"tiny-spinner": "^2.0.3",
5555
"worktank": "^2.6.1",
5656
"zeptomatch": "^2.0.0",

src/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ async function runGlobs(options: Options, pluginsOptions: PluginsOptions): Promi
4949

5050
const rootPath = process.cwd();
5151
const projectPath = getProjectPath(rootPath);
52-
const ignoreFiles = options.ignorePath ? [] : [".gitignore", ".prettierignore"];
53-
const [filesPaths, filesNames, filesNamesToPaths, filesFoundPaths, foldersFoundPaths] = await getTargetsPaths(rootPath, options.globs, ignoreFiles, options.withNodeModules); // prettier-ignore
52+
const [filesPaths, filesNames, filesNamesToPaths, filesFoundPaths, foldersFoundPaths] = await getTargetsPaths(rootPath, options.globs, options.withNodeModules); // prettier-ignore
5453
const filesPathsTargets = filesPaths.filter(negate(isBinaryPath)).sort();
5554
const [foldersPathsTargets, foldersExtraPaths] = getExpandedFoldersPaths(foldersFoundPaths, projectPath);
5655
const filesExtraPaths = await getFoldersChildrenPaths([rootPath, ...foldersExtraPaths]);
@@ -105,7 +104,7 @@ async function runGlobs(options: Options, pluginsOptions: PluginsOptions): Promi
105104
filesPathsTargets.map(async (filePath) => {
106105
const isIgnored = () => (ignoreManual ? ignoreManual(filePath) : getIgnoreResolved(filePath, ignoreNames));
107106
const isCacheable = () => cache?.has(filePath, isIgnored);
108-
const ignored = !ignoreFiles.length && (cache ? !(await isCacheable()) : await isIgnored());
107+
const ignored = cache ? !(await isCacheable()) : await isIgnored();
109108
if (ignored) return;
110109
const getFormatOptions = async (): Promise<FormatOptions> => {
111110
const editorConfig = options.editorConfig ? getEditorConfigFormatOptions(await getEditorConfigResolved(filePath, editorConfigNames)) : {};

src/utils.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { text as stream2text } from "node:stream/consumers";
1010
import url from "node:url";
1111
import resolveTimeout from "promise-resolve-timeout";
1212
import { exit } from "specialist";
13-
import readdir from "tiny-readdir-glob-gitignore";
13+
import readdir from "tiny-readdir-glob";
1414
import zeptomatchEscape from "zeptomatch-escape";
1515
import zeptomatchIsStatic from "zeptomatch-is-static";
1616
import type { ContextOptions, FormatOptions, FunctionMaybe, Key, LogLevel, Options, PrettierConfigWithOverrides, PrettierPlugin } from "./types.js";
@@ -87,13 +87,11 @@ async function getFoldersChildrenPaths(foldersPaths: string[]): Promise<string[]
8787
return childrenPaths;
8888
}
8989

90-
function getGlobPaths(rootPath: string, globs: string[], ignoreFiles: string[], withNodeModules: boolean) {
90+
function getGlobPaths(rootPath: string, globs: string[], withNodeModules: boolean) {
9191
return readdir(globs, {
9292
cwd: rootPath,
9393
followSymlinks: false,
9494
ignore: `**/{.git,.sl,.svn,.hg,.DS_Store,Thumbs.db${withNodeModules ? "" : ",node_modules"}}`,
95-
ignoreFiles,
96-
ignoreFilesFindAbove: false,
9795
});
9896
}
9997

@@ -186,7 +184,6 @@ const getStdin = once(async (): Promise<string | undefined> => {
186184
async function getTargetsPaths(
187185
rootPath: string,
188186
globs: string[],
189-
ignoreFiles: string[],
190187
withNodeModules: boolean,
191188
): Promise<[string[], string[], Record<string, string[]>, string[], string[]]> {
192189
const targetFiles: string[] = [];
@@ -207,7 +204,7 @@ async function getTargetsPaths(
207204
}
208205
}
209206

210-
const result = await getGlobPaths(rootPath, targetGlobs, ignoreFiles, withNodeModules);
207+
const result = await getGlobPaths(rootPath, targetGlobs, withNodeModules);
211208
const filesPaths = [...targetFiles, ...result.files];
212209
const filesNames = [...targetFilesNames, ...result.filesFoundNames];
213210
const filesNamesToPaths = result.filesFoundNamesToPaths;

0 commit comments

Comments
 (0)