A set of rules I've adopted to keep my code sane. Gotta love those single quotes and semicolons ;)
npm i -D eslint-config-johnnyji
npm i -D eslint-config-johnnyji eslint eslint-plugin-react eslint-plugin-babel babel-eslint
ESLint will sometimes have trouble finding babel-eslint
or other modules when using extends
in
your eslintrc
. This can cause in-editor linting to not work properly. In order to avoid
this, it's best to also install any ESLint dependencies globally as well,
npm i -g eslint-config-johnnyji eslint eslint-plugin-react eslint-plugin-babel babel-eslint
Create a .eslintrc.js
file in the root of the project directory:
// .eslintrc.js
module.exports = {
extends: require.resolve('./node_modules/eslint-config-johnnyji/index.js')
};