feat: set lint --max-warnings to -1

Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
Paul Schultz
2025-01-31 10:35:43 -06:00
parent 870079299b
commit 5b7067966c
5 changed files with 12 additions and 5 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/cli': minor
---
**BREAKING**: ESLint warnings no longer trigger system exit codes like errors do.
Set the max number of warnings to `-1` during linting to enable the gradual adoption of new ESLint rules. To restore the previous behavior, include the `--max-warnings 0` flag in the `backstage-cli <repo|package> lint` command.
+1 -1
View File
@@ -189,7 +189,7 @@ Lint a package
Options:
--format <format> Lint report output format (default: "eslint-formatter-friendly")
--fix Attempt to automatically fix violations
--max-warnings <number> Fail if more than this number of warnings. -1 allows warnings. (default: 0)
--max-warnings <number> Fail if more than this number of warnings. -1 allows warnings. (default: -1)
```
## package test
+2 -2
View File
@@ -95,7 +95,7 @@ function createConfig(dir, extraConfig = {}) {
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/no-unused-vars': [
'warn',
'error',
{
vars: 'all',
args: 'after-used',
@@ -173,7 +173,7 @@ function createConfig(dir, extraConfig = {}) {
'no-unused-vars': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
'error',
{
vars: 'all',
varsIgnorePattern: '^_',
+1 -1
View File
@@ -129,7 +129,7 @@ export function registerScriptCommand(program: Command) {
.option('--fix', 'Attempt to automatically fix violations')
.option(
'--max-warnings <number>',
'Fail if more than this number of warnings. -1 allows warnings. (default: 0)',
'Fail if more than this number of warnings. -1 allows warnings. (default: -1)',
)
.description('Lint a package')
.action(lazy(() => import('./lint'), 'default'));
+1 -1
View File
@@ -30,7 +30,7 @@ export default async (directories: string[], opts: OptionValues) => {
directories.length ? directories : ['.'],
);
const maxWarnings = opts.maxWarnings ?? 0;
const maxWarnings = opts.maxWarnings ?? -1;
const ignoreWarnings = +maxWarnings === -1;
const failed =