Skip to content

Instantly share code, notes, and snippets.

@tomasevich
Last active June 14, 2019 14:08
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 tomasevich/f4c6b2121c47d88304921e748db6193a to your computer and use it in GitHub Desktop.
Save tomasevich/f4c6b2121c47d88304921e748db6193a to your computer and use it in GitHub Desktop.
ESLint config for server-side (no plugins, clear rules)
'use strict';
const OFF = 0;
const WARN = 1;
const DANGER = 2;
const ALWAYS = 'always';
const NEVER = 'never';
const TAB = 2;
module.exports = {
env: {
es6: true,
node: true
},
extends: 'eslint:recommended',
rules: {
// Fix or warning
'sort-keys': OFF,
'sort-vars': OFF,
'no-console': OFF,
'max-classes-per-file': OFF,
'padded-blocks': [
WARN, {
blocks: NEVER,
classes: NEVER, switches: NEVER
}
],
'one-var': [ WARN, NEVER ],
'one-var-declaration-per-line': OFF,
'lines-around-comment': [
WARN, {
beforeBlockComment: true, beforeLineComment: true,
allowBlockStart: true, allowObjectStart: true,
allowArrayStart: true, allowClassStart: true,
afterBlockComment: false, afterLineComment: false
}
],
'lines-around-directive': [ WARN, { before: NEVER, after: ALWAYS } ],
'no-multiple-empty-lines': [ WARN, { max: 1 } ],
indent: [ WARN, TAB ],
'indent-legacy': [ WARN, TAB ],
'prefer-const': OFF,
'quote-props': [ WARN, 'as-needed' ],
quotes: [ WARN, 'single' ],
'object-curly-spacing': [ WARN, ALWAYS ],
'object-property-newline': OFF,
'array-element-newline': [ WARN, ALWAYS ],
'line-comment-position': [ WARN, { position: 'above' } ],
'no-misleading-character-class': OFF,
'no-useless-catch': OFF,
'prefer-arrow-callback': OFF,
'prefer-destructuring': OFF,
'prefer-named-capture-group': OFF,
'prefer-numeric-literals': OFF,
'prefer-object-spread': OFF,
'prefer-promise-reject-errors': OFF,
'prefer-reflect': OFF,
'prefer-rest-params': OFF,
'prefer-spread': OFF,
'prefer-template': OFF,
'max-lines-per-function': OFF,
'no-async-promise-executor': OFF,
'require-atomic-updates': OFF,
'require-await': OFF,
'require-jsdoc': OFF,
'valid-jsdoc': OFF,
'require-unicode-regexp': OFF,
'require-yield': OFF,
'max-len': WARN,
'array-bracket-spacing': [ WARN, ALWAYS ],
'dot-location': [ WARN, 'property' ],
'dot-notation': WARN,
'comma-spacing': WARN,
'newline-after-var': WARN,
'lines-between-class-members': WARN,
'no-trailing-spaces': WARN,
'newline-before-return': OFF,
'arrow-parens': [WARN, "as-needed"],
semi: WARN,
'no-unneeded-ternary': [WARN, {defaultAssignment: true}],
'no-ternary': OFF,
'multiline-ternary': [WARN, "always-multiline"],
'new-cap': [WARN, { "capIsNew": false }],
'no-negated-condition': OFF,
'no-magic-numbers': WARN,
'no-undefined': WARN,
'global-require': WARN,
'callback-return': OFF,
'no-unused-expressions': OFF,
'no-nested-ternary': OFF,
'no-underscore-dangle': WARN,
// Others is dangeres
'space-before-blocks': DANGER,
'space-before-function-paren': DANGER,
'key-spacing': DANGER,
'keyword-spacing': DANGER,
'accessor-pairs': DANGER,
'array-bracket-newline': DANGER,
'array-callback-return': DANGER,
'arrow-body-style': DANGER,
'arrow-spacing': DANGER,
'block-scoped-var': DANGER,
'block-spacing': DANGER,
'brace-style': DANGER,
camelcase: DANGER,
'capitalized-comments': DANGER,
'class-methods-use-this': DANGER,
'comma-dangle': DANGER,
'comma-style': DANGER,
complexity: DANGER,
'computed-property-spacing': DANGER,
'consistent-return': DANGER,
'consistent-this': DANGER,
'constructor-super': DANGER,
curly: DANGER,
'default-case': DANGER,
'eol-last': DANGER,
eqeqeq: DANGER,
'for-direction': DANGER,
'func-call-spacing': DANGER,
'func-name-matching': DANGER,
'func-names': DANGER,
'func-style': DANGER,
'function-paren-newline': DANGER,
'generator-star-spacing': DANGER,
'getter-return': DANGER,
'guard-for-in': DANGER,
'handle-callback-err': DANGER,
'id-blacklist': DANGER,
'id-length': DANGER,
'id-match': DANGER,
'implicit-arrow-linebreak': DANGER,
'init-declarations': DANGER,
'jsx-quotes': DANGER,
'linebreak-style': DANGER,
'max-depth': DANGER,
'max-lines': DANGER,
'max-nested-callbacks': DANGER,
'max-params': DANGER,
'max-statements': DANGER,
'max-statements-per-line': DANGER,
'multiline-comment-style': DANGER,
'new-parens': DANGER,
'newline-per-chained-call': DANGER,
'no-alert': DANGER,
'no-array-constructor': DANGER,
'no-await-in-loop': DANGER,
'no-bitwise': DANGER,
'no-buffer-constructor': DANGER,
'no-caller': DANGER,
'no-case-declarations': DANGER,
'no-catch-shadow': DANGER,
'no-class-assign': DANGER,
'no-compare-neg-zero': DANGER,
'no-cond-assign': DANGER,
'no-confusing-arrow': DANGER,
'no-const-assign': DANGER,
'no-constant-condition': DANGER,
'no-continue': DANGER,
'no-control-regex': DANGER,
'no-debugger': DANGER,
'no-delete-var': DANGER,
'no-div-regex': DANGER,
'no-dupe-args': DANGER,
'no-dupe-class-members': DANGER,
'no-dupe-keys': DANGER,
'no-duplicate-case': DANGER,
'no-duplicate-imports': DANGER,
'no-else-return': DANGER,
'no-empty': DANGER,
'no-empty-character-class': DANGER,
'no-empty-function': DANGER,
'no-empty-pattern': DANGER,
'no-eq-null': DANGER,
'no-eval': DANGER,
'no-ex-assign': DANGER,
'no-extend-native': DANGER,
'no-extra-bind': DANGER,
'no-extra-boolean-cast': DANGER,
'no-extra-label': DANGER,
'no-extra-parens': DANGER,
'no-extra-semi': DANGER,
'no-fallthrough': DANGER,
'no-floating-decimal': DANGER,
'no-func-assign': DANGER,
'no-global-assign': DANGER,
'no-implicit-coercion': DANGER,
'no-implicit-globals': DANGER,
'no-implied-eval': DANGER,
'no-inline-comments': DANGER,
'no-inner-declarations': DANGER,
'no-invalid-regexp': DANGER,
'no-invalid-this': DANGER,
'no-irregular-whitespace': DANGER,
'no-iterator': DANGER,
'no-label-var': DANGER,
'no-labels': DANGER,
'no-lone-blocks': DANGER,
'no-lonely-if': DANGER,
'no-loop-func': DANGER,
'no-mixed-operators': DANGER,
'no-mixed-requires': DANGER,
'no-mixed-spaces-and-tabs': DANGER,
'no-multi-assign': DANGER,
'no-multi-spaces': DANGER,
'no-multi-str': DANGER,
'no-native-reassign': DANGER,
'no-negated-in-lhs': DANGER,
'no-new': DANGER,
'no-new-func': DANGER,
'no-new-object': DANGER,
'no-new-require': DANGER,
'no-new-symbol': DANGER,
'no-new-wrappers': DANGER,
'no-obj-calls': DANGER,
'no-octal': DANGER,
'no-octal-escape': DANGER,
'no-param-reassign': DANGER,
'no-path-concat': DANGER,
'no-plusplus': DANGER,
'no-process-env': DANGER,
'no-process-exit': DANGER,
'no-proto': DANGER,
'no-prototype-builtins': DANGER,
'no-redeclare': DANGER,
'no-regex-spaces': DANGER,
'no-restricted-globals': DANGER,
'no-restricted-imports': DANGER,
'no-restricted-modules': DANGER,
'no-restricted-properties': DANGER,
'no-restricted-syntax': DANGER,
'no-return-assign': DANGER,
'no-return-await': DANGER,
'no-script-url': DANGER,
'no-self-assign': DANGER,
'no-self-compare': DANGER,
'no-sequences': DANGER,
'no-shadow': DANGER,
'no-shadow-restricted-names': DANGER,
'no-spaced-func': DANGER,
'no-sparse-arrays': DANGER,
'no-sync': DANGER,
'no-tabs': DANGER,
'no-template-curly-in-string': DANGER,
'no-this-before-super': DANGER,
'no-throw-literal': DANGER,
'no-undef': DANGER,
'no-undef-init': DANGER,
'no-unexpected-multiline': DANGER,
'no-unmodified-loop-condition': DANGER,
'no-unreachable': DANGER,
'no-unsafe-finally': DANGER,
'no-unsafe-negation': DANGER,
'no-unused-labels': DANGER,
'no-unused-vars': DANGER,
'no-use-before-define': DANGER,
'no-useless-call': DANGER,
'no-useless-computed-key': DANGER,
'no-useless-concat': DANGER,
'no-useless-constructor': DANGER,
'no-useless-escape': DANGER,
'no-useless-rename': DANGER,
'no-useless-return': DANGER,
'no-var': DANGER,
'no-void': DANGER,
'no-warning-comments': DANGER,
'no-whitespace-before-property': DANGER,
'no-with': DANGER,
'nonblock-statement-body-position': DANGER,
'object-curly-newline': DANGER,
'object-shorthand': DANGER,
'operator-assignment': DANGER,
'operator-linebreak': DANGER,
'padding-line-between-statements': DANGER,
radix: DANGER,
'rest-spread-spacing': DANGER,
'semi-spacing': DANGER,
'semi-style': DANGER,
'sort-imports': DANGER,
'space-in-parens': DANGER,
'space-infix-ops': DANGER,
'space-unary-ops': DANGER,
'spaced-comment': DANGER,
strict: DANGER,
'switch-colon-spacing': DANGER,
'symbol-description': DANGER,
'template-curly-spacing': DANGER,
'template-tag-spacing': DANGER,
'unicode-bom': DANGER,
'use-isnan': DANGER,
'valid-typeof': DANGER,
'vars-on-top': DANGER,
'wrap-iife': DANGER,
'wrap-regex': DANGER,
'yield-star-spacing': DANGER,
yoda: DANGER
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment