broccoli-lint-eslint
Lint JavaScript with ESLint as part of your Broccoli build pipeline.
Most of the test setup and the build configuration is based on sindresorhus/grunt-eslint. The internal validation is heavily inspired by eslint cli.js.
Installation
As of 5.0.0, broccoli-lint-eslint uses versions of eslint greater than 5.0.0. Because eslint@5.0.0 dropped support for Node versions below 6, you may need to use the latest 4.x version of broccoli-lint-eslint (which uses eslint@^4.11.0), if you need support for Node v4:
npm install --save broccoli-lint-eslint@4
If versions of Node >= 6 suit your needs, you can safely install the latest version of broccoli-lint-eslint:
npm install --save broccoli-lint-eslint
Usage
var ESLint = require('broccoli-lint-eslint');
var outputNode = ESLint.create(inputNode, options);
API
inputNodeA Broccoli nodeoptions{Object}: Options to control howbroccoli-lint-eslintis run.format{string|function}: The path, or function reference, to a custom formatter (See eslint/tree/master/lib/formatters for alternatives).Default:
'eslint/lib/formatters/stylish'testGenerator{function(relativePath, errors), returns reporter output string}: The function used to generate test modules. You can provide a custom function for your client side testing framework of choice.Default:
null- relativePath - The relative path to the file being tested.
- errors - An array of eslint error objects found.
If you provide a
stringone of the predefined test generators is used. Currently supported arequnitandmocha.Example usage:
var path = require('path'); function testGenerator(relativePath, errors) { return "module('" + path.dirname(relativePath) + "');\n"; "test('" + relativePath + "' should pass ESLint', function() {\n" + " ok(" + passed + ", '" + moduleName + " should pass ESLint." + (errors ? "\\n" + errors : '') + "');\n" + "});\n"; }; return eslint(inputNode, { options: { configFile: this.eslintrc.app + '/eslint.json' }, testGenerator: testGenerator });group{string|undefined}: Groups the generated ESLint tests into a single file and test suite with the given group name.Default:
undefinedthrowOnError{boolean}: Cause exception error on first violation witherror-level severity.Default:
falsethrowOnWarn{boolean}: Cause exception error on first violation withwarn-level severity. NOTE: Setting this to true will automatically enablethrowOnErrorbehavior.Default:
falsepersist{boolean}: Persist the state of filter output across restartsDefault:
falseconsole: {Object}: A custom console object with alogmethod forbroccoli-lint-eslintto use when logging formatter output.Default: The global
consoleobjectoptions{options}: Options native to ESLint CLI. While all options will be passed to the ESLint CLIEngine, these are the ones thatbroccoli-lint-eslintmakes use of in particular:configFile{string}: Path to eslint configuration file.Default:
./eslintrcrulePaths{Array}: Paths to a directory with custom rules. Your custom rules will be used in addition to the built-in ones. Recommended read: Working with Rules.Default: built-in rules directory
ignore{boolean}:falsedisables use of.eslintignore,ignorePathandignorePatternDefault:
true
extensions{Array}: File extensions to lint. NOTE: If you add Typescript filestypescript-eslint-parserhas to be installed and specified as the parser. For more information take a look at thetypescript-eslint-parserDefault:
['js']