Skip to content

Commit 16103e9

Browse files
committed
Support warnings-as-errors
This patch adds support for using --warnings-as-errors as a parameter for the lint command. This complements the PR mozilla/addons-linter#1016 and completes the issue mozilla/addons-linter#1014.
1 parent fd662af commit 16103e9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/cmd/lint.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type LinterCreatorParams = {
1616
logLevel: 'debug' | 'fatal',
1717
stack: boolean,
1818
pretty?: boolean,
19+
warningsAsErrors?: boolean,
1920
metadata?: boolean,
2021
output?: LinterOutputType,
2122
boring?: boolean,
@@ -42,6 +43,7 @@ export type LintCmdParams = {
4243
output?: LinterOutputType,
4344
metadata?: boolean,
4445
pretty?: boolean,
46+
warningsAsErrors?: boolean,
4547
};
4648

4749
export type LintCmdOptions = {
@@ -52,7 +54,7 @@ export type LintCmdOptions = {
5254
export default function lint(
5355
{
5456
verbose, sourceDir, selfHosted, boring, output,
55-
metadata, pretty,
57+
metadata, pretty, warningsAsErrors,
5658
}: LintCmdParams,
5759
{
5860
createLinter = defaultLinterCreator,
@@ -65,6 +67,7 @@ export default function lint(
6567
logLevel: verbose ? 'debug' : 'fatal',
6668
stack: Boolean(verbose),
6769
pretty,
70+
warningsAsErrors,
6871
metadata,
6972
output,
7073
boring,

src/program.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ Example: $0 --help run.
297297
type: 'boolean',
298298
default: false,
299299
},
300+
'warnings-as-errors': {
301+
describe: 'Treat warnings as errors',
302+
type: 'boolean',
303+
default: false,
304+
},
300305
'pretty': {
301306
describe: 'Prettify JSON output',
302307
type: 'boolean',

0 commit comments

Comments
 (0)