Skip to content

Instantly share code, notes, and snippets.

@remarkablemark
Last active August 24, 2016 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remarkablemark/669f9e26079cbc916583eaa63e503330 to your computer and use it in GitHub Desktop.
Save remarkablemark/669f9e26079cbc916583eaa63e503330 to your computer and use it in GitHub Desktop.
ESLint configuration
{
"parser": "babel-eslint",
"env": {
"browser": true, // allow browser globals like `window` and `document`
"node": true, // allow node globals like `process`
"commonjs": true, // allow globals like `require` and `exports`
"mocha": true // allow mocha globals like `describe` and `it`
},
"settings": {
"ecmascript": 6,
"jsx": true // react jsx syntax
},
"plugins": [
"react"
],
"extends": "eslint:recommended", // use recommended settings from eslint
"rules": {
// 0 = "off"
// 1 = "warn"
// 2 = "error"
"strict": 2, // always enable strict mode
"semi": 2, // semicolons
"index": [
"error",
4 // use 4 spaces
],
"quotes": [
"error",
"single" // use single quotes
],
"no-unused-vars": 2, // no unused variables
"linebreak-style": 2, // default is unix
"eol-last": 2, // default is unix
"no-mixed-requires": 0,
"no-underscore-dangle": 0,
"camelcase": 0,
"react/jsx-uses-vars": 1
}
}
let g:syntastic_javascript_checkers = ['eslint']

My ESLint Configuration

You may place .eslintrc in your project directory and/or your home directory ~/.eslintrc.

Install the linters globally via npm:

$ bash install.sh

Update your .vimrc if you are using syntastic.

Documentation on configuring ESLint.

#!/usr/bin/env bash
npm install -g eslint
npm install -g babel-eslint
npm install -g eslint-plugin-react
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment