feat: set lint --max-warnings to -1
Signed-off-by: Paul Schultz <pschultz@pobox.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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
|
||||
|
||||
@@ -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: '^_',
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user