Last active
May 20, 2017 18:25
-
-
Save gugadev/44db7ff615b5704b3336fef3fc22249c to your computer and use it in GitHub Desktop.
ESLint configuration for ES6+ and React via Airbnb and jsx-a11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"extends": "airbnb", | |
"env": { | |
"node": true, | |
"es6": true, | |
"browser": true | |
}, | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "module", | |
"ecmaFeatures": { | |
"jsx": true | |
} | |
}, | |
"rules": { | |
# evita que marque error al usar console | |
"no-console": 0, | |
# permite usar variables con _ | |
"no-underscore-dangle": 0, | |
# máximo de línea: 99 | |
"max-len": [1, 99, 2], | |
# obliga a usar punto y coma | |
"semi": [2, "always"], | |
# obliga a usar const sobre let | |
"prefer-const": 2, | |
# obliga a definir llaves en if/else | |
"curly": [2, "all"], | |
# prefiere === a == | |
"eqeqeq": [2, "allow-null"], | |
"no-shadow": 1, | |
# pide que las funciones como callbacks | |
# tengan un nombre | |
"func-names": 0, | |
# prefiere apóstrofe a comillas | |
# y también para template literal | |
"quotes": [ | |
2, | |
"single", | |
{ | |
"allowTemplateLiterals": true | |
} | |
], | |
# previene múltiples líneas en blanco | |
"no-multiple-empty-lines": [ 2, { | |
"max": 1, | |
"maxEOF": 0, | |
"maxBOF": 0 | |
}], | |
# no activa el warning en parámetros rest | |
"no-unused-vars": ["warn", { | |
"ignoreRestSiblings": true | |
}], | |
# prefiere clases ES6 | |
"react/prefer-es6-class": 1, | |
# no prefiere funciones stateless | |
"react/prefer-stateless-function": 0, | |
# se requiere especificar los tipos de las props | |
# y previene que se usen tipos vagos como: object, array | |
"react/forbid-prop-types": 0, | |
# previene que React sea marcado como no usado | |
"react/jsx-uses-react": 2, | |
# previene que variables en JSX sean marcadas como no usadas | |
"react/jsx-uses-vars": 2 | |
}, | |
"settings": { | |
"node": { | |
"extensions": [ | |
".js", | |
".es6" | |
], | |
"moduleDirectory": [ | |
"node_modules", | |
"src" | |
] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- eslint | |
- babel-eslint | |
- eslint-plugin-import | |
- eslint-config-airbnb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment