@evojs/eslint-plugin
Version:
Plugin for eslint
647 lines (646 loc) • 17.4 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const importPlugin = require("eslint-plugin-import");
const lodashPlugin = require("eslint-plugin-lodash");
const unusedImportsPlugin = require("eslint-plugin-unused-imports");
const stylisticPlugin = require("@stylistic/eslint-plugin");
exports.default = {
name: 'ecmascript',
plugins: {
'@stylistic': stylisticPlugin,
'import': importPlugin,
'lodash': lodashPlugin,
'unused-imports': unusedImportsPlugin,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: false,
},
},
},
rules: {
'lodash/callback-binding': 'warn',
'lodash/chain-style': ['warn', 'as-needed'],
'lodash/chaining': 'warn',
'lodash/collection-method-value': 'warn',
'lodash/collection-ordering': 'warn',
'lodash/collection-return': 'warn',
'lodash/consistent-compose': ['warn', 'flow'],
'lodash/identity-shorthand': ['warn', 'always'],
'lodash/import-scope': ['error'],
'lodash/matches-prop-shorthand': ['warn', 'always'],
'lodash/matches-shorthand': ['warn', 'always', 3],
'lodash/no-commit': 'warn',
'lodash/no-double-unwrap': 'warn',
'lodash/no-extra-args': 'warn',
'lodash/no-unbound-this': 'warn',
'lodash/path-style': ['warn', 'string'],
'lodash/prefer-compact': 'warn',
'lodash/prefer-constant': 'off',
'lodash/prefer-filter': ['warn', 3],
'lodash/prefer-find': 'warn',
'lodash/prefer-flat-map': 'warn',
'lodash/prefer-get': ['warn', 3],
'lodash/prefer-immutable-method': 'warn',
'lodash/prefer-includes': [
'warn',
{
'includeNative': true,
},
],
'lodash/prefer-invoke-map': 'warn',
'lodash/prefer-is-nil': 'warn',
'lodash/prefer-lodash-chain': 'warn',
'lodash/prefer-lodash-method': 'off',
'lodash/prefer-lodash-typecheck': 'warn',
'lodash/prefer-map': 'warn',
'lodash/prefer-matches': ['off', 3],
'lodash/prefer-noop': 'off',
'lodash/prefer-over-quantifier': 'warn',
'lodash/prefer-reject': ['warn', 3],
'lodash/prefer-some': [
'warn',
{
'includeNative': true,
},
],
'lodash/prefer-startswith': 'off',
'lodash/prefer-thru': 'warn',
'lodash/prefer-times': 'warn',
'lodash/prefer-wrapper-method': 'warn',
'lodash/preferred-alias': 'off',
'lodash/prop-shorthand': ['warn', 'always'],
'lodash/unwrap': 'warn',
'unused-imports/no-unused-imports': 'warn',
'import/consistent-type-specifier-style': ['warn', 'prefer-inline'],
'import/default': 'error',
'import/dynamic-import-chunkname': 'off',
'import/enforce-node-protocol-usage': ['error', 'always'],
'import/export': 'error',
'import/exports-last': 'off',
'import/extensions': 'off',
'import/first': 'warn',
'import/group-exports': 'off',
'import/imports-first': 'off',
'import/max-dependencies': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/newline-after-import': 'warn',
'import/no-absolute-path': 'warn',
'import/no-amd': 'off',
'import/no-anonymous-default-export': 'warn',
'import/no-commonjs': 'off',
'import/no-cycle': 'off',
'import/no-default-export': 'off',
'import/no-deprecated': 'warn',
'import/no-duplicates': 'warn',
'import/no-dynamic-require': 'off',
'import/no-empty-named-blocks': 'error',
'import/no-extraneous-dependencies': 'warn',
'import/no-import-module-exports': 'warn',
'import/no-internal-modules': 'off',
'import/no-mutable-exports': 'off',
'import/no-named-as-default-member': 'warn',
'import/no-named-as-default': 'warn',
'import/no-named-default': 'off',
'import/no-named-export': 'off',
'import/no-namespace': 'off',
'import/no-nodejs-modules': 'off',
'import/no-relative-packages': 'off',
'import/no-relative-parent-imports': 'off',
'import/no-restricted-paths': 'off',
'import/no-self-import': 'error',
'import/no-unassigned-import': 'off',
'import/no-unresolved': 'error',
'import/no-unused-modules': 'warn',
'import/no-useless-path-segments': 'warn',
'import/no-webpack-loader-syntax': 'off',
'import/order': [
'warn',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
groups: [
['builtin', 'external', 'object', 'internal', 'unknown'],
['parent', 'sibling', 'index', 'type'],
],
'newlines-between': 'always',
'sortTypesGroup': true,
},
],
'import/prefer-default-export': 'off',
'import/unambiguous': 'off',
'@stylistic/array-bracket-newline': [
'warn',
{
multiline: true,
},
],
'@stylistic/array-bracket-spacing': ['warn', 'never'],
'@stylistic/array-element-newline': ['warn', 'consistent'],
'@stylistic/arrow-parens': ['error', 'always'],
'@stylistic/arrow-spacing': 'warn',
'@stylistic/block-spacing': ['warn', 'always'],
'@stylistic/brace-style': ['warn', '1tbs'],
'@stylistic/comma-dangle': ['warn', 'always-multiline'],
'@stylistic/comma-spacing': 'warn',
'@stylistic/comma-style': 'warn',
'@stylistic/computed-property-spacing': ['warn', 'never'],
'@stylistic/curly-newline': 'off',
'@stylistic/dot-location': ['error', 'property'],
'@stylistic/eol-last': 'error',
'@stylistic/exp-list-style': 'off',
'@stylistic/function-call-argument-newline': ['warn', 'consistent'],
'@stylistic/function-call-spacing': 'warn',
'@stylistic/function-paren-newline': ['warn', 'multiline-arguments'],
'@stylistic/generator-star-spacing': ['warn', 'after'],
'@stylistic/implicit-arrow-linebreak': ['off', 'beside'],
'@stylistic/indent': [
'warn',
2,
{
SwitchCase: 1,
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
ignoredNodes: [
'TSTypeParameterInstantiation',
'FunctionExpression > .params[decorators.length > 0]',
'FunctionExpression > .params > :matches(Decorator, :not(:first-child))',
'ClassBody.body > PropertyDefinition[decorators.length > 0] > .key',
],
},
],
'@stylistic/indent-binary-ops': 'off',
'@stylistic/key-spacing': 'warn',
'@stylistic/keyword-spacing': 'warn',
'@stylistic/line-comment-position': 'off',
'@stylistic/linebreak-style': ['error', 'unix'],
'@stylistic/lines-around-comment': [
'warn',
{
allowBlockStart: true,
},
],
'@stylistic/lines-between-class-members': [
'warn',
'always',
{
exceptAfterSingleLine: true,
},
],
'@stylistic/max-len': 'off',
'@stylistic/max-statements-per-line': 'warn',
'@stylistic/member-delimiter-style': [
'warn',
{
multiline: {
delimiter: 'semi',
requireLast: true,
},
singleline: {
delimiter: 'semi',
requireLast: false,
},
},
],
'@stylistic/multiline-comment-style': 'off',
'@stylistic/multiline-ternary': ['warn', 'always-multiline'],
'@stylistic/new-parens': 'error',
'@stylistic/newline-per-chained-call': 'off',
'@stylistic/no-confusing-arrow': 'off',
'@stylistic/no-extra-parens': [
'warn',
'all',
{
returnAssign: false,
nestedBinaryExpressions: false,
enforceForSequenceExpressions: false,
ignoreJSX: 'multi-line',
},
],
'@stylistic/no-extra-semi': 'error',
'@stylistic/no-floating-decimal': 'warn',
'@stylistic/no-mixed-operators': [
'off',
{
'groups': [
['+', '-', '*', '/', '%', '**'],
['&', '|', '^', '~', '<<', '>>', '>>>'],
['==', '!=', '===', '!==', '>', '>=', '<', '<='],
['&&', '||'],
['in', 'instanceof'],
],
'allowSamePrecedence': true,
},
],
'@stylistic/no-mixed-spaces-and-tabs': 'error',
'@stylistic/no-multi-spaces': 'warn',
'@stylistic/no-multiple-empty-lines': [
'warn',
{
max: 1,
maxEOF: 0,
},
],
'@stylistic/no-tabs': [
'warn',
{
allowIndentationTabs: true,
},
],
'@stylistic/no-trailing-spaces': 'warn',
'@stylistic/no-whitespace-before-property': 'warn',
'@stylistic/nonblock-statement-body-position': 'warn',
'@stylistic/object-curly-newline': [
'warn',
{
ObjectExpression: { multiline: true, minProperties: 10, consistent: true },
ImportDeclaration: { multiline: true, consistent: true },
ExportDeclaration: { multiline: true, minProperties: 10, consistent: true },
},
],
'@stylistic/object-curly-spacing': ['warn', 'always'],
'@stylistic/object-property-newline': [
'warn',
{
allowAllPropertiesOnSameLine: true,
},
],
'@stylistic/one-var-declaration-per-line': 'warn',
'@stylistic/operator-linebreak': [
'warn',
'after',
{
overrides: {
'|': 'before',
'?': 'before',
':': 'before',
},
},
],
'@stylistic/padded-blocks': ['warn', 'never'],
'@stylistic/padding-line-between-statements': [
'warn',
{
blankLine: 'always',
prev: 'block-like',
next: '*',
},
{
blankLine: 'always',
prev: '*',
next: [
'break',
'class',
'const',
'continue',
'do',
'for',
'function',
'if',
'interface',
'let',
'return',
'switch',
'throw',
'try',
'type',
'while',
],
},
{
blankLine: 'any',
prev: ['const', 'let'],
next: ['const', 'let'],
},
{
blankLine: 'any',
prev: ['type'],
next: ['type'],
},
],
'@stylistic/quote-props': 'off',
'@stylistic/quotes': [
'warn',
'single',
{
avoidEscape: true,
allowTemplateLiterals: 'avoidEscape',
},
],
'@stylistic/rest-spread-spacing': 'warn',
'@stylistic/semi-spacing': 'warn',
'@stylistic/semi-style': 'warn',
'@stylistic/semi': ['error', 'always'],
'@stylistic/space-before-blocks': 'warn',
'@stylistic/space-before-function-paren': [
'warn',
{
asyncArrow: 'always',
anonymous: 'always',
named: 'never',
},
],
'@stylistic/space-in-parens': ['warn', 'never'],
'@stylistic/space-infix-ops': 'warn',
'@stylistic/space-unary-ops': 'warn',
'@stylistic/spaced-comment': ['warn', 'always'],
'@stylistic/switch-colon-spacing': 'warn',
'@stylistic/template-curly-spacing': 'warn',
'@stylistic/template-tag-spacing': 'warn',
'@stylistic/type-annotation-spacing': 'warn',
'@stylistic/type-generic-spacing': 'off',
'@stylistic/type-named-tuple-spacing': 'off',
'@stylistic/wrap-iife': [
'warn',
'inside',
{
functionPrototypeMethods: true,
},
],
'@stylistic/wrap-regex': 'warn',
'@stylistic/yield-star-spacing': ['warn', 'after'],
'accessor-pairs': 'error',
'array-callback-return': [
'warn',
{
allowImplicit: true,
checkForEach: true,
},
],
'arrow-body-style': 'warn',
'block-scoped-var': 'warn',
'camelcase': [
'off',
{
properties: 'never',
},
],
'capitalized-comments': 'off',
'class-methods-use-this': 'off',
'complexity': 'off',
'consistent-return': 'off',
'consistent-this': 'off',
'constructor-super': 'error',
'curly': ['error'],
'default-case-last': 'warn',
'default-case': 'warn',
'default-param-last': 'off',
'dot-notation': 'warn',
'eqeqeq': ['error', 'smart'],
'for-direction': 'error',
'func-name-matching': 'warn',
'func-names': 'warn',
'func-style': 'off',
'getter-return': 'error',
'grouped-accessor-pairs': ['warn', 'getBeforeSet'],
'guard-for-in': 'error',
'id-denylist': 'off',
'id-length': 'off',
'id-match': 'off',
'init-declarations': [
'off',
'never',
{
ignoreForLoopInit: true,
},
],
'logical-assignment-operators': [
'warn',
'always',
{
enforceForIfStatements: true,
},
],
'max-classes-per-file': 'off',
'max-depth': 'off',
'max-lines-per-function': 'off',
'max-lines': 'off',
'max-nested-callbacks': 'off',
'max-params': 'off',
'max-statements': 'off',
'new-cap': 'off',
'no-alert': 'off',
'no-array-constructor': 'error',
'no-async-promise-executor': 'error',
'no-await-in-loop': 'off',
'no-bitwise': 'off',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-class-assign': 'error',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'off',
'no-console': 'off',
'no-const-assign': 'error',
'no-constant-binary-expression': 'error',
'no-constant-condition': 'error',
'no-constructor-return': 'error',
'no-continue': 'off',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-delete-var': 'error',
'no-div-regex': 'warn',
'no-dupe-args': 'error',
'no-dupe-class-members': 'error',
'no-dupe-else-if': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-else-return': [
'warn',
{
allowElseIf: false,
},
],
'no-empty-character-class': 'error',
'no-empty-function': 'off',
'no-empty-pattern': 'error',
'no-empty-static-block': 'off',
'no-empty': 'off',
'no-eq-null': 'off',
'no-eval': 'error',
'no-ex-assign': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-label': 'error',
'no-fallthrough': 'error',
'no-func-assign': 'error',
'no-global-assign': 'error',
'no-implicit-coercion': 'off',
'no-implicit-globals': 'off',
'no-implied-eval': 'error',
'no-import-assign': 'error',
'no-inline-comments': 'off',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-invalid-this': 'warn',
'no-irregular-whitespace': 'error',
'no-iterator': 'error',
'no-label-var': 'error',
'no-labels': 'error',
'no-lone-blocks': 'error',
'no-lonely-if': 'warn',
'no-loop-func': 'off',
'no-loss-of-precision': 'error',
'no-magic-numbers': 'off',
'no-misleading-character-class': 'error',
'no-multi-assign': 'warn',
'no-multi-str': 'warn',
'no-negated-condition': 'warn',
'no-nested-ternary': 'off',
'no-new-func': 'error',
'no-new-native-nonconstructor': 'error',
'no-new-wrappers': 'error',
'no-new': 'off',
'no-nonoctal-decimal-escape': 'error',
'no-obj-calls': 'error',
'no-object-constructor': 'error',
'no-octal-escape': 'error',
'no-octal': 'error',
'no-param-reassign': 'off',
'no-plusplus': 'off',
'no-promise-executor-return': 'off',
'no-proto': 'error',
'no-prototype-builtins': 'error',
'no-redeclare': 'error',
'no-regex-spaces': 'error',
'no-restricted-exports': 'off',
'no-restricted-globals': 'warn',
'no-restricted-imports': [
'warn',
{
'paths': ['.', '..', '../..'],
'patterns': [],
},
],
'no-restricted-properties': 'off',
'no-restricted-syntax': ['error', 'WithStatement'],
'no-return-assign': 'error',
'no-script-url': 'warn',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'error',
'no-setter-return': 'error',
'no-shadow-restricted-names': 'error',
'no-shadow': [
'off',
{
hoist: 'functions',
},
],
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'warn',
'no-ternary': 'off',
'no-this-before-super': 'error',
'no-throw-literal': 'error',
'no-unassigned-vars': 'error',
'no-undef-init': 'error',
'no-undef': 'off',
'no-undefined': 'off',
'no-underscore-dangle': 'off',
'no-unexpected-multiline': 'error',
'no-unmodified-loop-condition': 'error',
'no-unneeded-ternary': 'error',
'no-unreachable-loop': 'warn',
'no-unreachable': 'error',
'no-unused-private-class-members': 'warn',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-expressions': [
'error',
{
allowTernary: true,
allowShortCircuit: true,
},
],
'no-unused-labels': 'error',
'no-unused-vars': [
'warn',
{
args: 'none',
caughtErrors: 'none',
ignoreRestSiblings: true,
},
],
'no-use-before-define': 'warn',
'no-useless-assignment': 'warn',
'no-useless-backreference': 'error',
'no-useless-call': 'error',
'no-useless-catch': 'error',
'no-useless-computed-key': 'warn',
'no-useless-concat': 'error',
'no-useless-constructor': 'error',
'no-useless-escape': 'error',
'no-useless-rename': 'warn',
'no-useless-return': 'error',
'no-var': 'error',
'no-void': 'off',
'no-warning-comments': 'off',
'no-with': 'error',
'object-shorthand': 'error',
'one-var': [
'off',
{
var: 'never',
let: 'never',
const: 'never',
},
],
'operator-assignment': 'warn',
'prefer-arrow-callback': 'warn',
'prefer-const': [
'error',
{
destructuring: 'all',
},
],
'prefer-destructuring': [
'error',
{
AssignmentExpression: {
array: false,
object: false,
},
},
],
'prefer-exponentiation-operator': 'error',
'prefer-named-capture-group': 'off',
'prefer-numeric-literals': 'warn',
'prefer-object-has-own': 'warn',
'prefer-object-spread': 'error',
'prefer-promise-reject-errors': 'warn',
'prefer-regex-literals': 'warn',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'warn',
'preserve-caught-error': 'off',
'radix': 'error',
'require-atomic-updates': 'off',
'require-await': 'warn',
'require-unicode-regexp': 'off',
'require-yield': 'error',
'sort-imports': [
'warn',
{
ignoreDeclarationSort: true,
ignoreMemberSort: false,
},
],
'sort-keys': 'off',
'sort-vars': 'off',
'strict': 'off',
'symbol-description': 'error',
'unicode-bom': ['error', 'never'],
'use-isnan': 'error',
'valid-typeof': 'error',
'vars-on-top': 'off',
'yoda': ['error', 'never'],
},
};