diff --git a/.changeset/metal-clouds-fail.md b/.changeset/metal-clouds-fail.md new file mode 100644 index 0000000000..083984c015 --- /dev/null +++ b/.changeset/metal-clouds-fail.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +The file path printed by the default lint formatter is now relative to the repository root, rather than the individual package. diff --git a/packages/cli/src/commands/lint.ts b/packages/cli/src/commands/lint.ts index 6db17dbfc4..9b86ea06b3 100644 --- a/packages/cli/src/commands/lint.ts +++ b/packages/cli/src/commands/lint.ts @@ -32,6 +32,11 @@ export default async (cmd: Command) => { } const formatter = await eslint.loadFormatter(cmd.format); + + // This formatter uses the cwd to format file paths, so let's have that happen from the root instead + if (cmd.format === 'eslint-formatter-friendly') { + process.chdir(paths.targetRoot); + } const resultText = formatter.format(results); // If there is any feedback at all, we treat it as a lint failure. This should be