Skip to content

Instantly share code, notes, and snippets.

@morulus
Last active September 21, 2018 00:40
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 morulus/e1eff3c7e36b80df9262b398cf13016b to your computer and use it in GitHub Desktop.
Save morulus/e1eff3c7e36b80df9262b398cf13016b to your computer and use it in GitHub Desktop.
File.eslintrc.es6.react
{
parser: babel-eslint,
env: {
browser: true,
jest : true,
node : true,
es6: true
},
parserOptions: {
ecmaFeatures: {
jsx: true,
experimentalObjectRestSpread: true,
classes: true,
ecmaVersion: 6,
},
sourceType: module
},
extends: [
airbnb
],
plugins: [
react,
promise,
class-property
],
globals: {
__DEV__ : false,
__TEST__ : false,
__PROD__ : false,
__COVERAGE__: false
},
rules: {
indent : [2, 2, { SwitchCase: 1 }],
semi : [2, never],
comma-dangle : [2, always-multiline],
function-paren-newline : [2, consistent],
arrow-parens : [2, always],
jsx-quotes : [2, prefer-double],
quotes : [2, backtick],
no-underscore-dangle : 0, // stream._transform?
multiline-ternary : [2, always-multiline],
operator-linebreak : [2, after, {
overrides: {
'?' : before,
':' : before,
'&&': before,
'||': before,
},
}],
no-useless-escape : [2],
object-curly-spacing : [2, always],
react/jsx-max-props-per-line: [2, { maximum: 2 }],
no-param-reassign : [2, { props: false }],
key-spacing : [2, {
afterColon: true,
mode : minimum,
align: {
beforeColon: false,
afterColon : true,
on : colon
},
}],
no-unused-expressions : [2, {
allowTernary : true,
allowShortCircuit: true,
}],
react/jsx-filename-extension: [2, { extensions: ['.js'] }],
react/require-default-props : [2],
jsx-a11y/label-has-for : [2, {
required: {
every: [ nesting, id ]
},
allowChildren: true,
}],
react/jsx-handler-names : [2, {
eventHandlerPrefix : handle,
eventHandlerPropPrefix: on,
}],
react/prefer-stateless-function: [2],
no-useless-constructor : [2],
no-mixed-operators : [2, {
groups: [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof']
],
allowSamePrecedence: true
}],
/* disablers */
no-plusplus: 0, //no thanks
no-return-assign: 0, //refs
import/no-named-as-default: 0, //export const Some =..., export default Some
jsx-a11y/no-autofocus: 0, //focus-based navigation in form
import/prefer-default-export: 0, //domains
no-confusing-arrow: 0, //too hard to maintain
linebreak-style: 0, //git controles it
no-nested-ternary: 0, //maybe later
react/prop-types: 0, //dont use proptypes
react/no-array-index-key: 0,
import/extensions: 0,
import/no-unresolved: 0, // needs resolvers
import/no-extraneous-dependencies: 0, //needs resolvers
import/no-webpack-loader-syntax: 0, // why not? we are uses webpack!
no-shadow: 1, // I prefer to use simple names, but there are not many of them
react/jsx-closing-tag-location: 0, // Allow to use && with element
/* TODO enable and remove */
jsx-a11y/anchor-is-valid: 0,
jsx-a11y/no-noninteractive-element-interactions: 0,
jsx-a11y/click-events-have-key-events: 0,
jsx-a11y/no-static-element-interactions: 0,
max-len: 0, // Doesn't ignore text inside JSX
}
}

Normal .eslintrc for React application with es6

npm i eslint-config-airbnb@16 eslint-plugin-promise eslint-plugin-class-property --D && npx install-peerdeps eslint-config-airbnb@16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment