Skip to content

Instantly share code, notes, and snippets.

@ahmed1490
Last active March 10, 2016 10:04
Show Gist options
  • Save ahmed1490/5f17cd9f5bc3df52c797 to your computer and use it in GitHub Desktop.
Save ahmed1490/5f17cd9f5bc3df52c797 to your computer and use it in GitHub Desktop.
ES List description
{
env: {
es6: true
},
parserOptions: {
sourceType: 'module',
ecmaVersion: 6,
ecmaFeatures: {
modules: true,
experimentalObjectRestSpread: true
}
},
globals: {
jQuery: true,
__: false
}
"rules": {
"brace-style": [2, "1tbs"],
"comma-style": [2, "last"],
"indent": [2, 4, { "SwitchCase": 1 }],
"no-constant-condition": 2,
"semi": [2, "always"],
"space-after-keywords": [2, "always"],
"space-before-blocks": [2, "always"],
"strict": [2, "never"],
"quotes": [2, "single"],
"react/self-closing-comp": 1,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/react-in-jsx-scope": 1
},
"plugins": [
"react"
],
"extends": "plugin:react/recommended",
"extends": "airbnb"
"extends": "meteor"
}
@ahmed1490
Copy link
Author

Lets start...

  • get started with npm install eslint --save-dev && eslint --init

4 ways to define linting

  • package.json
{
    "name": "mypackage",
    "version": "0.0.1",
    "eslintConfig": {
        "env": {
            "browser": true,
            "node": true
        }
    }
}
  • .eslintrc
{
  ...
}
  • command line --- globals: var1: true var2: false
  • on the top of each file with comments /*eslint-env node, mocha */

eslint 2.x vs 1.x

You can nest .eslintrc files

check sample fragment

  • if you use webpack, add eslint-loader in your wepack.dev.js as a preloader (preloader so that your colleage doesnt makes mistake to put babel-loader before the eslint-loader)

others bla bla

Read the manual
http://eslint.org/docs/user-guide/configuring

@ahmed1490
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment