Skip to content

Instantly share code, notes, and snippets.

@satyambnsal
Created October 3, 2018 18:55
Show Gist options
  • Select an option

  • Save satyambnsal/93b9c0b2c8e186268c35d0510ae1916f to your computer and use it in GitHub Desktop.

Select an option

Save satyambnsal/93b9c0b2c8e186268c35d0510ae1916f to your computer and use it in GitHub Desktop.
ESLInt rules for javascript developers
module.exports = {
env: {
browser: true,
node: true,
es6: true
},
extends: ['eslint:recommended', 'plugin:node/recommended'],
parserOptions: {
ecmaVersion: 2017,
ecmaFeatures: {
jsx: true
},
sourceType: 'module'
},
plugins: ['node'],
globals: {
describe: true,
it: true,
expect: true
},
rules: {
'node/exports-style': ['error', 'module.exports'],
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'prefer-const': ['error'],
'no-var': ['error'],
'no-new-object': ['error'],
'object-shorthand': ['error'],
'quote-props': ['error', 'as-needed'],
'no-array-constructor': ['error'],
'array-callback-return': ['error'],
'prefer-rest-params': ['error'],
'no-param-reassign': ['error'],
'prefer-arrow-callback': ['error'],
'arrow-spacing': ['error'],
'arrow-parens': ['error', 'as-needed'],
'arrow-body-style': ['error', 'as-needed'],
'no-useless-constructor': ['error'],
'no-dupe-class-members': ['error'],
'no-duplicate-imports': ['error'],
'no-iterator': ['error'],
'no-restricted-syntax': ['error'],
'generator-star-spacing': ['error', 'after'],
'dot-notation': ['error'],
eqeqeq: ['error'],
'no-nested-ternary': ['error'],
'no-unneeded-ternary': ['error'],
'brace-style': ['error'],
'space-before-blocks': ['error'],
'keyword-spacing': ['error'],
'space-infix-ops': ['error'],
'eol-last': ['error'],
'padded-blocks': ['error', 'never'],
'space-in-parens': ['error'],
'array-bracket-spacing': ['error'],
'no-multiple-empty-lines': ['error'],
'key-spacing': ['error'],
'object-curly-spacing': [
'error',
'always',
{
objectsInObjects: false,
arraysInObjects: false
}
],
camelcase: ['warn'],
'no-trailing-spaces': ['error'],
'no-multi-spaces': ['error'],
'no-irregular-whitespace': ['error'],
'new-cap': ['error'],
'jsx-quotes': ['error'],
'comma-spacing': [
2,
{
before: false,
after: true
}
],
'no-console': 0
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment