2.0.2 • Published 8 years ago
@easy-webpack/config-eslint v2.0.2
@easy-webpack/config-eslint
Lint JavaScript files using eslint and eslint-loader.
Installation
npm install --save-dev @easy-webpack/config-eslint
easy-webpack is also required.
Usage
// webpack.config.js
const generateConfig = require('@easy-webpack/core').generateConfig;
const baseConfig = { ... }; // project-specific config like the entry file
module.exports = generateConfig(
baseConfig,
require('@easy-webpack/config-eslint')
({
/* Option object */
options: { fix: true, cache: true },
exclude: /(node_modules|bower_components)/
})
);
// .eslintrc.json
{
"parserOptions": {
"ecmaVersion": 2017,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"browser": true,
"commonjs": true
},
"extends": "eslint:recommended"
}
// This config will lint JavaScript files and potentially fix it
Options
options
Type: Object
Default: {}
options
is a key in the options object.
This will be passed into eslint-loader directly. Read their documentation for details.
exclude
Type: (Array of) Webpack Exclude object
Default: node_modules
Files to be excluded from eslint checking.
Check webpack documentation on how to write valid exclude files.
Related tutorials
Tips
Enable cache
Cache can speed up build performance. This can greatly reduce rebuilt time and enhance productivity.
Enable cache by setting cache
to true in options object.
require('@easy-webpack/config-eslint')
({cache: true})