1.0.2 • Published 9 years ago
lint-paths v1.0.2
lint-paths
Checks that paths correspond to a desired pattern.
Install
As a command line tool:
npm install -g lint-paths
Or as development tool:
npm install --save-dev lint-paths
Command line usage
lint-paths [options] root[, root]
Options
-h
,--help
: display a help message,-p
,--pattern
: the expected pattern of the paths,^[^A-Z]*$
by default,-i
,--ignore
: a valid RegExp pattern to ignore, this options can be repeated multiple times.
Examples
$ lint-paths .
$ lint-paths -p "^[a-z]*\$" .
$ lint-paths -p "^[a-z]*\$" -i bin .
$ lint-paths -p "^[a-z]*\$" --ignore=bin -i "\\.json$" .
$ lint-paths --pattern "^[a-z]*\$" src lib
API usage
Syntax
lintPaths(options)
Parameter
options
: an object containing:roots
(array): the array of folder to scan,pattern
(RegExp): the expected pattern of the paths,ignore
(array): the array of valid RegExp patterns to ignore.
Return value
Return the array of errors. If there are none, the array is empty.
Example
const lintPaths = require('lint-paths');
const options = {
roots: [ src, lib ],
pattern: /^[^0-9]*$/,
ignore: [ 'node_modules' ]
};
console.log(lintPaths(options));
License
MIT