Skip to content

Instantly share code, notes, and snippets.

@ivanalejandro0
Last active January 31, 2018 23:24
Show Gist options
  • Save ivanalejandro0/7aad3c718ffd1f589733cffb95783081 to your computer and use it in GitHub Desktop.
Save ivanalejandro0/7aad3c718ffd1f589733cffb95783081 to your computer and use it in GitHub Desktop.
My ESLint configuration for Reactjs
---
parser: babel-eslint
parserOptions:
ecmaVersion: 6
sourceType: "module"
ecmaFeatures:
jsx: true
plugins:
- react
env:
browser: true
es6: true
extends:
- "eslint:recommended"
- "plugin:react/recommended"
- "plugin:import/errors"
- "plugin:import/warnings"
rules:
no-console: 0
comma-dangle: [2, "only-multiline"]
no-inner-declarations: 0
no-unused-vars: [2, {argsIgnorePattern: "^(nextState|prevState|err|error|reject|getState)$"}]
no-use-before-define: [2, {functions: false}]
no-trailing-spaces: 2
react/no-did-update-set-state: [1]
react/no-did-mount-set-state: [1]
react/no-unused-prop-types: [1]
react/jsx-no-bind: [1]
import/no-duplicates: 0
globals:
module: true
modules: true
require: true
settings:
import/resolver:
webpack:
config: 'webpack.config.js'
import/ignore:
# these prevent "No default export found in module" on webpack'ed modules
- node_modules
- \.(scss|less|css)$ # can't parse unprocessed CSS modules
- \.(svg|png)$ # can't parse images

Usage

To install eslint and plugins do:

npm install -g [email protected] babel-eslint eslint-plugin-react eslint-plugin-import eslint-import-resolver-webpack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment