diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..73a3f6d4f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,9 @@ +require('@rushstack/eslint-patch/modern-module-resolution') + +module.exports = { + extends: ['./config/eslint/src/working-example/index.js'], + parserOptions: { + project: './tsconfig.json', + }, + ignorePatterns: ['.eslintrc.js'], +} diff --git a/.pnp.cjs b/.pnp.cjs index 4c13abcb6..333db9844 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -319,6 +319,7 @@ const RAW_RUNTIME_STATE = ["@atls/schematics", "workspace:schematics/schematics"],\ ["@atls/tools-setup-ts-execution", "workspace:utils/setup-ts-execution"],\ ["@jest/core", "virtual:93762f395d50e2410536eefd1c9656e618c9e599e2d023ef5341f0dd44b7c10b9c8541440da9da71a8fae8443bde146c84aabb5f6bc6020be89f6fe1913af10c#npm:28.1.0"],\ + ["@rushstack/eslint-patch", "npm:1.6.0"],\ ["@types/eslint", "npm:8.4.2"],\ ["@types/jest", "npm:27.5.2"],\ ["@types/node", "npm:17.0.38"],\ @@ -5630,6 +5631,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["@rushstack/eslint-patch", [\ + ["npm:1.6.0", {\ + "packageLocation": "./.yarn/cache/@rushstack-eslint-patch-npm-1.6.0-5901435a0f-cf2cc9a7e6.zip/node_modules/@rushstack/eslint-patch/",\ + "packageDependencies": [\ + ["@rushstack/eslint-patch", "npm:1.6.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@sinclair/typebox", [\ ["npm:0.23.5", {\ "packageLocation": "./.yarn/cache/@sinclair-typebox-npm-0.23.5-10c003c068-376054f51a.zip/node_modules/@sinclair/typebox/",\ @@ -20516,6 +20526,7 @@ const RAW_RUNTIME_STATE = ["@atls/schematics", "workspace:schematics/schematics"],\ ["@atls/tools-setup-ts-execution", "workspace:utils/setup-ts-execution"],\ ["@jest/core", "virtual:93762f395d50e2410536eefd1c9656e618c9e599e2d023ef5341f0dd44b7c10b9c8541440da9da71a8fae8443bde146c84aabb5f6bc6020be89f6fe1913af10c#npm:28.1.0"],\ + ["@rushstack/eslint-patch", "npm:1.6.0"],\ ["@types/eslint", "npm:8.4.2"],\ ["@types/jest", "npm:27.5.2"],\ ["@types/node", "npm:17.0.38"],\ diff --git a/.yarn/cache/@rushstack-eslint-patch-npm-1.6.0-5901435a0f-cf2cc9a7e6.zip b/.yarn/cache/@rushstack-eslint-patch-npm-1.6.0-5901435a0f-cf2cc9a7e6.zip new file mode 100644 index 000000000..b96af3cfd Binary files /dev/null and b/.yarn/cache/@rushstack-eslint-patch-npm-1.6.0-5901435a0f-cf2cc9a7e6.zip differ diff --git a/README.md b/README.md index 0bf5fce89..2a0a46054 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ **ВАЖНО:** Мы используем [собственный бандл](https://yarnpkg.com/builder/cli/build/bundle) ярна для запуска собственных скриптов. Для начала использования нашей сборки: + - `yarn set version https://raw.githubusercontent.com/atls/tools/master/yarn/cli/bundles/yarn.js` - эта команда установит вместо стокового ярна наш и положит в папку .yarn/releases, если же наша сборка уже установленна - произойдёт обновление до актуальной версии ## Основные скрипты `yarn` для нашей работы diff --git a/config/eslint/README.md b/config/eslint/README.md new file mode 100644 index 000000000..fef2af58d --- /dev/null +++ b/config/eslint/README.md @@ -0,0 +1,52 @@ +# @atls/config-eslint + +## Инструкция по применению + +1. Установить в корень проекта зависимость + - `@atls/config-eslint` + - `@rushstack/eslint-patch`, рабочая версия 1.6.0 (необходим чтобы `eslint` брал плагины и + парсеры из пакета с нашей зависимостью, а не требовал ее установку в каждом проекте) +2. (пока мы на 8 версии `eslint`) необходимо сделать анплаг конфига: `yarn unplug @atls/config-eslint` +3. В корне проекта создать `.eslintrc.js` +4. Вставить в него: + +```js +require('@rushstack/eslint-patch/modern-module-resolution') + +module.exports = { + // прописать путь до нашего пакета. + // В светлом будущем можно будет так: '@atls/config-eslint' + // А пока через анплаг, то будет что то вроде + // './.yarn/unplugged/@atls-config-eslint-npm-0.0.9-eb6c230fca/node_modules/@atls/config-eslint/dist/.eslintrc.js' + extends: ['./config/eslint/dist/eslintrc.js'], + parserOptions: { + // Ссылка на рутовый tsconfig. + // eslint смотрит на inlude и проверяет только эти файлы. + project: './tsconfig.json', + }, + // Это чтобы eslint не проверял ваш конфиг. + // Можно добавить и другие файлы по необходимости. + ignorePatterns: ['.eslintrc.js'], +} +``` + +5. Добавить настройки для вашей IDE: + +- Настройки - ESLint: +- Manual ESLint Configuration - выбрать +- ESLint package - дать ссылку до рута (`yarn:package.json:eslint`) +- Configuration File - дать ссылку до вашего созданного `.eslintrc.js` в руте + (`/Users/*/*/*/atlantis/tools/.eslintrc.js`) + +6. Проверить `include` в рутовом `tsconfig.json` чтобы содержал все папки с рабочими файлами + +## Рекомендация для IDE + +Плагин для JetBrains IDE `Inspection Lens` - пишет ошибки рядом с кодом без необходимости +наведению мышью или F2. + +## Для будущих соискателей приключений + +В `src/working-example` лежат рабочие на момент написания конфиги. К сожалению они не +компилируются из `index.ts`, поэтому приходится держать дубликат `eslint.ts` в котором уже +сделано как надо. diff --git a/config/eslint/package.json b/config/eslint/package.json index 6f0782847..c64da512b 100644 --- a/config/eslint/package.json +++ b/config/eslint/package.json @@ -7,7 +7,7 @@ "dist" ], "scripts": { - "build": "yarn library build && node -e 'const fs = require(\"fs\"); const config = require(\"./dist/.eslintrc.js\"); fs.writeFileSync(\"./dist/.eslintrc.json\", JSON.stringify(config, null, 2))'", + "build": "yarn library build", "prepack": "yarn run build", "postpack": "rm -rf dist" }, diff --git a/config/eslint/src/.eslintrc.json b/config/eslint/src/.eslintrc.json deleted file mode 100644 index c31f77621..000000000 --- a/config/eslint/src/.eslintrc.json +++ /dev/null @@ -1,2034 +0,0 @@ -{ - "rules": { - "no-undef": [ - "off" - ], - "brace-style": "off", - "@typescript-eslint/brace-style": "off", - "camelcase": [ - "off", - { - "properties": "never", - "ignoreDestructuring": false, - "ignoreImports": false, - "ignoreGlobals": false - } - ], - "func-call-spacing": "off", - "@typescript-eslint/func-call-spacing": "off", - "indent": "off", - "no-array-constructor": [ - "off" - ], - "@typescript-eslint/no-array-constructor": [ - "error" - ], - "no-extra-parens": "off", - "@typescript-eslint/no-extra-parens": "off", - "no-magic-numbers": [ - "off", - { - "ignore": [], - "ignoreArrayIndexes": true, - "enforceConst": true, - "detectObjects": false - } - ], - "@typescript-eslint/no-magic-numbers": [ - "off", - { - "ignore": [], - "ignoreArrayIndexes": true, - "enforceConst": true, - "detectObjects": false - } - ], - "no-unused-expressions": [ - "off", - { - "allowShortCircuit": false, - "allowTernary": false, - "allowTaggedTemplates": false, - "enforceForJSX": false - } - ], - "@typescript-eslint/no-unused-expressions": [ - "error", - { - "allowShortCircuit": false, - "allowTernary": false, - "allowTaggedTemplates": false, - "enforceForJSX": false - } - ], - "no-unused-vars": [ - "off", - { - "vars": "all", - "args": "after-used", - "ignoreRestSiblings": true - } - ], - "no-use-before-define": [ - "off", - { - "functions": true, - "classes": true, - "variables": true - } - ], - "@typescript-eslint/no-use-before-define": [ - "error", - { - "functions": true, - "classes": true, - "variables": true - } - ], - "quotes": 0, - "@typescript-eslint/quotes": 0, - "semi": "off", - "@typescript-eslint/naming-convention": [ - "error", - { - "selector": "variable", - "format": [ - "camelCase", - "PascalCase", - "UPPER_CASE" - ] - }, - { - "selector": "function", - "format": [ - "camelCase", - "PascalCase" - ] - }, - { - "selector": "typeLike", - "format": [ - "PascalCase" - ] - } - ], - "class-methods-use-this": [ - 0, - { - "exceptMethods": [ - "render", - "getInitialState", - "getDefaultProps", - "getChildContext", - "componentWillMount", - "UNSAFE_componentWillMount", - "componentDidMount", - "componentWillReceiveProps", - "UNSAFE_componentWillReceiveProps", - "shouldComponentUpdate", - "componentWillUpdate", - "UNSAFE_componentWillUpdate", - "componentDidUpdate", - "componentWillUnmount", - "componentDidCatch", - "getSnapshotBeforeUpdate" - ], - "enforceForClassFields": true - } - ], - "jsx-a11y/html-has-lang": [ - 0 - ], - "react/function-component-definition": [ - 2, - { - "namedComponents": "arrow-function" - } - ], - "react/jsx-props-no-spreading": [ - 0, - { - "html": "enforce", - "custom": "enforce", - "explicitSpread": "ignore", - "exceptions": [] - } - ], - "react/jsx-filename-extension": [ - 1, - { - "extensions": [ - ".js", - ".jsx", - ".tsx" - ] - } - ], - "react/prop-types": [ - 0, - { - "ignore": [], - "customValidators": [], - "skipUndeclared": false - } - ], - "react/no-danger": [ - 0 - ], - "@typescript-eslint/semi": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { - "args": "none" - } - ], - "no-useless-constructor": [ - "off" - ], - "@typescript-eslint/no-useless-constructor": [ - "error" - ], - "no-empty-function": [ - "off", - { - "allow": [ - "arrowFunctions", - "functions", - "methods" - ] - } - ], - "@typescript-eslint/no-empty-function": [ - "error" - ], - "@typescript-eslint/indent": "off", - "@typescript-eslint/no-shadow": [ - "error", - { - "allow": [ - "ClientFactory", - "ServerBuilder" - ], - "builtinGlobals": false, - "hoist": "functions" - } - ], - "no-shadow": "off", - "curly": 0, - "lines-around-comment": 0, - "max-len": 0, - "no-confusing-arrow": 0, - "no-mixed-operators": 0, - "no-tabs": 0, - "no-unexpected-multiline": 0, - "babel/quotes": 0, - "vue/html-self-closing": 0, - "vue/max-len": 0, - "array-bracket-newline": "off", - "array-bracket-spacing": "off", - "array-element-newline": "off", - "arrow-parens": "off", - "arrow-spacing": "off", - "block-spacing": "off", - "comma-dangle": "off", - "comma-spacing": "off", - "comma-style": "off", - "computed-property-spacing": "off", - "dot-location": "off", - "eol-last": "off", - "function-call-argument-newline": "off", - "function-paren-newline": "off", - "generator-star": "off", - "generator-star-spacing": "off", - "implicit-arrow-linebreak": "off", - "jsx-quotes": "off", - "key-spacing": "off", - "keyword-spacing": "off", - "linebreak-style": "off", - "multiline-ternary": "off", - "newline-per-chained-call": "off", - "new-parens": "off", - "no-arrow-condition": "off", - "no-comma-dangle": "off", - "no-extra-semi": "off", - "no-floating-decimal": "off", - "no-mixed-spaces-and-tabs": "off", - "no-multi-spaces": "off", - "no-multiple-empty-lines": "off", - "no-reserved-keys": "off", - "no-space-before-semi": "off", - "no-trailing-spaces": "off", - "no-whitespace-before-property": "off", - "no-wrap-func": "off", - "nonblock-statement-body-position": "off", - "object-curly-newline": "off", - "object-curly-spacing": "off", - "object-property-newline": "off", - "one-var-declaration-per-line": "off", - "operator-linebreak": "off", - "padded-blocks": "off", - "quote-props": "off", - "rest-spread-spacing": "off", - "semi-spacing": "off", - "semi-style": "off", - "space-after-function-name": "off", - "space-after-keywords": "off", - "space-before-blocks": "off", - "space-before-function-paren": "off", - "space-before-function-parentheses": "off", - "space-before-keywords": "off", - "space-in-brackets": "off", - "space-in-parens": "off", - "space-infix-ops": "off", - "space-return-throw-case": "off", - "space-unary-ops": "off", - "space-unary-word-ops": "off", - "switch-colon-spacing": "off", - "template-curly-spacing": "off", - "template-tag-spacing": "off", - "unicode-bom": "off", - "wrap-iife": "off", - "wrap-regex": "off", - "yield-star-spacing": "off", - "@babel/object-curly-spacing": "off", - "@babel/semi": "off", - "@typescript-eslint/comma-dangle": "off", - "@typescript-eslint/comma-spacing": "off", - "@typescript-eslint/keyword-spacing": "off", - "@typescript-eslint/member-delimiter-style": "off", - "@typescript-eslint/no-extra-semi": "off", - "@typescript-eslint/object-curly-spacing": "off", - "@typescript-eslint/space-before-function-paren": "off", - "@typescript-eslint/space-infix-ops": "off", - "@typescript-eslint/type-annotation-spacing": "off", - "babel/object-curly-spacing": "off", - "babel/semi": "off", - "flowtype/boolean-style": "off", - "flowtype/delimiter-dangle": "off", - "flowtype/generic-spacing": "off", - "flowtype/object-type-curly-spacing": "off", - "flowtype/object-type-delimiter": "off", - "flowtype/quotes": "off", - "flowtype/semi": "off", - "flowtype/space-after-type-colon": "off", - "flowtype/space-before-generic-bracket": "off", - "flowtype/space-before-type-colon": "off", - "flowtype/union-intersection-spacing": "off", - "react/jsx-child-element-spacing": "off", - "react/jsx-closing-bracket-location": "off", - "react/jsx-closing-tag-location": "off", - "react/jsx-curly-newline": "off", - "react/jsx-curly-spacing": "off", - "react/jsx-equals-spacing": "off", - "react/jsx-first-prop-new-line": "off", - "react/jsx-indent": "off", - "react/jsx-indent-props": "off", - "react/jsx-max-props-per-line": "off", - "react/jsx-newline": "off", - "react/jsx-one-expression-per-line": "off", - "react/jsx-props-no-multi-spaces": "off", - "react/jsx-tag-spacing": "off", - "react/jsx-wrap-multilines": "off", - "standard/array-bracket-even-spacing": "off", - "standard/computed-property-even-spacing": "off", - "standard/object-curly-even-spacing": "off", - "unicorn/empty-brace-spaces": "off", - "unicorn/no-nested-ternary": "off", - "unicorn/number-literal-case": "off", - "vue/array-bracket-newline": "off", - "vue/array-bracket-spacing": "off", - "vue/arrow-spacing": "off", - "vue/block-spacing": "off", - "vue/block-tag-newline": "off", - "vue/brace-style": "off", - "vue/comma-dangle": "off", - "vue/comma-spacing": "off", - "vue/comma-style": "off", - "vue/dot-location": "off", - "vue/func-call-spacing": "off", - "vue/html-closing-bracket-newline": "off", - "vue/html-closing-bracket-spacing": "off", - "vue/html-end-tags": "off", - "vue/html-indent": "off", - "vue/html-quotes": "off", - "vue/key-spacing": "off", - "vue/keyword-spacing": "off", - "vue/max-attributes-per-line": "off", - "vue/multiline-html-element-content-newline": "off", - "vue/mustache-interpolation-spacing": "off", - "vue/no-extra-parens": "off", - "vue/no-multi-spaces": "off", - "vue/no-spaces-around-equal-signs-in-attribute": "off", - "vue/object-curly-newline": "off", - "vue/object-curly-spacing": "off", - "vue/object-property-newline": "off", - "vue/operator-linebreak": "off", - "vue/script-indent": "off", - "vue/singleline-html-element-content-newline": "off", - "vue/space-in-parens": "off", - "vue/space-infix-ops": "off", - "vue/space-unary-ops": "off", - "vue/template-curly-spacing": "off", - "indent-legacy": [ - "off" - ], - "no-spaced-func": [ - "off" - ], - "react/jsx-space-before-closing": [ - "off", - "always" - ], - "react-hooks/rules-of-hooks": [ - "error" - ], - "react-hooks/exhaustive-deps": [ - "error" - ], - "jsx-a11y/accessible-emoji": [ - "off" - ], - "jsx-a11y/alt-text": [ - "error", - { - "elements": [ - "img", - "object", - "area", - "input[type=\"image\"]" - ], - "img": [], - "object": [], - "area": [], - "input[type=\"image\"]": [] - } - ], - "jsx-a11y/anchor-has-content": [ - "error", - { - "components": [] - } - ], - "jsx-a11y/anchor-is-valid": [ - "error", - { - "components": [ - "Link" - ], - "specialLink": [ - "to" - ], - "aspects": [ - "noHref", - "invalidHref", - "preferButton" - ] - } - ], - "jsx-a11y/aria-activedescendant-has-tabindex": [ - "error" - ], - "jsx-a11y/aria-props": [ - "error" - ], - "jsx-a11y/aria-proptypes": [ - "error" - ], - "jsx-a11y/aria-role": [ - "error", - { - "ignoreNonDOM": false - } - ], - "jsx-a11y/aria-unsupported-elements": [ - "error" - ], - "jsx-a11y/autocomplete-valid": [ - "off", - { - "inputComponents": [] - } - ], - "jsx-a11y/click-events-have-key-events": [ - "error" - ], - "jsx-a11y/control-has-associated-label": [ - "error", - { - "labelAttributes": [ - "label" - ], - "controlComponents": [], - "ignoreElements": [ - "audio", - "canvas", - "embed", - "input", - "textarea", - "tr", - "video" - ], - "ignoreRoles": [ - "grid", - "listbox", - "menu", - "menubar", - "radiogroup", - "row", - "tablist", - "toolbar", - "tree", - "treegrid" - ], - "depth": 5 - } - ], - "jsx-a11y/heading-has-content": [ - "error", - { - "components": [ - "" - ] - } - ], - "jsx-a11y/iframe-has-title": [ - "error" - ], - "jsx-a11y/img-redundant-alt": [ - "error" - ], - "jsx-a11y/interactive-supports-focus": [ - "error" - ], - "jsx-a11y/label-has-associated-control": [ - "error", - { - "labelComponents": [], - "labelAttributes": [], - "controlComponents": [], - "assert": "both", - "depth": 25 - } - ], - "jsx-a11y/lang": [ - "error" - ], - "jsx-a11y/media-has-caption": [ - "error", - { - "audio": [], - "video": [], - "track": [] - } - ], - "jsx-a11y/mouse-events-have-key-events": [ - "error" - ], - "jsx-a11y/no-access-key": [ - "error" - ], - "jsx-a11y/no-autofocus": [ - "error", - { - "ignoreNonDOM": true - } - ], - "jsx-a11y/no-distracting-elements": [ - "error", - { - "elements": [ - "marquee", - "blink" - ] - } - ], - "jsx-a11y/no-interactive-element-to-noninteractive-role": [ - "error", - { - "tr": [ - "none", - "presentation" - ] - } - ], - "jsx-a11y/no-noninteractive-element-interactions": [ - "error", - { - "handlers": [ - "onClick", - "onMouseDown", - "onMouseUp", - "onKeyPress", - "onKeyDown", - "onKeyUp" - ] - } - ], - "jsx-a11y/no-noninteractive-element-to-interactive-role": [ - "error", - { - "ul": [ - "listbox", - "menu", - "menubar", - "radiogroup", - "tablist", - "tree", - "treegrid" - ], - "ol": [ - "listbox", - "menu", - "menubar", - "radiogroup", - "tablist", - "tree", - "treegrid" - ], - "li": [ - "menuitem", - "option", - "row", - "tab", - "treeitem" - ], - "table": [ - "grid" - ], - "td": [ - "gridcell" - ] - } - ], - "jsx-a11y/no-noninteractive-tabindex": [ - "error", - { - "tags": [], - "roles": [ - "tabpanel" - ] - } - ], - "jsx-a11y/no-onchange": [ - "off" - ], - "jsx-a11y/no-redundant-roles": [ - "error" - ], - "jsx-a11y/no-static-element-interactions": [ - "error", - { - "handlers": [ - "onClick", - "onMouseDown", - "onMouseUp", - "onKeyPress", - "onKeyDown", - "onKeyUp" - ] - } - ], - "jsx-a11y/role-has-required-aria-props": [ - "error" - ], - "jsx-a11y/role-supports-aria-props": [ - "error" - ], - "jsx-a11y/scope": [ - "error" - ], - "jsx-a11y/tabindex-no-positive": [ - "error" - ], - "jsx-a11y/label-has-for": [ - "off", - { - "components": [], - "required": { - "every": [ - "nesting", - "id" - ] - }, - "allowChildren": false - } - ], - "no-underscore-dangle": [ - "error", - { - "allow": [ - "__REDUX_DEVTOOLS_EXTENSION_COMPOSE__" - ], - "allowAfterThis": false, - "allowAfterSuper": false, - "enforceInMethodNames": true, - "allowAfterThisConstructor": false, - "allowFunctionParams": true - } - ], - "react/display-name": [ - "off", - { - "ignoreTranspilerName": false - } - ], - "react/forbid-prop-types": [ - "error", - { - "forbid": [ - "any", - "array", - "object" - ], - "checkContextTypes": true, - "checkChildContextTypes": true - } - ], - "react/forbid-dom-props": [ - "off", - { - "forbid": [] - } - ], - "react/jsx-boolean-value": [ - "error", - "never", - { - "always": [] - } - ], - "react/jsx-handler-names": [ - "off", - { - "eventHandlerPrefix": "handle", - "eventHandlerPropPrefix": "on" - } - ], - "react/jsx-key": [ - "off" - ], - "react/jsx-no-bind": [ - "error", - { - "ignoreRefs": true, - "allowArrowFunctions": true, - "allowFunctions": false, - "allowBind": false, - "ignoreDOMComponents": true - } - ], - "react/jsx-no-duplicate-props": [ - "error", - { - "ignoreCase": true - } - ], - "react/jsx-no-literals": [ - "off", - { - "noStrings": true - } - ], - "react/jsx-no-undef": [ - "error" - ], - "react/jsx-pascal-case": [ - "error", - { - "allowAllCaps": true, - "ignore": [] - } - ], - "react/sort-prop-types": [ - "off", - { - "ignoreCase": true, - "callbacksLast": false, - "requiredFirst": false, - "sortShapeProp": true - } - ], - "react/jsx-sort-prop-types": [ - "off" - ], - "react/jsx-sort-props": [ - "off", - { - "ignoreCase": true, - "callbacksLast": false, - "shorthandFirst": false, - "shorthandLast": false, - "noSortAlphabetically": false, - "reservedFirst": true - } - ], - "react/jsx-sort-default-props": [ - "off", - { - "ignoreCase": true - } - ], - "react/jsx-uses-react": [ - "error" - ], - "react/jsx-uses-vars": [ - "error" - ], - "react/no-deprecated": [ - "error" - ], - "react/no-did-mount-set-state": [ - "off" - ], - "react/no-did-update-set-state": [ - "error" - ], - "react/no-will-update-set-state": [ - "error" - ], - "react/no-direct-mutation-state": [ - "off" - ], - "react/no-is-mounted": [ - "error" - ], - "react/no-multi-comp": [ - "off" - ], - "react/no-set-state": [ - "off" - ], - "react/no-string-refs": [ - "error" - ], - "react/no-unknown-property": [ - "error" - ], - "react/prefer-es6-class": [ - "error", - "always" - ], - "react/prefer-stateless-function": [ - "error", - { - "ignorePureComponents": true - } - ], - "react/react-in-jsx-scope": [ - "error" - ], - "react/require-render-return": [ - "error" - ], - "react/self-closing-comp": [ - "error" - ], - "react/sort-comp": [ - "error", - { - "order": [ - "static-variables", - "static-methods", - "instance-variables", - "lifecycle", - "/^handle.+$/", - "/^on.+$/", - "getters", - "setters", - "/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/", - "instance-methods", - "everything-else", - "rendering" - ], - "groups": { - "lifecycle": [ - "displayName", - "propTypes", - "contextTypes", - "childContextTypes", - "mixins", - "statics", - "defaultProps", - "constructor", - "getDefaultProps", - "getInitialState", - "state", - "getChildContext", - "getDerivedStateFromProps", - "componentWillMount", - "UNSAFE_componentWillMount", - "componentDidMount", - "componentWillReceiveProps", - "UNSAFE_componentWillReceiveProps", - "shouldComponentUpdate", - "componentWillUpdate", - "UNSAFE_componentWillUpdate", - "getSnapshotBeforeUpdate", - "componentDidUpdate", - "componentDidCatch", - "componentWillUnmount" - ], - "rendering": [ - "/^render.+$/", - "render" - ] - } - } - ], - "react/jsx-no-target-blank": [ - "error", - { - "enforceDynamicLinks": "always", - "links": true, - "forms": false - } - ], - "react/jsx-no-comment-textnodes": [ - "error" - ], - "react/no-render-return-value": [ - "error" - ], - "react/require-optimization": [ - "off", - { - "allowDecorators": [] - } - ], - "react/no-find-dom-node": [ - "error" - ], - "react/forbid-component-props": [ - "off", - { - "forbid": [] - } - ], - "react/forbid-elements": [ - "off", - { - "forbid": [] - } - ], - "react/no-danger-with-children": [ - "error" - ], - "react/no-unused-prop-types": [ - "error", - { - "customValidators": [], - "skipShapeProps": true - } - ], - "react/style-prop-object": [ - "error" - ], - "react/no-unescaped-entities": [ - "error" - ], - "react/no-children-prop": [ - "error" - ], - "react/no-array-index-key": [ - "error" - ], - "react/require-default-props": [ - "error", - { - "forbidDefaultForRequired": true - } - ], - "react/forbid-foreign-prop-types": [ - "warn", - { - "allowInPropTypes": true - } - ], - "react/void-dom-elements-no-children": [ - "error" - ], - "react/default-props-match-prop-types": [ - "error", - { - "allowRequiredDefaults": false - } - ], - "react/no-redundant-should-component-update": [ - "error" - ], - "react/no-unused-state": [ - "error" - ], - "react/boolean-prop-naming": [ - "off", - { - "propTypeNames": [ - "bool", - "mutuallyExclusiveTrueProps" - ], - "rule": "^(is|has)[A-Z]([A-Za-z0-9]?)+", - "message": "" - } - ], - "react/no-typos": [ - "error" - ], - "react/jsx-curly-brace-presence": [ - "error", - { - "props": "never", - "children": "never" - } - ], - "react/destructuring-assignment": [ - "error", - "always" - ], - "react/no-access-state-in-setstate": [ - "error" - ], - "react/button-has-type": [ - "error", - { - "button": true, - "submit": true, - "reset": false - } - ], - "react/no-this-in-sfc": [ - "error" - ], - "react/jsx-max-depth": [ - "off" - ], - "react/no-unsafe": [ - "off" - ], - "react/jsx-fragments": [ - "error", - "syntax" - ], - "react/state-in-constructor": [ - "error", - "always" - ], - "react/static-property-placement": [ - "error", - "property assignment" - ], - "react/prefer-read-only-props": [ - "off" - ], - "react/jsx-no-script-url": [ - "error", - [ - { - "name": "Link", - "props": [ - "to" - ] - } - ] - ], - "react/jsx-no-useless-fragment": [ - "error" - ], - "react/no-adjacent-inline-elements": [ - "off" - ], - "react/jsx-no-constructed-context-values": [ - "error" - ], - "react/no-unstable-nested-components": [ - "error" - ], - "react/no-namespace": [ - "error" - ], - "react/prefer-exact-props": [ - "error" - ], - "react/no-arrow-function-lifecycle": [ - "error" - ], - "react/no-invalid-html-attribute": [ - "error" - ], - "react/no-unused-class-component-methods": [ - "error" - ], - "strict": [ - "error", - "never" - ], - "arrow-body-style": [ - "error", - "as-needed", - { - "requireReturnForObjectLiteral": false - } - ], - "constructor-super": [ - "error" - ], - "no-class-assign": [ - "error" - ], - "no-const-assign": [ - "error" - ], - "no-dupe-class-members": [ - "error" - ], - "no-duplicate-imports": [ - "off" - ], - "no-new-symbol": [ - "error" - ], - "no-restricted-exports": [ - "error", - { - "restrictedNamedExports": [ - "then" - ] - } - ], - "no-restricted-imports": [ - "off", - { - "paths": [], - "patterns": [] - } - ], - "no-this-before-super": [ - "error" - ], - "no-useless-computed-key": [ - "error" - ], - "no-useless-rename": [ - "error", - { - "ignoreDestructuring": false, - "ignoreImport": false, - "ignoreExport": false - } - ], - "no-var": [ - "error" - ], - "object-shorthand": [ - "error", - "always", - { - "ignoreConstructors": false, - "avoidQuotes": true - } - ], - "prefer-arrow-callback": [ - "error", - { - "allowNamedFunctions": false, - "allowUnboundThis": true - } - ], - "prefer-const": [ - "error", - { - "destructuring": "any", - "ignoreReadBeforeAssign": true - } - ], - "prefer-destructuring": [ - "error", - { - "VariableDeclarator": { - "array": false, - "object": true - }, - "AssignmentExpression": { - "array": true, - "object": false - } - }, - { - "enforceForRenamedProperties": false - } - ], - "prefer-numeric-literals": [ - "error" - ], - "prefer-reflect": [ - "off" - ], - "prefer-rest-params": [ - "error" - ], - "prefer-spread": [ - "error" - ], - "prefer-template": [ - "error" - ], - "require-yield": [ - "error" - ], - "sort-imports": [ - "off", - { - "ignoreCase": false, - "ignoreDeclarationSort": false, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single" - ] - } - ], - "symbol-description": [ - "error" - ], - "init-declarations": [ - "off" - ], - "no-catch-shadow": [ - "off" - ], - "no-delete-var": [ - "error" - ], - "no-label-var": [ - "error" - ], - "no-restricted-globals": [ - "error", - { - "name": "isFinite", - "message": "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite" - }, - { - "name": "isNaN", - "message": "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan" - }, - "addEventListener", - "blur", - "close", - "closed", - "confirm", - "defaultStatus", - "defaultstatus", - "event", - "external", - "find", - "focus", - "frameElement", - "frames", - "history", - "innerHeight", - "innerWidth", - "length", - "location", - "locationbar", - "menubar", - "moveBy", - "moveTo", - "name", - "onblur", - "onerror", - "onfocus", - "onload", - "onresize", - "onunload", - "open", - "opener", - "opera", - "outerHeight", - "outerWidth", - "pageXOffset", - "pageYOffset", - "parent", - "print", - "removeEventListener", - "resizeBy", - "resizeTo", - "screen", - "screenLeft", - "screenTop", - "screenX", - "screenY", - "scroll", - "scrollbars", - "scrollBy", - "scrollTo", - "scrollX", - "scrollY", - "self", - "status", - "statusbar", - "stop", - "toolbar", - "top" - ], - "no-shadow-restricted-names": [ - "error" - ], - "no-undef-init": [ - "error" - ], - "no-undefined": [ - "off" - ], - "capitalized-comments": [ - "off", - "never", - { - "line": { - "ignorePattern": ".*", - "ignoreInlineComments": true, - "ignoreConsecutiveComments": true - }, - "block": { - "ignorePattern": ".*", - "ignoreInlineComments": true, - "ignoreConsecutiveComments": true - } - } - ], - "consistent-this": [ - "off" - ], - "func-name-matching": [ - "off", - "always", - { - "includeCommonJSModuleExports": false, - "considerPropertyDescriptor": true - } - ], - "func-names": [ - "warn" - ], - "func-style": [ - "off", - "expression" - ], - "id-denylist": [ - "off" - ], - "id-length": [ - "off" - ], - "id-match": [ - "off" - ], - "line-comment-position": [ - "off", - { - "position": "above", - "ignorePattern": "", - "applyDefaultPatterns": true - } - ], - "lines-between-class-members": [ - "error", - "always", - { - "exceptAfterSingleLine": false - } - ], - "lines-around-directive": [ - "error", - { - "before": "always", - "after": "always" - } - ], - "max-depth": [ - "off", - 4 - ], - "max-lines": [ - "off", - { - "max": 300, - "skipBlankLines": true, - "skipComments": true - } - ], - "max-lines-per-function": [ - "off", - { - "max": 50, - "skipBlankLines": true, - "skipComments": true, - "IIFEs": true - } - ], - "max-nested-callbacks": [ - "off" - ], - "max-params": [ - "off", - 3 - ], - "max-statements": [ - "off", - 10 - ], - "max-statements-per-line": [ - "off", - { - "max": 1 - } - ], - "multiline-comment-style": [ - "off", - "starred-block" - ], - "new-cap": [ - "error", - { - "newIsCap": true, - "newIsCapExceptions": [], - "capIsNew": false, - "capIsNewExceptions": [ - "Immutable.Map", - "Immutable.Set", - "Immutable.List" - ], - "properties": true - } - ], - "newline-after-var": [ - "off" - ], - "newline-before-return": [ - "off" - ], - "no-bitwise": [ - "error" - ], - "no-continue": [ - "error" - ], - "no-inline-comments": [ - "off" - ], - "no-lonely-if": [ - "error" - ], - "no-multi-assign": [ - "error" - ], - "no-negated-condition": [ - "off" - ], - "no-nested-ternary": [ - "error" - ], - "no-new-object": [ - "error" - ], - "no-plusplus": [ - "error" - ], - "no-restricted-syntax": [ - "error", - { - "selector": "ForInStatement", - "message": "for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array." - }, - { - "selector": "LabeledStatement", - "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand." - }, - { - "selector": "WithStatement", - "message": "`with` is disallowed in strict mode because it makes code impossible to predict and optimize." - } - ], - "no-ternary": [ - "off" - ], - "no-unneeded-ternary": [ - "error", - { - "defaultAssignment": false - } - ], - "one-var": [ - "error", - "never" - ], - "operator-assignment": [ - "error", - "always" - ], - "padding-line-between-statements": [ - "off" - ], - "prefer-exponentiation-operator": [ - "error" - ], - "prefer-object-spread": [ - "error" - ], - "require-jsdoc": [ - "off" - ], - "sort-keys": [ - "off", - "asc", - { - "caseSensitive": false, - "natural": true - } - ], - "sort-vars": [ - "off" - ], - "spaced-comment": [ - "error", - "always", - { - "line": { - "exceptions": [ - "-", - "+" - ], - "markers": [ - "=", - "!", - "/" - ] - }, - "block": { - "exceptions": [ - "-", - "+" - ], - "markers": [ - "=", - "!", - ":", - "::" - ], - "balanced": true - } - } - ], - "callback-return": [ - "off" - ], - "global-require": [ - "off" - ], - "handle-callback-err": [ - "off" - ], - "no-buffer-constructor": [ - "error" - ], - "no-mixed-requires": [ - "off", - false - ], - "no-new-require": [ - "error" - ], - "no-path-concat": [ - "error" - ], - "no-process-env": [ - "off" - ], - "no-process-exit": [ - "off" - ], - "no-restricted-modules": [ - "off" - ], - "no-sync": [ - "off" - ], - "for-direction": [ - "error" - ], - "getter-return": [ - "error", - { - "allowImplicit": true - } - ], - "no-async-promise-executor": [ - "error" - ], - "no-await-in-loop": [ - "error" - ], - "no-compare-neg-zero": [ - "error" - ], - "no-cond-assign": [ - "error", - "always" - ], - "no-console": [ - "warn" - ], - "no-constant-condition": [ - "warn" - ], - "no-control-regex": [ - "error" - ], - "no-debugger": [ - "error" - ], - "no-dupe-args": [ - "error" - ], - "no-dupe-else-if": [ - "error" - ], - "no-dupe-keys": [ - "error" - ], - "no-duplicate-case": [ - "error" - ], - "no-empty": [ - "error" - ], - "no-empty-character-class": [ - "error" - ], - "no-ex-assign": [ - "error" - ], - "no-extra-boolean-cast": [ - "error" - ], - "no-func-assign": [ - "error" - ], - "no-import-assign": [ - "error" - ], - "no-inner-declarations": [ - "error" - ], - "no-invalid-regexp": [ - "error" - ], - "no-irregular-whitespace": [ - "error" - ], - "no-loss-of-precision": [ - "error" - ], - "no-misleading-character-class": [ - "error" - ], - "no-obj-calls": [ - "error" - ], - "no-promise-executor-return": [ - "error" - ], - "no-prototype-builtins": [ - "error" - ], - "no-regex-spaces": [ - "error" - ], - "no-setter-return": [ - "error" - ], - "no-sparse-arrays": [ - "error" - ], - "no-template-curly-in-string": [ - "error" - ], - "no-unreachable": [ - "error" - ], - "no-unreachable-loop": [ - "error", - { - "ignore": [] - } - ], - "no-unsafe-finally": [ - "error" - ], - "no-unsafe-negation": [ - "error" - ], - "no-unsafe-optional-chaining": [ - "error", - { - "disallowArithmeticOperators": true - } - ], - "no-unused-private-class-members": [ - "off" - ], - "no-useless-backreference": [ - "error" - ], - "no-negated-in-lhs": [ - "off" - ], - "require-atomic-updates": [ - "off" - ], - "use-isnan": [ - "error" - ], - "valid-jsdoc": [ - "off" - ], - "valid-typeof": [ - "error", - { - "requireStringLiterals": true - } - ], - "accessor-pairs": [ - "off" - ], - "array-callback-return": [ - "error", - { - "allowImplicit": true, - "checkForEach": false - } - ], - "block-scoped-var": [ - "error" - ], - "complexity": [ - "off", - 20 - ], - "consistent-return": [ - "error" - ], - "default-case": [ - "error", - { - "commentPattern": "^no default$" - } - ], - "default-case-last": [ - "error" - ], - "default-param-last": [ - "off" - ], - "dot-notation": [ - "error", - { - "allowKeywords": true, - "allowPattern": "" - } - ], - "eqeqeq": [ - "error", - "always", - { - "null": "ignore" - } - ], - "grouped-accessor-pairs": [ - "error" - ], - "guard-for-in": [ - "error" - ], - "max-classes-per-file": [ - "error", - 1 - ], - "no-alert": [ - "warn" - ], - "no-caller": [ - "error" - ], - "no-case-declarations": [ - "error" - ], - "no-constructor-return": [ - "error" - ], - "no-div-regex": [ - "off" - ], - "no-else-return": [ - "error", - { - "allowElseIf": false - } - ], - "no-empty-pattern": [ - "error" - ], - "no-eq-null": [ - "off" - ], - "no-eval": [ - "error" - ], - "no-extend-native": [ - "error" - ], - "no-extra-bind": [ - "error" - ], - "no-extra-label": [ - "error" - ], - "no-fallthrough": [ - "error" - ], - "no-global-assign": [ - "error", - { - "exceptions": [] - } - ], - "no-native-reassign": [ - "off" - ], - "no-implicit-coercion": [ - "off", - { - "boolean": false, - "number": true, - "string": true, - "allow": [] - } - ], - "no-implicit-globals": [ - "off" - ], - "no-implied-eval": [ - "error" - ], - "no-invalid-this": [ - "off" - ], - "no-iterator": [ - "error" - ], - "no-labels": [ - "error", - { - "allowLoop": false, - "allowSwitch": false - } - ], - "no-lone-blocks": [ - "error" - ], - "no-loop-func": [ - "error" - ], - "no-multi-str": [ - "error" - ], - "no-new": [ - "error" - ], - "no-new-func": [ - "error" - ], - "no-new-wrappers": [ - "error" - ], - "no-nonoctal-decimal-escape": [ - "error" - ], - "no-octal": [ - "error" - ], - "no-octal-escape": [ - "error" - ], - "no-param-reassign": [ - "error", - { - "props": true, - "ignorePropertyModificationsFor": [ - "acc", - "accumulator", - "e", - "ctx", - "context", - "req", - "request", - "res", - "response", - "$scope", - "staticContext" - ] - } - ], - "no-proto": [ - "error" - ], - "no-redeclare": [ - "error" - ], - "no-restricted-properties": [ - "error", - { - "object": "arguments", - "property": "callee", - "message": "arguments.callee is deprecated" - }, - { - "object": "global", - "property": "isFinite", - "message": "Please use Number.isFinite instead" - }, - { - "object": "self", - "property": "isFinite", - "message": "Please use Number.isFinite instead" - }, - { - "object": "window", - "property": "isFinite", - "message": "Please use Number.isFinite instead" - }, - { - "object": "global", - "property": "isNaN", - "message": "Please use Number.isNaN instead" - }, - { - "object": "self", - "property": "isNaN", - "message": "Please use Number.isNaN instead" - }, - { - "object": "window", - "property": "isNaN", - "message": "Please use Number.isNaN instead" - }, - { - "property": "__defineGetter__", - "message": "Please use Object.defineProperty instead." - }, - { - "property": "__defineSetter__", - "message": "Please use Object.defineProperty instead." - }, - { - "object": "Math", - "property": "pow", - "message": "Use the exponentiation operator (**) instead." - } - ], - "no-return-assign": [ - "error", - "always" - ], - "no-return-await": [ - "error" - ], - "no-script-url": [ - "error" - ], - "no-self-assign": [ - "error", - { - "props": true - } - ], - "no-self-compare": [ - "error" - ], - "no-sequences": [ - "error" - ], - "no-throw-literal": [ - "error" - ], - "no-unmodified-loop-condition": [ - "off" - ], - "no-unused-labels": [ - "error" - ], - "no-useless-call": [ - "off" - ], - "no-useless-catch": [ - "error" - ], - "no-useless-concat": [ - "error" - ], - "no-useless-escape": [ - "error" - ], - "no-useless-return": [ - "error" - ], - "no-void": [ - "error" - ], - "no-warning-comments": [ - "off", - { - "terms": [ - "todo", - "fixme", - "xxx" - ], - "location": "start" - } - ], - "no-with": [ - "error" - ], - "prefer-promise-reject-errors": [ - "error", - { - "allowEmptyReject": true - } - ], - "prefer-named-capture-group": [ - "off" - ], - "prefer-regex-literals": [ - "error", - { - "disallowRedundantWrapping": true - } - ], - "radix": [ - "error" - ], - "require-await": [ - "off" - ], - "require-unicode-regexp": [ - "off" - ], - "vars-on-top": [ - "error" - ], - "yoda": [ - "error" - ] - } -} diff --git a/config/eslint/src/eslintrc.ts b/config/eslint/src/eslintrc.ts new file mode 100644 index 000000000..2d6e32136 --- /dev/null +++ b/config/eslint/src/eslintrc.ts @@ -0,0 +1,28 @@ +module.exports = { + rules: require('./rules-common'), + plugins: [ + 'eslint-plugin-react', + 'eslint-plugin-jsx-a11y', + '@typescript-eslint/eslint-plugin', + 'eslint-plugin-react-hooks', + ], + reportUnusedDisableDirectives: true, + globals: {}, + settings: { + react: { + pragma: 'React', + version: '17.0.2', + }, + propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'], + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true, + generators: false, + objectLiteralDuplicateProperties: false, + }, + ecmaVersion: 2020, + sourceType: 'module', + }, +} diff --git a/config/eslint/src/index.ts b/config/eslint/src/index.ts index a89af78d2..ff8baeec0 100644 --- a/config/eslint/src/index.ts +++ b/config/eslint/src/index.ts @@ -6,7 +6,7 @@ import react from 'eslint-plugin-react' import reactHooks from 'eslint-plugin-react-hooks' import eslintPluginReactHooks from 'eslint-plugin-react-hooks' -import eslintrc from './.eslintrc' +import eslintrc from './rules' export default [ { diff --git a/config/eslint/src/rules-common.ts b/config/eslint/src/rules-common.ts new file mode 100644 index 000000000..22ab579c2 --- /dev/null +++ b/config/eslint/src/rules-common.ts @@ -0,0 +1,1382 @@ +module.exports = { + 'no-undef': ['off'], + 'brace-style': 'off', + '@typescript-eslint/brace-style': 'off', + camelcase: [ + 'off', + { + properties: 'never', + ignoreDestructuring: false, + ignoreImports: false, + ignoreGlobals: false, + }, + ], + 'func-call-spacing': 'off', + '@typescript-eslint/func-call-spacing': 'off', + indent: 'off', + 'no-array-constructor': ['off'], + '@typescript-eslint/no-array-constructor': ['error'], + 'no-extra-parens': 'off', + '@typescript-eslint/no-extra-parens': 'off', + 'no-magic-numbers': [ + 'off', + { + ignore: [], + ignoreArrayIndexes: true, + enforceConst: true, + detectObjects: false, + }, + ], + '@typescript-eslint/no-magic-numbers': [ + 'off', + { + ignore: [], + ignoreArrayIndexes: true, + enforceConst: true, + detectObjects: false, + }, + ], + 'no-unused-expressions': [ + 'off', + { + allowShortCircuit: false, + allowTernary: false, + allowTaggedTemplates: false, + enforceForJSX: false, + }, + ], + '@typescript-eslint/no-unused-expressions': [ + 'error', + { + allowShortCircuit: false, + allowTernary: false, + allowTaggedTemplates: false, + enforceForJSX: false, + }, + ], + 'no-unused-vars': [ + 'off', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: true, + }, + ], + 'no-use-before-define': [ + 'off', + { + functions: true, + classes: true, + variables: true, + }, + ], + '@typescript-eslint/no-use-before-define': [ + 'error', + { + functions: true, + classes: true, + variables: true, + }, + ], + quotes: 0, + '@typescript-eslint/quotes': 0, + semi: 'off', + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'variable', + format: ['camelCase', 'PascalCase', 'UPPER_CASE'], + }, + { + selector: 'function', + format: ['camelCase', 'PascalCase'], + }, + { + selector: 'typeLike', + format: ['PascalCase'], + }, + ], + 'class-methods-use-this': [ + 0, + { + exceptMethods: [ + 'render', + 'getInitialState', + 'getDefaultProps', + 'getChildContext', + 'componentWillMount', + 'UNSAFE_componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'UNSAFE_componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'UNSAFE_componentWillUpdate', + 'componentDidUpdate', + 'componentWillUnmount', + 'componentDidCatch', + 'getSnapshotBeforeUpdate', + ], + enforceForClassFields: true, + }, + ], + 'jsx-a11y/html-has-lang': [0], + 'react/function-component-definition': [ + 2, + { + namedComponents: 'arrow-function', + }, + ], + 'react/jsx-props-no-spreading': [ + 0, + { + html: 'enforce', + custom: 'enforce', + explicitSpread: 'ignore', + exceptions: [], + }, + ], + 'react/jsx-filename-extension': [ + 1, + { + extensions: ['.js', '.jsx', '.tsx'], + }, + ], + 'react/prop-types': [ + 0, + { + ignore: [], + customValidators: [], + skipUndeclared: false, + }, + ], + 'react/no-danger': [0], + '@typescript-eslint/semi': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + args: 'none', + }, + ], + 'no-useless-constructor': ['off'], + '@typescript-eslint/no-useless-constructor': ['error'], + 'no-empty-function': [ + 'off', + { + allow: ['arrowFunctions', 'functions', 'methods'], + }, + ], + '@typescript-eslint/no-empty-function': ['error'], + '@typescript-eslint/indent': 'off', + '@typescript-eslint/no-shadow': [ + 'error', + { + allow: ['ClientFactory', 'ServerBuilder'], + builtinGlobals: false, + hoist: 'functions', + }, + ], + 'no-shadow': 'off', + curly: 0, + 'lines-around-comment': 0, + 'max-len': 0, + 'no-confusing-arrow': 0, + 'no-mixed-operators': 0, + 'no-tabs': 0, + 'no-unexpected-multiline': 0, + 'babel/quotes': 0, + 'vue/html-self-closing': 0, + 'vue/max-len': 0, + 'array-bracket-newline': 'off', + 'array-bracket-spacing': 'off', + 'array-element-newline': 'off', + 'arrow-parens': 'off', + 'arrow-spacing': 'off', + 'block-spacing': 'off', + 'comma-dangle': 'off', + 'comma-spacing': 'off', + 'comma-style': 'off', + 'computed-property-spacing': 'off', + 'dot-location': 'off', + 'eol-last': 'off', + 'function-call-argument-newline': 'off', + 'function-paren-newline': 'off', + 'generator-star': 'off', + 'generator-star-spacing': 'off', + 'implicit-arrow-linebreak': 'off', + 'jsx-quotes': 'off', + 'key-spacing': 'off', + 'keyword-spacing': 'off', + 'linebreak-style': 'off', + 'multiline-ternary': 'off', + 'newline-per-chained-call': 'off', + 'new-parens': 'off', + 'no-arrow-condition': 'off', + 'no-comma-dangle': 'off', + 'no-extra-semi': 'off', + 'no-floating-decimal': 'off', + 'no-mixed-spaces-and-tabs': 'off', + 'no-multi-spaces': 'off', + 'no-multiple-empty-lines': 'off', + 'no-reserved-keys': 'off', + 'no-space-before-semi': 'off', + 'no-trailing-spaces': 'off', + 'no-whitespace-before-property': 'off', + 'no-wrap-func': 'off', + 'nonblock-statement-body-position': 'off', + 'object-curly-newline': 'off', + 'object-curly-spacing': 'off', + 'object-property-newline': 'off', + 'one-var-declaration-per-line': 'off', + 'operator-linebreak': 'off', + 'padded-blocks': 'off', + 'quote-props': 'off', + 'rest-spread-spacing': 'off', + 'semi-spacing': 'off', + 'semi-style': 'off', + 'space-after-function-name': 'off', + 'space-after-keywords': 'off', + 'space-before-blocks': 'off', + 'space-before-function-paren': 'off', + 'space-before-function-parentheses': 'off', + 'space-before-keywords': 'off', + 'space-in-brackets': 'off', + 'space-in-parens': 'off', + 'space-infix-ops': 'off', + 'space-return-throw-case': 'off', + 'space-unary-ops': 'off', + 'space-unary-word-ops': 'off', + 'switch-colon-spacing': 'off', + 'template-curly-spacing': 'off', + 'template-tag-spacing': 'off', + 'unicode-bom': 'off', + 'wrap-iife': 'off', + 'wrap-regex': 'off', + 'yield-star-spacing': 'off', + '@babel/object-curly-spacing': 'off', + '@babel/semi': 'off', + '@typescript-eslint/comma-dangle': 'off', + '@typescript-eslint/comma-spacing': 'off', + '@typescript-eslint/keyword-spacing': 'off', + '@typescript-eslint/member-delimiter-style': 'off', + '@typescript-eslint/no-extra-semi': 'off', + '@typescript-eslint/object-curly-spacing': 'off', + '@typescript-eslint/space-before-function-paren': 'off', + '@typescript-eslint/space-infix-ops': 'off', + '@typescript-eslint/type-annotation-spacing': 'off', + 'babel/object-curly-spacing': 'off', + 'babel/semi': 'off', + 'flowtype/boolean-style': 'off', + 'flowtype/delimiter-dangle': 'off', + 'flowtype/generic-spacing': 'off', + 'flowtype/object-type-curly-spacing': 'off', + 'flowtype/object-type-delimiter': 'off', + 'flowtype/quotes': 'off', + 'flowtype/semi': 'off', + 'flowtype/space-after-type-colon': 'off', + 'flowtype/space-before-generic-bracket': 'off', + 'flowtype/space-before-type-colon': 'off', + 'flowtype/union-intersection-spacing': 'off', + 'react/jsx-child-element-spacing': 'off', + 'react/jsx-closing-bracket-location': 'off', + 'react/jsx-closing-tag-location': 'off', + 'react/jsx-curly-newline': 'off', + 'react/jsx-curly-spacing': 'off', + 'react/jsx-equals-spacing': 'off', + 'react/jsx-first-prop-new-line': 'off', + 'react/jsx-indent': 'off', + 'react/jsx-indent-props': 'off', + 'react/jsx-max-props-per-line': 'off', + 'react/jsx-newline': 'off', + 'react/jsx-one-expression-per-line': 'off', + 'react/jsx-props-no-multi-spaces': 'off', + 'react/jsx-tag-spacing': 'off', + 'react/jsx-wrap-multilines': 'off', + 'standard/array-bracket-even-spacing': 'off', + 'standard/computed-property-even-spacing': 'off', + 'standard/object-curly-even-spacing': 'off', + 'unicorn/empty-brace-spaces': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/number-literal-case': 'off', + 'vue/array-bracket-newline': 'off', + 'vue/array-bracket-spacing': 'off', + 'vue/arrow-spacing': 'off', + 'vue/block-spacing': 'off', + 'vue/block-tag-newline': 'off', + 'vue/brace-style': 'off', + 'vue/comma-dangle': 'off', + 'vue/comma-spacing': 'off', + 'vue/comma-style': 'off', + 'vue/dot-location': 'off', + 'vue/func-call-spacing': 'off', + 'vue/html-closing-bracket-newline': 'off', + 'vue/html-closing-bracket-spacing': 'off', + 'vue/html-end-tags': 'off', + 'vue/html-indent': 'off', + 'vue/html-quotes': 'off', + 'vue/key-spacing': 'off', + 'vue/keyword-spacing': 'off', + 'vue/max-attributes-per-line': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/mustache-interpolation-spacing': 'off', + 'vue/no-extra-parens': 'off', + 'vue/no-multi-spaces': 'off', + 'vue/no-spaces-around-equal-signs-in-attribute': 'off', + 'vue/object-curly-newline': 'off', + 'vue/object-curly-spacing': 'off', + 'vue/object-property-newline': 'off', + 'vue/operator-linebreak': 'off', + 'vue/script-indent': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/space-in-parens': 'off', + 'vue/space-infix-ops': 'off', + 'vue/space-unary-ops': 'off', + 'vue/template-curly-spacing': 'off', + 'indent-legacy': ['off'], + 'no-spaced-func': ['off'], + 'react/jsx-space-before-closing': ['off', 'always'], + 'react-hooks/rules-of-hooks': ['error'], + 'react-hooks/exhaustive-deps': ['error'], + 'jsx-a11y/accessible-emoji': ['off'], + 'jsx-a11y/alt-text': [ + 'error', + { + elements: ['img', 'object', 'area', 'input[type="image"]'], + img: [], + object: [], + area: [], + 'input[type="image"]': [], + }, + ], + 'jsx-a11y/anchor-has-content': [ + 'error', + { + components: [], + }, + ], + 'jsx-a11y/anchor-is-valid': [ + 'error', + { + components: ['Link'], + specialLink: ['to'], + aspects: ['noHref', 'invalidHref', 'preferButton'], + }, + ], + 'jsx-a11y/aria-activedescendant-has-tabindex': ['error'], + 'jsx-a11y/aria-props': ['error'], + 'jsx-a11y/aria-proptypes': ['error'], + 'jsx-a11y/aria-role': [ + 'error', + { + ignoreNonDOM: false, + }, + ], + 'jsx-a11y/aria-unsupported-elements': ['error'], + 'jsx-a11y/autocomplete-valid': [ + 'off', + { + inputComponents: [], + }, + ], + 'jsx-a11y/click-events-have-key-events': ['error'], + 'jsx-a11y/control-has-associated-label': [ + 'error', + { + labelAttributes: ['label'], + controlComponents: [], + ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'], + ignoreRoles: [ + 'grid', + 'listbox', + 'menu', + 'menubar', + 'radiogroup', + 'row', + 'tablist', + 'toolbar', + 'tree', + 'treegrid', + ], + depth: 5, + }, + ], + 'jsx-a11y/heading-has-content': [ + 'error', + { + components: [''], + }, + ], + 'jsx-a11y/iframe-has-title': ['error'], + 'jsx-a11y/img-redundant-alt': ['error'], + 'jsx-a11y/interactive-supports-focus': ['error'], + 'jsx-a11y/label-has-associated-control': [ + 'error', + { + labelComponents: [], + labelAttributes: [], + controlComponents: [], + assert: 'both', + depth: 25, + }, + ], + 'jsx-a11y/lang': ['error'], + 'jsx-a11y/media-has-caption': [ + 'error', + { + audio: [], + video: [], + track: [], + }, + ], + 'jsx-a11y/mouse-events-have-key-events': ['error'], + 'jsx-a11y/no-access-key': ['error'], + 'jsx-a11y/no-autofocus': [ + 'error', + { + ignoreNonDOM: true, + }, + ], + 'jsx-a11y/no-distracting-elements': [ + 'error', + { + elements: ['marquee', 'blink'], + }, + ], + 'jsx-a11y/no-interactive-element-to-noninteractive-role': [ + 'error', + { + tr: ['none', 'presentation'], + }, + ], + 'jsx-a11y/no-noninteractive-element-interactions': [ + 'error', + { + handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'], + }, + ], + 'jsx-a11y/no-noninteractive-element-to-interactive-role': [ + 'error', + { + ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], + ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], + li: ['menuitem', 'option', 'row', 'tab', 'treeitem'], + table: ['grid'], + td: ['gridcell'], + }, + ], + 'jsx-a11y/no-noninteractive-tabindex': [ + 'error', + { + tags: [], + roles: ['tabpanel'], + }, + ], + 'jsx-a11y/no-onchange': ['off'], + 'jsx-a11y/no-redundant-roles': ['error'], + 'jsx-a11y/no-static-element-interactions': [ + 'error', + { + handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'], + }, + ], + 'jsx-a11y/role-has-required-aria-props': ['error'], + 'jsx-a11y/role-supports-aria-props': ['error'], + 'jsx-a11y/scope': ['error'], + 'jsx-a11y/tabindex-no-positive': ['error'], + 'jsx-a11y/label-has-for': [ + 'off', + { + components: [], + required: { + every: ['nesting', 'id'], + }, + allowChildren: false, + }, + ], + 'no-underscore-dangle': [ + 'error', + { + allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'], + allowAfterThis: false, + allowAfterSuper: false, + enforceInMethodNames: true, + allowAfterThisConstructor: false, + allowFunctionParams: true, + }, + ], + 'react/display-name': [ + 'off', + { + ignoreTranspilerName: false, + }, + ], + 'react/forbid-prop-types': [ + 'error', + { + forbid: ['any', 'array', 'object'], + checkContextTypes: true, + checkChildContextTypes: true, + }, + ], + 'react/forbid-dom-props': [ + 'off', + { + forbid: [], + }, + ], + 'react/jsx-boolean-value': [ + 'error', + 'never', + { + always: [], + }, + ], + 'react/jsx-handler-names': [ + 'off', + { + eventHandlerPrefix: 'handle', + eventHandlerPropPrefix: 'on', + }, + ], + 'react/jsx-key': ['off'], + 'react/jsx-no-bind': [ + 'error', + { + ignoreRefs: true, + allowArrowFunctions: true, + allowFunctions: false, + allowBind: false, + ignoreDOMComponents: true, + }, + ], + 'react/jsx-no-duplicate-props': [ + 'error', + { + ignoreCase: true, + }, + ], + 'react/jsx-no-literals': [ + 'off', + { + noStrings: true, + }, + ], + 'react/jsx-no-undef': ['error'], + 'react/jsx-pascal-case': [ + 'error', + { + allowAllCaps: true, + ignore: [], + }, + ], + 'react/sort-prop-types': [ + 'off', + { + ignoreCase: true, + callbacksLast: false, + requiredFirst: false, + sortShapeProp: true, + }, + ], + 'react/jsx-sort-prop-types': ['off'], + 'react/jsx-sort-props': [ + 'off', + { + ignoreCase: true, + callbacksLast: false, + shorthandFirst: false, + shorthandLast: false, + noSortAlphabetically: false, + reservedFirst: true, + }, + ], + 'react/jsx-sort-default-props': [ + 'off', + { + ignoreCase: true, + }, + ], + 'react/jsx-uses-react': ['error'], + 'react/jsx-uses-vars': ['error'], + 'react/no-deprecated': ['error'], + 'react/no-did-mount-set-state': ['off'], + 'react/no-did-update-set-state': ['error'], + 'react/no-will-update-set-state': ['error'], + 'react/no-direct-mutation-state': ['off'], + 'react/no-is-mounted': ['error'], + 'react/no-multi-comp': ['off'], + 'react/no-set-state': ['off'], + 'react/no-string-refs': ['error'], + 'react/no-unknown-property': ['error'], + 'react/prefer-es6-class': ['error', 'always'], + 'react/prefer-stateless-function': [ + 'error', + { + ignorePureComponents: true, + }, + ], + 'react/react-in-jsx-scope': ['error'], + 'react/require-render-return': ['error'], + 'react/self-closing-comp': ['error'], + 'react/sort-comp': [ + 'error', + { + order: [ + 'static-variables', + 'static-methods', + 'instance-variables', + 'lifecycle', + '/^handle.+$/', + '/^on.+$/', + 'getters', + 'setters', + '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', + 'instance-methods', + 'everything-else', + 'rendering', + ], + groups: { + lifecycle: [ + 'displayName', + 'propTypes', + 'contextTypes', + 'childContextTypes', + 'mixins', + 'statics', + 'defaultProps', + 'constructor', + 'getDefaultProps', + 'getInitialState', + 'state', + 'getChildContext', + 'getDerivedStateFromProps', + 'componentWillMount', + 'UNSAFE_componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'UNSAFE_componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'UNSAFE_componentWillUpdate', + 'getSnapshotBeforeUpdate', + 'componentDidUpdate', + 'componentDidCatch', + 'componentWillUnmount', + ], + rendering: ['/^render.+$/', 'render'], + }, + }, + ], + 'react/jsx-no-target-blank': [ + 'error', + { + enforceDynamicLinks: 'always', + links: true, + forms: false, + }, + ], + 'react/jsx-no-comment-textnodes': ['error'], + 'react/no-render-return-value': ['error'], + 'react/require-optimization': [ + 'off', + { + allowDecorators: [], + }, + ], + 'react/no-find-dom-node': ['error'], + 'react/forbid-component-props': [ + 'off', + { + forbid: [], + }, + ], + 'react/forbid-elements': [ + 'off', + { + forbid: [], + }, + ], + 'react/no-danger-with-children': ['error'], + 'react/no-unused-prop-types': [ + 'error', + { + customValidators: [], + skipShapeProps: true, + }, + ], + 'react/style-prop-object': ['error'], + 'react/no-unescaped-entities': ['error'], + 'react/no-children-prop': ['error'], + 'react/no-array-index-key': ['error'], + 'react/require-default-props': ['off'], + 'react/forbid-foreign-prop-types': [ + 'warn', + { + allowInPropTypes: true, + }, + ], + 'react/void-dom-elements-no-children': ['error'], + 'react/default-props-match-prop-types': ['off'], + 'react/no-redundant-should-component-update': ['error'], + 'react/no-unused-state': ['error'], + 'react/boolean-prop-naming': [ + 'off', + { + propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'], + rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+', + message: '', + }, + ], + 'react/no-typos': ['error'], + 'react/jsx-curly-brace-presence': [ + 'error', + { + props: 'never', + children: 'never', + }, + ], + 'react/destructuring-assignment': ['error', 'always'], + 'react/no-access-state-in-setstate': ['error'], + 'react/button-has-type': [ + 'error', + { + button: true, + submit: true, + reset: false, + }, + ], + 'react/no-this-in-sfc': ['error'], + 'react/jsx-max-depth': ['off'], + 'react/no-unsafe': ['off'], + 'react/jsx-fragments': ['error', 'syntax'], + 'react/state-in-constructor': ['error', 'always'], + 'react/static-property-placement': ['error', 'property assignment'], + 'react/prefer-read-only-props': ['off'], + 'react/jsx-no-script-url': [ + 'error', + [ + { + name: 'Link', + props: ['to'], + }, + ], + ], + 'react/jsx-no-useless-fragment': ['error'], + 'react/no-adjacent-inline-elements': ['off'], + 'react/jsx-no-constructed-context-values': ['error'], + 'react/no-unstable-nested-components': ['off'], + 'react/no-namespace': ['error'], + 'react/prefer-exact-props': ['error'], + 'react/no-arrow-function-lifecycle': ['error'], + 'react/no-invalid-html-attribute': ['error'], + 'react/no-unused-class-component-methods': ['error'], + strict: ['error', 'never'], + 'arrow-body-style': [ + 'error', + 'as-needed', + { + requireReturnForObjectLiteral: false, + }, + ], + 'constructor-super': ['error'], + 'no-class-assign': ['error'], + 'no-const-assign': ['error'], + 'no-dupe-class-members': ['error'], + 'no-duplicate-imports': ['off'], + 'no-new-symbol': ['error'], + 'no-restricted-exports': [ + 'error', + { + restrictedNamedExports: ['then'], + }, + ], + 'no-restricted-imports': [ + 'off', + { + paths: [], + patterns: [], + }, + ], + 'no-this-before-super': ['error'], + 'no-useless-computed-key': ['error'], + 'no-useless-rename': [ + 'error', + { + ignoreDestructuring: false, + ignoreImport: false, + ignoreExport: false, + }, + ], + 'no-var': ['error'], + 'object-shorthand': [ + 'error', + 'always', + { + ignoreConstructors: false, + avoidQuotes: true, + }, + ], + 'prefer-arrow-callback': [ + 'error', + { + allowNamedFunctions: false, + allowUnboundThis: true, + }, + ], + 'prefer-const': [ + 'error', + { + destructuring: 'any', + ignoreReadBeforeAssign: true, + }, + ], + 'prefer-destructuring': [ + 'error', + { + VariableDeclarator: { + array: false, + object: true, + }, + AssignmentExpression: { + array: true, + object: false, + }, + }, + { + enforceForRenamedProperties: false, + }, + ], + 'prefer-numeric-literals': ['error'], + 'prefer-reflect': ['off'], + 'prefer-rest-params': ['error'], + 'prefer-spread': ['error'], + 'prefer-template': ['error'], + 'require-yield': ['error'], + 'sort-imports': [ + 'off', + { + ignoreCase: false, + ignoreDeclarationSort: false, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + }, + ], + 'symbol-description': ['error'], + 'init-declarations': ['off'], + 'no-catch-shadow': ['off'], + 'no-delete-var': ['error'], + 'no-label-var': ['error'], + 'no-restricted-globals': [ + 'error', + { + name: 'isFinite', + message: + 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite', + }, + { + name: 'isNaN', + message: + 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan', + }, + 'addEventListener', + 'blur', + 'close', + 'closed', + 'confirm', + 'defaultStatus', + 'defaultstatus', + 'event', + 'external', + 'find', + 'focus', + 'frameElement', + 'frames', + 'history', + 'innerHeight', + 'innerWidth', + 'length', + 'location', + 'locationbar', + 'menubar', + 'moveBy', + 'moveTo', + 'name', + 'onblur', + 'onerror', + 'onfocus', + 'onload', + 'onresize', + 'onunload', + 'open', + 'opener', + 'opera', + 'outerHeight', + 'outerWidth', + 'pageXOffset', + 'pageYOffset', + 'parent', + 'print', + 'removeEventListener', + 'resizeBy', + 'resizeTo', + 'screen', + 'screenLeft', + 'screenTop', + 'screenX', + 'screenY', + 'scroll', + 'scrollbars', + 'scrollBy', + 'scrollTo', + 'scrollX', + 'scrollY', + 'self', + 'status', + 'statusbar', + 'stop', + 'toolbar', + 'top', + ], + 'no-shadow-restricted-names': ['error'], + 'no-undef-init': ['error'], + 'no-undefined': ['off'], + 'capitalized-comments': [ + 'off', + 'never', + { + line: { + ignorePattern: '.*', + ignoreInlineComments: true, + ignoreConsecutiveComments: true, + }, + block: { + ignorePattern: '.*', + ignoreInlineComments: true, + ignoreConsecutiveComments: true, + }, + }, + ], + 'consistent-this': ['off'], + 'func-name-matching': [ + 'off', + 'always', + { + includeCommonJSModuleExports: false, + considerPropertyDescriptor: true, + }, + ], + 'func-names': ['warn'], + 'func-style': ['off', 'expression'], + 'id-denylist': ['off'], + 'id-length': ['off'], + 'id-match': ['off'], + 'line-comment-position': [ + 'off', + { + position: 'above', + ignorePattern: '', + applyDefaultPatterns: true, + }, + ], + 'lines-between-class-members': [ + 'error', + 'always', + { + exceptAfterSingleLine: false, + }, + ], + 'lines-around-directive': [ + 'error', + { + before: 'always', + after: 'always', + }, + ], + 'max-depth': ['off', 4], + 'max-lines': [ + 'off', + { + max: 300, + skipBlankLines: true, + skipComments: true, + }, + ], + 'max-lines-per-function': [ + 'off', + { + max: 50, + skipBlankLines: true, + skipComments: true, + IIFEs: true, + }, + ], + 'max-nested-callbacks': ['off'], + 'max-params': ['off', 3], + 'max-statements': ['off', 10], + 'max-statements-per-line': [ + 'off', + { + max: 1, + }, + ], + 'multiline-comment-style': ['off', 'starred-block'], + 'new-cap': [ + 'error', + { + newIsCap: true, + newIsCapExceptions: [], + capIsNew: false, + capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'], + properties: true, + }, + ], + 'newline-after-var': ['off'], + 'newline-before-return': ['off'], + 'no-bitwise': ['error'], + 'no-continue': ['error'], + 'no-inline-comments': ['off'], + 'no-lonely-if': ['error'], + 'no-multi-assign': ['error'], + 'no-negated-condition': ['off'], + 'no-nested-ternary': ['error'], + 'no-new-object': ['error'], + 'no-plusplus': ['error'], + 'no-restricted-syntax': [ + 'error', + { + selector: 'ForInStatement', + message: + 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', + }, + { + selector: 'LabeledStatement', + message: + 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', + }, + { + selector: 'WithStatement', + message: + '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', + }, + ], + 'no-ternary': ['off'], + 'no-unneeded-ternary': [ + 'error', + { + defaultAssignment: false, + }, + ], + 'one-var': ['error', 'never'], + 'operator-assignment': ['error', 'always'], + 'padding-line-between-statements': ['off'], + 'prefer-exponentiation-operator': ['error'], + 'prefer-object-spread': ['error'], + 'require-jsdoc': ['off'], + 'sort-keys': [ + 'off', + 'asc', + { + caseSensitive: false, + natural: true, + }, + ], + 'sort-vars': ['off'], + 'spaced-comment': [ + 'error', + 'always', + { + line: { + exceptions: ['-', '+'], + markers: ['=', '!', '/'], + }, + block: { + exceptions: ['-', '+'], + markers: ['=', '!', ':', '::'], + balanced: true, + }, + }, + ], + 'callback-return': ['off'], + 'global-require': ['off'], + 'handle-callback-err': ['off'], + 'no-buffer-constructor': ['error'], + 'no-mixed-requires': ['off', false], + 'no-new-require': ['error'], + 'no-path-concat': ['error'], + 'no-process-env': ['off'], + 'no-process-exit': ['off'], + 'no-restricted-modules': ['off'], + 'no-sync': ['off'], + 'for-direction': ['error'], + 'getter-return': [ + 'error', + { + allowImplicit: true, + }, + ], + 'no-async-promise-executor': ['error'], + 'no-await-in-loop': ['error'], + 'no-compare-neg-zero': ['error'], + 'no-cond-assign': ['error', 'always'], + 'no-console': ['warn'], + 'no-constant-condition': ['warn'], + 'no-control-regex': ['error'], + 'no-debugger': ['error'], + 'no-dupe-args': ['error'], + 'no-dupe-else-if': ['error'], + 'no-dupe-keys': ['error'], + 'no-duplicate-case': ['error'], + 'no-empty': ['error'], + 'no-empty-character-class': ['error'], + 'no-ex-assign': ['error'], + 'no-extra-boolean-cast': ['error'], + 'no-func-assign': ['error'], + 'no-import-assign': ['error'], + 'no-inner-declarations': ['error'], + 'no-invalid-regexp': ['error'], + 'no-irregular-whitespace': ['error'], + 'no-loss-of-precision': ['error'], + 'no-misleading-character-class': ['error'], + 'no-obj-calls': ['error'], + 'no-promise-executor-return': ['error'], + 'no-prototype-builtins': ['error'], + 'no-regex-spaces': ['error'], + 'no-setter-return': ['error'], + 'no-sparse-arrays': ['error'], + 'no-template-curly-in-string': ['error'], + 'no-unreachable': ['error'], + 'no-unreachable-loop': [ + 'error', + { + ignore: [], + }, + ], + 'no-unsafe-finally': ['error'], + 'no-unsafe-negation': ['error'], + 'no-unsafe-optional-chaining': [ + 'error', + { + disallowArithmeticOperators: true, + }, + ], + 'no-unused-private-class-members': ['off'], + 'no-useless-backreference': ['error'], + 'no-negated-in-lhs': ['off'], + 'require-atomic-updates': ['off'], + 'use-isnan': ['error'], + 'valid-jsdoc': ['off'], + 'valid-typeof': [ + 'error', + { + requireStringLiterals: true, + }, + ], + 'accessor-pairs': ['off'], + 'array-callback-return': [ + 'error', + { + allowImplicit: true, + checkForEach: false, + }, + ], + 'block-scoped-var': ['error'], + complexity: ['off', 20], + 'consistent-return': ['error'], + 'default-case': [ + 'error', + { + commentPattern: '^no default$', + }, + ], + 'default-case-last': ['error'], + 'default-param-last': ['off'], + 'dot-notation': [ + 'error', + { + allowKeywords: true, + allowPattern: '', + }, + ], + eqeqeq: [ + 'error', + 'always', + { + null: 'ignore', + }, + ], + 'grouped-accessor-pairs': ['error'], + 'guard-for-in': ['error'], + 'max-classes-per-file': ['error', 1], + 'no-alert': ['warn'], + 'no-caller': ['error'], + 'no-case-declarations': ['error'], + 'no-constructor-return': ['error'], + 'no-div-regex': ['off'], + 'no-else-return': [ + 'error', + { + allowElseIf: false, + }, + ], + 'no-empty-pattern': ['error'], + 'no-eq-null': ['off'], + 'no-eval': ['error'], + 'no-extend-native': ['error'], + 'no-extra-bind': ['error'], + 'no-extra-label': ['error'], + 'no-fallthrough': ['error'], + 'no-global-assign': [ + 'error', + { + exceptions: [], + }, + ], + 'no-native-reassign': ['off'], + 'no-implicit-coercion': [ + 'off', + { + boolean: false, + number: true, + string: true, + allow: [], + }, + ], + 'no-implicit-globals': ['off'], + 'no-implied-eval': ['error'], + 'no-invalid-this': ['off'], + 'no-iterator': ['error'], + 'no-labels': [ + 'error', + { + allowLoop: false, + allowSwitch: false, + }, + ], + 'no-lone-blocks': ['error'], + 'no-loop-func': ['error'], + 'no-multi-str': ['error'], + 'no-new': ['error'], + 'no-new-func': ['error'], + 'no-new-wrappers': ['error'], + 'no-nonoctal-decimal-escape': ['error'], + 'no-octal': ['error'], + 'no-octal-escape': ['error'], + 'no-param-reassign': [ + 'error', + { + props: true, + ignorePropertyModificationsFor: [ + 'acc', + 'accumulator', + 'e', + 'ctx', + 'context', + 'req', + 'request', + 'res', + 'response', + '$scope', + 'staticContext', + ], + }, + ], + 'no-proto': ['error'], + 'no-redeclare': ['error'], + 'no-restricted-properties': [ + 'error', + { + object: 'arguments', + property: 'callee', + message: 'arguments.callee is deprecated', + }, + { + object: 'global', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'self', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'window', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'global', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + object: 'self', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + object: 'window', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + property: '__defineGetter__', + message: 'Please use Object.defineProperty instead.', + }, + { + property: '__defineSetter__', + message: 'Please use Object.defineProperty instead.', + }, + { + object: 'Math', + property: 'pow', + message: 'Use the exponentiation operator (**) instead.', + }, + ], + 'no-return-assign': ['error', 'always'], + 'no-return-await': ['error'], + 'no-script-url': ['error'], + 'no-self-assign': [ + 'error', + { + props: true, + }, + ], + 'no-self-compare': ['error'], + 'no-sequences': ['error'], + 'no-throw-literal': ['error'], + 'no-unmodified-loop-condition': ['off'], + 'no-unused-labels': ['error'], + 'no-useless-call': ['off'], + 'no-useless-catch': ['error'], + 'no-useless-concat': ['error'], + 'no-useless-escape': ['error'], + 'no-useless-return': ['error'], + 'no-void': ['error'], + 'no-warning-comments': [ + 'off', + { + terms: ['todo', 'fixme', 'xxx'], + location: 'start', + }, + ], + 'no-with': ['error'], + 'prefer-promise-reject-errors': [ + 'error', + { + allowEmptyReject: true, + }, + ], + 'prefer-named-capture-group': ['off'], + 'prefer-regex-literals': [ + 'error', + { + disallowRedundantWrapping: true, + }, + ], + radix: ['error'], + 'require-await': ['off'], + 'require-unicode-regexp': ['off'], + 'vars-on-top': ['error'], + yoda: ['error'], +} diff --git a/config/eslint/src/.eslintrc.ts b/config/eslint/src/rules.ts similarity index 99% rename from config/eslint/src/.eslintrc.ts rename to config/eslint/src/rules.ts index 3179bf93b..c1ff9052e 100644 --- a/config/eslint/src/.eslintrc.ts +++ b/config/eslint/src/rules.ts @@ -173,13 +173,10 @@ const eslintrc: Linter.RulesRecord = { '@typescript-eslint/no-shadow': [ 'error', { - 'allow': [ - 'ClientFactory', - 'ServerBuilder' - ], - 'builtinGlobals': false, - 'hoist': 'functions' - } + allow: ['ClientFactory', 'ServerBuilder'], + builtinGlobals: false, + hoist: 'functions', + }, ], 'no-shadow': 'off', curly: 0, diff --git a/config/eslint/src/working-example/index.js b/config/eslint/src/working-example/index.js new file mode 100644 index 000000000..03fb14485 --- /dev/null +++ b/config/eslint/src/working-example/index.js @@ -0,0 +1,30 @@ +/* eslint-disable */ +'use strict' +module.exports = { + rules: require('./rules'), + plugins: [ + 'eslint-plugin-react', + 'eslint-plugin-jsx-a11y', + '@typescript-eslint/eslint-plugin', + 'eslint-plugin-react-hooks', + ], + reportUnusedDisableDirectives: true, + globals: {}, + settings: { + react: { + pragma: 'React', + version: '17.0.2', + }, + propWrapperFunctions: ['forbidExtraProps', 'exact', 'Object.freeze'], + }, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaFeatures: { + jsx: true, + generators: false, + objectLiteralDuplicateProperties: false, + }, + ecmaVersion: 2020, + sourceType: 'module', + }, +} diff --git a/config/eslint/src/working-example/rules.js b/config/eslint/src/working-example/rules.js new file mode 100644 index 000000000..b6d398c48 --- /dev/null +++ b/config/eslint/src/working-example/rules.js @@ -0,0 +1,1384 @@ +/* eslint-disable */ +'use strict' +module.exports = { + 'no-undef': ['off'], + 'brace-style': 'off', + '@typescript-eslint/brace-style': 'off', + camelcase: [ + 'off', + { + properties: 'never', + ignoreDestructuring: false, + ignoreImports: false, + ignoreGlobals: false, + }, + ], + 'func-call-spacing': 'off', + '@typescript-eslint/func-call-spacing': 'off', + indent: 'off', + 'no-array-constructor': ['off'], + '@typescript-eslint/no-array-constructor': ['error'], + 'no-extra-parens': 'off', + '@typescript-eslint/no-extra-parens': 'off', + 'no-magic-numbers': [ + 'off', + { + ignore: [], + ignoreArrayIndexes: true, + enforceConst: true, + detectObjects: false, + }, + ], + '@typescript-eslint/no-magic-numbers': [ + 'off', + { + ignore: [], + ignoreArrayIndexes: true, + enforceConst: true, + detectObjects: false, + }, + ], + 'no-unused-expressions': [ + 'off', + { + allowShortCircuit: false, + allowTernary: false, + allowTaggedTemplates: false, + enforceForJSX: false, + }, + ], + '@typescript-eslint/no-unused-expressions': [ + 'error', + { + allowShortCircuit: false, + allowTernary: false, + allowTaggedTemplates: false, + enforceForJSX: false, + }, + ], + 'no-unused-vars': [ + 'off', + { + vars: 'all', + args: 'after-used', + ignoreRestSiblings: true, + }, + ], + 'no-use-before-define': [ + 'off', + { + functions: true, + classes: true, + variables: true, + }, + ], + '@typescript-eslint/no-use-before-define': [ + 'error', + { + functions: true, + classes: true, + variables: true, + }, + ], + quotes: 0, + '@typescript-eslint/quotes': 0, + semi: 'off', + '@typescript-eslint/naming-convention': [ + 'error', + { + selector: 'variable', + format: ['camelCase', 'PascalCase', 'UPPER_CASE'], + }, + { + selector: 'function', + format: ['camelCase', 'PascalCase'], + }, + { + selector: 'typeLike', + format: ['PascalCase'], + }, + ], + 'class-methods-use-this': [ + 0, + { + exceptMethods: [ + 'render', + 'getInitialState', + 'getDefaultProps', + 'getChildContext', + 'componentWillMount', + 'UNSAFE_componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'UNSAFE_componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'UNSAFE_componentWillUpdate', + 'componentDidUpdate', + 'componentWillUnmount', + 'componentDidCatch', + 'getSnapshotBeforeUpdate', + ], + enforceForClassFields: true, + }, + ], + 'jsx-a11y/html-has-lang': [0], + 'react/function-component-definition': [ + 2, + { + namedComponents: 'arrow-function', + }, + ], + 'react/jsx-props-no-spreading': [ + 0, + { + html: 'enforce', + custom: 'enforce', + explicitSpread: 'ignore', + exceptions: [], + }, + ], + 'react/jsx-filename-extension': [ + 1, + { + extensions: ['.js', '.jsx', '.tsx'], + }, + ], + 'react/prop-types': [ + 0, + { + ignore: [], + customValidators: [], + skipUndeclared: false, + }, + ], + 'react/no-danger': [0], + '@typescript-eslint/semi': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + args: 'none', + }, + ], + 'no-useless-constructor': ['off'], + '@typescript-eslint/no-useless-constructor': ['error'], + 'no-empty-function': [ + 'off', + { + allow: ['arrowFunctions', 'functions', 'methods'], + }, + ], + '@typescript-eslint/no-empty-function': ['error'], + '@typescript-eslint/indent': 'off', + '@typescript-eslint/no-shadow': [ + 'error', + { + allow: ['ClientFactory', 'ServerBuilder'], + builtinGlobals: false, + hoist: 'functions', + }, + ], + 'no-shadow': 'off', + curly: 0, + 'lines-around-comment': 0, + 'max-len': 0, + 'no-confusing-arrow': 0, + 'no-mixed-operators': 0, + 'no-tabs': 0, + 'no-unexpected-multiline': 0, + 'babel/quotes': 0, + 'vue/html-self-closing': 0, + 'vue/max-len': 0, + 'array-bracket-newline': 'off', + 'array-bracket-spacing': 'off', + 'array-element-newline': 'off', + 'arrow-parens': 'off', + 'arrow-spacing': 'off', + 'block-spacing': 'off', + 'comma-dangle': 'off', + 'comma-spacing': 'off', + 'comma-style': 'off', + 'computed-property-spacing': 'off', + 'dot-location': 'off', + 'eol-last': 'off', + 'function-call-argument-newline': 'off', + 'function-paren-newline': 'off', + 'generator-star': 'off', + 'generator-star-spacing': 'off', + 'implicit-arrow-linebreak': 'off', + 'jsx-quotes': 'off', + 'key-spacing': 'off', + 'keyword-spacing': 'off', + 'linebreak-style': 'off', + 'multiline-ternary': 'off', + 'newline-per-chained-call': 'off', + 'new-parens': 'off', + 'no-arrow-condition': 'off', + 'no-comma-dangle': 'off', + 'no-extra-semi': 'off', + 'no-floating-decimal': 'off', + 'no-mixed-spaces-and-tabs': 'off', + 'no-multi-spaces': 'off', + 'no-multiple-empty-lines': 'off', + 'no-reserved-keys': 'off', + 'no-space-before-semi': 'off', + 'no-trailing-spaces': 'off', + 'no-whitespace-before-property': 'off', + 'no-wrap-func': 'off', + 'nonblock-statement-body-position': 'off', + 'object-curly-newline': 'off', + 'object-curly-spacing': 'off', + 'object-property-newline': 'off', + 'one-var-declaration-per-line': 'off', + 'operator-linebreak': 'off', + 'padded-blocks': 'off', + 'quote-props': 'off', + 'rest-spread-spacing': 'off', + 'semi-spacing': 'off', + 'semi-style': 'off', + 'space-after-function-name': 'off', + 'space-after-keywords': 'off', + 'space-before-blocks': 'off', + 'space-before-function-paren': 'off', + 'space-before-function-parentheses': 'off', + 'space-before-keywords': 'off', + 'space-in-brackets': 'off', + 'space-in-parens': 'off', + 'space-infix-ops': 'off', + 'space-return-throw-case': 'off', + 'space-unary-ops': 'off', + 'space-unary-word-ops': 'off', + 'switch-colon-spacing': 'off', + 'template-curly-spacing': 'off', + 'template-tag-spacing': 'off', + 'unicode-bom': 'off', + 'wrap-iife': 'off', + 'wrap-regex': 'off', + 'yield-star-spacing': 'off', + '@babel/object-curly-spacing': 'off', + '@babel/semi': 'off', + '@typescript-eslint/comma-dangle': 'off', + '@typescript-eslint/comma-spacing': 'off', + '@typescript-eslint/keyword-spacing': 'off', + '@typescript-eslint/member-delimiter-style': 'off', + '@typescript-eslint/no-extra-semi': 'off', + '@typescript-eslint/object-curly-spacing': 'off', + '@typescript-eslint/space-before-function-paren': 'off', + '@typescript-eslint/space-infix-ops': 'off', + '@typescript-eslint/type-annotation-spacing': 'off', + 'babel/object-curly-spacing': 'off', + 'babel/semi': 'off', + 'flowtype/boolean-style': 'off', + 'flowtype/delimiter-dangle': 'off', + 'flowtype/generic-spacing': 'off', + 'flowtype/object-type-curly-spacing': 'off', + 'flowtype/object-type-delimiter': 'off', + 'flowtype/quotes': 'off', + 'flowtype/semi': 'off', + 'flowtype/space-after-type-colon': 'off', + 'flowtype/space-before-generic-bracket': 'off', + 'flowtype/space-before-type-colon': 'off', + 'flowtype/union-intersection-spacing': 'off', + 'react/jsx-child-element-spacing': 'off', + 'react/jsx-closing-bracket-location': 'off', + 'react/jsx-closing-tag-location': 'off', + 'react/jsx-curly-newline': 'off', + 'react/jsx-curly-spacing': 'off', + 'react/jsx-equals-spacing': 'off', + 'react/jsx-first-prop-new-line': 'off', + 'react/jsx-indent': 'off', + 'react/jsx-indent-props': 'off', + 'react/jsx-max-props-per-line': 'off', + 'react/jsx-newline': 'off', + 'react/jsx-one-expression-per-line': 'off', + 'react/jsx-props-no-multi-spaces': 'off', + 'react/jsx-tag-spacing': 'off', + 'react/jsx-wrap-multilines': 'off', + 'standard/array-bracket-even-spacing': 'off', + 'standard/computed-property-even-spacing': 'off', + 'standard/object-curly-even-spacing': 'off', + 'unicorn/empty-brace-spaces': 'off', + 'unicorn/no-nested-ternary': 'off', + 'unicorn/number-literal-case': 'off', + 'vue/array-bracket-newline': 'off', + 'vue/array-bracket-spacing': 'off', + 'vue/arrow-spacing': 'off', + 'vue/block-spacing': 'off', + 'vue/block-tag-newline': 'off', + 'vue/brace-style': 'off', + 'vue/comma-dangle': 'off', + 'vue/comma-spacing': 'off', + 'vue/comma-style': 'off', + 'vue/dot-location': 'off', + 'vue/func-call-spacing': 'off', + 'vue/html-closing-bracket-newline': 'off', + 'vue/html-closing-bracket-spacing': 'off', + 'vue/html-end-tags': 'off', + 'vue/html-indent': 'off', + 'vue/html-quotes': 'off', + 'vue/key-spacing': 'off', + 'vue/keyword-spacing': 'off', + 'vue/max-attributes-per-line': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/mustache-interpolation-spacing': 'off', + 'vue/no-extra-parens': 'off', + 'vue/no-multi-spaces': 'off', + 'vue/no-spaces-around-equal-signs-in-attribute': 'off', + 'vue/object-curly-newline': 'off', + 'vue/object-curly-spacing': 'off', + 'vue/object-property-newline': 'off', + 'vue/operator-linebreak': 'off', + 'vue/script-indent': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/space-in-parens': 'off', + 'vue/space-infix-ops': 'off', + 'vue/space-unary-ops': 'off', + 'vue/template-curly-spacing': 'off', + 'indent-legacy': ['off'], + 'no-spaced-func': ['off'], + 'react/jsx-space-before-closing': ['off', 'always'], + 'react-hooks/rules-of-hooks': ['error'], + 'react-hooks/exhaustive-deps': ['error'], + 'jsx-a11y/accessible-emoji': ['off'], + 'jsx-a11y/alt-text': [ + 'error', + { + elements: ['img', 'object', 'area', 'input[type="image"]'], + img: [], + object: [], + area: [], + 'input[type="image"]': [], + }, + ], + 'jsx-a11y/anchor-has-content': [ + 'error', + { + components: [], + }, + ], + 'jsx-a11y/anchor-is-valid': [ + 'error', + { + components: ['Link'], + specialLink: ['to'], + aspects: ['noHref', 'invalidHref', 'preferButton'], + }, + ], + 'jsx-a11y/aria-activedescendant-has-tabindex': ['error'], + 'jsx-a11y/aria-props': ['error'], + 'jsx-a11y/aria-proptypes': ['error'], + 'jsx-a11y/aria-role': [ + 'error', + { + ignoreNonDOM: false, + }, + ], + 'jsx-a11y/aria-unsupported-elements': ['error'], + 'jsx-a11y/autocomplete-valid': [ + 'off', + { + inputComponents: [], + }, + ], + 'jsx-a11y/click-events-have-key-events': ['error'], + 'jsx-a11y/control-has-associated-label': [ + 'error', + { + labelAttributes: ['label'], + controlComponents: [], + ignoreElements: ['audio', 'canvas', 'embed', 'input', 'textarea', 'tr', 'video'], + ignoreRoles: [ + 'grid', + 'listbox', + 'menu', + 'menubar', + 'radiogroup', + 'row', + 'tablist', + 'toolbar', + 'tree', + 'treegrid', + ], + depth: 5, + }, + ], + 'jsx-a11y/heading-has-content': [ + 'error', + { + components: [''], + }, + ], + 'jsx-a11y/iframe-has-title': ['error'], + 'jsx-a11y/img-redundant-alt': ['error'], + 'jsx-a11y/interactive-supports-focus': ['error'], + 'jsx-a11y/label-has-associated-control': [ + 'error', + { + labelComponents: [], + labelAttributes: [], + controlComponents: [], + assert: 'both', + depth: 25, + }, + ], + 'jsx-a11y/lang': ['error'], + 'jsx-a11y/media-has-caption': [ + 'error', + { + audio: [], + video: [], + track: [], + }, + ], + 'jsx-a11y/mouse-events-have-key-events': ['error'], + 'jsx-a11y/no-access-key': ['error'], + 'jsx-a11y/no-autofocus': [ + 'error', + { + ignoreNonDOM: true, + }, + ], + 'jsx-a11y/no-distracting-elements': [ + 'error', + { + elements: ['marquee', 'blink'], + }, + ], + 'jsx-a11y/no-interactive-element-to-noninteractive-role': [ + 'error', + { + tr: ['none', 'presentation'], + }, + ], + 'jsx-a11y/no-noninteractive-element-interactions': [ + 'error', + { + handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'], + }, + ], + 'jsx-a11y/no-noninteractive-element-to-interactive-role': [ + 'error', + { + ul: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], + ol: ['listbox', 'menu', 'menubar', 'radiogroup', 'tablist', 'tree', 'treegrid'], + li: ['menuitem', 'option', 'row', 'tab', 'treeitem'], + table: ['grid'], + td: ['gridcell'], + }, + ], + 'jsx-a11y/no-noninteractive-tabindex': [ + 'error', + { + tags: [], + roles: ['tabpanel'], + }, + ], + 'jsx-a11y/no-onchange': ['off'], + 'jsx-a11y/no-redundant-roles': ['error'], + 'jsx-a11y/no-static-element-interactions': [ + 'error', + { + handlers: ['onClick', 'onMouseDown', 'onMouseUp', 'onKeyPress', 'onKeyDown', 'onKeyUp'], + }, + ], + 'jsx-a11y/role-has-required-aria-props': ['error'], + 'jsx-a11y/role-supports-aria-props': ['error'], + 'jsx-a11y/scope': ['error'], + 'jsx-a11y/tabindex-no-positive': ['error'], + 'jsx-a11y/label-has-for': [ + 'off', + { + components: [], + required: { + every: ['nesting', 'id'], + }, + allowChildren: false, + }, + ], + 'no-underscore-dangle': [ + 'error', + { + allow: ['__REDUX_DEVTOOLS_EXTENSION_COMPOSE__'], + allowAfterThis: false, + allowAfterSuper: false, + enforceInMethodNames: true, + allowAfterThisConstructor: false, + allowFunctionParams: true, + }, + ], + 'react/display-name': [ + 'off', + { + ignoreTranspilerName: false, + }, + ], + 'react/forbid-prop-types': [ + 'error', + { + forbid: ['any', 'array', 'object'], + checkContextTypes: true, + checkChildContextTypes: true, + }, + ], + 'react/forbid-dom-props': [ + 'off', + { + forbid: [], + }, + ], + 'react/jsx-boolean-value': [ + 'error', + 'never', + { + always: [], + }, + ], + 'react/jsx-handler-names': [ + 'off', + { + eventHandlerPrefix: 'handle', + eventHandlerPropPrefix: 'on', + }, + ], + 'react/jsx-key': ['off'], + 'react/jsx-no-bind': [ + 'error', + { + ignoreRefs: true, + allowArrowFunctions: true, + allowFunctions: false, + allowBind: false, + ignoreDOMComponents: true, + }, + ], + 'react/jsx-no-duplicate-props': [ + 'error', + { + ignoreCase: true, + }, + ], + 'react/jsx-no-literals': [ + 'off', + { + noStrings: true, + }, + ], + 'react/jsx-no-undef': ['error'], + 'react/jsx-pascal-case': [ + 'error', + { + allowAllCaps: true, + ignore: [], + }, + ], + 'react/sort-prop-types': [ + 'off', + { + ignoreCase: true, + callbacksLast: false, + requiredFirst: false, + sortShapeProp: true, + }, + ], + 'react/jsx-sort-prop-types': ['off'], + 'react/jsx-sort-props': [ + 'off', + { + ignoreCase: true, + callbacksLast: false, + shorthandFirst: false, + shorthandLast: false, + noSortAlphabetically: false, + reservedFirst: true, + }, + ], + 'react/jsx-sort-default-props': [ + 'off', + { + ignoreCase: true, + }, + ], + 'react/jsx-uses-react': ['error'], + 'react/jsx-uses-vars': ['error'], + 'react/no-deprecated': ['error'], + 'react/no-did-mount-set-state': ['off'], + 'react/no-did-update-set-state': ['error'], + 'react/no-will-update-set-state': ['error'], + 'react/no-direct-mutation-state': ['off'], + 'react/no-is-mounted': ['error'], + 'react/no-multi-comp': ['off'], + 'react/no-set-state': ['off'], + 'react/no-string-refs': ['error'], + 'react/no-unknown-property': ['error'], + 'react/prefer-es6-class': ['error', 'always'], + 'react/prefer-stateless-function': [ + 'error', + { + ignorePureComponents: true, + }, + ], + 'react/react-in-jsx-scope': ['error'], + 'react/require-render-return': ['error'], + 'react/self-closing-comp': ['error'], + 'react/sort-comp': [ + 'error', + { + order: [ + 'static-variables', + 'static-methods', + 'instance-variables', + 'lifecycle', + '/^handle.+$/', + '/^on.+$/', + 'getters', + 'setters', + '/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/', + 'instance-methods', + 'everything-else', + 'rendering', + ], + groups: { + lifecycle: [ + 'displayName', + 'propTypes', + 'contextTypes', + 'childContextTypes', + 'mixins', + 'statics', + 'defaultProps', + 'constructor', + 'getDefaultProps', + 'getInitialState', + 'state', + 'getChildContext', + 'getDerivedStateFromProps', + 'componentWillMount', + 'UNSAFE_componentWillMount', + 'componentDidMount', + 'componentWillReceiveProps', + 'UNSAFE_componentWillReceiveProps', + 'shouldComponentUpdate', + 'componentWillUpdate', + 'UNSAFE_componentWillUpdate', + 'getSnapshotBeforeUpdate', + 'componentDidUpdate', + 'componentDidCatch', + 'componentWillUnmount', + ], + rendering: ['/^render.+$/', 'render'], + }, + }, + ], + 'react/jsx-no-target-blank': [ + 'error', + { + enforceDynamicLinks: 'always', + links: true, + forms: false, + }, + ], + 'react/jsx-no-comment-textnodes': ['error'], + 'react/no-render-return-value': ['error'], + 'react/require-optimization': [ + 'off', + { + allowDecorators: [], + }, + ], + 'react/no-find-dom-node': ['error'], + 'react/forbid-component-props': [ + 'off', + { + forbid: [], + }, + ], + 'react/forbid-elements': [ + 'off', + { + forbid: [], + }, + ], + 'react/no-danger-with-children': ['error'], + 'react/no-unused-prop-types': [ + 'error', + { + customValidators: [], + skipShapeProps: true, + }, + ], + 'react/style-prop-object': ['error'], + 'react/no-unescaped-entities': ['error'], + 'react/no-children-prop': ['error'], + 'react/no-array-index-key': ['error'], + 'react/require-default-props': ['off'], + 'react/forbid-foreign-prop-types': [ + 'warn', + { + allowInPropTypes: true, + }, + ], + 'react/void-dom-elements-no-children': ['error'], + 'react/default-props-match-prop-types': ['off'], + 'react/no-redundant-should-component-update': ['error'], + 'react/no-unused-state': ['error'], + 'react/boolean-prop-naming': [ + 'off', + { + propTypeNames: ['bool', 'mutuallyExclusiveTrueProps'], + rule: '^(is|has)[A-Z]([A-Za-z0-9]?)+', + message: '', + }, + ], + 'react/no-typos': ['error'], + 'react/jsx-curly-brace-presence': [ + 'error', + { + props: 'never', + children: 'never', + }, + ], + 'react/destructuring-assignment': ['error', 'always'], + 'react/no-access-state-in-setstate': ['error'], + 'react/button-has-type': [ + 'error', + { + button: true, + submit: true, + reset: false, + }, + ], + 'react/no-this-in-sfc': ['error'], + 'react/jsx-max-depth': ['off'], + 'react/no-unsafe': ['off'], + 'react/jsx-fragments': ['error', 'syntax'], + 'react/state-in-constructor': ['error', 'always'], + 'react/static-property-placement': ['error', 'property assignment'], + 'react/prefer-read-only-props': ['off'], + 'react/jsx-no-script-url': [ + 'error', + [ + { + name: 'Link', + props: ['to'], + }, + ], + ], + 'react/jsx-no-useless-fragment': ['error'], + 'react/no-adjacent-inline-elements': ['off'], + 'react/jsx-no-constructed-context-values': ['error'], + 'react/no-unstable-nested-components': ['off'], + 'react/no-namespace': ['error'], + 'react/prefer-exact-props': ['error'], + 'react/no-arrow-function-lifecycle': ['error'], + 'react/no-invalid-html-attribute': ['error'], + 'react/no-unused-class-component-methods': ['error'], + strict: ['error', 'never'], + 'arrow-body-style': [ + 'error', + 'as-needed', + { + requireReturnForObjectLiteral: false, + }, + ], + 'constructor-super': ['error'], + 'no-class-assign': ['error'], + 'no-const-assign': ['error'], + 'no-dupe-class-members': ['error'], + 'no-duplicate-imports': ['off'], + 'no-new-symbol': ['error'], + 'no-restricted-exports': [ + 'error', + { + restrictedNamedExports: ['then'], + }, + ], + 'no-restricted-imports': [ + 'off', + { + paths: [], + patterns: [], + }, + ], + 'no-this-before-super': ['error'], + 'no-useless-computed-key': ['error'], + 'no-useless-rename': [ + 'error', + { + ignoreDestructuring: false, + ignoreImport: false, + ignoreExport: false, + }, + ], + 'no-var': ['error'], + 'object-shorthand': [ + 'error', + 'always', + { + ignoreConstructors: false, + avoidQuotes: true, + }, + ], + 'prefer-arrow-callback': [ + 'error', + { + allowNamedFunctions: false, + allowUnboundThis: true, + }, + ], + 'prefer-const': [ + 'error', + { + destructuring: 'any', + ignoreReadBeforeAssign: true, + }, + ], + 'prefer-destructuring': [ + 'error', + { + VariableDeclarator: { + array: false, + object: true, + }, + AssignmentExpression: { + array: true, + object: false, + }, + }, + { + enforceForRenamedProperties: false, + }, + ], + 'prefer-numeric-literals': ['error'], + 'prefer-reflect': ['off'], + 'prefer-rest-params': ['error'], + 'prefer-spread': ['error'], + 'prefer-template': ['error'], + 'require-yield': ['error'], + 'sort-imports': [ + 'off', + { + ignoreCase: false, + ignoreDeclarationSort: false, + ignoreMemberSort: false, + memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], + }, + ], + 'symbol-description': ['error'], + 'init-declarations': ['off'], + 'no-catch-shadow': ['off'], + 'no-delete-var': ['error'], + 'no-label-var': ['error'], + 'no-restricted-globals': [ + 'error', + { + name: 'isFinite', + message: + 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite', + }, + { + name: 'isNaN', + message: + 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan', + }, + 'addEventListener', + 'blur', + 'close', + 'closed', + 'confirm', + 'defaultStatus', + 'defaultstatus', + 'event', + 'external', + 'find', + 'focus', + 'frameElement', + 'frames', + 'history', + 'innerHeight', + 'innerWidth', + 'length', + 'location', + 'locationbar', + 'menubar', + 'moveBy', + 'moveTo', + 'name', + 'onblur', + 'onerror', + 'onfocus', + 'onload', + 'onresize', + 'onunload', + 'open', + 'opener', + 'opera', + 'outerHeight', + 'outerWidth', + 'pageXOffset', + 'pageYOffset', + 'parent', + 'print', + 'removeEventListener', + 'resizeBy', + 'resizeTo', + 'screen', + 'screenLeft', + 'screenTop', + 'screenX', + 'screenY', + 'scroll', + 'scrollbars', + 'scrollBy', + 'scrollTo', + 'scrollX', + 'scrollY', + 'self', + 'status', + 'statusbar', + 'stop', + 'toolbar', + 'top', + ], + 'no-shadow-restricted-names': ['error'], + 'no-undef-init': ['error'], + 'no-undefined': ['off'], + 'capitalized-comments': [ + 'off', + 'never', + { + line: { + ignorePattern: '.*', + ignoreInlineComments: true, + ignoreConsecutiveComments: true, + }, + block: { + ignorePattern: '.*', + ignoreInlineComments: true, + ignoreConsecutiveComments: true, + }, + }, + ], + 'consistent-this': ['off'], + 'func-name-matching': [ + 'off', + 'always', + { + includeCommonJSModuleExports: false, + considerPropertyDescriptor: true, + }, + ], + 'func-names': ['warn'], + 'func-style': ['off', 'expression'], + 'id-denylist': ['off'], + 'id-length': ['off'], + 'id-match': ['off'], + 'line-comment-position': [ + 'off', + { + position: 'above', + ignorePattern: '', + applyDefaultPatterns: true, + }, + ], + 'lines-between-class-members': [ + 'error', + 'always', + { + exceptAfterSingleLine: false, + }, + ], + 'lines-around-directive': [ + 'error', + { + before: 'always', + after: 'always', + }, + ], + 'max-depth': ['off', 4], + 'max-lines': [ + 'off', + { + max: 300, + skipBlankLines: true, + skipComments: true, + }, + ], + 'max-lines-per-function': [ + 'off', + { + max: 50, + skipBlankLines: true, + skipComments: true, + IIFEs: true, + }, + ], + 'max-nested-callbacks': ['off'], + 'max-params': ['off', 3], + 'max-statements': ['off', 10], + 'max-statements-per-line': [ + 'off', + { + max: 1, + }, + ], + 'multiline-comment-style': ['off', 'starred-block'], + 'new-cap': [ + 'error', + { + newIsCap: true, + newIsCapExceptions: [], + capIsNew: false, + capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'], + properties: true, + }, + ], + 'newline-after-var': ['off'], + 'newline-before-return': ['off'], + 'no-bitwise': ['error'], + 'no-continue': ['error'], + 'no-inline-comments': ['off'], + 'no-lonely-if': ['error'], + 'no-multi-assign': ['error'], + 'no-negated-condition': ['off'], + 'no-nested-ternary': ['error'], + 'no-new-object': ['error'], + 'no-plusplus': ['error'], + 'no-restricted-syntax': [ + 'error', + { + selector: 'ForInStatement', + message: + 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.', + }, + { + selector: 'LabeledStatement', + message: + 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.', + }, + { + selector: 'WithStatement', + message: + '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', + }, + ], + 'no-ternary': ['off'], + 'no-unneeded-ternary': [ + 'error', + { + defaultAssignment: false, + }, + ], + 'one-var': ['error', 'never'], + 'operator-assignment': ['error', 'always'], + 'padding-line-between-statements': ['off'], + 'prefer-exponentiation-operator': ['error'], + 'prefer-object-spread': ['error'], + 'require-jsdoc': ['off'], + 'sort-keys': [ + 'off', + 'asc', + { + caseSensitive: false, + natural: true, + }, + ], + 'sort-vars': ['off'], + 'spaced-comment': [ + 'error', + 'always', + { + line: { + exceptions: ['-', '+'], + markers: ['=', '!', '/'], + }, + block: { + exceptions: ['-', '+'], + markers: ['=', '!', ':', '::'], + balanced: true, + }, + }, + ], + 'callback-return': ['off'], + 'global-require': ['off'], + 'handle-callback-err': ['off'], + 'no-buffer-constructor': ['error'], + 'no-mixed-requires': ['off', false], + 'no-new-require': ['error'], + 'no-path-concat': ['error'], + 'no-process-env': ['off'], + 'no-process-exit': ['off'], + 'no-restricted-modules': ['off'], + 'no-sync': ['off'], + 'for-direction': ['error'], + 'getter-return': [ + 'error', + { + allowImplicit: true, + }, + ], + 'no-async-promise-executor': ['error'], + 'no-await-in-loop': ['error'], + 'no-compare-neg-zero': ['error'], + 'no-cond-assign': ['error', 'always'], + 'no-console': ['warn'], + 'no-constant-condition': ['warn'], + 'no-control-regex': ['error'], + 'no-debugger': ['error'], + 'no-dupe-args': ['error'], + 'no-dupe-else-if': ['error'], + 'no-dupe-keys': ['error'], + 'no-duplicate-case': ['error'], + 'no-empty': ['error'], + 'no-empty-character-class': ['error'], + 'no-ex-assign': ['error'], + 'no-extra-boolean-cast': ['error'], + 'no-func-assign': ['error'], + 'no-import-assign': ['error'], + 'no-inner-declarations': ['error'], + 'no-invalid-regexp': ['error'], + 'no-irregular-whitespace': ['error'], + 'no-loss-of-precision': ['error'], + 'no-misleading-character-class': ['error'], + 'no-obj-calls': ['error'], + 'no-promise-executor-return': ['error'], + 'no-prototype-builtins': ['error'], + 'no-regex-spaces': ['error'], + 'no-setter-return': ['error'], + 'no-sparse-arrays': ['error'], + 'no-template-curly-in-string': ['error'], + 'no-unreachable': ['error'], + 'no-unreachable-loop': [ + 'error', + { + ignore: [], + }, + ], + 'no-unsafe-finally': ['error'], + 'no-unsafe-negation': ['error'], + 'no-unsafe-optional-chaining': [ + 'error', + { + disallowArithmeticOperators: true, + }, + ], + 'no-unused-private-class-members': ['off'], + 'no-useless-backreference': ['error'], + 'no-negated-in-lhs': ['off'], + 'require-atomic-updates': ['off'], + 'use-isnan': ['error'], + 'valid-jsdoc': ['off'], + 'valid-typeof': [ + 'error', + { + requireStringLiterals: true, + }, + ], + 'accessor-pairs': ['off'], + 'array-callback-return': [ + 'error', + { + allowImplicit: true, + checkForEach: false, + }, + ], + 'block-scoped-var': ['error'], + complexity: ['off', 20], + 'consistent-return': ['error'], + 'default-case': [ + 'error', + { + commentPattern: '^no default$', + }, + ], + 'default-case-last': ['error'], + 'default-param-last': ['off'], + 'dot-notation': [ + 'error', + { + allowKeywords: true, + allowPattern: '', + }, + ], + eqeqeq: [ + 'error', + 'always', + { + null: 'ignore', + }, + ], + 'grouped-accessor-pairs': ['error'], + 'guard-for-in': ['error'], + 'max-classes-per-file': ['error', 1], + 'no-alert': ['warn'], + 'no-caller': ['error'], + 'no-case-declarations': ['error'], + 'no-constructor-return': ['error'], + 'no-div-regex': ['off'], + 'no-else-return': [ + 'error', + { + allowElseIf: false, + }, + ], + 'no-empty-pattern': ['error'], + 'no-eq-null': ['off'], + 'no-eval': ['error'], + 'no-extend-native': ['error'], + 'no-extra-bind': ['error'], + 'no-extra-label': ['error'], + 'no-fallthrough': ['error'], + 'no-global-assign': [ + 'error', + { + exceptions: [], + }, + ], + 'no-native-reassign': ['off'], + 'no-implicit-coercion': [ + 'off', + { + boolean: false, + number: true, + string: true, + allow: [], + }, + ], + 'no-implicit-globals': ['off'], + 'no-implied-eval': ['error'], + 'no-invalid-this': ['off'], + 'no-iterator': ['error'], + 'no-labels': [ + 'error', + { + allowLoop: false, + allowSwitch: false, + }, + ], + 'no-lone-blocks': ['error'], + 'no-loop-func': ['error'], + 'no-multi-str': ['error'], + 'no-new': ['error'], + 'no-new-func': ['error'], + 'no-new-wrappers': ['error'], + 'no-nonoctal-decimal-escape': ['error'], + 'no-octal': ['error'], + 'no-octal-escape': ['error'], + 'no-param-reassign': [ + 'error', + { + props: true, + ignorePropertyModificationsFor: [ + 'acc', + 'accumulator', + 'e', + 'ctx', + 'context', + 'req', + 'request', + 'res', + 'response', + '$scope', + 'staticContext', + ], + }, + ], + 'no-proto': ['error'], + 'no-redeclare': ['error'], + 'no-restricted-properties': [ + 'error', + { + object: 'arguments', + property: 'callee', + message: 'arguments.callee is deprecated', + }, + { + object: 'global', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'self', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'window', + property: 'isFinite', + message: 'Please use Number.isFinite instead', + }, + { + object: 'global', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + object: 'self', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + object: 'window', + property: 'isNaN', + message: 'Please use Number.isNaN instead', + }, + { + property: '__defineGetter__', + message: 'Please use Object.defineProperty instead.', + }, + { + property: '__defineSetter__', + message: 'Please use Object.defineProperty instead.', + }, + { + object: 'Math', + property: 'pow', + message: 'Use the exponentiation operator (**) instead.', + }, + ], + 'no-return-assign': ['error', 'always'], + 'no-return-await': ['error'], + 'no-script-url': ['error'], + 'no-self-assign': [ + 'error', + { + props: true, + }, + ], + 'no-self-compare': ['error'], + 'no-sequences': ['error'], + 'no-throw-literal': ['error'], + 'no-unmodified-loop-condition': ['off'], + 'no-unused-labels': ['error'], + 'no-useless-call': ['off'], + 'no-useless-catch': ['error'], + 'no-useless-concat': ['error'], + 'no-useless-escape': ['error'], + 'no-useless-return': ['error'], + 'no-void': ['error'], + 'no-warning-comments': [ + 'off', + { + terms: ['todo', 'fixme', 'xxx'], + location: 'start', + }, + ], + 'no-with': ['error'], + 'prefer-promise-reject-errors': [ + 'error', + { + allowEmptyReject: true, + }, + ], + 'prefer-named-capture-group': ['off'], + 'prefer-regex-literals': [ + 'error', + { + disallowRedundantWrapping: true, + }, + ], + radix: ['error'], + 'require-await': ['off'], + 'require-unicode-regexp': ['off'], + 'vars-on-top': ['error'], + yoda: ['error'], +} diff --git a/package.json b/package.json index 465f212ee..4e8f5e699 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "@atls/schematics": "workspace:0.0.18", "@atls/tools-setup-ts-execution": "workspace:0.0.1", "@jest/core": "^28.1.0", + "@rushstack/eslint-patch": "1.6.0", "@types/eslint": "^8.4.2", "@types/jest": "^27.5.2", "@types/node": "^17.0.38", diff --git a/tsconfig.json b/tsconfig.json index b703b48a9..f8bf4c286 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -31,6 +31,7 @@ "github/**/*", "prettier/**/*", "eslint/**/*", - "schematics/**/*" + "schematics/**/*", + "config/**/*" ] } diff --git a/yarn.lock b/yarn.lock index bbf33928b..0644b8d15 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3768,6 +3768,13 @@ __metadata: languageName: node linkType: hard +"@rushstack/eslint-patch@npm:1.6.0": + version: 1.6.0 + resolution: "@rushstack/eslint-patch@npm:1.6.0" + checksum: cf2cc9a7e653d555a7b7d4898931d588ea308108d0acfd20ffab2039fa90793f33a4e7cd465b4527ad31e4b7b59df84295339e94a19c60a51490744c14b937b3 + languageName: node + linkType: hard + "@sinclair/typebox@npm:^0.23.3": version: 0.23.5 resolution: "@sinclair/typebox@npm:0.23.5" @@ -16291,6 +16298,7 @@ __metadata: "@atls/schematics": "workspace:0.0.18" "@atls/tools-setup-ts-execution": "workspace:0.0.1" "@jest/core": "npm:^28.1.0" + "@rushstack/eslint-patch": "npm:1.6.0" "@types/eslint": "npm:^8.4.2" "@types/jest": "npm:^27.5.2" "@types/node": "npm:^17.0.38"