fix(lint): re-arrange scripts (#36511)
This commit is contained in:
25
tools/scripts/lint/linter/index.js
Normal file
25
tools/scripts/lint/linter/index.js
Normal file
@ -0,0 +1,25 @@
|
||||
const markdownlint = require('markdownlint');
|
||||
|
||||
const lintPrism = require('./markdown-prism');
|
||||
const lintYAML = require('./markdown-yaml');
|
||||
|
||||
function linter(rules) {
|
||||
const lint = (file, next) => {
|
||||
const options = {
|
||||
files: [file.path],
|
||||
config: rules,
|
||||
customRules: [lintYAML, lintPrism]
|
||||
};
|
||||
markdownlint(options, function callback(err, result) {
|
||||
const resultString = (result || '').toString();
|
||||
if (resultString) {
|
||||
process.exitCode = 1;
|
||||
console.log(resultString);
|
||||
}
|
||||
if (next) next(err, file);
|
||||
});
|
||||
};
|
||||
return lint;
|
||||
}
|
||||
|
||||
module.exports = linter;
|
Reference in New Issue
Block a user