UNPKG

@playerberry/eslint-config

Version:

An ESLint config for JavaScript projects, brought to you by PlayerBerry

246 lines (236 loc) 7.44 kB
'use strict'; /* eslint-disable no-magic-numbers */ module.exports = { extends: ['./index.js'].map(require.resolve), plugins: ['import', 'jsdoc', 'node', 'prettier'], rules: { /** * Plugins */ // Import -> https://github.com/import-js/eslint-plugin-import#eslint-plugin-import 'import/order': [ 'error', { groups: ['builtin', 'external', 'internal', 'index', 'sibling', 'parent'], alphabetize: { order: 'asc', }, }, ], // Jsdoc -> https://github.com/gajus/eslint-plugin-jsdoc#configuration 'jsdoc/check-access': 'warn', 'jsdoc/check-alignment': 'warn', 'jsdoc/check-param-names': 'warn', 'jsdoc/check-property-names': 'warn', 'jsdoc/check-tag-names': 'warn', 'jsdoc/check-types': 'warn', 'jsdoc/check-values': 'warn', 'jsdoc/empty-tags': 'warn', 'jsdoc/implements-on-classes': 'warn', 'jsdoc/multiline-blocks': 'warn', 'jsdoc/no-multi-asterisks': 'warn', 'jsdoc/require-jsdoc': 'warn', 'jsdoc/require-param': 'warn', 'jsdoc/require-param-description': 'warn', 'jsdoc/require-param-name': 'warn', 'jsdoc/require-param-type': 'warn', 'jsdoc/require-property': 'warn', 'jsdoc/require-property-description': 'warn', 'jsdoc/require-property-name': 'warn', 'jsdoc/require-property-type': 'warn', 'jsdoc/require-returns': 'warn', 'jsdoc/require-returns-check': 'warn', 'jsdoc/require-returns-type': 'warn', 'jsdoc/require-yields': 'warn', 'jsdoc/require-yields-check': 'warn', 'jsdoc/tag-lines': 'warn', 'jsdoc/valid-types': 'warn', // Node -> https://github.com/mysticatea/eslint-plugin-node#eslint-plugin-node 'node/no-unsupported-features/es-builtins': 'error', // 'node/no-unsupported-features/es-syntax': 'error', 'node/no-unsupported-features/node-builtins': 'error', 'node/process-exit-as-throw': 'error', 'node/shebang': 'error', 'node/handle-callback-err': ['error', 'error'], 'node/callback-return': 'error', 'node/no-mixed-requires': 'error', 'node/no-new-require': 'error', 'node/no-path-concat': 'error', // Prettier -> https://github.com/prettier/eslint-plugin-prettier#readme 'prettier/prettier': [ 'error', { printWidth: 120, tabWidth: 2, singleQuote: true, quoteProps: 'as-needed', arrowParens: 'avoid', trailingComma: 'all', endOfLine: 'lf', }, { usePrettierrc: false, fileInfoOptions: { withNodeModules: true, }, }, ], /** * Possible Problems */ 'no-await-in-loop': 'warn', 'no-template-curly-in-string': 'error', 'array-callback-return': 'error', 'no-self-compare': 'error', 'no-unmodified-loop-condition': 'error', 'no-duplicate-imports': 'error', 'no-unused-private-class-members': 'error', 'no-use-before-define': ['error', { functions: true, classes: true, variables: true }], /** * Suggestions */ strict: ['error', 'global'], 'accessor-pairs': 'warn', 'consistent-return': 'error', curly: ['error', 'multi-line', 'consistent'], 'dot-notation': 'error', eqeqeq: 'error', 'no-empty-function': 'error', 'no-floating-decimal': 'error', 'no-implied-eval': 'error', 'no-invalid-this': 'error', 'no-lone-blocks': 'error', 'no-new-func': 'error', 'no-new-wrappers': 'error', 'no-new': 'error', 'no-octal-escape': 'error', 'no-return-assign': 'error', 'no-return-await': 'error', 'no-sequences': 'error', 'no-throw-literal': 'error', 'no-unused-expressions': 'error', 'no-useless-call': 'error', 'no-useless-concat': 'error', 'no-useless-return': 'error', 'no-void': 'error', 'no-warning-comments': 'error', 'prefer-promise-reject-errors': 'error', 'require-await': 'warn', yoda: 'error', 'no-label-var': 'error', 'no-shadow': 'error', 'no-undef-init': 'error', 'capitalized-comments': ['error', 'always', { ignoreConsecutiveComments: true }], 'consistent-this': ['error', '$this'], 'func-names': 'error', 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], 'max-depth': 'error', 'max-nested-callbacks': ['error', { max: 4 }], 'new-cap': 'off', 'no-array-constructor': 'error', 'no-inline-comments': 'error', 'no-lonely-if': 'error', 'no-new-object': 'error', 'no-unneeded-ternary': 'error', 'operator-assignment': 'error', 'quote-props': ['error', 'as-needed'], 'spaced-comment': 'error', // Disabled: visit: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration 'arrow-body-style': 'off', 'no-useless-computed-key': 'error', 'no-useless-constructor': 'error', // Disabled: visit: https://github.com/prettier/eslint-plugin-prettier#recommended-configuration 'prefer-arrow-callback': 'off', 'prefer-numeric-literals': 'error', 'prefer-rest-params': 'error', 'prefer-spread': 'error', 'prefer-template': 'error', 'no-eval': 'error', camelcase: 'error', complexity: ['error', { max: 9 }], 'default-case': 'error', 'default-case-last': 'error', 'default-param-last': 'error', 'func-name-matching': ['error', 'always'], 'grouped-accessor-pairs': ['error', 'setBeforeGet'], 'guard-for-in': 'error', 'max-classes-per-file': 'error', 'multiline-comment-style': ['error', 'starred-block'], 'no-console': 'error', 'no-eq-null': 'error', 'no-extra-bind': 'error', 'no-multi-assign': 'error', 'no-nested-ternary': 'error', 'no-proto': 'error', 'no-restricted-globals': [ 'error', { name: 'Buffer', message: 'Import Buffer from `node:buffer` instead', }, { name: 'process', message: 'Import process from `node:process` instead', }, { name: 'setTimeout', message: 'Import setTimeout from `node:timers` instead', }, { name: 'setInterval', message: 'Import setInterval from `node:timers` instead', }, { name: 'setImmediate', message: 'Import setImmediate from `node:timers` instead', }, ], /** * Layout & Formating */ 'dot-location': ['error', 'property'], 'no-multi-spaces': 'error', 'wrap-iife': 'error', 'array-bracket-spacing': 'error', 'block-spacing': 'error', 'brace-style': ['error', '1tbs', { allowSingleLine: true }], 'comma-dangle': ['error', 'always-multiline'], 'comma-spacing': 'error', 'comma-style': 'error', 'computed-property-spacing': 'error', 'eol-last': 'error', 'key-spacing': 'error', 'keyword-spacing': 'error', 'max-len': ['error', 120, 2], 'max-statements-per-line': ['error', { max: 2 }], 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 3 }], 'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }], 'no-trailing-spaces': 'error', 'no-whitespace-before-property': 'error', 'nonblock-statement-body-position': 'error', 'object-curly-spacing': ['error', 'always'], 'padded-blocks': ['error', 'never'], quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], 'semi-spacing': 'error', semi: 'error', 'space-before-blocks': 'error', 'space-before-function-paren': [ 'error', { anonymous: 'never', named: 'never', asyncArrow: 'always', }, ], 'space-in-parens': 'error', 'space-infix-ops': 'error', 'space-unary-ops': 'error', 'template-tag-spacing': 'error', 'arrow-parens': ['error', 'as-needed'], 'arrow-spacing': 'error', 'rest-spread-spacing': 'error', 'template-curly-spacing': 'error', 'yield-star-spacing': 'error', 'func-call-spacing': ['error', 'never'], }, };