Skip to content

Instantly share code, notes, and snippets.

@arecvlohe
Last active June 21, 2016 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arecvlohe/91cea38b6f4411376a59b1f33919d8aa to your computer and use it in GitHub Desktop.
Save arecvlohe/91cea38b6f4411376a59b1f33919d8aa to your computer and use it in GitHub Desktop.
ESLint Config
{
"extends": "airbnb-base",
"parserOptions": {
"ecmaFeatures": {
"arrowFunctions": true,
"destructuring": true,
"blockBindings": true,
"defaultParams": true,
"forOf": true,
"modules": true,
"generators": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"templateStrings": true,
"restParams": true,
"spread": true,
"jsx": true,
}
},
"env": {
"browser": true,
"node": true,
},
"rules": {
"no-cond-assign": 0,
"no-console": 1,
"no-redeclare": 2,
"no-extra-parens": 2,
"block-scoped-var": 2,
"default-case": 2,
"dot-notation": 2,
"eqeqeq": [2, "smart"],
"wrap-life": [2, "inside"],
"no-else-return": 2,
"no-floating-decimal": 2,
"no-unused-vars": 0,
"no-use-before-define": 2,
"no-mixed-requires": 0,
"no-path-concat": 0,
"curly": 0,
"semi": 0,
"max-len": 2,
"comma-spacing": 0,
"camelcase": 0,
"new-cap": 0,
"no-lonely-if": 2,
"no-underscore-dangle": 0,
"keyword-spacing": 2,
"object-curly-spacing": ["error", "always"],
"space-infix-ops": 2,
"one-var": 2,
"quotes": [2, "single"],
"no-trailing-spaces": 2,
"no-multi-spaces": 0,
"no-var": 2,
"no-mixed-spaces-and-tabs": 2,
}
}

ESLint Config

These files will show you what will need to do to setup eslint on your local machine. What you will need:

  • Node
  • ESLint
  • Atom

To begin install Node on your machine. You can do this here. Once you have Node you can install eslint globally using the command npm i -g eslint. In your Atom text editor install the linter-eslint package. On your mac go to Preferences then Install and search linter-eslint. When the package comes up press the Install button.

Now that you have eslint installed you can now setup your local environment to use it.

To begin create a package.json file using the command npm init -y. Then install the following packages using npm. npm i -D eslint-config-airbnb-base eslint-plugin-import eslint Finally, set up your .eslintrc at the root of you directory and include the necessary rules that you want for your project. I have included an example above for inspiration.

If you have anyquestions feel free to email me at adam.recvlohe@gmail.com.

{
"devDependencies": {
"eslint": "^2.11.1",
"eslint-config-airbnb-base": "^3.0.1",
"eslint-plugin-import": "^1.8.1",
}
}
@arecvlohe
Copy link
Author

Example screenshot of errors for a React project.

screen shot 2016-06-06 at 8 59 01 am

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