What is linting?
The term was derived from the name of the undesirable bits of fiber and fluff found in sheep's wool.
Finds syntactic and/or stylistic discrepancies and potential programming errors
Benefits of linting your code
VS
Other Linters
JsLint
JsHint
¯\_(ツ)_/¯
Benefits of ESLint
Stuff to Install
$ npm install -g eslint$ npm install babel-eslint eslint-loader eslint-plugin-reactWriting an eslintrc.js
$ eslint --initHow would you like to configure ESLint?
> Answer questions about your style
Use a popular style guide
Inspect your JavaScript file(s)Common JS Styles
Which style guide do you want to follow?
> Google
Airbnb
StandardWiring to Webpack
module: {
preLoaders: [{
test: /^(?!.*spec.jsx$).*\.jsx$/i,
loaders: ['eslint'],
exclude: ['/node_modules/',
'./webpack.config.js',
'/__tests__/'
]
}],eslint: {
failOnWarning: false,
failOnError: true
},Rule Name
"no-unused-vars": [1, {"vars": "local", "args": "after-used"}],Strength of Rule
Options
2: error
1: warn
0: don't track
Allows for further customization of a rule
"prefer-const": 2,"semi": [1, "always"],"no-ternary": 0,