@@ -12,7 +12,7 @@ import generators from '../src/generators/index.mjs';
1212import createMarkdownLoader from '../src/loaders/markdown.mjs' ;
1313import createMarkdownParser from '../src/parsers/markdown.mjs' ;
1414import createNodeReleases from '../src/releases.mjs' ;
15- import { Linter } from '../src/linter/index.mjs' ;
15+ import createLinter from '../src/linter/index.mjs' ;
1616import reporters from '../src/linter/reporters/index.mjs' ;
1717
1818const availableGenerators = Object . keys ( generators ) ;
@@ -52,7 +52,9 @@ program
5252 'Set the processing target modes'
5353 ) . choices ( availableGenerators )
5454 )
55- . addOption ( new Option ( '--skip-linting' , 'Skip linting' ) . default ( false ) )
55+ . addOption (
56+ new Option ( '--lint-dry-run' , 'Run linter in dry-run mode' ) . default ( false )
57+ )
5658 . addOption (
5759 new Option ( '-r, --reporter [reporter]' , 'Specify the linter reporter' )
5860 . choices ( Object . keys ( reporters ) )
@@ -68,9 +70,9 @@ program
6870 * @property {string } output Specifies the directory where output files will be saved.
6971 * @property {Target[] } target Specifies the generator target mode.
7072 * @property {string } version Specifies the target Node.js version.
71- * @property {string } changelog Specifies the path to the Node.js CHANGELOG.md file
72- * @property {boolean } skipLinting Specifies whether to skip linting
73- * @property {keyof reporters } reporter Specifies the linter reporter
73+ * @property {string } changelog Specifies the path to the Node.js CHANGELOG.md file.
74+ * @property {boolean } lintDryRun Specifies whether the linter should run in dry-run mode.
75+ * @property {keyof reporters } reporter Specifies the linter reporter.
7476 *
7577 * @name ProgramOptions
7678 * @type {Options }
@@ -82,11 +84,11 @@ const {
8284 target = [ ] ,
8385 version,
8486 changelog,
85- skipLinting ,
87+ lintDryRun ,
8688 reporter,
8789} = program . opts ( ) ;
8890
89- const linter = skipLinting ? undefined : new Linter ( ) ;
91+ const linter = createLinter ( lintDryRun ) ;
9092
9193const { loadFiles } = createMarkdownLoader ( ) ;
9294const { parseApiDocs } = createMarkdownParser ( ) ;
@@ -100,7 +102,7 @@ const { runGenerators } = createGenerator(parsedApiDocs);
100102// Retrieves Node.js release metadata from a given Node.js version and CHANGELOG.md file
101103const { getAllMajors } = createNodeReleases ( changelog ) ;
102104
103- linter ? .lintAll ( parsedApiDocs ) ;
105+ linter . lintAll ( parsedApiDocs ) ;
104106
105107await runGenerators ( {
106108 // A list of target modes for the API docs parser
@@ -115,10 +117,8 @@ await runGenerators({
115117 releases : await getAllMajors ( ) ,
116118} ) ;
117119
118- if ( linter ) {
119- linter . report ( reporter ) ;
120+ linter . report ( reporter ) ;
120121
121- if ( linter . hasError ) {
122- exit ( 1 ) ;
123- }
122+ if ( linter . hasError ( ) ) {
123+ exit ( 1 ) ;
124124}
0 commit comments