mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
tools: enable Markdown linter's usage information
Prior to this commit, running `node tools/lint-md --help` and `node tools/lint-md --version` resulted in an error. * Use `unified-args` to start processor * Use `unified-args`'s error handler Fixes: https://github.com/nodejs/node/issues/30156 PR-URL: https://github.com/nodejs/node/pull/30216 Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
2097a6fc05
commit
80fb15353a
File diff suppressed because one or more lines are too long
811
tools/node-lint-md-cli-rollup/package-lock.json
generated
811
tools/node-lint-md-cli-rollup/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,19 @@
|
||||
{
|
||||
"name": "node-lint-md-cli-rollup",
|
||||
"description": "remark packaged for node markdown linting",
|
||||
"version": "2.0.0",
|
||||
"description": "remark packaged for Node.js Markdown linting",
|
||||
"version": "2.0.1",
|
||||
"devDependencies": {
|
||||
"@zeit/ncc": "^0.16.1"
|
||||
"rollup": "^1.27.11",
|
||||
"rollup-plugin-commonjs": "^10.1.0",
|
||||
"rollup-plugin-json": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"markdown-extensions": "^1.1.1",
|
||||
"remark": "^10.0.1",
|
||||
"remark": "^11.0.2",
|
||||
"remark-lint": "^6.0.5",
|
||||
"remark-preset-lint-node": "^1.11.0",
|
||||
"unified-args": "^7.1.0",
|
||||
"unified-engine": "^6.0.1"
|
||||
"unified-args": "^7.1.0"
|
||||
},
|
||||
"main": "src/cli-entry.js",
|
||||
"scripts": {
|
||||
|
@ -1,29 +1,29 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const engine = require('unified-engine');
|
||||
const options = require('unified-args/lib/options');
|
||||
// To aid in future maintenance, this layout closely matches remark-cli/cli.js.
|
||||
// https://github.com/remarkjs/remark/blob/master/packages/remark-cli/cli.js
|
||||
|
||||
const start = require('unified-args');
|
||||
const extensions = require('markdown-extensions');
|
||||
const processor = require('remark');
|
||||
const proc = require('remark/package.json');
|
||||
const cli = require('../package.json');
|
||||
const { plugins } = require('remark-preset-lint-node');
|
||||
const lintNode = require('remark-preset-lint-node');
|
||||
|
||||
const args = {
|
||||
processor: processor,
|
||||
start({
|
||||
processor: processor().use(lintNode),
|
||||
name: proc.name,
|
||||
description: cli.description,
|
||||
version: [
|
||||
proc.name + ': ' + proc.version,
|
||||
cli.name + ': ' + cli.version,
|
||||
].join(', '),
|
||||
pluginPrefix: proc.name,
|
||||
presetPrefix: proc.name + '-preset',
|
||||
packageField: proc.name + 'Config',
|
||||
rcName: '.' + proc.name + 'rc',
|
||||
ignoreName: '.' + proc.name + 'ignore',
|
||||
extensions: extensions
|
||||
};
|
||||
const config = options(process.argv.slice(2), args);
|
||||
config.detectConfig = false;
|
||||
config.plugins = plugins;
|
||||
|
||||
engine(config, (err, code) => {
|
||||
if (err) console.error(err);
|
||||
process.exit(code);
|
||||
extensions: extensions,
|
||||
detectConfig: false,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user