Skip to content

Instantly share code, notes, and snippets.

@gcangussu
Last active September 23, 2018 18:43
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 gcangussu/e93b78258067b8c85f470764cd255ce5 to your computer and use it in GitHub Desktop.
Save gcangussu/e93b78258067b8c85f470764cd255ce5 to your computer and use it in GitHub Desktop.
Eslint front end setup
coverage
build
dist
module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
plugins: ['import', 'jsx-a11y', 'react', 'redux-saga', 'jest'],
extends: [
'plugin:jest/recommended',
'plugin:redux-saga/recommended',
'airbnb',
'prettier',
'prettier/react',
],
env: {
es6: true,
browser: true,
node: true,
jest: true,
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.ts', '.tsx'],
},
},
},
rules: {
// Be able to make only one named export
'import/prefer-default-export': 'off',
// Don't alow ".jsx"
'react/jsx-filename-extension': ['error', { extensions: ['.js'] }],
// Allow use before definition
'no-use-before-define': 'off',
// Airbnb enforces input nesting and id linking, this is too strict
// These following two rules make only one strategy required
'jsx-a11y/label-has-for': [
'error',
{
components: [],
required: {
some: ['nesting', 'id'],
},
allowChildren: false,
},
],
'jsx-a11y/label-has-associated-control': [
'error',
{
labelComponents: [],
labelAttributes: [],
controlComponents: [],
depth: 25,
},
],
// Airbnb makes this an error
// Make it a warning temporarily while we refactor the code
'react/destructuring-assignment': ['warn', 'always'],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment