new JSLint(configFileopt)
A JavaScript linter
Example
import {JSLint} from 'webcompiler';
// or - import {JSLint} from 'webcompiler/lib/JSLint';
// or - var JSLint = require('webcompiler').JSLint;
// or - var JSLint = require('webcompiler/lib/JSLint').JSLint;
const linter = new JSLint();
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
configFile |
string |
<optional> |
"webcompiler/.eslintrc.yaml"
|
path to the ESLint configuration file |
Methods
run(paths, callback)
Execute the linter
Example
import {join} from 'path';
import {logLintingErrors} from 'webcompiler';
// lint "index.js" as well as the entire contents of the "src" directory
linter.run([join(__dirname, 'index.js'), join(__dirname, 'src')], errors => {
if (errors) {
return logLintingErrors(errors);
}
// there were no linting errors
});
Parameters:
Name | Type | Description |
---|---|---|
paths |
Array.<string> | an array of paths to files/directories to lint |
callback |
LintCallback | a callback function |