fix(misc): format must exclude ignored patterns (#18670)
Co-authored-by: Stefano Pongelli <stefano.pongelli@eligamo.com>
This commit is contained in:
parent
a25cc29214
commit
c479a54f7b
@ -6,6 +6,7 @@ import {
|
|||||||
parseFiles,
|
parseFiles,
|
||||||
splitArgsIntoNxArgsAndOverrides,
|
splitArgsIntoNxArgsAndOverrides,
|
||||||
} from '../../utils/command-line-utils';
|
} from '../../utils/command-line-utils';
|
||||||
|
import { getIgnoreObject } from '../../utils/ignore';
|
||||||
import { fileExists, readJsonFile, writeJsonFile } from '../../utils/fileutils';
|
import { fileExists, readJsonFile, writeJsonFile } from '../../utils/fileutils';
|
||||||
import { calculateFileChanges, FileData } from '../../project-graph/file-utils';
|
import { calculateFileChanges, FileData } from '../../project-graph/file-utils';
|
||||||
import * as yargs from 'yargs';
|
import * as yargs from 'yargs';
|
||||||
@ -94,9 +95,16 @@ async function getPatterns(
|
|||||||
(f) => fileExists(f) && supportedExtensions.includes(path.extname(f))
|
(f) => fileExists(f) && supportedExtensions.includes(path.extname(f))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// exclude patterns in .nxignore or .gitignore
|
||||||
|
const nonIgnoredPatterns = getIgnoreObject().filter(patterns);
|
||||||
|
|
||||||
return args.libsAndApps
|
return args.libsAndApps
|
||||||
? await getPatternsFromApps(patterns, await allFileData(), graph)
|
? await getPatternsFromApps(
|
||||||
: patterns;
|
nonIgnoredPatterns,
|
||||||
|
await allFileData(),
|
||||||
|
graph
|
||||||
|
)
|
||||||
|
: nonIgnoredPatterns;
|
||||||
} catch {
|
} catch {
|
||||||
return allFilesPattern;
|
return allFilesPattern;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user