Skip to content

Commit

Permalink
fix(misc): format must exclude ignored patterns (#18670)
Browse files Browse the repository at this point in the history
Co-authored-by: Stefano Pongelli <stefano.pongelli@eligamo.com>
  • Loading branch information
pongells and Stefano Pongelli authored Aug 22, 2023
1 parent a25cc29 commit c479a54
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/nx/src/command-line/format/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
parseFiles,
splitArgsIntoNxArgsAndOverrides,
} from '../../utils/command-line-utils';
import { getIgnoreObject } from '../../utils/ignore';
import { fileExists, readJsonFile, writeJsonFile } from '../../utils/fileutils';
import { calculateFileChanges, FileData } from '../../project-graph/file-utils';
import * as yargs from 'yargs';
Expand Down Expand Up @@ -94,9 +95,16 @@ async function getPatterns(
(f) => fileExists(f) && supportedExtensions.includes(path.extname(f))
);

// exclude patterns in .nxignore or .gitignore
const nonIgnoredPatterns = getIgnoreObject().filter(patterns);

return args.libsAndApps
? await getPatternsFromApps(patterns, await allFileData(), graph)
: patterns;
? await getPatternsFromApps(
nonIgnoredPatterns,
await allFileData(),
graph
)
: nonIgnoredPatterns;
} catch {
return allFilesPattern;
}
Expand Down

1 comment on commit c479a54

@vercel
Copy link

@vercel vercel bot commented on c479a54 Aug 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev
nx-dev-nrwl.vercel.app

Please sign in to comment.