This settings extends airbnb's with some important features and integration with webpack.
- eslint@^2.9.0 - The ESLint compatible version
- babel-eslint@^6.0.4 - Allows all Babel code to be validated with ESlint
- estraverse@^4.2.0 - ECMAScript JS AST traversal functions
- estraverse-fb@^1.3.1 - Drop-in for estraverse that enables traversal over React's JSX nodes.
- eslint-config-airbnb@^8.0.0 - Airbnb's JavaScript Style Guide rules setup
- eslint-plugin-babel@^3.2.0 - Babel's integration, allowing ES2016 and JSX
- eslint-plugin-import@^1.7 - Import and Export analysis
- eslint-plugin-jsx-a11y@^1.0.4 - Accessibility analysis on JSX code,
- eslint-plugin-react@^5.0.1 - JSX specific lint rules addition
Paste the .eslintrc on project's root directory and lnstall ESLint, Airbnb's config and its peerDependencies and dependencies:
npm install --save-dev eslint@^2.9.0 babel-eslint@^6.0.4 [email protected] [email protected] eslint-config-airbnb@^8.0.0 eslint-plugin-babel@^3.2.0 eslint-plugin-import@^1.7 eslint-plugin-jsx-a11y@^1.0.4 eslint-plugin-react@^5.0.1
Install eslint-import-resolver-node, the default resolver for imports and exports.
node install --save-dev eslint-import-resolver-node@^0.2.0
Then set up the .eslintrc
file
+ "settings": {
+ "import/resolver": "node"
+ }
Install eslint-import-resolver-webpack@^0.2.4, a Webpack resolver for imports and exports. Then, install and eslint-loader^1.3.0, a Webpack loader to display on screen ESLint analysis.
Install the packages:
npm install --save-dev [email protected] eslint-loader@^1.3.0
After, set up the eslint
preloader to webpack dev config, as follows:
module: {
+ preLoaders: [
+ {test: /\.js$/, loader: 'eslint-loader', exclude: /node_modules/}
+ ],
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loaders: [ 'babel' ]}
]
}
Include the Webpack resolver to .eslintrc
settings:
+ "settings": {
+ "import/resolver": {
+ "webpack": { "config": "config/webpack.config.dev.js" }
+ }
+ }
In node suporte
change for :
npm install --save-dev eslint-import-resolver-node@^0.2.0