From 5ba959f94cb924779f644f27e525a53a6c047e83 Mon Sep 17 00:00:00 2001 From: Jiahao Guo Date: Fri, 5 Jul 2024 15:43:32 +0800 Subject: [PATCH] feat: remove unnecessary rules, migrate deprecated rules and tweak configs --- ...-533ee8bb-43e2-4aac-98aa-0743da157aa8.json | 7 + ...-6fbc77dd-536a-44c3-86a8-18473a1fc2e3.json | 7 + ...-bd60cf26-8ff8-4d56-8f3f-beda1d170181.json | 7 + ...-552d208c-9bb9-490a-9443-a528bfa11cfe.json | 7 + packages/eslint-config-base/package.json | 8 +- packages/eslint-config-base/src/index.ts | 70 +- .../src/rules/best-practices.ts | 121 +- .../eslint-config-base/src/rules/errors.ts | 33 +- packages/eslint-config-base/src/rules/es6.ts | 96 - .../eslint-config-base/src/rules/imports.ts | 172 +- packages/eslint-config-base/src/rules/node.ts | 34 +- .../eslint-config-base/src/rules/strict.ts | 12 - .../eslint-config-base/src/rules/style.ts | 537 +- .../eslint-config-base/src/rules/variables.ts | 11 - .../eslint-config-javascript/package.json | 6 +- .../eslint-config-javascript/src/index.ts | 2 - .../package.json | 3 +- .../src/index.ts | 4 +- .../src/rules/react-a11y.ts | 51 - .../eslint-config-typescript/package.json | 3 +- pnpm-lock.yaml | 79 +- specs/eslint/README.md | 10 +- ...hot.test.ts.snap => presets.test.mts.snap} | 5361 +++-------------- specs/eslint/config-snapshot.test.ts | 32 - specs/eslint/package.json | 1 + specs/eslint/presets.test.mts | 109 + specs/eslint/tsconfig.json | 6 +- 27 files changed, 1198 insertions(+), 5591 deletions(-) create mode 100644 change/@rightcapital-eslint-config-base-533ee8bb-43e2-4aac-98aa-0743da157aa8.json create mode 100644 change/@rightcapital-eslint-config-javascript-6fbc77dd-536a-44c3-86a8-18473a1fc2e3.json create mode 100644 change/@rightcapital-eslint-config-typescript-bd60cf26-8ff8-4d56-8f3f-beda1d170181.json create mode 100644 change/@rightcapital-eslint-config-typescript-react-552d208c-9bb9-490a-9443-a528bfa11cfe.json delete mode 100644 packages/eslint-config-base/src/rules/strict.ts rename specs/eslint/__snapshots__/{config-snapshot.test.ts.snap => presets.test.mts.snap} (51%) delete mode 100644 specs/eslint/config-snapshot.test.ts create mode 100644 specs/eslint/presets.test.mts diff --git a/change/@rightcapital-eslint-config-base-533ee8bb-43e2-4aac-98aa-0743da157aa8.json b/change/@rightcapital-eslint-config-base-533ee8bb-43e2-4aac-98aa-0743da157aa8.json new file mode 100644 index 00000000..dadd8228 --- /dev/null +++ b/change/@rightcapital-eslint-config-base-533ee8bb-43e2-4aac-98aa-0743da157aa8.json @@ -0,0 +1,7 @@ +{ + "comment": "feat: remove unnecessary rules, migrate deprecated rules and tweak configs", + "type": "major", + "packageName": "@rightcapital/eslint-config-base", + "email": "im@pyonpyon.today", + "dependentChangeType": "patch" +} diff --git a/change/@rightcapital-eslint-config-javascript-6fbc77dd-536a-44c3-86a8-18473a1fc2e3.json b/change/@rightcapital-eslint-config-javascript-6fbc77dd-536a-44c3-86a8-18473a1fc2e3.json new file mode 100644 index 00000000..924d51ca --- /dev/null +++ b/change/@rightcapital-eslint-config-javascript-6fbc77dd-536a-44c3-86a8-18473a1fc2e3.json @@ -0,0 +1,7 @@ +{ + "comment": "feat: remove unnecessary rules, migrate deprecated rules and tweak configs", + "type": "major", + "packageName": "@rightcapital/eslint-config-javascript", + "email": "im@pyonpyon.today", + "dependentChangeType": "patch" +} diff --git a/change/@rightcapital-eslint-config-typescript-bd60cf26-8ff8-4d56-8f3f-beda1d170181.json b/change/@rightcapital-eslint-config-typescript-bd60cf26-8ff8-4d56-8f3f-beda1d170181.json new file mode 100644 index 00000000..ba44bd62 --- /dev/null +++ b/change/@rightcapital-eslint-config-typescript-bd60cf26-8ff8-4d56-8f3f-beda1d170181.json @@ -0,0 +1,7 @@ +{ + "comment": "feat: remove unnecessary rules, migrate deprecated rules and tweak configs", + "type": "major", + "packageName": "@rightcapital/eslint-config-typescript", + "email": "im@pyonpyon.today", + "dependentChangeType": "patch" +} diff --git a/change/@rightcapital-eslint-config-typescript-react-552d208c-9bb9-490a-9443-a528bfa11cfe.json b/change/@rightcapital-eslint-config-typescript-react-552d208c-9bb9-490a-9443-a528bfa11cfe.json new file mode 100644 index 00000000..f9dbf19b --- /dev/null +++ b/change/@rightcapital-eslint-config-typescript-react-552d208c-9bb9-490a-9443-a528bfa11cfe.json @@ -0,0 +1,7 @@ +{ + "comment": "feat: remove unnecessary rules, migrate deprecated rules and tweak configs", + "type": "major", + "packageName": "@rightcapital/eslint-config-typescript-react", + "email": "im@pyonpyon.today", + "dependentChangeType": "patch" +} diff --git a/packages/eslint-config-base/package.json b/packages/eslint-config-base/package.json index 29023145..ea1722f1 100644 --- a/packages/eslint-config-base/package.json +++ b/packages/eslint-config-base/package.json @@ -13,8 +13,7 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "files": [ - "lib/index.js", - "lib/index.d.ts" + "lib" ], "scripts": { "prebuild": "pnpm run clean", @@ -24,12 +23,13 @@ }, "dependencies": { "@rushstack/eslint-patch": "1.10.3", + "@stylistic/eslint-plugin-js": "2.3.0", "confusing-browser-globals": "1.0.11", "eslint-import-resolver-typescript": "3.6.1", "eslint-plugin-import": "npm:eslint-plugin-i@2.29.1", + "eslint-plugin-n": "17.9.0", "eslint-plugin-simple-import-sort": "12.1.0", - "eslint-plugin-unicorn": "54.0.0", - "semver": "7.6.2" + "eslint-plugin-unicorn": "54.0.0" }, "devDependencies": { "@rightcapital/tsconfig": "workspace:*", diff --git a/packages/eslint-config-base/src/index.ts b/packages/eslint-config-base/src/index.ts index 7243ff09..3a849393 100644 --- a/packages/eslint-config-base/src/index.ts +++ b/packages/eslint-config-base/src/index.ts @@ -12,82 +12,14 @@ const config: Linter.Config = { require.resolve('./rules/variables'), require.resolve('./rules/es6'), require.resolve('./rules/imports'), - require.resolve('./rules/strict'), - require.resolve('eslint-config-prettier'), ], - plugins: ['simple-import-sort', 'unicorn'], - env: { es6: true }, + env: { es2024: true }, parserOptions: { ecmaVersion: 'latest', ecmaFeatures: { jsx: true }, sourceType: 'module', }, - settings: { - 'import/resolver': { - typescript: {}, - }, - }, reportUnusedDisableDirectives: true, - rules: { - curly: ['error', 'all'], - - // not necessary or too opinionated - 'default-param-last': 'off', - 'class-methods-use-this': 'off', - 'arrow-body-style': 'off', - 'prefer-arrow-callback': 'off', - - /** - * We want to allow for...of statement, but airbnb config disables it. - * We override this rule from airbnb-base. - * - * airbnb config: https://github.com/airbnb/javascript/blob/5c01a1094986c4dd50a6ee4d9f7617abdfabb58a/packages/eslint-config-airbnb-base/rules/style.js#L338-L358 - */ - '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.', - }, - { - /** https://stackoverflow.com/a/72903871/2488867 */ - selector: - "MemberExpression[object.property.name='constructor'][property.name='name']", - message: 'constructor name is not reliable, do not use it.', - }, - ], - - // MEMO: simple-import-sort/imports should not be used with import/order - 'import/order': 'off', - 'simple-import-sort/imports': 'error', - - 'simple-import-sort/exports': 'error', - 'import/extensions': [ - 'warn', - 'ignorePackages', - { - ts: 'never', - tsx: 'never', - js: 'never', - jsx: 'never', - }, - ], - 'import/prefer-default-export': 'off', - - 'unicorn/prefer-node-protocol': 'error', - 'unicorn/text-encoding-identifier-case': 'error', - }, }; export = config; diff --git a/packages/eslint-config-base/src/rules/best-practices.ts b/packages/eslint-config-base/src/rules/best-practices.ts index bdffa013..ce74db0b 100644 --- a/packages/eslint-config-base/src/rules/best-practices.ts +++ b/packages/eslint-config-base/src/rules/best-practices.ts @@ -3,11 +3,8 @@ import type { Linter } from 'eslint'; // extracted from eslint-config-airbnb-base@15.0.0 // https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/best-practices.js const config: Linter.Config = { + plugins: ['unicorn'], rules: { - // enforces getter/setter pairs in objects - // https://eslint.org/docs/rules/accessor-pairs - 'accessor-pairs': 'off', - // enforces return statements in callbacks of array's methods // https://eslint.org/docs/rules/array-callback-return 'array-callback-return': ['error', { allowImplicit: true }], @@ -16,26 +13,13 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/block-scoped-var 'block-scoped-var': 'error', - // specify the maximum cyclomatic complexity allowed in a program - // https://eslint.org/docs/rules/complexity - complexity: ['off', 20], - - // enforce that class methods use "this" - // https://eslint.org/docs/rules/class-methods-use-this - 'class-methods-use-this': [ - 'error', - { - exceptMethods: [], - }, - ], - // require return statements to either always or never specify values // https://eslint.org/docs/rules/consistent-return 'consistent-return': 'error', // specify curly brace conventions for all control statements // https://eslint.org/docs/rules/curly - curly: ['error', 'multi-line'], // multiline + curly: ['error', 'all'], // require default case in switch statements // https://eslint.org/docs/rules/default-case @@ -45,17 +29,10 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/default-case-last 'default-case-last': 'error', - // https://eslint.org/docs/rules/default-param-last - 'default-param-last': 'error', - // encourages use of dot notation whenever possible // https://eslint.org/docs/rules/dot-notation 'dot-notation': ['error', { allowKeywords: true }], - // enforces consistent newlines before or after dots - // https://eslint.org/docs/rules/dot-location - 'dot-location': ['error', 'property'], - // require the use of === and !== // https://eslint.org/docs/rules/eqeqeq eqeqeq: ['error', 'always', { null: 'ignore' }], @@ -88,10 +65,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-constructor-return 'no-constructor-return': 'error', - // disallow division operators explicitly at beginning of regular expression - // https://eslint.org/docs/rules/no-div-regex - 'no-div-regex': 'off', - // disallow else after a return in an if // https://eslint.org/docs/rules/no-else-return 'no-else-return': ['error', { allowElseIf: false }], @@ -109,10 +82,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-empty-pattern 'no-empty-pattern': 'error', - // disallow comparisons to null without a type-checking operator - // https://eslint.org/docs/rules/no-eq-null - 'no-eq-null': 'off', - // disallow use of eval() // https://eslint.org/docs/rules/no-eval 'no-eval': 'error', @@ -133,42 +102,14 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-fallthrough 'no-fallthrough': 'error', - // disallow the use of leading or trailing decimal points in numeric literals - // https://eslint.org/docs/rules/no-floating-decimal - 'no-floating-decimal': 'error', - // disallow reassignments of native objects or read-only globals // https://eslint.org/docs/rules/no-global-assign 'no-global-assign': ['error', { exceptions: [] }], - // deprecated in favor of no-global-assign - // https://eslint.org/docs/rules/no-native-reassign - 'no-native-reassign': 'off', - - // disallow implicit type conversions - // https://eslint.org/docs/rules/no-implicit-coercion - 'no-implicit-coercion': [ - 'off', - { - boolean: false, - number: true, - string: true, - allow: [], - }, - ], - - // disallow var and named functions in global scope - // https://eslint.org/docs/rules/no-implicit-globals - 'no-implicit-globals': 'off', - // disallow use of eval()-like methods // https://eslint.org/docs/rules/no-implied-eval 'no-implied-eval': 'error', - // disallow this keywords outside of classes or class-like objects - // https://eslint.org/docs/rules/no-invalid-this - 'no-invalid-this': 'off', - // disallow usage of __iterator__ property // https://eslint.org/docs/rules/no-iterator 'no-iterator': 'error', @@ -185,27 +126,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-loop-func 'no-loop-func': 'error', - // disallow magic numbers - // https://eslint.org/docs/rules/no-magic-numbers - 'no-magic-numbers': [ - 'off', - { - ignore: [], - ignoreArrayIndexes: true, - enforceConst: true, - detectObjects: false, - }, - ], - - // disallow use of multiple spaces - // https://eslint.org/docs/rules/no-multi-spaces - 'no-multi-spaces': [ - 'error', - { - ignoreEOLComments: false, - }, - ], - // disallow use of multiline strings // https://eslint.org/docs/rules/no-multi-str 'no-multi-str': 'error', @@ -353,10 +273,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-throw-literal 'no-throw-literal': 'error', - // disallow unmodified conditions of loops - // https://eslint.org/docs/rules/no-unmodified-loop-condition - 'no-unmodified-loop-condition': 'off', - // disallow usage of expressions in statement position // https://eslint.org/docs/rules/no-unused-expressions 'no-unused-expressions': [ @@ -372,10 +288,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-unused-labels 'no-unused-labels': 'error', - // disallow unnecessary .call() and .apply() - // https://eslint.org/docs/rules/no-useless-call - 'no-useless-call': 'off', - // Disallow unnecessary catch clauses // https://eslint.org/docs/rules/no-useless-catch 'no-useless-catch': 'error', @@ -396,13 +308,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-void 'no-void': 'error', - // disallow usage of configurable warning terms in comments: e.g. todo - // https://eslint.org/docs/rules/no-warning-comments - 'no-warning-comments': [ - 'off', - { terms: ['todo', 'fixme', 'xxx'], location: 'start' }, - ], - // disallow use of the with statement // https://eslint.org/docs/rules/no-with 'no-with': 'error', @@ -411,10 +316,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/prefer-promise-reject-errors 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }], - // Suggest using named capture group in regular expression - // https://eslint.org/docs/rules/prefer-named-capture-group - 'prefer-named-capture-group': 'off', - // https://eslint.org/docs/rules/prefer-regex-literals 'prefer-regex-literals': [ 'error', @@ -427,25 +328,19 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/radix radix: 'error', - // require `await` in `async function` (note: this is a horrible rule that should never be used) - // https://eslint.org/docs/rules/require-await - 'require-await': 'off', - - // Enforce the use of u flag on RegExp - // https://eslint.org/docs/rules/require-unicode-regexp - 'require-unicode-regexp': 'off', - // requires to declare all vars on top of their containing scope // https://eslint.org/docs/rules/vars-on-top 'vars-on-top': 'error', - // require immediate function invocation to be wrapped in parentheses - // https://eslint.org/docs/rules/wrap-iife.html - 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }], - // require or disallow Yoda conditions // https://eslint.org/docs/rules/yoda yoda: 'error', + + // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-node-protocol.md + 'unicorn/prefer-node-protocol': 'error', + + // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/text-encoding-identifier-case.md + 'unicorn/text-encoding-identifier-case': 'error', }, }; diff --git a/packages/eslint-config-base/src/rules/errors.ts b/packages/eslint-config-base/src/rules/errors.ts index ee12bf5b..88b5b73e 100644 --- a/packages/eslint-config-base/src/rules/errors.ts +++ b/packages/eslint-config-base/src/rules/errors.ts @@ -65,23 +65,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-extra-boolean-cast 'no-extra-boolean-cast': 'error', - // disallow unnecessary parentheses - // https://eslint.org/docs/rules/no-extra-parens - 'no-extra-parens': [ - 'off', - 'all', - { - conditionalAssign: true, - nestedBinaryExpressions: false, - returnAssign: false, - ignoreJSX: 'all', // delegate to eslint-plugin-react - enforceForArrowConditionals: false, - }, - ], - - // disallow unnecessary semicolons - 'no-extra-semi': 'error', - // disallow overwriting functions written as function declarations 'no-func-assign': 'error', @@ -163,29 +146,15 @@ const config: Linter.Config = { // Disallow Unused Private Class Members // https://eslint.org/docs/rules/no-unused-private-class-members - // TODO: enable once eslint 7 is dropped (which is semver-major) - 'no-unused-private-class-members': 'off', + 'no-unused-private-class-members': 'error', // Disallow useless backreferences in regular expressions // https://eslint.org/docs/rules/no-useless-backreference 'no-useless-backreference': 'error', - // disallow negation of the left operand of an in expression - // deprecated in favor of no-unsafe-negation - 'no-negated-in-lhs': 'off', - - // Disallow assignments that can lead to race conditions due to usage of await or yield - // https://eslint.org/docs/rules/require-atomic-updates - // note: not enabled because it is very buggy - 'require-atomic-updates': 'off', - // disallow comparisons with the value NaN 'use-isnan': 'error', - // ensure JSDoc comments are valid - // https://eslint.org/docs/rules/valid-jsdoc - 'valid-jsdoc': 'off', - // ensure that the results of typeof are compared against a valid string // https://eslint.org/docs/rules/valid-typeof 'valid-typeof': ['error', { requireStringLiterals: true }], diff --git a/packages/eslint-config-base/src/rules/es6.ts b/packages/eslint-config-base/src/rules/es6.ts index 53fa0f9f..808400b8 100644 --- a/packages/eslint-config-base/src/rules/es6.ts +++ b/packages/eslint-config-base/src/rules/es6.ts @@ -3,58 +3,14 @@ import type { Linter } from 'eslint'; // extracted from eslint-config-airbnb-base@15.0.0 // https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/es6.js const config: Linter.Config = { - env: { - es6: true, - }, - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: { - generators: false, - objectLiteralDuplicateProperties: false, - }, - }, - rules: { - // enforces no braces where they can be omitted - // https://eslint.org/docs/rules/arrow-body-style - // TODO: enable requireReturnForObjectLiteral? - 'arrow-body-style': [ - 'error', - 'as-needed', - { - requireReturnForObjectLiteral: false, - }, - ], - - // require parens in arrow function arguments - // https://eslint.org/docs/rules/arrow-parens - 'arrow-parens': ['error', 'always'], - - // require space before/after arrow function's arrow - // https://eslint.org/docs/rules/arrow-spacing - 'arrow-spacing': ['error', { before: true, after: true }], - // verify super() callings in constructors 'constructor-super': 'error', - // enforce the spacing around the * in generator functions - // https://eslint.org/docs/rules/generator-star-spacing - 'generator-star-spacing': ['error', { before: false, after: true }], - // disallow modifying variables of class declarations // https://eslint.org/docs/rules/no-class-assign 'no-class-assign': 'error', - // disallow arrow functions where they could be confused with comparisons - // https://eslint.org/docs/rules/no-confusing-arrow - 'no-confusing-arrow': [ - 'error', - { - allowParens: true, - }, - ], - // disallow modifying variables that are declared using const 'no-const-assign': 'error', @@ -62,11 +18,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-dupe-class-members 'no-dupe-class-members': 'error', - // disallow importing from the same path more than once - // https://eslint.org/docs/rules/no-duplicate-imports - // replaced by https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md - 'no-duplicate-imports': 'off', - // disallow symbol constructor // https://eslint.org/docs/rules/no-new-symbol 'no-new-symbol': 'error', @@ -83,16 +34,6 @@ const config: Linter.Config = { }, ], - // disallow specific imports - // https://eslint.org/docs/rules/no-restricted-imports - 'no-restricted-imports': [ - 'off', - { - paths: [], - patterns: [], - }, - ], - // disallow to use this/super before super() calling in constructors. // https://eslint.org/docs/rules/no-this-before-super 'no-this-before-super': 'error', @@ -130,15 +71,6 @@ const config: Linter.Config = { }, ], - // suggest using arrow functions as callbacks - 'prefer-arrow-callback': [ - 'error', - { - allowNamedFunctions: false, - allowUnboundThis: true, - }, - ], - // suggest using of const declaration for variables that are never modified after declared 'prefer-const': [ 'error', @@ -171,10 +103,6 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/prefer-numeric-literals 'prefer-numeric-literals': 'error', - // suggest using Reflect methods where applicable - // https://eslint.org/docs/rules/prefer-reflect - 'prefer-reflect': 'off', - // use rest parameters instead of arguments // https://eslint.org/docs/rules/prefer-rest-params 'prefer-rest-params': 'error', @@ -191,33 +119,9 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/require-yield 'require-yield': 'error', - // enforce spacing between object rest-spread - // https://eslint.org/docs/rules/rest-spread-spacing - 'rest-spread-spacing': ['error', 'never'], - - // import sorting - // https://eslint.org/docs/rules/sort-imports - 'sort-imports': [ - 'off', - { - ignoreCase: false, - ignoreDeclarationSort: false, - ignoreMemberSort: false, - memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], - }, - ], - // require a Symbol description // https://eslint.org/docs/rules/symbol-description 'symbol-description': 'error', - - // enforce usage of spacing in template strings - // https://eslint.org/docs/rules/template-curly-spacing - 'template-curly-spacing': 'error', - - // enforce spacing around the * in yield* expressions - // https://eslint.org/docs/rules/yield-star-spacing - 'yield-star-spacing': ['error', 'after'], }, }; diff --git a/packages/eslint-config-base/src/rules/imports.ts b/packages/eslint-config-base/src/rules/imports.ts index ca0e998d..10279de3 100644 --- a/packages/eslint-config-base/src/rules/imports.ts +++ b/packages/eslint-config-base/src/rules/imports.ts @@ -3,20 +3,13 @@ import type { Linter } from 'eslint'; // extracted from eslint-config-airbnb-base@15.0.0 // https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/imports.js const config: Linter.Config = { - env: { - es6: true, - }, - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - }, - plugins: ['import'], - + plugins: ['import', 'simple-import-sort'], settings: { 'import/resolver': { node: { extensions: ['.mjs', '.js', '.json'], }, + typescript: {}, }, 'import/extensions': ['.js', '.mjs', '.jsx'], 'import/core-modules': [], @@ -37,13 +30,6 @@ const config: Linter.Config = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/named.md#when-not-to-use-it 'import/named': 'error', - // ensure default import coupled with default export - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/default.md#when-not-to-use-it - 'import/default': 'off', - - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/namespace.md - 'import/namespace': 'off', - // Helpful warnings: // disallow invalid exports, e.g. multiple defaults @@ -58,25 +44,24 @@ const config: Linter.Config = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default-member.md 'import/no-named-as-default-member': 'error', - // disallow use of jsdoc-marked-deprecated imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-deprecated.md - 'import/no-deprecated': 'off', - // Forbid the use of extraneous packages // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-extraneous-dependencies.md // paths are treated both as absolute paths, and relative to process.cwd() 'import/no-extraneous-dependencies': [ 'error', { + /** + * TODO: Move these options to ESLint's `overrides` groups for better clarity. + */ devDependencies: [ 'test/**', // tape, common npm pattern 'tests/**', // also common npm pattern 'spec/**', // mocha, rspec-like pattern '**/__tests__/**', // jest pattern '**/__mocks__/**', // jest pattern - 'test.{js,jsx}', // repos with a single test file - 'test-*.{js,jsx}', // repos with multiple top-level test files - '**/*{.,_}{test,spec}.{js,jsx}', // tests where the extension or filename suffix denotes that it is a test + 'test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}', // repos with a single test file + 'test-*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}', // repos with multiple top-level test files + '**/*{.,_}{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}', // tests where the extension or filename suffix denotes that it is a test '**/jest.config.js', // jest config '**/jest.setup.js', // jest setup '**/vue.config.js', // vue-cli config @@ -90,7 +75,12 @@ const config: Linter.Config = { '**/protractor.conf.js', // protractor config '**/protractor.conf.*.js', // protractor config '**/karma.conf.js', // karma config - '**/.eslintrc.js', // eslint config + + // eslint config(legacy) + // https://eslint.org/docs/latest/use/configure/configuration-files-deprecated + '**/.eslintrc.{js,cjs}', + // eslint config(flat config, new) + '**/eslint.config.{js,cjs,mjs}', ], optionalDependencies: false, }, @@ -100,73 +90,43 @@ const config: Linter.Config = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-mutable-exports.md 'import/no-mutable-exports': 'error', - // Module systems: - - // disallow require() - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-commonjs.md - 'import/no-commonjs': 'off', - - // disallow AMD require/define - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-amd.md - 'import/no-amd': 'error', - - // No Node.js builtin modules - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md - // TODO: enable? - 'import/no-nodejs-modules': 'off', - // Style guide: // disallow non-import statements appearing before import statements // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md 'import/first': 'error', - // disallow non-import statements appearing before import statements - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/imports-first.md - // deprecated: use `import/first` - 'import/imports-first': 'off', - // disallow duplicate imports // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md 'import/no-duplicates': 'error', - // disallow namespace imports - // TODO: enable? - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-namespace.md - 'import/no-namespace': 'off', - // Ensure consistent use of file extension within the import path // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/extensions.md 'import/extensions': [ - 'error', + 'warn', 'ignorePackages', { + ts: 'never', + tsx: 'never', js: 'never', - mjs: 'never', jsx: 'never', }, ], - // ensure absolute imports are above relative imports and that unassigned imports are ignored - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/order.md - // TODO: enforce a stricter convention in module import order? - 'import/order': [ - 'error', - { groups: [['builtin', 'external', 'internal']] }, - ], + // Ensure all imports are sorted + // https://github.com/lydell/eslint-plugin-simple-import-sort?tab=readme-ov-file#usage + // MEMO: simple-import-sort/imports should not be used with import/order + 'import/order': 'off', + 'simple-import-sort/imports': 'error', + + // Ensure all exports are sorted + // https://github.com/lydell/eslint-plugin-simple-import-sort?tab=readme-ov-file#usage + 'simple-import-sort/exports': 'error', // Require a newline after the last import/require in a group // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/newline-after-import.md 'import/newline-after-import': 'error', - // Require modules with a single export to use a default export - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md - 'import/prefer-default-export': 'error', - - // Restrict which files can be imported in a given folder - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-restricted-paths.md - 'import/no-restricted-paths': 'off', - // Forbid modules to have too many dependencies // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/max-dependencies.md 'import/max-dependencies': ['off', { max: 10 }], @@ -179,68 +139,14 @@ const config: Linter.Config = { // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md 'import/no-dynamic-require': 'error', - // prevent importing the submodules of other modules - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-internal-modules.md - 'import/no-internal-modules': [ - 'off', - { - allow: [], - }, - ], - - // Warn if a module could be mistakenly parsed as a script by a consumer - // leveraging Unambiguous JavaScript Grammar - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/unambiguous.md - // this should not be enabled until this proposal has at least been *presented* to TC39. - // At the moment, it's not a thing. - 'import/unambiguous': 'off', - // Forbid Webpack loader syntax in imports // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-webpack-loader-syntax.md 'import/no-webpack-loader-syntax': 'error', - // Prevent unassigned imports - // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-unassigned-import.md - // importing for side effects is perfectly acceptable, if you need side effects. - 'import/no-unassigned-import': 'off', - // Prevent importing the default as if it were named // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-default.md 'import/no-named-default': 'error', - // Reports if a module's default export is unnamed - // https://github.com/benmosher/eslint-plugin-import/blob/d9b712ac7fd1fddc391f7b234827925c160d956f/docs/rules/no-anonymous-default-export.md - 'import/no-anonymous-default-export': [ - 'off', - { - allowArray: false, - allowArrowFunction: false, - allowAnonymousClass: false, - allowAnonymousFunction: false, - allowLiteral: false, - allowObject: false, - }, - ], - - // This rule enforces that all exports are declared at the bottom of the file. - // https://github.com/benmosher/eslint-plugin-import/blob/98acd6afd04dcb6920b81330114e146dc8532ea4/docs/rules/exports-last.md - // TODO: enable? - 'import/exports-last': 'off', - - // Reports when named exports are not grouped together in a single export declaration - // or when multiple assignments to CommonJS module.exports or exports object are present - // in a single file. - // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/group-exports.md - 'import/group-exports': 'off', - - // forbid default exports. this is a terrible rule, do not use it. - // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-default-export.md - 'import/no-default-export': 'off', - - // Prohibit named exports. this is a terrible rule, do not use it. - // https://github.com/benmosher/eslint-plugin-import/blob/1ec80fa35fa1819e2d35a70e68fb6a149fb57c5e/docs/rules/no-named-export.md - 'import/no-named-export': 'off', - // Forbid a module from importing itself // https://github.com/benmosher/eslint-plugin-import/blob/44a038c06487964394b1e15b64f3bd34e5d40cde/docs/rules/no-self-import.md 'import/no-self-import': 'error', @@ -253,32 +159,6 @@ const config: Linter.Config = { // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/no-useless-path-segments.md 'import/no-useless-path-segments': ['error', { commonjs: true }], - // dynamic imports require a leading comment with a webpackChunkName - // https://github.com/benmosher/eslint-plugin-import/blob/ebafcbf59ec9f653b2ac2a0156ca3bcba0a7cf57/docs/rules/dynamic-import-chunkname.md - 'import/dynamic-import-chunkname': [ - 'off', - { - importFunctions: [], - webpackChunknameFormat: '[0-9a-zA-Z-_/.]+', - }, - ], - - // Use this rule to prevent imports to folders in relative parent paths. - // https://github.com/benmosher/eslint-plugin-import/blob/c34f14f67f077acd5a61b3da9c0b0de298d20059/docs/rules/no-relative-parent-imports.md - 'import/no-relative-parent-imports': 'off', - - // Reports modules without any exports, or with unused exports - // https://github.com/benmosher/eslint-plugin-import/blob/f63dd261809de6883b13b6b5b960e6d7f42a7813/docs/rules/no-unused-modules.md - // TODO: enable once it supports CJS - 'import/no-unused-modules': [ - 'off', - { - ignoreExports: [], - missingExports: true, - unusedExports: true, - }, - ], - // Reports the use of import declarations with CommonJS exports in any module except for the main module. // https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md 'import/no-import-module-exports': [ diff --git a/packages/eslint-config-base/src/rules/node.ts b/packages/eslint-config-base/src/rules/node.ts index 90ebe31a..d1d1611f 100644 --- a/packages/eslint-config-base/src/rules/node.ts +++ b/packages/eslint-config-base/src/rules/node.ts @@ -7,42 +7,24 @@ const config: Linter.Config = { node: true, }, - rules: { - // enforce return after a callback - 'callback-return': 'off', + plugins: ['n'], + rules: { // require all requires be top-level - // https://eslint.org/docs/rules/global-require - 'global-require': 'error', - - // enforces error handling in callbacks (node environment) - 'handle-callback-err': 'off', + // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/global-require.md + 'n/global-require': 'error', // disallow use of the Buffer() constructor // https://eslint.org/docs/rules/no-buffer-constructor 'no-buffer-constructor': 'error', - // disallow mixing regular variable and require declarations - 'no-mixed-requires': ['off', false], - // disallow use of new operator with the require function - 'no-new-require': 'error', + // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-new-require.md + 'n/no-new-require': 'error', // disallow string concatenation with __dirname and __filename - // https://eslint.org/docs/rules/no-path-concat - 'no-path-concat': 'error', - - // disallow use of process.env - 'no-process-env': 'off', - - // disallow process.exit() - 'no-process-exit': 'off', - - // restrict usage of specified node modules - 'no-restricted-modules': 'off', - - // disallow use of synchronous methods (off by default) - 'no-sync': 'off', + // https://github.com/eslint-community/eslint-plugin-n/blob/master/docs/rules/no-path-concat.md + 'n/no-path-concat': 'error', }, }; diff --git a/packages/eslint-config-base/src/rules/strict.ts b/packages/eslint-config-base/src/rules/strict.ts deleted file mode 100644 index 1baa79dc..00000000 --- a/packages/eslint-config-base/src/rules/strict.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { Linter } from 'eslint'; - -// extracted from eslint-config-airbnb-base@15.0.0 -// https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/strict.js -const config: Linter.Config = { - rules: { - // babel inserts `'use strict';` for us - strict: ['error', 'never'], - }, -}; - -export = config; diff --git a/packages/eslint-config-base/src/rules/style.ts b/packages/eslint-config-base/src/rules/style.ts index 28e5d71f..405edef0 100644 --- a/packages/eslint-config-base/src/rules/style.ts +++ b/packages/eslint-config-base/src/rules/style.ts @@ -1,320 +1,42 @@ import type { Linter } from 'eslint'; -import semver = require('semver'); -import eslintPkg = require('eslint/package.json'); - // extracted from eslint-config-airbnb-base@15.0.0 // https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/style.js const config: Linter.Config = { + plugins: ['@stylistic/js'], rules: { - // enforce line breaks after opening and before closing array brackets - // https://eslint.org/docs/rules/array-bracket-newline - // TODO: enable? semver-major - 'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 } - - // enforce line breaks between array elements - // https://eslint.org/docs/rules/array-element-newline - // TODO: enable? semver-major - 'array-element-newline': ['off', { multiline: true, minItems: 3 }], - - // enforce spacing inside array brackets - 'array-bracket-spacing': ['error', 'never'], - - // enforce spacing inside single-line blocks - // https://eslint.org/docs/rules/block-spacing - 'block-spacing': ['error', 'always'], - - // enforce one true brace style - 'brace-style': ['error', '1tbs', { allowSingleLine: true }], - // require camel case names camelcase: ['error', { properties: 'never', ignoreDestructuring: false }], - // enforce or disallow capitalization of the first letter of a comment - // https://eslint.org/docs/rules/capitalized-comments - 'capitalized-comments': [ - 'off', - 'never', - { - line: { - ignorePattern: '.*', - ignoreInlineComments: true, - ignoreConsecutiveComments: true, - }, - block: { - ignorePattern: '.*', - ignoreInlineComments: true, - ignoreConsecutiveComments: true, - }, - }, - ], - - // require trailing commas in multiline object literals - 'comma-dangle': [ - 'error', - { - arrays: 'always-multiline', - objects: 'always-multiline', - imports: 'always-multiline', - exports: 'always-multiline', - functions: 'always-multiline', - }, - ], - - // enforce spacing before and after comma - 'comma-spacing': ['error', { before: false, after: true }], - - // enforce one true comma style - 'comma-style': [ - 'error', - 'last', - { - exceptions: { - ArrayExpression: false, - ArrayPattern: false, - ArrowFunctionExpression: false, - CallExpression: false, - FunctionDeclaration: false, - FunctionExpression: false, - ImportDeclaration: false, - ObjectExpression: false, - ObjectPattern: false, - VariableDeclaration: false, - NewExpression: false, - }, - }, - ], - - // disallow padding inside computed properties - 'computed-property-spacing': ['error', 'never'], - - // enforces consistent naming when capturing the current execution context - 'consistent-this': 'off', - - // enforce newline at the end of file, with no multiple empty lines - 'eol-last': ['error', 'always'], - - // https://eslint.org/docs/rules/function-call-argument-newline - 'function-call-argument-newline': ['error', 'consistent'], - - // enforce spacing between functions and their invocations - // https://eslint.org/docs/rules/func-call-spacing - 'func-call-spacing': ['error', 'never'], - - // requires function names to match the name of the variable or property to which they are - // assigned - // https://eslint.org/docs/rules/func-name-matching - 'func-name-matching': [ - 'off', - 'always', - { - includeCommonJSModuleExports: false, - considerPropertyDescriptor: true, - }, - ], - // require function expressions to have a name // https://eslint.org/docs/rules/func-names 'func-names': 'warn', - // enforces use of function declarations or expressions - // https://eslint.org/docs/rules/func-style - // TODO: enable - 'func-style': ['off', 'expression'], + // require an empty line between class members + // https://eslint.style/rules/js/lines-between-class-members + '@stylistic/js/lines-between-class-members': ['error', 'always'], - // require line breaks inside function parentheses if there are line breaks between parameters - // https://eslint.org/docs/rules/function-paren-newline - 'function-paren-newline': [ + // require newlines around directives + // https://eslint.style/rules/js/padding-line-between-statements + '@stylistic/js/padding-line-between-statements': [ 'error', - semver.satisfies(eslintPkg.version, '>= 6') - ? 'multiline-arguments' - : 'consistent', - ], - - // disallow specified identifiers - // https://eslint.org/docs/rules/id-denylist - 'id-denylist': 'off', - - // this option enforces minimum and maximum identifier lengths - // (variable names, property names etc.) - 'id-length': 'off', - - // require identifiers to match the provided regular expression - 'id-match': 'off', - - // Enforce the location of arrow function bodies with implicit returns - // https://eslint.org/docs/rules/implicit-arrow-linebreak - 'implicit-arrow-linebreak': ['error', 'beside'], - - // this option sets a specific tab width for your code - // https://eslint.org/docs/rules/indent - indent: [ - 'error', - 2, - { - SwitchCase: 1, - VariableDeclarator: 1, - outerIIFEBody: 1, - // MemberExpression: null, - FunctionDeclaration: { - parameters: 1, - body: 1, - }, - FunctionExpression: { - parameters: 1, - body: 1, - }, - CallExpression: { - arguments: 1, - }, - ArrayExpression: 1, - ObjectExpression: 1, - ImportDeclaration: 1, - flatTernaryExpressions: false, - // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js - ignoredNodes: [ - 'JSXElement', - 'JSXElement > *', - 'JSXAttribute', - 'JSXIdentifier', - 'JSXNamespacedName', - 'JSXMemberExpression', - 'JSXSpreadAttribute', - 'JSXExpressionContainer', - 'JSXOpeningElement', - 'JSXClosingElement', - 'JSXFragment', - 'JSXOpeningFragment', - 'JSXClosingFragment', - 'JSXText', - 'JSXEmptyExpression', - 'JSXSpreadChild', - ], - ignoreComments: false, - }, - ], - - // specify whether double or single quotes should be used in JSX attributes - // https://eslint.org/docs/rules/jsx-quotes - 'jsx-quotes': ['off', 'prefer-double'], - - // enforces spacing between keys and values in object literal properties - 'key-spacing': ['error', { beforeColon: false, afterColon: true }], - - // require a space before & after certain keywords - 'keyword-spacing': [ - 'error', - { - before: true, - after: true, - overrides: { - return: { after: true }, - throw: { after: true }, - case: { after: true }, - }, - }, - ], - - // enforce position of line comments - // https://eslint.org/docs/rules/line-comment-position - // TODO: enable? - 'line-comment-position': [ - 'off', - { - position: 'above', - ignorePattern: '', - applyDefaultPatterns: true, - }, - ], - - // disallow mixed 'LF' and 'CRLF' as linebreaks - // https://eslint.org/docs/rules/linebreak-style - 'linebreak-style': ['error', 'unix'], - - // require or disallow an empty line between class members - // https://eslint.org/docs/rules/lines-between-class-members - 'lines-between-class-members': [ - 'error', - 'always', - { exceptAfterSingleLine: false }, - ], - - // enforces empty lines around comments - 'lines-around-comment': 'off', - - // require or disallow newlines around directives - // https://eslint.org/docs/rules/lines-around-directive - 'lines-around-directive': [ - 'error', - { - before: 'always', - after: 'always', - }, - ], - - // specify the maximum depth that blocks can be nested - 'max-depth': ['off', 4], - - // specify the maximum length of a line in your program - // https://eslint.org/docs/rules/max-len - 'max-len': [ - 'error', - 100, - 2, { - ignoreUrls: true, - ignoreComments: false, - ignoreRegExpLiterals: true, - ignoreStrings: true, - ignoreTemplateLiterals: true, + blankLine: 'always', + prev: 'directive', + next: '*', }, - ], - - // specify the max number of lines in a file - // https://eslint.org/docs/rules/max-lines - 'max-lines': [ - 'off', { - max: 300, - skipBlankLines: true, - skipComments: true, + blankLine: 'always', + prev: '*', + next: 'directive', }, - ], - - // enforce a maximum function length - // https://eslint.org/docs/rules/max-lines-per-function - 'max-lines-per-function': [ - 'off', { - max: 50, - skipBlankLines: true, - skipComments: true, - IIFEs: true, + blankLine: 'any', + prev: 'directive', + next: 'directive', }, ], - // specify the maximum depth callbacks can be nested - 'max-nested-callbacks': 'off', - - // limits the number of parameters that can be used in the function declaration. - 'max-params': ['off', 3], - - // specify the maximum number of statement allowed in a function - 'max-statements': ['off', 10], - - // restrict the number of statements per line - // https://eslint.org/docs/rules/max-statements-per-line - 'max-statements-per-line': ['off', { max: 1 }], - - // enforce a particular style for multiline comments - // https://eslint.org/docs/rules/multiline-comment-style - 'multiline-comment-style': ['off', 'starred-block'], - - // require multiline ternary - // https://eslint.org/docs/rules/multiline-ternary - // TODO: enable? - 'multiline-ternary': ['off', 'never'], - // require a capital letter for constructors 'new-cap': [ 'error', @@ -330,21 +52,6 @@ const config: Linter.Config = { }, ], - // disallow the omission of parentheses when invoking a constructor with no arguments - // https://eslint.org/docs/rules/new-parens - 'new-parens': 'error', - - // allow/disallow an empty newline after var statement - 'newline-after-var': 'off', - - // https://eslint.org/docs/rules/newline-before-return - 'newline-before-return': 'off', - - // enforces new line after each method call in the chain to make it - // more readable and easy to maintain - // https://eslint.org/docs/rules/newline-per-chained-call - 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }], - // disallow use of the Array constructor 'no-array-constructor': 'error', @@ -356,55 +63,20 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-continue 'no-continue': 'error', - // disallow comments inline after code - 'no-inline-comments': 'off', - // disallow if as the only statement in an else block // https://eslint.org/docs/rules/no-lonely-if 'no-lonely-if': 'error', - // disallow un-paren'd mixes of different operators - // https://eslint.org/docs/rules/no-mixed-operators - 'no-mixed-operators': [ - 'error', - { - // the list of arithmetic groups disallows mixing `%` and `**` - // with other arithmetic operators. - groups: [ - ['%', '**'], - ['%', '+'], - ['%', '-'], - ['%', '*'], - ['%', '/'], - ['/', '*'], - ['&', '|', '<<', '>>', '>>>'], - ['==', '!=', '===', '!=='], - ['&&', '||'], - ], - allowSamePrecedence: false, - }, - ], - - // disallow mixed spaces and tabs for indentation - 'no-mixed-spaces-and-tabs': 'error', - // disallow use of chained assignment expressions // https://eslint.org/docs/rules/no-multi-assign 'no-multi-assign': ['error'], - // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning - // https://eslint.org/docs/rules/no-multiple-empty-lines - 'no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }], - - // disallow negated conditions - // https://eslint.org/docs/rules/no-negated-condition - 'no-negated-condition': 'off', - // disallow nested ternary expressions 'no-nested-ternary': 'error', - // disallow use of the Object constructor - 'no-new-object': 'error', + // disallow calling the Object constructor without an argument + // https://eslint.org/docs/latest/rules/no-object-constructor + 'no-object-constructor': 'error', // disallow use of unary operators, ++ and -- // https://eslint.org/docs/rules/no-plusplus @@ -419,11 +91,6 @@ const config: Linter.Config = { 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: 'ForOfStatement', - message: - 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.', - }, { selector: 'LabeledStatement', message: @@ -434,23 +101,11 @@ const config: Linter.Config = { message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.', }, - ], - - // disallow space between function identifier and application - 'no-spaced-func': 'error', - - // disallow tab characters entirely - 'no-tabs': 'error', - - // disallow the use of ternary operators - 'no-ternary': 'off', - - // disallow trailing whitespace at the end of lines - 'no-trailing-spaces': [ - 'error', { - skipBlankLines: false, - ignoreComments: false, + /** https://stackoverflow.com/a/72903871/2488867 */ + selector: + "MemberExpression[object.property.name='constructor'][property.name='name']", + message: 'constructor name is not reliable, do not use it.', }, ], @@ -471,82 +126,13 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/no-unneeded-ternary 'no-unneeded-ternary': ['error', { defaultAssignment: false }], - // disallow whitespace before properties - // https://eslint.org/docs/rules/no-whitespace-before-property - 'no-whitespace-before-property': 'error', - - // enforce the location of single-line statements - // https://eslint.org/docs/rules/nonblock-statement-body-position - 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }], - - // require padding inside curly braces - 'object-curly-spacing': ['error', 'always'], - - // enforce line breaks between braces - // https://eslint.org/docs/rules/object-curly-newline - 'object-curly-newline': [ - 'error', - { - ObjectExpression: { - minProperties: 4, - multiline: true, - consistent: true, - }, - ObjectPattern: { minProperties: 4, multiline: true, consistent: true }, - ImportDeclaration: { - minProperties: 4, - multiline: true, - consistent: true, - }, - ExportDeclaration: { - minProperties: 4, - multiline: true, - consistent: true, - }, - }, - ], - - // enforce "same line" or "multiple line" on object properties. - // https://eslint.org/docs/rules/object-property-newline - 'object-property-newline': [ - 'error', - { - allowAllPropertiesOnSameLine: true, - }, - ], - // allow just one var statement per function 'one-var': ['error', 'never'], - // require a newline around variable declaration - // https://eslint.org/docs/rules/one-var-declaration-per-line - 'one-var-declaration-per-line': ['error', 'always'], - // require assignment operator shorthand where possible or prohibit it entirely // https://eslint.org/docs/rules/operator-assignment 'operator-assignment': ['error', 'always'], - // Requires operator at the beginning of the line in multiline statements - // https://eslint.org/docs/rules/operator-linebreak - 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }], - - // disallow padding within blocks - 'padded-blocks': [ - 'error', - { - blocks: 'never', - classes: 'never', - switches: 'never', - }, - { - allowSingleLineBlocks: true, - }, - ], - - // Require or disallow padding lines between statements - // https://eslint.org/docs/rules/padding-line-between-statements - 'padding-line-between-statements': 'off', - // Disallow the use of Math.pow in favor of the ** operator // https://eslint.org/docs/rules/prefer-exponentiation-operator 'prefer-exponentiation-operator': 'error', @@ -555,71 +141,9 @@ const config: Linter.Config = { // https://eslint.org/docs/rules/prefer-object-spread 'prefer-object-spread': 'error', - // require quotes around object literal property names - // https://eslint.org/docs/rules/quote-props.html - 'quote-props': [ - 'error', - 'as-needed', - { keywords: false, unnecessary: true, numbers: false }, - ], - - // specify whether double or single quotes should be used - quotes: ['error', 'single', { avoidEscape: true }], - - // do not require jsdoc - // https://eslint.org/docs/rules/require-jsdoc - 'require-jsdoc': 'off', - - // require or disallow use of semicolons instead of ASI - semi: ['error', 'always'], - - // enforce spacing before and after semicolons - 'semi-spacing': ['error', { before: false, after: true }], - - // Enforce location of semicolons - // https://eslint.org/docs/rules/semi-style - 'semi-style': ['error', 'last'], - - // requires object keys to be sorted - 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }], - - // sort variables within the same declaration block - 'sort-vars': 'off', - - // require or disallow space before blocks - 'space-before-blocks': 'error', - - // require or disallow space before function opening parenthesis - // https://eslint.org/docs/rules/space-before-function-paren - 'space-before-function-paren': [ - 'error', - { - anonymous: 'always', - named: 'never', - asyncArrow: 'always', - }, - ], - - // require or disallow spaces inside parentheses - 'space-in-parens': ['error', 'never'], - - // require spaces around operators - 'space-infix-ops': 'error', - - // Require or disallow spaces before/after unary operators - // https://eslint.org/docs/rules/space-unary-ops - 'space-unary-ops': [ - 'error', - { - words: true, - nonwords: false, - overrides: {}, - }, - ], - // require or disallow a space immediately following the // or /* in a comment - // https://eslint.org/docs/rules/spaced-comment - 'spaced-comment': [ + // https://eslint.style/rules/js/spaced-comment + '@stylistic/js/spaced-comment': [ 'error', 'always', { @@ -635,20 +159,9 @@ const config: Linter.Config = { }, ], - // Enforce spacing around colons of switch statements - // https://eslint.org/docs/rules/switch-colon-spacing - 'switch-colon-spacing': ['error', { after: true, before: false }], - - // Require or disallow spacing between template tags and their literals - // https://eslint.org/docs/rules/template-tag-spacing - 'template-tag-spacing': ['error', 'never'], - // require or disallow the Unicode Byte Order Mark // https://eslint.org/docs/rules/unicode-bom 'unicode-bom': ['error', 'never'], - - // require regex literals to be wrapped in parentheses - 'wrap-regex': 'off', }, }; diff --git a/packages/eslint-config-base/src/rules/variables.ts b/packages/eslint-config-base/src/rules/variables.ts index fb2057c6..00e99cb3 100644 --- a/packages/eslint-config-base/src/rules/variables.ts +++ b/packages/eslint-config-base/src/rules/variables.ts @@ -6,12 +6,6 @@ import confusingBrowserGlobals = require('confusing-browser-globals'); // https://github.com/airbnb/javascript/blob/eslint-config-airbnb-base-v15.0.0/packages/eslint-config-airbnb-base/rules/variables.js const config: Linter.Config = { rules: { - // enforce or disallow variable initializations at definition - 'init-declarations': 'off', - - // disallow the catch clause parameter name being the same as a variable in the outer scope - 'no-catch-shadow': 'off', - // disallow deletion of variables 'no-delete-var': 'error', @@ -47,11 +41,6 @@ const config: Linter.Config = { // disallow use of undefined when initializing variables 'no-undef-init': 'error', - // disallow use of undefined variable - // https://eslint.org/docs/rules/no-undefined - // TODO: enable? - 'no-undefined': 'off', - // disallow declaration of variables that are not used in the code 'no-unused-vars': [ 'error', diff --git a/packages/eslint-config-javascript/package.json b/packages/eslint-config-javascript/package.json index cfccab68..730353fb 100644 --- a/packages/eslint-config-javascript/package.json +++ b/packages/eslint-config-javascript/package.json @@ -13,8 +13,7 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "files": [ - "lib/index.js", - "lib/index.d.ts" + "lib" ], "scripts": { "prebuild": "pnpm run clean", @@ -24,8 +23,7 @@ }, "dependencies": { "@rightcapital/eslint-config-base": "workspace:*", - "@rushstack/eslint-patch": "1.10.3", - "eslint-config-prettier": "9.1.0" + "@rushstack/eslint-patch": "1.10.3" }, "devDependencies": { "@rightcapital/tsconfig": "workspace:*" diff --git a/packages/eslint-config-javascript/src/index.ts b/packages/eslint-config-javascript/src/index.ts index b550690f..fdd52026 100644 --- a/packages/eslint-config-javascript/src/index.ts +++ b/packages/eslint-config-javascript/src/index.ts @@ -6,8 +6,6 @@ require('@rushstack/eslint-patch/modern-module-resolution'); const config: Linter.Config = { extends: [require.resolve('@rightcapital/eslint-config-base')], reportUnusedDisableDirectives: true, - rules: {}, - settings: {}, }; export = config; diff --git a/packages/eslint-config-typescript-react/package.json b/packages/eslint-config-typescript-react/package.json index 8ac2837d..193e8e14 100644 --- a/packages/eslint-config-typescript-react/package.json +++ b/packages/eslint-config-typescript-react/package.json @@ -13,8 +13,7 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "files": [ - "lib/index.js", - "lib/index.d.ts" + "lib" ], "scripts": { "prebuild": "pnpm run clean", diff --git a/packages/eslint-config-typescript-react/src/index.ts b/packages/eslint-config-typescript-react/src/index.ts index 4f9a91ad..97d6a649 100644 --- a/packages/eslint-config-typescript-react/src/index.ts +++ b/packages/eslint-config-typescript-react/src/index.ts @@ -13,9 +13,7 @@ const config: Linter.Config = { plugins: ['@rightcapital'], reportUnusedDisableDirectives: true, rules: { - 'jsx-a11y/anchor-is-valid': 'off', - 'jsx-a11y/click-events-have-key-events': 'off', - '@eslint-react/no-useless-fragment': ['error'], + '@eslint-react/no-useless-fragment': 'error', '@rightcapital/no-explicit-type-on-function-component-identifier': 'error', }, }; diff --git a/packages/eslint-config-typescript-react/src/rules/react-a11y.ts b/packages/eslint-config-typescript-react/src/rules/react-a11y.ts index 0ab05df1..1595d963 100644 --- a/packages/eslint-config-typescript-react/src/rules/react-a11y.ts +++ b/packages/eslint-config-typescript-react/src/rules/react-a11y.ts @@ -12,11 +12,6 @@ const config: Linter.Config = { }, rules: { - // ensure emoji are accessible - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/accessible-emoji.md - // disabled: rule is deprecated - 'jsx-a11y/accessible-emoji': 'off', - // Enforce that all elements that require alternative text have meaningful information // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md 'jsx-a11y/alt-text': [ @@ -34,17 +29,6 @@ const config: Linter.Config = { // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-has-content.md 'jsx-a11y/anchor-has-content': ['error', { components: [] }], - // ensure tags are valid - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/0745af376cdc8686d85a361ce36952b1fb1ccf6e/docs/rules/anchor-is-valid.md - 'jsx-a11y/anchor-is-valid': [ - 'error', - { - components: ['Link'], - specialLink: ['to'], - aspects: ['noHref', 'invalidHref', 'preferButton'], - }, - ], - // elements with aria-activedescendant must be tabbable // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-activedescendant-has-tabindex.md 'jsx-a11y/aria-activedescendant-has-tabindex': 'error', @@ -66,19 +50,6 @@ const config: Linter.Config = { // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/aria-unsupported-elements.md 'jsx-a11y/aria-unsupported-elements': 'error', - // Ensure the autocomplete attribute is correct and suitable for the form field it is used with - // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/29c68596b15c4ff0a40daae6d4a2670e36e37d35/docs/rules/autocomplete-valid.md - 'jsx-a11y/autocomplete-valid': [ - 'off', - { - inputComponents: [], - }, - ], - - // require onClick be accompanied by onKeyUp/onKeyDown/onKeyPress - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/click-events-have-key-events.md - 'jsx-a11y/click-events-have-key-events': 'error', - // Enforce that a control (an interactive element) has a text label. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/control-has-associated-label.md 'jsx-a11y/control-has-associated-label': [ @@ -244,10 +215,6 @@ const config: Linter.Config = { }, ], - // require onBlur instead of onChange - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-onchange.md - 'jsx-a11y/no-onchange': 'off', - // ensure HTML elements do not specify redundant ARIA roles // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/no-redundant-roles.md 'jsx-a11y/no-redundant-roles': 'error', @@ -285,24 +252,6 @@ const config: Linter.Config = { // Enforce tabIndex value is not greater than zero. // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/tabindex-no-positive.md 'jsx-a11y/tabindex-no-positive': 'error', - - // ---------------------------------------------------- - // Rules that no longer exist in eslint-plugin-jsx-a11y - // ---------------------------------------------------- - - // require that JSX labels use "htmlFor" - // https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-for.md - // deprecated: replaced by `label-has-associated-control` rule - 'jsx-a11y/label-has-for': [ - 'off', - { - components: [], - required: { - every: ['nesting', 'id'], - }, - allowChildren: false, - }, - ], }, }; diff --git a/packages/eslint-config-typescript/package.json b/packages/eslint-config-typescript/package.json index 0d0694be..6b631500 100644 --- a/packages/eslint-config-typescript/package.json +++ b/packages/eslint-config-typescript/package.json @@ -13,8 +13,7 @@ "main": "./lib/index.js", "types": "./lib/index.d.ts", "files": [ - "lib/index.js", - "lib/index.d.ts" + "lib" ], "scripts": { "prebuild": "pnpm run clean", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1b93c94c..4ba9c9da 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -68,6 +68,9 @@ importers: '@rushstack/eslint-patch': specifier: 1.10.3 version: 1.10.3 + '@stylistic/eslint-plugin-js': + specifier: 2.3.0 + version: 2.3.0(eslint@8.57.0) confusing-browser-globals: specifier: 1.0.11 version: 1.0.11 @@ -80,15 +83,15 @@ importers: eslint-plugin-import: specifier: npm:eslint-plugin-i@2.29.1 version: eslint-plugin-i@2.29.1(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + eslint-plugin-n: + specifier: 17.9.0 + version: 17.9.0(eslint@8.57.0) eslint-plugin-simple-import-sort: specifier: 12.1.0 version: 12.1.0(eslint@8.57.0) eslint-plugin-unicorn: specifier: 54.0.0 version: 54.0.0(eslint@8.57.0) - semver: - specifier: 7.6.2 - version: 7.6.2 devDependencies: '@rightcapital/tsconfig': specifier: workspace:* @@ -111,9 +114,6 @@ importers: eslint: specifier: ^8.23.1 version: 8.57.0 - eslint-config-prettier: - specifier: 9.1.0 - version: 9.1.0(eslint@8.57.0) devDependencies: '@rightcapital/tsconfig': specifier: workspace:* @@ -291,6 +291,9 @@ importers: eslint: specifier: 8.57.0 version: 8.57.0 + eslint-config-prettier: + specifier: 9.1.0 + version: 9.1.0(eslint@8.57.0) execa: specifier: 9.3.0 version: 9.3.0 @@ -773,6 +776,12 @@ packages: resolution: {integrity: sha512-tlqY9xq5ukxTUZBmoOp+m61cqwQD5pHJtFY3Mn8CA8ps6yghLH/Hw8UPdqg4OLmFW3IFlcXnQNmo/dh8HzXYIQ==} engines: {node: '>=18'} + '@stylistic/eslint-plugin-js@2.3.0': + resolution: {integrity: sha512-lQwoiYb0Fs6Yc5QS3uT8+T9CPKK2Eoxc3H8EnYJgM26v/DgtW+1lvy2WNgyBflU+ThShZaHm3a6CdD9QeKx23w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + '@types/confusing-browser-globals@1.0.3': resolution: {integrity: sha512-q+6axdE3RyjrSsy2ONE4UpF89rwOfpoMBP3lqJ+OzLuOeYHwP+o2GITzuleKb1UT3FSYybO8QmeACgyHleu2CA==} @@ -1484,11 +1493,17 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + eslint-compat-utils@0.5.1: + resolution: {integrity: sha512-3z3vFexKIEnjHE3zCMRo6fn/e44U7T1khUjg+Hp0ZQMCigh28rALD0nPFBcGZuiLC5rLZa2ubQHDRln09JfU2Q==} + engines: {node: '>=12'} + peerDependencies: + eslint: '>=6.0.0' + eslint-config-prettier@9.1.0: resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true peerDependencies: - eslint: '>=7.0.0' + eslint: '*' eslint-doc-generator@1.7.1: resolution: {integrity: sha512-i1Zjl+Xcy712SZhbceCeMVaIdhbFqY27i8d7f9gyb9P/6AQNnPA0VCWynAFVGYa0hpeR5kwUI09+GBELgC2nnA==} @@ -1528,6 +1543,12 @@ packages: eslint-import-resolver-webpack: optional: true + eslint-plugin-es-x@7.8.0: + resolution: {integrity: sha512-7Ds8+wAAoV3T+LAKeu39Y5BzXCrGKrcISfgKEqTS4BDN8SFEDQd0S43jiQ8vIa3wUKD07qitZdfzlenSi8/0qQ==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '>=8' + eslint-plugin-eslint-plugin@6.2.0: resolution: {integrity: sha512-+SSHlThUMBb6MhXl/CqNhKvnUY3111s/1vEcu+paOwTJzniTanRZCfl0kQXNfK57XsWJ5aRsiwMlPg/FgnYsag==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -1546,6 +1567,12 @@ packages: peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + eslint-plugin-n@17.9.0: + resolution: {integrity: sha512-CPSaXDXdrT4nsrOrO4mT4VB6FMUkoySRkHWuuJJHVqsIEjIeZgMY1H7AzSwPbDScikBmLN82KeM1u7ixV7PzGg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.23.0' + eslint-plugin-react-dom@1.5.18: resolution: {integrity: sha512-aUJfFeWD8bVVBDVNIDOIKbhDUqlq7yh6fTRc2SYj9OfyLMcmSJfwIR350i5feJC+H1F3wQq8dyVmaTRZOZan9Q==} engines: {bun: '>=1.0.15', node: '>=18.18.0'} @@ -1854,6 +1881,10 @@ packages: resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==} engines: {node: '>=18'} + globals@15.8.0: + resolution: {integrity: sha512-VZAJ4cewHTExBWDHR6yptdIBlx9YSSZuwojj9Nt5mBRXQzrKakDsVKQ1J63sklLvzAJm0X5+RpO4i3Y2hcOnFw==} + engines: {node: '>=18'} + globalthis@1.0.4: resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==} engines: {node: '>= 0.4'} @@ -3743,6 +3774,14 @@ snapshots: '@sindresorhus/merge-streams@4.0.0': {} + '@stylistic/eslint-plugin-js@2.3.0(eslint@8.57.0)': + dependencies: + '@types/eslint': 8.56.10 + acorn: 8.12.1 + eslint: 8.57.0 + eslint-visitor-keys: 4.0.0 + espree: 10.1.0 + '@types/confusing-browser-globals@1.0.3': {} '@types/conventional-commits-parser@5.0.0': @@ -4738,6 +4777,11 @@ snapshots: escape-string-regexp@4.0.0: {} + eslint-compat-utils@0.5.1(eslint@8.57.0): + dependencies: + eslint: 8.57.0 + semver: 7.6.2 + eslint-config-prettier@9.1.0(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -4796,6 +4840,13 @@ snapshots: transitivePeerDependencies: - supports-color + eslint-plugin-es-x@7.8.0(eslint@8.57.0): + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint-community/regexpp': 4.11.0 + eslint: 8.57.0 + eslint-compat-utils: 0.5.1(eslint@8.57.0) + eslint-plugin-eslint-plugin@6.2.0(eslint@8.57.0): dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -4839,6 +4890,18 @@ snapshots: object.fromentries: 2.0.8 semver: 6.3.1 + eslint-plugin-n@17.9.0(eslint@8.57.0): + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + enhanced-resolve: 5.17.0 + eslint: 8.57.0 + eslint-plugin-es-x: 7.8.0(eslint@8.57.0) + get-tsconfig: 4.7.5 + globals: 15.8.0 + ignore: 5.3.1 + minimatch: 9.0.5 + semver: 7.6.2 + eslint-plugin-react-dom@1.5.18(eslint@8.57.0)(typescript@5.5.3): dependencies: '@eslint-react/ast': 1.5.18(eslint@8.57.0)(typescript@5.5.3) @@ -5312,6 +5375,8 @@ snapshots: globals@14.0.0: {} + globals@15.8.0: {} + globalthis@1.0.4: dependencies: define-properties: 1.2.1 diff --git a/specs/eslint/README.md b/specs/eslint/README.md index a8c8abce..165c01d1 100644 --- a/specs/eslint/README.md +++ b/specs/eslint/README.md @@ -1,10 +1,14 @@ -Basic snapshot tests for the `@rightcapital/eslint-config-*` packages. +Tests for the `@rightcapital/eslint-config-*` packages. ## Introduction -We made snapshot tests for the `@rightcapital/eslint-config-*` packages to make sure we can observe the changes of the configs during dependency upgrades. See [config-snapshot.test.ts][] for details. +We made tests(see [presets.test.mts][] for details.) for the `@rightcapital/eslint-config-*` packages to make sure we can: -[config-snapshot.test.ts]: ./config-snapshot.test.ts +1. Observe the changes of the configs during dependency upgrades. +2. Ensure no rules are conflicting with Prettier. +3. Ensure no deprecated rules are used, or at least we are aware of them. + +[presets.test.mts]: ./presets.test.mts ## Dealing with dependency upgrades diff --git a/specs/eslint/__snapshots__/config-snapshot.test.ts.snap b/specs/eslint/__snapshots__/presets.test.mts.snap similarity index 51% rename from specs/eslint/__snapshots__/config-snapshot.test.ts.snap rename to specs/eslint/__snapshots__/presets.test.mts.snap index 14106966..c2e156b8 100644 --- a/specs/eslint/__snapshots__/config-snapshot.test.ts.snap +++ b/specs/eslint/__snapshots__/presets.test.mts.snap @@ -1,162 +1,93 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`resolved config matches snapshot > javascript.js 1`] = ` +exports[`Resolved config matches snapshot > javascript.js 1`] = ` { "env": { - "es6": true, + "es2024": true, "node": true, }, "globals": {}, "ignorePatterns": [], + "noInlineConfig": undefined, "parser": "", "parserOptions": { "ecmaFeatures": { - "generators": false, "jsx": true, - "objectLiteralDuplicateProperties": false, }, "ecmaVersion": "latest", "sourceType": "module", }, "plugins": [ - "import", "unicorn", + "n", + "@stylistic/js", "simple-import-sort", + "import", ], "reportUnusedDisableDirectives": true, "rules": { - "@babel/object-curly-spacing": [ - "off", - ], - "@babel/semi": [ - "off", - ], - "@typescript-eslint/block-spacing": [ - "off", - ], - "@typescript-eslint/brace-style": [ - "off", - ], - "@typescript-eslint/comma-dangle": [ - "off", - ], - "@typescript-eslint/comma-spacing": [ - "off", - ], - "@typescript-eslint/func-call-spacing": [ - "off", - ], - "@typescript-eslint/indent": [ - "off", - ], - "@typescript-eslint/key-spacing": [ - "off", - ], - "@typescript-eslint/keyword-spacing": [ - "off", - ], - "@typescript-eslint/lines-around-comment": [ - 0, - ], - "@typescript-eslint/member-delimiter-style": [ - "off", - ], - "@typescript-eslint/no-extra-parens": [ - "off", - ], - "@typescript-eslint/no-extra-semi": [ - "off", - ], - "@typescript-eslint/object-curly-spacing": [ - "off", - ], - "@typescript-eslint/quotes": [ - 0, - ], - "@typescript-eslint/semi": [ - "off", - ], - "@typescript-eslint/space-before-blocks": [ - "off", - ], - "@typescript-eslint/space-before-function-paren": [ - "off", - ], - "@typescript-eslint/space-infix-ops": [ - "off", - ], - "@typescript-eslint/type-annotation-spacing": [ - "off", - ], - "accessor-pairs": [ - "off", - ], - "array-bracket-newline": [ - "off", - "consistent", - ], - "array-bracket-spacing": [ - "off", - "never", + "@stylistic/js/lines-between-class-members": [ + "error", + "always", ], - "array-callback-return": [ + "@stylistic/js/padding-line-between-statements": [ "error", { - "allowImplicit": true, - "allowVoid": false, - "checkForEach": false, + "blankLine": "always", + "next": "*", + "prev": "directive", }, - ], - "array-element-newline": [ - "off", { - "minItems": 3, - "multiline": true, + "blankLine": "always", + "next": "directive", + "prev": "*", }, - ], - "arrow-body-style": [ - "off", - "as-needed", { - "requireReturnForObjectLiteral": false, + "blankLine": "any", + "next": "directive", + "prev": "directive", }, ], - "arrow-parens": [ - "off", + "@stylistic/js/spaced-comment": [ + "error", "always", - ], - "arrow-spacing": [ - "off", { - "after": true, - "before": true, + "block": { + "balanced": true, + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + ":", + "::", + ], + }, + "line": { + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + "/", + ], + }, }, ], - "babel/object-curly-spacing": [ - "off", - ], - "babel/quotes": [ - 0, - ], - "babel/semi": [ - "off", - ], - "block-scoped-var": [ + "array-callback-return": [ "error", - ], - "block-spacing": [ - "off", - "always", - ], - "brace-style": [ - "off", - "1tbs", { - "allowSingleLine": true, + "allowImplicit": true, + "allowVoid": false, + "checkForEach": false, }, ], - "callback-return": [ - "off", + "block-scoped-var": [ + "error", ], "camelcase": [ "error", @@ -167,79 +98,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "properties": "never", }, ], - "capitalized-comments": [ - "off", - "never", - { - "block": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, - "line": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, - }, - ], - "class-methods-use-this": [ - "off", - { - "enforceForClassFields": true, - "exceptMethods": [], - }, - ], - "comma-dangle": [ - "off", - { - "arrays": "always-multiline", - "exports": "always-multiline", - "functions": "always-multiline", - "imports": "always-multiline", - "objects": "always-multiline", - }, - ], - "comma-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], - "comma-style": [ - "off", - "last", - { - "exceptions": { - "ArrayExpression": false, - "ArrayPattern": false, - "ArrowFunctionExpression": false, - "CallExpression": false, - "FunctionDeclaration": false, - "FunctionExpression": false, - "ImportDeclaration": false, - "NewExpression": false, - "ObjectExpression": false, - "ObjectPattern": false, - "VariableDeclaration": false, - }, - }, - ], - "complexity": [ - "off", - 20, - ], - "computed-property-spacing": [ - "off", - "never", - ], "consistent-return": [ "error", ], - "consistent-this": [ - "off", - ], "constructor-super": [ "error", ], @@ -256,13 +117,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "default-case-last": [ "error", ], - "default-param-last": [ - "off", - ], - "dot-location": [ - "off", - "property", - ], "dot-notation": [ "error", { @@ -270,10 +124,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "allowPattern": "", }, ], - "eol-last": [ - "off", - "always", - ], "eqeqeq": [ "error", "always", @@ -281,126 +131,27 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "null": "ignore", }, ], - "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", - ], "for-direction": [ "error", ], - "func-call-spacing": [ - "off", - "never", - ], - "func-name-matching": [ - "off", - "always", - { - "considerPropertyDescriptor": true, - "includeCommonJSModuleExports": false, - }, - ], "func-names": [ "warn", ], - "func-style": [ - "off", - "expression", - ], - "function-call-argument-newline": [ - "off", - "consistent", - ], - "function-paren-newline": [ - "off", - "multiline-arguments", - ], - "generator-star": [ - "off", - ], - "generator-star-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], "getter-return": [ "error", { "allowImplicit": true, }, ], - "global-require": [ - "error", - ], "grouped-accessor-pairs": [ "error", ], "guard-for-in": [ "error", ], - "handle-callback-err": [ - "off", - ], - "id-denylist": [ - "off", - ], - "id-length": [ - "off", - ], - "id-match": [ - "off", - ], - "implicit-arrow-linebreak": [ - "off", - "beside", - ], - "import/default": [ - "off", - ], - "import/dynamic-import-chunkname": [ - "off", - { - "importFunctions": [], - "webpackChunknameFormat": "[0-9a-zA-Z-_/.]+", - }, - ], "import/export": [ "error", ], - "import/exports-last": [ - "off", - ], "import/extensions": [ "warn", "ignorePackages", @@ -414,12 +165,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/first": [ "error", ], - "import/group-exports": [ - "off", - ], - "import/imports-first": [ - "off", - ], "import/max-dependencies": [ "off", { @@ -429,32 +174,12 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/named": [ "error", ], - "import/namespace": [ - "off", - ], "import/newline-after-import": [ "error", ], "import/no-absolute-path": [ "error", ], - "import/no-amd": [ - "error", - ], - "import/no-anonymous-default-export": [ - "off", - { - "allowAnonymousClass": false, - "allowAnonymousFunction": false, - "allowArray": false, - "allowArrowFunction": false, - "allowLiteral": false, - "allowObject": false, - }, - ], - "import/no-commonjs": [ - "off", - ], "import/no-cycle": [ "error", { @@ -463,12 +188,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "maxDepth": "∞", }, ], - "import/no-default-export": [ - "off", - ], - "import/no-deprecated": [ - "off", - ], "import/no-duplicates": [ "error", ], @@ -484,9 +203,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "spec/**", "**/__tests__/**", "**/__mocks__/**", - "test.{js,jsx}", - "test-*.{js,jsx}", - "**/*{.,_}{test,spec}.{js,jsx}", + "test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "test-*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "**/*{.,_}{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/jest.config.js", "**/jest.setup.js", "**/vue.config.js", @@ -500,7 +219,8 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "**/protractor.conf.js", "**/protractor.conf.*.js", "**/karma.conf.js", - "**/.eslintrc.js", + "**/.eslintrc.{js,cjs}", + "**/eslint.config.{js,cjs,mjs}", ], "optionalDependencies": false, }, @@ -511,12 +231,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "exceptions": [], }, ], - "import/no-internal-modules": [ - "off", - { - "allow": [], - }, - ], "import/no-mutable-exports": [ "error", ], @@ -529,30 +243,12 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/no-named-default": [ "error", ], - "import/no-named-export": [ - "off", - ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], "import/no-relative-packages": [ "error", ], - "import/no-relative-parent-imports": [ - "off", - ], - "import/no-restricted-paths": [ - "off", - ], "import/no-self-import": [ "error", ], - "import/no-unassigned-import": [ - "off", - ], "import/no-unresolved": [ "error", { @@ -561,14 +257,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "commonjs": true, }, ], - "import/no-unused-modules": [ - "off", - { - "ignoreExports": [], - "missingExports": true, - "unusedExports": true, - }, - ], "import/no-useless-path-segments": [ "error", { @@ -580,193 +268,19 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` ], "import/order": [ "off", - { - "distinctGroup": true, - "groups": [ - [ - "builtin", - "external", - "internal", - ], - ], - "warnOnUnassignedImports": false, - }, ], - "import/prefer-default-export": [ - "off", + "max-classes-per-file": [ + "error", + 1, ], - "import/unambiguous": [ - "off", + "n/global-require": [ + "error", ], - "indent": [ - "off", - 2, - { - "ArrayExpression": 1, - "CallExpression": { - "arguments": 1, - }, - "FunctionDeclaration": { - "body": 1, - "parameters": 1, - }, - "FunctionExpression": { - "body": 1, - "parameters": 1, - }, - "ImportDeclaration": 1, - "ObjectExpression": 1, - "SwitchCase": 1, - "VariableDeclarator": 1, - "flatTernaryExpressions": false, - "ignoreComments": false, - "ignoredNodes": [ - "JSXElement", - "JSXElement > *", - "JSXAttribute", - "JSXIdentifier", - "JSXNamespacedName", - "JSXMemberExpression", - "JSXSpreadAttribute", - "JSXExpressionContainer", - "JSXOpeningElement", - "JSXClosingElement", - "JSXFragment", - "JSXOpeningFragment", - "JSXClosingFragment", - "JSXText", - "JSXEmptyExpression", - "JSXSpreadChild", - ], - "offsetTernaryExpressions": false, - "outerIIFEBody": 1, - }, - ], - "indent-legacy": [ - "off", - ], - "init-declarations": [ - "off", - ], - "jsx-quotes": [ - "off", - "prefer-double", - ], - "key-spacing": [ - "off", - { - "afterColon": true, - "beforeColon": false, - }, - ], - "keyword-spacing": [ - "off", - { - "after": true, - "before": true, - "overrides": { - "case": { - "after": true, - }, - "return": { - "after": true, - }, - "throw": { - "after": true, - }, - }, - }, - ], - "line-comment-position": [ - "off", - { - "applyDefaultPatterns": true, - "ignorePattern": "", - "position": "above", - }, - ], - "linebreak-style": [ - "off", - "unix", - ], - "lines-around-comment": [ - 0, - ], - "lines-around-directive": [ - "error", - { - "after": "always", - "before": "always", - }, - ], - "lines-between-class-members": [ + "n/no-new-require": [ "error", - "always", - { - "exceptAfterSingleLine": false, - }, ], - "max-classes-per-file": [ + "n/no-path-concat": [ "error", - 1, - ], - "max-depth": [ - "off", - 4, - ], - "max-len": [ - 0, - 100, - 2, - { - "ignoreComments": false, - "ignoreRegExpLiterals": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreUrls": true, - }, - ], - "max-lines": [ - "off", - { - "max": 300, - "skipBlankLines": true, - "skipComments": true, - }, - ], - "max-lines-per-function": [ - "off", - { - "IIFEs": true, - "max": 50, - "skipBlankLines": true, - "skipComments": 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", - ], - "multiline-ternary": [ - "off", - "never", ], "new-cap": [ "error", @@ -782,30 +296,12 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "properties": true, }, ], - "new-parens": [ - "off", - ], - "newline-after-var": [ - "off", - ], - "newline-before-return": [ - "off", - ], - "newline-per-chained-call": [ - "off", - { - "ignoreChainWithDepth": 4, - }, - ], "no-alert": [ "warn", ], "no-array-constructor": [ "error", ], - "no-arrow-condition": [ - "off", - ], "no-async-promise-executor": [ "error", ], @@ -824,15 +320,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-case-declarations": [ "error", ], - "no-catch-shadow": [ - "off", - ], "no-class-assign": [ "error", ], - "no-comma-dangle": [ - "off", - ], "no-compare-neg-zero": [ "error", ], @@ -840,13 +330,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "error", "always", ], - "no-confusing-arrow": [ - 0, - { - "allowParens": true, - "onlyOneSimpleParam": false, - }, - ], "no-console": [ "warn", ], @@ -871,9 +354,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-delete-var": [ "error", ], - "no-div-regex": [ - "off", - ], "no-dupe-args": [ "error", ], @@ -889,9 +369,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-duplicate-case": [ "error", ], - "no-duplicate-imports": [ - "off", - ], "no-else-return": [ "error", { @@ -917,9 +394,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-empty-pattern": [ "error", ], - "no-eq-null": [ - "off", - ], "no-eval": [ "error", ], @@ -938,26 +412,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-extra-label": [ "error", ], - "no-extra-parens": [ - "off", - "all", - { - "conditionalAssign": true, - "enforceForArrowConditionals": false, - "ignoreJSX": "all", - "nestedBinaryExpressions": false, - "returnAssign": false, - }, - ], - "no-extra-semi": [ - "off", - ], "no-fallthrough": [ "error", ], - "no-floating-decimal": [ - "off", - ], "no-func-assign": [ "error", ], @@ -967,36 +424,18 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "exceptions": [], }, ], - "no-implicit-coercion": [ - "off", - { - "allow": [], - "boolean": false, - "number": true, - "string": true, - }, - ], - "no-implicit-globals": [ - "off", - ], "no-implied-eval": [ "error", ], "no-import-assign": [ "error", ], - "no-inline-comments": [ - "off", - ], "no-inner-declarations": [ "error", ], "no-invalid-regexp": [ "error", ], - "no-invalid-this": [ - "off", - ], "no-irregular-whitespace": [ "error", ], @@ -1025,103 +464,15 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-loss-of-precision": [ "error", ], - "no-magic-numbers": [ - "off", - { - "detectObjects": false, - "enforceConst": true, - "ignore": [], - "ignoreArrayIndexes": true, - }, - ], "no-misleading-character-class": [ "error", ], - "no-mixed-operators": [ - 0, - { - "allowSamePrecedence": false, - "groups": [ - [ - "%", - "**", - ], - [ - "%", - "+", - ], - [ - "%", - "-", - ], - [ - "%", - "*", - ], - [ - "%", - "/", - ], - [ - "/", - "*", - ], - [ - "&", - "|", - "<<", - ">>", - ">>>", - ], - [ - "==", - "!=", - "===", - "!==", - ], - [ - "&&", - "||", - ], - ], - }, - ], - "no-mixed-requires": [ - "off", - false, - ], - "no-mixed-spaces-and-tabs": [ - "off", - ], "no-multi-assign": [ "error", ], - "no-multi-spaces": [ - "off", - { - "ignoreEOLComments": false, - }, - ], "no-multi-str": [ "error", ], - "no-multiple-empty-lines": [ - "off", - { - "max": 1, - "maxBOF": 0, - "maxEOF": 0, - }, - ], - "no-native-reassign": [ - "off", - ], - "no-negated-condition": [ - "off", - ], - "no-negated-in-lhs": [ - "off", - ], "no-nested-ternary": [ "error", ], @@ -1131,12 +482,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-new-func": [ "error", ], - "no-new-object": [ - "error", - ], - "no-new-require": [ - "error", - ], "no-new-symbol": [ "error", ], @@ -1149,6 +494,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-obj-calls": [ "error", ], + "no-object-constructor": [ + "error", + ], "no-octal": [ "error", ], @@ -1174,18 +522,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "props": true, }, ], - "no-path-concat": [ - "error", - ], "no-plusplus": [ "error", ], - "no-process-env": [ - "off", - ], - "no-process-exit": [ - "off", - ], "no-promise-executor-return": [ "error", ], @@ -1201,9 +540,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-regex-spaces": [ "error", ], - "no-reserved-keys": [ - "off", - ], "no-restricted-exports": [ "error", { @@ -1282,16 +618,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "toolbar", "top", ], - "no-restricted-imports": [ - "off", - { - "paths": [], - "patterns": [], - }, - ], - "no-restricted-modules": [ - "off", - ], "no-restricted-properties": [ "error", { @@ -1393,49 +719,24 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-shadow-restricted-names": [ "error", ], - "no-space-before-semi": [ - "off", - ], - "no-spaced-func": [ - "off", - ], "no-sparse-arrays": [ "error", ], - "no-sync": [ - "off", - ], - "no-tabs": [ - 0, - ], "no-template-curly-in-string": [ "error", ], - "no-ternary": [ - "off", - ], "no-this-before-super": [ "error", ], "no-throw-literal": [ "error", ], - "no-trailing-spaces": [ - "off", - { - "ignoreComments": false, - "skipBlankLines": false, - }, - ], "no-undef": [ "error", ], "no-undef-init": [ "error", ], - "no-undefined": [ - "off", - ], "no-underscore-dangle": [ "error", { @@ -1451,10 +752,7 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` }, ], "no-unexpected-multiline": [ - 0, - ], - "no-unmodified-loop-condition": [ - "off", + "error", ], "no-unneeded-ternary": [ "error", @@ -1496,7 +794,7 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "error", ], "no-unused-private-class-members": [ - "off", + "error", ], "no-unused-vars": [ "error", @@ -1517,9 +815,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-useless-backreference": [ "error", ], - "no-useless-call": [ - "off", - ], "no-useless-catch": [ "error", ], @@ -1552,69 +847,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-void": [ "error", ], - "no-warning-comments": [ - "off", - { - "location": "start", - "terms": [ - "todo", - "fixme", - "xxx", - ], - }, - ], - "no-whitespace-before-property": [ - "off", - ], "no-with": [ "error", ], - "no-wrap-func": [ - "off", - ], - "nonblock-statement-body-position": [ - "off", - "beside", - { - "overrides": {}, - }, - ], - "object-curly-newline": [ - "off", - { - "ExportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ImportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectExpression": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectPattern": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - }, - ], - "object-curly-spacing": [ - "off", - "always", - ], - "object-property-newline": [ - "off", - { - "allowAllPropertiesOnSameLine": true, - "allowMultiplePropertiesPerLine": false, - }, - ], "object-shorthand": [ "error", "always", @@ -1627,44 +862,10 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "error", "never", ], - "one-var-declaration-per-line": [ - "off", - "always", - ], "operator-assignment": [ "error", "always", ], - "operator-linebreak": [ - "off", - "before", - { - "overrides": { - "=": "none", - }, - }, - ], - "padded-blocks": [ - "off", - { - "blocks": "never", - "classes": "never", - "switches": "never", - }, - { - "allowSingleLineBlocks": true, - }, - ], - "padding-line-between-statements": [ - "off", - ], - "prefer-arrow-callback": [ - "off", - { - "allowNamedFunctions": false, - "allowUnboundThis": true, - }, - ], "prefer-const": [ "error", { @@ -1691,9 +892,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "prefer-exponentiation-operator": [ "error", ], - "prefer-named-capture-group": [ - "off", - ], "prefer-numeric-literals": [ "error", ], @@ -1706,9 +904,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "allowEmptyReject": true, }, ], - "prefer-reflect": [ - "off", - ], "prefer-regex-literals": [ "error", { @@ -1724,186 +919,127 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "prefer-template": [ "error", ], - "quote-props": [ - "off", - "as-needed", - { - "keywords": false, - "numbers": false, - "unnecessary": true, - }, - ], - "quotes": [ - 0, - "single", - { - "avoidEscape": true, - }, - ], "radix": [ "error", ], - "react/jsx-child-element-spacing": [ - "off", - ], - "react/jsx-closing-bracket-location": [ - "off", + "require-yield": [ + "error", ], - "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-space-before-closing": [ - "off", - ], - "react/jsx-tag-spacing": [ - "off", - ], - "react/jsx-wrap-multilines": [ - "off", - ], - "require-atomic-updates": [ - "off", + "simple-import-sort/exports": [ + "error", ], - "require-await": [ - "off", + "simple-import-sort/imports": [ + "error", ], - "require-jsdoc": [ - "off", + "symbol-description": [ + "error", ], - "require-unicode-regexp": [ - "off", + "unicode-bom": [ + "error", + "never", ], - "require-yield": [ + "unicorn/prefer-node-protocol": [ "error", ], - "rest-spread-spacing": [ - "off", - "never", + "unicorn/text-encoding-identifier-case": [ + "error", ], - "semi": [ - "off", - "always", + "use-isnan": [ + "error", ], - "semi-spacing": [ - "off", + "valid-typeof": [ + "error", { - "after": true, - "before": false, + "requireStringLiterals": true, }, ], - "semi-style": [ - "off", - "last", - ], - "simple-import-sort/exports": [ + "vars-on-top": [ "error", ], - "simple-import-sort/imports": [ + "yoda": [ "error", ], - "sort-imports": [ - "off", - { - "ignoreCase": false, - "ignoreDeclarationSort": false, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single", + }, + "settings": { + "import/core-modules": [], + "import/extensions": [ + ".js", + ".mjs", + ".jsx", + ], + "import/ignore": [ + "node_modules", + "\\.(coffee|scss|css|less|hbs|svg|json)$", + ], + "import/resolver": { + "node": { + "extensions": [ + ".mjs", + ".js", + ".json", ], }, + "typescript": {}, + }, + }, +} +`; + +exports[`Resolved config matches snapshot > typescript.ts 1`] = ` +{ + "env": { + "es2024": true, + "node": true, + }, + "globals": {}, + "ignorePatterns": [], + "noInlineConfig": undefined, + "parser": "", + "parserOptions": { + "EXPERIMENTAL_useProjectService": true, + "ecmaFeatures": { + "jsx": true, + }, + "ecmaVersion": "latest", + "sourceType": "module", + }, + "plugins": [ + "unicorn", + "n", + "@stylistic/js", + "simple-import-sort", + "import", + "@typescript-eslint", + "@rightcapital", + ], + "reportUnusedDisableDirectives": true, + "rules": { + "@rightcapital/no-explicit-type-on-function-component-identifier": [ + "error", ], - "sort-keys": [ - "off", - "asc", + "@stylistic/js/lines-between-class-members": [ + "error", + "always", + ], + "@stylistic/js/padding-line-between-statements": [ + "error", { - "caseSensitive": false, - "natural": true, + "blankLine": "always", + "next": "*", + "prev": "directive", }, - ], - "sort-vars": [ - "off", - ], - "space-after-function-name": [ - "off", - ], - "space-after-keywords": [ - "off", - ], - "space-before-blocks": [ - "off", - ], - "space-before-function-paren": [ - "off", { - "anonymous": "always", - "asyncArrow": "always", - "named": "never", + "blankLine": "always", + "next": "directive", + "prev": "*", }, - ], - "space-before-function-parentheses": [ - "off", - ], - "space-before-keywords": [ - "off", - ], - "space-in-brackets": [ - "off", - ], - "space-in-parens": [ - "off", - "never", - ], - "space-infix-ops": [ - "off", - ], - "space-return-throw-case": [ - "off", - ], - "space-unary-ops": [ - "off", { - "nonwords": false, - "overrides": {}, - "words": true, + "blankLine": "any", + "next": "directive", + "prev": "directive", }, ], - "space-unary-word-ops": [ - "off", - ], - "spaced-comment": [ + "@stylistic/js/spaced-comment": [ "error", "always", { @@ -1933,2547 +1069,1064 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` }, }, ], - "standard/array-bracket-even-spacing": [ - "off", - ], - "standard/computed-property-even-spacing": [ - "off", + "@typescript-eslint/await-thenable": [ + "error", ], - "standard/object-curly-even-spacing": [ - "off", + "@typescript-eslint/ban-ts-comment": [ + "error", ], - "strict": [ + "@typescript-eslint/ban-types": [ "error", - "never", ], - "switch-colon-spacing": [ - "off", + "@typescript-eslint/consistent-type-exports": [ + "error", { - "after": true, - "before": false, + "fixMixedExportsWithInlineTypeSpecifier": true, }, ], - "symbol-description": [ + "@typescript-eslint/consistent-type-imports": [ "error", + { + "fixStyle": "inline-type-imports", + "prefer": "type-imports", + }, ], - "template-curly-spacing": [ - "off", + "@typescript-eslint/naming-convention": [ + "error", + { + "custom": { + "match": true, + "regex": "^I[A-Z]", + }, + "format": [ + "PascalCase", + ], + "selector": "interface", + }, ], - "template-tag-spacing": [ - "off", - "never", + "@typescript-eslint/no-array-constructor": [ + "error", ], - "unicode-bom": [ + "@typescript-eslint/no-base-to-string": [ "error", - "never", ], - "unicorn/empty-brace-spaces": [ - "off", + "@typescript-eslint/no-duplicate-enum-values": [ + "error", ], - "unicorn/no-nested-ternary": [ - "off", + "@typescript-eslint/no-duplicate-type-constituents": [ + "error", ], - "unicorn/number-literal-case": [ - "off", + "@typescript-eslint/no-empty-function": [ + "error", ], - "unicorn/prefer-node-protocol": [ + "@typescript-eslint/no-empty-interface": [ "error", ], - "unicorn/template-indent": [ - 0, + "@typescript-eslint/no-explicit-any": [ + "error", ], - "unicorn/text-encoding-identifier-case": [ + "@typescript-eslint/no-extra-non-null-assertion": [ "error", ], - "use-isnan": [ + "@typescript-eslint/no-floating-promises": [ "error", ], - "valid-jsdoc": [ - "off", + "@typescript-eslint/no-for-in-array": [ + "error", ], - "valid-typeof": [ + "@typescript-eslint/no-implied-eval": [ "error", - { - "requireStringLiterals": true, - }, ], - "vars-on-top": [ + "@typescript-eslint/no-import-type-side-effects": [ "error", ], - "vue/array-bracket-newline": [ - "off", + "@typescript-eslint/no-loss-of-precision": [ + "error", ], - "vue/array-bracket-spacing": [ - "off", + "@typescript-eslint/no-misused-new": [ + "error", ], - "vue/array-element-newline": [ - "off", + "@typescript-eslint/no-misused-promises": [ + "error", ], - "vue/arrow-spacing": [ - "off", + "@typescript-eslint/no-namespace": [ + "error", ], - "vue/block-spacing": [ - "off", + "@typescript-eslint/no-non-null-asserted-optional-chain": [ + "error", ], - "vue/block-tag-newline": [ - "off", + "@typescript-eslint/no-non-null-assertion": [ + "error", ], - "vue/brace-style": [ - "off", + "@typescript-eslint/no-redundant-type-constituents": [ + "error", ], - "vue/comma-dangle": [ - "off", + "@typescript-eslint/no-shadow": [ + "error", ], - "vue/comma-spacing": [ - "off", + "@typescript-eslint/no-this-alias": [ + "error", ], - "vue/comma-style": [ - "off", + "@typescript-eslint/no-unnecessary-type-assertion": [ + "error", ], - "vue/dot-location": [ - "off", + "@typescript-eslint/no-unnecessary-type-constraint": [ + "error", ], - "vue/func-call-spacing": [ - "off", + "@typescript-eslint/no-unsafe-argument": [ + "error", ], - "vue/html-closing-bracket-newline": [ - "off", + "@typescript-eslint/no-unsafe-assignment": [ + "error", ], - "vue/html-closing-bracket-spacing": [ - "off", + "@typescript-eslint/no-unsafe-call": [ + "error", ], - "vue/html-end-tags": [ - "off", - ], - "vue/html-indent": [ - "off", - ], - "vue/html-quotes": [ - "off", - ], - "vue/html-self-closing": [ - 0, - ], - "vue/key-spacing": [ - "off", - ], - "vue/keyword-spacing": [ - "off", - ], - "vue/max-attributes-per-line": [ - "off", - ], - "vue/max-len": [ - 0, - ], - "vue/multiline-html-element-content-newline": [ - "off", - ], - "vue/multiline-ternary": [ - "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/quote-props": [ - "off", - ], - "vue/script-indent": [ - "off", - ], - "vue/singleline-html-element-content-newline": [ - "off", - ], - "vue/space-in-parens": [ - "off", + "@typescript-eslint/no-unsafe-declaration-merging": [ + "error", ], - "vue/space-infix-ops": [ - "off", + "@typescript-eslint/no-unsafe-enum-comparison": [ + "error", ], - "vue/space-unary-ops": [ - "off", + "@typescript-eslint/no-unsafe-member-access": [ + "error", ], - "vue/template-curly-spacing": [ - "off", + "@typescript-eslint/no-unsafe-return": [ + "error", ], - "wrap-iife": [ - "off", - "outside", + "@typescript-eslint/no-unused-vars": [ + "error", { - "functionPrototypeMethods": false, + "argsIgnorePattern": "^_", }, ], - "wrap-regex": [ - "off", - ], - "yield-star-spacing": [ - "off", - "after", - ], - "yoda": [ + "@typescript-eslint/no-use-before-define": [ "error", - ], - }, - "settings": { - "import/core-modules": [], - "import/extensions": [ - ".js", - ".mjs", - ".jsx", - ], - "import/ignore": [ - "node_modules", - "\\.(coffee|scss|css|less|hbs|svg|json)$", - ], - "import/resolver": { - "node": { - "extensions": [ - ".mjs", - ".js", - ".json", - ], + { + "classes": false, + "functions": false, + "typedefs": false, + "variables": false, }, - "typescript": {}, - }, - }, -} -`; - -exports[`resolved config matches snapshot > typescript.ts 1`] = ` -{ - "env": { - "es6": true, - "node": true, - }, - "globals": {}, - "ignorePatterns": [], - "parser": "", - "parserOptions": { - "EXPERIMENTAL_useProjectService": true, - "ecmaFeatures": { - "generators": false, - "jsx": true, - "objectLiteralDuplicateProperties": false, - }, - "ecmaVersion": "latest", - "sourceType": "module", - }, - "plugins": [ - "import", - "unicorn", - "simple-import-sort", - "@typescript-eslint", - "@rightcapital", - ], - "reportUnusedDisableDirectives": true, - "rules": { - "@babel/object-curly-spacing": [ - "off", - ], - "@babel/semi": [ - "off", ], - "@rightcapital/no-explicit-type-on-function-component-identifier": [ + "@typescript-eslint/no-useless-constructor": [ "error", ], - "@typescript-eslint/await-thenable": [ + "@typescript-eslint/no-var-requires": [ "error", ], - "@typescript-eslint/ban-ts-comment": [ + "@typescript-eslint/prefer-as-const": [ "error", ], - "@typescript-eslint/ban-types": [ + "@typescript-eslint/require-await": [ "error", ], - "@typescript-eslint/block-spacing": [ - "off", - ], - "@typescript-eslint/brace-style": [ - "off", - ], - "@typescript-eslint/comma-dangle": [ - "off", - ], - "@typescript-eslint/comma-spacing": [ - "off", - ], - "@typescript-eslint/consistent-type-exports": [ + "@typescript-eslint/restrict-plus-operands": [ "error", - { - "fixMixedExportsWithInlineTypeSpecifier": true, - }, ], - "@typescript-eslint/consistent-type-imports": [ + "@typescript-eslint/restrict-template-expressions": [ "error", { - "fixStyle": "inline-type-imports", - "prefer": "type-imports", + "allowAny": true, + "allowBoolean": true, + "allowNever": true, + "allowNullish": true, + "allowNumber": true, + "allowRegExp": true, }, ], - "@typescript-eslint/func-call-spacing": [ - "off", - ], - "@typescript-eslint/indent": [ - "off", - ], - "@typescript-eslint/key-spacing": [ - "off", + "@typescript-eslint/triple-slash-reference": [ + "error", ], - "@typescript-eslint/keyword-spacing": [ - "off", + "@typescript-eslint/unbound-method": [ + "error", ], - "@typescript-eslint/lines-around-comment": [ - 0, + "array-callback-return": [ + "error", + { + "allowImplicit": true, + "allowVoid": false, + "checkForEach": false, + }, ], - "@typescript-eslint/member-delimiter-style": [ - "off", + "block-scoped-var": [ + "error", ], - "@typescript-eslint/naming-convention": [ + "camelcase": [ "error", { - "custom": { - "match": true, - "regex": "^I[A-Z]", - }, - "format": [ - "PascalCase", - ], - "selector": "interface", + "ignoreDestructuring": false, + "ignoreGlobals": false, + "ignoreImports": false, + "properties": "never", }, ], - "@typescript-eslint/no-array-constructor": [ + "consistent-return": [ "error", ], - "@typescript-eslint/no-base-to-string": [ - "error", + "constructor-super": [ + "off", ], - "@typescript-eslint/no-duplicate-enum-values": [ + "curly": [ "error", + "all", ], - "@typescript-eslint/no-duplicate-type-constituents": [ + "default-case": [ "error", + { + "commentPattern": "^no default$", + }, ], - "@typescript-eslint/no-empty-function": [ + "default-case-last": [ "error", ], - "@typescript-eslint/no-empty-interface": [ + "dot-notation": [ "error", + { + "allowKeywords": true, + "allowPattern": "", + }, ], - "@typescript-eslint/no-explicit-any": [ + "eqeqeq": [ "error", + "always", + { + "null": "ignore", + }, ], - "@typescript-eslint/no-extra-non-null-assertion": [ + "for-direction": [ "error", ], - "@typescript-eslint/no-extra-parens": [ - "off", + "func-names": [ + "warn", ], - "@typescript-eslint/no-extra-semi": [ + "getter-return": [ "off", + { + "allowImplicit": true, + }, ], - "@typescript-eslint/no-floating-promises": [ + "grouped-accessor-pairs": [ "error", ], - "@typescript-eslint/no-for-in-array": [ + "guard-for-in": [ "error", ], - "@typescript-eslint/no-implied-eval": [ + "import/export": [ "error", ], - "@typescript-eslint/no-import-type-side-effects": [ - "error", + "import/extensions": [ + "warn", + "ignorePackages", + { + "js": "never", + "jsx": "never", + "ts": "never", + "tsx": "never", + }, ], - "@typescript-eslint/no-loss-of-precision": [ + "import/first": [ "error", ], - "@typescript-eslint/no-misused-new": [ - "error", + "import/max-dependencies": [ + "off", + { + "max": 10, + }, ], - "@typescript-eslint/no-misused-promises": [ + "import/named": [ "error", ], - "@typescript-eslint/no-namespace": [ + "import/newline-after-import": [ "error", ], - "@typescript-eslint/no-non-null-asserted-optional-chain": [ + "import/no-absolute-path": [ "error", ], - "@typescript-eslint/no-non-null-assertion": [ - "error", - ], - "@typescript-eslint/no-redundant-type-constituents": [ - "error", - ], - "@typescript-eslint/no-shadow": [ + "import/no-cycle": [ "error", + { + "allowUnsafeDynamicCyclicDependency": false, + "ignoreExternal": false, + "maxDepth": "∞", + }, ], - "@typescript-eslint/no-this-alias": [ + "import/no-duplicates": [ "error", + { + "prefer-inline": true, + }, ], - "@typescript-eslint/no-unnecessary-type-assertion": [ + "import/no-dynamic-require": [ "error", ], - "@typescript-eslint/no-unnecessary-type-constraint": [ + "import/no-extraneous-dependencies": [ "error", + { + "devDependencies": [ + "test/**", + "tests/**", + "spec/**", + "**/__tests__/**", + "**/__mocks__/**", + "test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "test-*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "**/*{.,_}{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "**/jest.config.js", + "**/jest.setup.js", + "**/vue.config.js", + "**/webpack.config.js", + "**/webpack.config.*.js", + "**/rollup.config.js", + "**/rollup.config.*.js", + "**/gulpfile.js", + "**/gulpfile.*.js", + "**/Gruntfile{,.js}", + "**/protractor.conf.js", + "**/protractor.conf.*.js", + "**/karma.conf.js", + "**/.eslintrc.{js,cjs}", + "**/eslint.config.{js,cjs,mjs}", + ], + "optionalDependencies": false, + }, ], - "@typescript-eslint/no-unsafe-argument": [ + "import/no-import-module-exports": [ "error", + { + "exceptions": [], + }, ], - "@typescript-eslint/no-unsafe-assignment": [ + "import/no-mutable-exports": [ "error", ], - "@typescript-eslint/no-unsafe-call": [ + "import/no-named-as-default": [ "error", ], - "@typescript-eslint/no-unsafe-declaration-merging": [ + "import/no-named-as-default-member": [ "error", ], - "@typescript-eslint/no-unsafe-enum-comparison": [ + "import/no-named-default": [ "error", ], - "@typescript-eslint/no-unsafe-member-access": [ + "import/no-relative-packages": [ "error", ], - "@typescript-eslint/no-unsafe-return": [ + "import/no-self-import": [ "error", ], - "@typescript-eslint/no-unused-vars": [ + "import/no-unresolved": [ "error", { - "argsIgnorePattern": "^_", + "caseSensitive": true, + "caseSensitiveStrict": false, + "commonjs": true, }, ], - "@typescript-eslint/no-use-before-define": [ + "import/no-useless-path-segments": [ "error", { - "classes": false, - "functions": false, - "typedefs": false, - "variables": false, + "commonjs": true, }, ], - "@typescript-eslint/no-useless-constructor": [ - "error", - ], - "@typescript-eslint/no-var-requires": [ + "import/no-webpack-loader-syntax": [ "error", ], - "@typescript-eslint/object-curly-spacing": [ + "import/order": [ "off", ], - "@typescript-eslint/prefer-as-const": [ + "max-classes-per-file": [ "error", + 1, ], - "@typescript-eslint/quotes": [ - 0, + "n/global-require": [ + "error", ], - "@typescript-eslint/require-await": [ + "n/no-new-require": [ "error", ], - "@typescript-eslint/restrict-plus-operands": [ + "n/no-path-concat": [ "error", ], - "@typescript-eslint/restrict-template-expressions": [ + "new-cap": [ "error", { - "allowAny": true, - "allowBoolean": true, - "allowNever": true, - "allowNullish": true, - "allowNumber": true, - "allowRegExp": true, + "capIsNew": false, + "capIsNewExceptions": [ + "Immutable.Map", + "Immutable.Set", + "Immutable.List", + ], + "newIsCap": true, + "newIsCapExceptions": [], + "properties": true, }, ], - "@typescript-eslint/semi": [ - "off", + "no-alert": [ + "warn", ], - "@typescript-eslint/space-before-blocks": [ + "no-array-constructor": [ "off", ], - "@typescript-eslint/space-before-function-paren": [ - "off", + "no-async-promise-executor": [ + "error", ], - "@typescript-eslint/space-infix-ops": [ - "off", + "no-await-in-loop": [ + "error", ], - "@typescript-eslint/triple-slash-reference": [ + "no-bitwise": [ "error", ], - "@typescript-eslint/type-annotation-spacing": [ - "off", + "no-buffer-constructor": [ + "error", ], - "@typescript-eslint/unbound-method": [ + "no-caller": [ "error", ], - "accessor-pairs": [ - "off", + "no-case-declarations": [ + "error", ], - "array-bracket-newline": [ - "off", - "consistent", + "no-class-assign": [ + "error", ], - "array-bracket-spacing": [ - "off", - "never", + "no-compare-neg-zero": [ + "error", ], - "array-callback-return": [ + "no-cond-assign": [ "error", - { - "allowImplicit": true, - "allowVoid": false, - "checkForEach": false, - }, + "always", ], - "array-element-newline": [ - "off", - { - "minItems": 3, - "multiline": true, - }, + "no-console": [ + "warn", ], - "arrow-body-style": [ + "no-const-assign": [ "off", - "as-needed", - { - "requireReturnForObjectLiteral": false, - }, ], - "arrow-parens": [ - "off", - "always", + "no-constant-condition": [ + "warn", ], - "arrow-spacing": [ - "off", - { - "after": true, - "before": true, - }, + "no-constructor-return": [ + "error", ], - "babel/object-curly-spacing": [ - "off", + "no-continue": [ + "error", ], - "babel/quotes": [ - 0, + "no-control-regex": [ + "error", ], - "babel/semi": [ - "off", + "no-debugger": [ + "error", ], - "block-scoped-var": [ + "no-delete-var": [ "error", ], - "block-spacing": [ + "no-dupe-args": [ "off", - "always", ], - "brace-style": [ + "no-dupe-class-members": [ "off", - "1tbs", - { - "allowSingleLine": true, - }, ], - "callback-return": [ + "no-dupe-else-if": [ + "error", + ], + "no-dupe-keys": [ "off", ], - "camelcase": [ + "no-duplicate-case": [ "error", - { - "ignoreDestructuring": false, - "ignoreGlobals": false, - "ignoreImports": false, - "properties": "never", - }, ], - "capitalized-comments": [ - "off", - "never", + "no-else-return": [ + "error", { - "block": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, - "line": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, + "allowElseIf": false, }, ], - "class-methods-use-this": [ - "off", - { - "enforceForClassFields": true, - "exceptMethods": [], - }, + "no-empty": [ + "error", ], - "comma-dangle": [ - "off", - { - "arrays": "always-multiline", - "exports": "always-multiline", - "functions": "always-multiline", - "imports": "always-multiline", - "objects": "always-multiline", - }, + "no-empty-character-class": [ + "error", ], - "comma-spacing": [ + "no-empty-function": [ "off", { - "after": true, - "before": false, - }, - ], - "comma-style": [ - "off", - "last", - { - "exceptions": { - "ArrayExpression": false, - "ArrayPattern": false, - "ArrowFunctionExpression": false, - "CallExpression": false, - "FunctionDeclaration": false, - "FunctionExpression": false, - "ImportDeclaration": false, - "NewExpression": false, - "ObjectExpression": false, - "ObjectPattern": false, - "VariableDeclaration": false, - }, + "allow": [ + "arrowFunctions", + "functions", + "methods", + ], }, ], - "complexity": [ - "off", - 20, - ], - "computed-property-spacing": [ - "off", - "never", - ], - "consistent-return": [ + "no-empty-pattern": [ "error", ], - "consistent-this": [ - "off", - ], - "constructor-super": [ - "off", + "no-eval": [ + "error", ], - "curly": [ + "no-ex-assign": [ "error", - "all", ], - "default-case": [ + "no-extend-native": [ "error", - { - "commentPattern": "^no default$", - }, ], - "default-case-last": [ + "no-extra-bind": [ "error", ], - "default-param-last": [ - "off", + "no-extra-boolean-cast": [ + "error", ], - "dot-location": [ - "off", - "property", + "no-extra-label": [ + "error", ], - "dot-notation": [ + "no-fallthrough": [ "error", - { - "allowKeywords": true, - "allowPattern": "", - }, ], - "eol-last": [ + "no-func-assign": [ "off", - "always", ], - "eqeqeq": [ + "no-global-assign": [ "error", - "always", { - "null": "ignore", + "exceptions": [], }, ], - "flowtype/boolean-style": [ - "off", - ], - "flowtype/delimiter-dangle": [ + "no-implied-eval": [ "off", ], - "flowtype/generic-spacing": [ + "no-import-assign": [ "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", - ], - "for-direction": [ + "no-inner-declarations": [ "error", ], - "func-call-spacing": [ - "off", - "never", - ], - "func-name-matching": [ - "off", - "always", - { - "considerPropertyDescriptor": true, - "includeCommonJSModuleExports": false, - }, - ], - "func-names": [ - "warn", - ], - "func-style": [ - "off", - "expression", - ], - "function-call-argument-newline": [ - "off", - "consistent", - ], - "function-paren-newline": [ - "off", - "multiline-arguments", - ], - "generator-star": [ - "off", - ], - "generator-star-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], - "getter-return": [ - "off", - { - "allowImplicit": true, - }, - ], - "global-require": [ + "no-invalid-regexp": [ "error", ], - "grouped-accessor-pairs": [ + "no-irregular-whitespace": [ "error", ], - "guard-for-in": [ + "no-iterator": [ "error", ], - "handle-callback-err": [ - "off", - ], - "id-denylist": [ - "off", - ], - "id-length": [ - "off", - ], - "id-match": [ - "off", - ], - "implicit-arrow-linebreak": [ - "off", - "beside", - ], - "import/default": [ - "off", + "no-label-var": [ + "error", ], - "import/dynamic-import-chunkname": [ - "off", + "no-labels": [ + "error", { - "importFunctions": [], - "webpackChunknameFormat": "[0-9a-zA-Z-_/.]+", + "allowLoop": false, + "allowSwitch": false, }, ], - "import/export": [ + "no-lone-blocks": [ "error", ], - "import/exports-last": [ - "off", - ], - "import/extensions": [ - "warn", - "ignorePackages", - { - "js": "never", - "jsx": "never", - "ts": "never", - "tsx": "never", - }, - ], - "import/first": [ + "no-lonely-if": [ "error", ], - "import/group-exports": [ - "off", + "no-loop-func": [ + "error", ], - "import/imports-first": [ + "no-loss-of-precision": [ "off", ], - "import/max-dependencies": [ - "off", - { - "max": 10, - }, + "no-misleading-character-class": [ + "error", ], - "import/named": [ + "no-multi-assign": [ "error", ], - "import/namespace": [ - "off", + "no-multi-str": [ + "error", ], - "import/newline-after-import": [ + "no-nested-ternary": [ "error", ], - "import/no-absolute-path": [ + "no-new": [ "error", ], - "import/no-amd": [ + "no-new-func": [ "error", ], - "import/no-anonymous-default-export": [ + "no-new-native-nonconstructor": [ "off", - { - "allowAnonymousClass": false, - "allowAnonymousFunction": false, - "allowArray": false, - "allowArrowFunction": false, - "allowLiteral": false, - "allowObject": false, - }, ], - "import/no-commonjs": [ + "no-new-symbol": [ "off", ], - "import/no-cycle": [ + "no-new-wrappers": [ "error", - { - "allowUnsafeDynamicCyclicDependency": false, - "ignoreExternal": false, - "maxDepth": "∞", - }, ], - "import/no-default-export": [ - "off", + "no-nonoctal-decimal-escape": [ + "error", ], - "import/no-deprecated": [ + "no-obj-calls": [ "off", ], - "import/no-duplicates": [ + "no-object-constructor": [ "error", - { - "prefer-inline": true, - }, ], - "import/no-dynamic-require": [ + "no-octal": [ "error", ], - "import/no-extraneous-dependencies": [ + "no-octal-escape": [ "error", - { - "devDependencies": [ - "test/**", - "tests/**", - "spec/**", - "**/__tests__/**", - "**/__mocks__/**", - "test.{js,jsx}", - "test-*.{js,jsx}", - "**/*{.,_}{test,spec}.{js,jsx}", - "**/jest.config.js", - "**/jest.setup.js", - "**/vue.config.js", - "**/webpack.config.js", - "**/webpack.config.*.js", - "**/rollup.config.js", - "**/rollup.config.*.js", - "**/gulpfile.js", - "**/gulpfile.*.js", - "**/Gruntfile{,.js}", - "**/protractor.conf.js", - "**/protractor.conf.*.js", - "**/karma.conf.js", - "**/.eslintrc.js", - ], - "optionalDependencies": false, - }, ], - "import/no-import-module-exports": [ + "no-param-reassign": [ "error", { - "exceptions": [], - }, - ], - "import/no-internal-modules": [ - "off", - { - "allow": [], + "ignorePropertyModificationsFor": [ + "acc", + "accumulator", + "e", + "ctx", + "context", + "req", + "request", + "res", + "response", + "$scope", + "staticContext", + ], + "props": true, }, ], - "import/no-mutable-exports": [ - "error", - ], - "import/no-named-as-default": [ - "error", - ], - "import/no-named-as-default-member": [ - "error", - ], - "import/no-named-default": [ + "no-plusplus": [ "error", ], - "import/no-named-export": [ - "off", - ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], - "import/no-relative-packages": [ + "no-promise-executor-return": [ "error", ], - "import/no-relative-parent-imports": [ - "off", - ], - "import/no-restricted-paths": [ - "off", - ], - "import/no-self-import": [ + "no-proto": [ "error", ], - "import/no-unassigned-import": [ - "off", - ], - "import/no-unresolved": [ + "no-prototype-builtins": [ "error", - { - "caseSensitive": true, - "caseSensitiveStrict": false, - "commonjs": true, - }, ], - "import/no-unused-modules": [ + "no-redeclare": [ "off", - { - "ignoreExports": [], - "missingExports": true, - "unusedExports": true, - }, ], - "import/no-useless-path-segments": [ + "no-regex-spaces": [ "error", - { - "commonjs": true, - }, ], - "import/no-webpack-loader-syntax": [ + "no-restricted-exports": [ "error", - ], - "import/order": [ - "off", - { - "distinctGroup": true, - "groups": [ - [ - "builtin", - "external", - "internal", - ], - ], - "warnOnUnassignedImports": false, - }, - ], - "import/prefer-default-export": [ - "off", - ], - "import/unambiguous": [ - "off", - ], - "indent": [ - "off", - 2, { - "ArrayExpression": 1, - "CallExpression": { - "arguments": 1, - }, - "FunctionDeclaration": { - "body": 1, - "parameters": 1, - }, - "FunctionExpression": { - "body": 1, - "parameters": 1, - }, - "ImportDeclaration": 1, - "ObjectExpression": 1, - "SwitchCase": 1, - "VariableDeclarator": 1, - "flatTernaryExpressions": false, - "ignoreComments": false, - "ignoredNodes": [ - "JSXElement", - "JSXElement > *", - "JSXAttribute", - "JSXIdentifier", - "JSXNamespacedName", - "JSXMemberExpression", - "JSXSpreadAttribute", - "JSXExpressionContainer", - "JSXOpeningElement", - "JSXClosingElement", - "JSXFragment", - "JSXOpeningFragment", - "JSXClosingFragment", - "JSXText", - "JSXEmptyExpression", - "JSXSpreadChild", + "restrictedNamedExports": [ + "default", + "then", ], - "offsetTernaryExpressions": false, - "outerIIFEBody": 1, }, ], - "indent-legacy": [ - "off", - ], - "init-declarations": [ - "off", - ], - "jsx-quotes": [ - "off", - "prefer-double", - ], - "key-spacing": [ - "off", + "no-restricted-globals": [ + "error", { - "afterColon": true, - "beforeColon": false, + "message": "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite", + "name": "isFinite", }, - ], - "keyword-spacing": [ - "off", { - "after": true, - "before": true, - "overrides": { - "case": { - "after": true, - }, - "return": { - "after": true, - }, - "throw": { - "after": true, - }, - }, + "message": "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan", + "name": "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", ], - "line-comment-position": [ - "off", - { - "applyDefaultPatterns": true, - "ignorePattern": "", - "position": "above", - }, - ], - "linebreak-style": [ - "off", - "unix", - ], - "lines-around-comment": [ - 0, - ], - "lines-around-directive": [ - "error", - { - "after": "always", - "before": "always", - }, - ], - "lines-between-class-members": [ - "error", - "always", - { - "exceptAfterSingleLine": false, - }, - ], - "max-classes-per-file": [ - "error", - 1, - ], - "max-depth": [ - "off", - 4, - ], - "max-len": [ - 0, - 100, - 2, - { - "ignoreComments": false, - "ignoreRegExpLiterals": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreUrls": true, - }, - ], - "max-lines": [ - "off", - { - "max": 300, - "skipBlankLines": true, - "skipComments": true, - }, - ], - "max-lines-per-function": [ - "off", - { - "IIFEs": true, - "max": 50, - "skipBlankLines": true, - "skipComments": 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", - ], - "multiline-ternary": [ - "off", - "never", - ], - "new-cap": [ - "error", - { - "capIsNew": false, - "capIsNewExceptions": [ - "Immutable.Map", - "Immutable.Set", - "Immutable.List", - ], - "newIsCap": true, - "newIsCapExceptions": [], - "properties": true, - }, - ], - "new-parens": [ - "off", - ], - "newline-after-var": [ - "off", - ], - "newline-before-return": [ - "off", - ], - "newline-per-chained-call": [ - "off", - { - "ignoreChainWithDepth": 4, - }, - ], - "no-alert": [ - "warn", - ], - "no-array-constructor": [ - "off", - ], - "no-arrow-condition": [ - "off", - ], - "no-async-promise-executor": [ - "error", - ], - "no-await-in-loop": [ - "error", - ], - "no-bitwise": [ - "error", - ], - "no-buffer-constructor": [ - "error", - ], - "no-caller": [ - "error", - ], - "no-case-declarations": [ - "error", - ], - "no-catch-shadow": [ - "off", - ], - "no-class-assign": [ - "error", - ], - "no-comma-dangle": [ - "off", - ], - "no-compare-neg-zero": [ - "error", - ], - "no-cond-assign": [ - "error", - "always", - ], - "no-confusing-arrow": [ - 0, - { - "allowParens": true, - "onlyOneSimpleParam": false, - }, - ], - "no-console": [ - "warn", - ], - "no-const-assign": [ - "off", - ], - "no-constant-condition": [ - "warn", - ], - "no-constructor-return": [ - "error", - ], - "no-continue": [ - "error", - ], - "no-control-regex": [ - "error", - ], - "no-debugger": [ - "error", - ], - "no-delete-var": [ - "error", - ], - "no-div-regex": [ - "off", - ], - "no-dupe-args": [ - "off", - ], - "no-dupe-class-members": [ - "off", - ], - "no-dupe-else-if": [ - "error", - ], - "no-dupe-keys": [ - "off", - ], - "no-duplicate-case": [ - "error", - ], - "no-duplicate-imports": [ - "off", - ], - "no-else-return": [ - "error", - { - "allowElseIf": false, - }, - ], - "no-empty": [ - "error", - ], - "no-empty-character-class": [ - "error", - ], - "no-empty-function": [ - "off", - { - "allow": [ - "arrowFunctions", - "functions", - "methods", - ], - }, - ], - "no-empty-pattern": [ - "error", - ], - "no-eq-null": [ - "off", - ], - "no-eval": [ - "error", - ], - "no-ex-assign": [ - "error", - ], - "no-extend-native": [ - "error", - ], - "no-extra-bind": [ - "error", - ], - "no-extra-boolean-cast": [ - "error", - ], - "no-extra-label": [ - "error", - ], - "no-extra-parens": [ - "off", - "all", - { - "conditionalAssign": true, - "enforceForArrowConditionals": false, - "ignoreJSX": "all", - "nestedBinaryExpressions": false, - "returnAssign": false, - }, - ], - "no-extra-semi": [ - "off", - ], - "no-fallthrough": [ - "error", - ], - "no-floating-decimal": [ - "off", - ], - "no-func-assign": [ - "off", - ], - "no-global-assign": [ - "error", - { - "exceptions": [], - }, - ], - "no-implicit-coercion": [ - "off", - { - "allow": [], - "boolean": false, - "number": true, - "string": true, - }, - ], - "no-implicit-globals": [ - "off", - ], - "no-implied-eval": [ - "off", - ], - "no-import-assign": [ - "off", - ], - "no-inline-comments": [ - "off", - ], - "no-inner-declarations": [ - "error", - ], - "no-invalid-regexp": [ - "error", - ], - "no-invalid-this": [ - "off", - ], - "no-irregular-whitespace": [ - "error", - ], - "no-iterator": [ - "error", - ], - "no-label-var": [ - "error", - ], - "no-labels": [ - "error", - { - "allowLoop": false, - "allowSwitch": false, - }, - ], - "no-lone-blocks": [ - "error", - ], - "no-lonely-if": [ - "error", - ], - "no-loop-func": [ - "error", - ], - "no-loss-of-precision": [ - "off", - ], - "no-magic-numbers": [ - "off", - { - "detectObjects": false, - "enforceConst": true, - "ignore": [], - "ignoreArrayIndexes": true, - }, - ], - "no-misleading-character-class": [ - "error", - ], - "no-mixed-operators": [ - 0, - { - "allowSamePrecedence": false, - "groups": [ - [ - "%", - "**", - ], - [ - "%", - "+", - ], - [ - "%", - "-", - ], - [ - "%", - "*", - ], - [ - "%", - "/", - ], - [ - "/", - "*", - ], - [ - "&", - "|", - "<<", - ">>", - ">>>", - ], - [ - "==", - "!=", - "===", - "!==", - ], - [ - "&&", - "||", - ], - ], - }, - ], - "no-mixed-requires": [ - "off", - false, - ], - "no-mixed-spaces-and-tabs": [ - "off", - ], - "no-multi-assign": [ - "error", - ], - "no-multi-spaces": [ - "off", - { - "ignoreEOLComments": false, - }, - ], - "no-multi-str": [ - "error", - ], - "no-multiple-empty-lines": [ - "off", - { - "max": 1, - "maxBOF": 0, - "maxEOF": 0, - }, - ], - "no-native-reassign": [ - "off", - ], - "no-negated-condition": [ - "off", - ], - "no-negated-in-lhs": [ - "off", - ], - "no-nested-ternary": [ - "error", - ], - "no-new": [ - "error", - ], - "no-new-func": [ - "error", - ], - "no-new-native-nonconstructor": [ - "off", - ], - "no-new-object": [ - "error", - ], - "no-new-require": [ - "error", - ], - "no-new-symbol": [ - "off", - ], - "no-new-wrappers": [ - "error", - ], - "no-nonoctal-decimal-escape": [ - "error", - ], - "no-obj-calls": [ - "off", - ], - "no-octal": [ - "error", - ], - "no-octal-escape": [ - "error", - ], - "no-param-reassign": [ - "error", - { - "ignorePropertyModificationsFor": [ - "acc", - "accumulator", - "e", - "ctx", - "context", - "req", - "request", - "res", - "response", - "$scope", - "staticContext", - ], - "props": true, - }, - ], - "no-path-concat": [ - "error", - ], - "no-plusplus": [ - "error", - ], - "no-process-env": [ - "off", - ], - "no-process-exit": [ - "off", - ], - "no-promise-executor-return": [ - "error", - ], - "no-proto": [ - "error", - ], - "no-prototype-builtins": [ - "error", - ], - "no-redeclare": [ - "off", - ], - "no-regex-spaces": [ - "error", - ], - "no-reserved-keys": [ - "off", - ], - "no-restricted-exports": [ - "error", - { - "restrictedNamedExports": [ - "default", - "then", - ], - }, - ], - "no-restricted-globals": [ - "error", - { - "message": "Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite", - "name": "isFinite", - }, - { - "message": "Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan", - "name": "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-restricted-imports": [ - "off", - { - "paths": [], - "patterns": [], - }, - ], - "no-restricted-modules": [ - "off", - ], - "no-restricted-properties": [ - "error", - { - "message": "arguments.callee is deprecated", - "object": "arguments", - "property": "callee", - }, - { - "message": "Please use Number.isFinite instead", - "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.isNaN 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 Object.defineProperty instead.", - "property": "__defineGetter__", - }, - { - "message": "Please use Object.defineProperty instead.", - "property": "__defineSetter__", - }, - { - "message": "Use the exponentiation operator (**) instead.", - "object": "Math", - "property": "pow", - }, - ], - "no-restricted-syntax": [ - "error", - { - "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": "ForInStatement", - }, - { - "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.", - "selector": "LabeledStatement", - }, - { - "message": "\`with\` is disallowed in strict mode because it makes code impossible to predict and optimize.", - "selector": "WithStatement", - }, - { - "message": "constructor name is not reliable, do not use it.", - "selector": "MemberExpression[object.property.name='constructor'][property.name='name']", - }, - ], - "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-setter-return": [ - "off", - ], - "no-shadow": [ - "off", - ], - "no-shadow-restricted-names": [ - "error", - ], - "no-space-before-semi": [ - "off", - ], - "no-spaced-func": [ - "off", - ], - "no-sparse-arrays": [ - "error", - ], - "no-sync": [ - "off", - ], - "no-tabs": [ - 0, - ], - "no-template-curly-in-string": [ - "error", - ], - "no-ternary": [ - "off", - ], - "no-this-before-super": [ - "off", - ], - "no-throw-literal": [ - "error", - ], - "no-trailing-spaces": [ - "off", - { - "ignoreComments": false, - "skipBlankLines": false, - }, - ], - "no-undef": [ - "off", - ], - "no-undef-init": [ - "error", - ], - "no-undefined": [ - "off", - ], - "no-underscore-dangle": [ - "error", - { - "allow": [], - "allowAfterSuper": false, - "allowAfterThis": false, - "allowAfterThisConstructor": false, - "allowFunctionParams": true, - "allowInArrayDestructuring": true, - "allowInObjectDestructuring": true, - "enforceInClassFields": false, - "enforceInMethodNames": true, - }, - ], - "no-unexpected-multiline": [ - 0, - ], - "no-unmodified-loop-condition": [ - "off", - ], - "no-unneeded-ternary": [ - "error", - { - "defaultAssignment": false, - }, - ], - "no-unreachable": [ - "off", - ], - "no-unreachable-loop": [ - "error", - { - "ignore": [], - }, - ], - "no-unsafe-finally": [ - "error", - ], - "no-unsafe-negation": [ - "off", - ], - "no-unsafe-optional-chaining": [ - "error", - { - "disallowArithmeticOperators": true, - }, - ], - "no-unused-expressions": [ - "error", - { - "allowShortCircuit": false, - "allowTaggedTemplates": false, - "allowTernary": false, - "enforceForJSX": false, - }, - ], - "no-unused-labels": [ - "error", - ], - "no-unused-private-class-members": [ - "off", - ], - "no-unused-vars": [ - "off", - { - "args": "after-used", - "ignoreRestSiblings": true, - "vars": "all", - }, - ], - "no-use-before-define": [ - "off", - { - "classes": true, - "functions": true, - "variables": true, - }, - ], - "no-useless-backreference": [ - "error", - ], - "no-useless-call": [ - "off", - ], - "no-useless-catch": [ - "error", - ], - "no-useless-computed-key": [ - "error", - ], - "no-useless-concat": [ - "error", - ], - "no-useless-constructor": [ - "off", - ], - "no-useless-escape": [ - "error", - ], - "no-useless-rename": [ - "error", - { - "ignoreDestructuring": false, - "ignoreExport": false, - "ignoreImport": false, - }, - ], - "no-useless-return": [ - "error", - ], - "no-var": [ - "error", - ], - "no-void": [ - "error", - ], - "no-warning-comments": [ - "off", - { - "location": "start", - "terms": [ - "todo", - "fixme", - "xxx", - ], - }, - ], - "no-whitespace-before-property": [ - "off", - ], - "no-with": [ - "error", - ], - "no-wrap-func": [ - "off", - ], - "nonblock-statement-body-position": [ - "off", - "beside", - { - "overrides": {}, - }, - ], - "object-curly-newline": [ - "off", - { - "ExportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ImportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectExpression": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectPattern": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - }, - ], - "object-curly-spacing": [ - "off", - "always", - ], - "object-property-newline": [ - "off", - { - "allowAllPropertiesOnSameLine": true, - "allowMultiplePropertiesPerLine": false, - }, - ], - "object-shorthand": [ - "error", - "always", - { - "avoidQuotes": true, - "ignoreConstructors": false, - }, - ], - "one-var": [ - "error", - "never", - ], - "one-var-declaration-per-line": [ - "off", - "always", - ], - "operator-assignment": [ + "no-restricted-properties": [ "error", - "always", - ], - "operator-linebreak": [ - "off", - "before", - { - "overrides": { - "=": "none", - }, - }, - ], - "padded-blocks": [ - "off", - { - "blocks": "never", - "classes": "never", - "switches": "never", - }, { - "allowSingleLineBlocks": true, + "message": "arguments.callee is deprecated", + "object": "arguments", + "property": "callee", }, - ], - "padding-line-between-statements": [ - "off", - ], - "prefer-arrow-callback": [ - "off", { - "allowNamedFunctions": false, - "allowUnboundThis": true, + "message": "Please use Number.isFinite instead", + "object": "global", + "property": "isFinite", }, - ], - "prefer-const": [ - "error", { - "destructuring": "any", - "ignoreReadBeforeAssign": true, + "message": "Please use Number.isFinite instead", + "object": "self", + "property": "isFinite", }, - ], - "prefer-destructuring": [ - "error", { - "AssignmentExpression": { - "array": true, - "object": false, - }, - "VariableDeclarator": { - "array": false, - "object": true, - }, + "message": "Please use Number.isFinite instead", + "object": "window", + "property": "isFinite", }, { - "enforceForRenamedProperties": false, + "message": "Please use Number.isNaN instead", + "object": "global", + "property": "isNaN", }, - ], - "prefer-exponentiation-operator": [ - "error", - ], - "prefer-named-capture-group": [ - "off", - ], - "prefer-numeric-literals": [ - "error", - ], - "prefer-object-spread": [ - "error", - ], - "prefer-promise-reject-errors": [ - "error", { - "allowEmptyReject": true, + "message": "Please use Number.isNaN instead", + "object": "self", + "property": "isNaN", }, - ], - "prefer-reflect": [ - "off", - ], - "prefer-regex-literals": [ - "error", { - "disallowRedundantWrapping": true, + "message": "Please use Number.isNaN instead", + "object": "window", + "property": "isNaN", }, - ], - "prefer-rest-params": [ - "error", - ], - "prefer-spread": [ - "error", - ], - "prefer-template": [ - "error", - ], - "quote-props": [ - "off", - "as-needed", { - "keywords": false, - "numbers": false, - "unnecessary": true, + "message": "Please use Object.defineProperty instead.", + "property": "__defineGetter__", }, - ], - "quotes": [ - 0, - "single", { - "avoidEscape": true, + "message": "Please use Object.defineProperty instead.", + "property": "__defineSetter__", }, - ], - "radix": [ - "error", - ], - "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-space-before-closing": [ - "off", - ], - "react/jsx-tag-spacing": [ - "off", - ], - "react/jsx-wrap-multilines": [ - "off", - ], - "require-atomic-updates": [ - "off", - ], - "require-await": [ - "off", - ], - "require-jsdoc": [ - "off", - ], - "require-unicode-regexp": [ - "off", - ], - "require-yield": [ - "error", - ], - "rest-spread-spacing": [ - "off", - "never", - ], - "semi": [ - "off", - "always", - ], - "semi-spacing": [ - "off", { - "after": true, - "before": false, + "message": "Use the exponentiation operator (**) instead.", + "object": "Math", + "property": "pow", }, ], - "semi-style": [ - "off", - "last", - ], - "simple-import-sort/exports": [ - "error", - ], - "simple-import-sort/imports": [ + "no-restricted-syntax": [ "error", - ], - "sort-imports": [ - "off", { - "ignoreCase": false, - "ignoreDeclarationSort": false, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single", - ], + "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": "ForInStatement", }, - ], - "sort-keys": [ - "off", - "asc", { - "caseSensitive": false, - "natural": true, + "message": "Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.", + "selector": "LabeledStatement", }, - ], - "sort-vars": [ - "off", - ], - "space-after-function-name": [ - "off", - ], - "space-after-keywords": [ - "off", - ], - "space-before-blocks": [ - "off", - ], - "space-before-function-paren": [ - "off", { - "anonymous": "always", - "asyncArrow": "always", - "named": "never", + "message": "\`with\` is disallowed in strict mode because it makes code impossible to predict and optimize.", + "selector": "WithStatement", }, - ], - "space-before-function-parentheses": [ - "off", - ], - "space-before-keywords": [ - "off", - ], - "space-in-brackets": [ - "off", - ], - "space-in-parens": [ - "off", - "never", - ], - "space-infix-ops": [ - "off", - ], - "space-return-throw-case": [ - "off", - ], - "space-unary-ops": [ - "off", { - "nonwords": false, - "overrides": {}, - "words": true, + "message": "constructor name is not reliable, do not use it.", + "selector": "MemberExpression[object.property.name='constructor'][property.name='name']", }, ], - "space-unary-word-ops": [ - "off", - ], - "spaced-comment": [ + "no-return-assign": [ "error", "always", - { - "block": { - "balanced": true, - "exceptions": [ - "-", - "+", - ], - "markers": [ - "=", - "!", - ":", - "::", - ], - }, - "line": { - "exceptions": [ - "-", - "+", - ], - "markers": [ - "=", - "!", - "/", - ], - }, - }, - ], - "standard/array-bracket-even-spacing": [ - "off", - ], - "standard/computed-property-even-spacing": [ - "off", ], - "standard/object-curly-even-spacing": [ - "off", + "no-return-await": [ + "error", ], - "strict": [ + "no-script-url": [ "error", - "never", ], - "switch-colon-spacing": [ - "off", + "no-self-assign": [ + "error", { - "after": true, - "before": false, + "props": true, }, ], - "symbol-description": [ + "no-self-compare": [ + "error", + ], + "no-sequences": [ "error", ], - "template-curly-spacing": [ + "no-setter-return": [ "off", ], - "template-tag-spacing": [ + "no-shadow": [ "off", - "never", ], - "unicode-bom": [ + "no-shadow-restricted-names": [ "error", - "never", ], - "unicorn/empty-brace-spaces": [ - "off", + "no-sparse-arrays": [ + "error", + ], + "no-template-curly-in-string": [ + "error", ], - "unicorn/no-nested-ternary": [ + "no-this-before-super": [ "off", ], - "unicorn/number-literal-case": [ + "no-throw-literal": [ + "error", + ], + "no-undef": [ "off", ], - "unicorn/prefer-node-protocol": [ + "no-undef-init": [ "error", ], - "unicorn/template-indent": [ - 0, + "no-underscore-dangle": [ + "error", + { + "allow": [], + "allowAfterSuper": false, + "allowAfterThis": false, + "allowAfterThisConstructor": false, + "allowFunctionParams": true, + "allowInArrayDestructuring": true, + "allowInObjectDestructuring": true, + "enforceInClassFields": false, + "enforceInMethodNames": true, + }, ], - "unicorn/text-encoding-identifier-case": [ + "no-unexpected-multiline": [ "error", ], - "use-isnan": [ + "no-unneeded-ternary": [ "error", + { + "defaultAssignment": false, + }, ], - "valid-jsdoc": [ + "no-unreachable": [ "off", ], - "valid-typeof": [ + "no-unreachable-loop": [ "error", { - "requireStringLiterals": true, + "ignore": [], }, ], - "vars-on-top": [ + "no-unsafe-finally": [ "error", ], - "vue/array-bracket-newline": [ + "no-unsafe-negation": [ "off", ], - "vue/array-bracket-spacing": [ - "off", + "no-unsafe-optional-chaining": [ + "error", + { + "disallowArithmeticOperators": true, + }, ], - "vue/array-element-newline": [ - "off", + "no-unused-expressions": [ + "error", + { + "allowShortCircuit": false, + "allowTaggedTemplates": false, + "allowTernary": false, + "enforceForJSX": false, + }, ], - "vue/arrow-spacing": [ - "off", + "no-unused-labels": [ + "error", ], - "vue/block-spacing": [ - "off", + "no-unused-private-class-members": [ + "error", ], - "vue/block-tag-newline": [ + "no-unused-vars": [ "off", + { + "args": "after-used", + "ignoreRestSiblings": true, + "vars": "all", + }, ], - "vue/brace-style": [ + "no-use-before-define": [ "off", + { + "classes": true, + "functions": true, + "variables": true, + }, ], - "vue/comma-dangle": [ - "off", + "no-useless-backreference": [ + "error", ], - "vue/comma-spacing": [ - "off", + "no-useless-catch": [ + "error", ], - "vue/comma-style": [ - "off", + "no-useless-computed-key": [ + "error", ], - "vue/dot-location": [ - "off", + "no-useless-concat": [ + "error", ], - "vue/func-call-spacing": [ + "no-useless-constructor": [ "off", ], - "vue/html-closing-bracket-newline": [ - "off", + "no-useless-escape": [ + "error", ], - "vue/html-closing-bracket-spacing": [ - "off", + "no-useless-rename": [ + "error", + { + "ignoreDestructuring": false, + "ignoreExport": false, + "ignoreImport": false, + }, ], - "vue/html-end-tags": [ - "off", + "no-useless-return": [ + "error", ], - "vue/html-indent": [ - "off", + "no-var": [ + "error", ], - "vue/html-quotes": [ - "off", + "no-void": [ + "error", ], - "vue/html-self-closing": [ - 0, + "no-with": [ + "error", ], - "vue/key-spacing": [ - "off", + "object-shorthand": [ + "error", + "always", + { + "avoidQuotes": true, + "ignoreConstructors": false, + }, ], - "vue/keyword-spacing": [ - "off", + "one-var": [ + "error", + "never", ], - "vue/max-attributes-per-line": [ - "off", + "operator-assignment": [ + "error", + "always", ], - "vue/max-len": [ - 0, + "prefer-const": [ + "error", + { + "destructuring": "any", + "ignoreReadBeforeAssign": true, + }, ], - "vue/multiline-html-element-content-newline": [ - "off", + "prefer-destructuring": [ + "error", + { + "AssignmentExpression": { + "array": true, + "object": false, + }, + "VariableDeclarator": { + "array": false, + "object": true, + }, + }, + { + "enforceForRenamedProperties": false, + }, ], - "vue/multiline-ternary": [ - "off", + "prefer-exponentiation-operator": [ + "error", ], - "vue/mustache-interpolation-spacing": [ - "off", + "prefer-numeric-literals": [ + "error", ], - "vue/no-extra-parens": [ - "off", + "prefer-object-spread": [ + "error", ], - "vue/no-multi-spaces": [ - "off", + "prefer-promise-reject-errors": [ + "error", + { + "allowEmptyReject": true, + }, ], - "vue/no-spaces-around-equal-signs-in-attribute": [ - "off", + "prefer-regex-literals": [ + "error", + { + "disallowRedundantWrapping": true, + }, ], - "vue/object-curly-newline": [ - "off", + "prefer-rest-params": [ + "error", ], - "vue/object-curly-spacing": [ - "off", + "prefer-spread": [ + "error", ], - "vue/object-property-newline": [ - "off", + "prefer-template": [ + "error", ], - "vue/operator-linebreak": [ - "off", + "radix": [ + "error", ], - "vue/quote-props": [ + "require-await": [ "off", ], - "vue/script-indent": [ - "off", + "require-yield": [ + "error", ], - "vue/singleline-html-element-content-newline": [ - "off", + "simple-import-sort/exports": [ + "error", ], - "vue/space-in-parens": [ - "off", + "simple-import-sort/imports": [ + "error", ], - "vue/space-infix-ops": [ - "off", + "symbol-description": [ + "error", ], - "vue/space-unary-ops": [ - "off", + "unicode-bom": [ + "error", + "never", ], - "vue/template-curly-spacing": [ - "off", + "unicorn/prefer-node-protocol": [ + "error", ], - "wrap-iife": [ - "off", - "outside", + "unicorn/text-encoding-identifier-case": [ + "error", + ], + "use-isnan": [ + "error", + ], + "valid-typeof": [ + "error", { - "functionPrototypeMethods": false, + "requireStringLiterals": true, }, ], - "wrap-regex": [ - "off", - ], - "yield-star-spacing": [ - "off", - "after", + "vars-on-top": [ + "error", ], "yoda": [ "error", @@ -4514,29 +2167,30 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` } `; -exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` +exports[`Resolved config matches snapshot > typescript-react.tsx 1`] = ` { "env": { - "es6": true, + "es2024": true, "node": true, }, "globals": {}, "ignorePatterns": [], + "noInlineConfig": undefined, "parser": "", "parserOptions": { "EXPERIMENTAL_useProjectService": true, "ecmaFeatures": { - "generators": false, "jsx": true, - "objectLiteralDuplicateProperties": false, }, "ecmaVersion": "latest", "sourceType": "module", }, "plugins": [ - "import", "unicorn", + "n", + "@stylistic/js", "simple-import-sort", + "import", "@typescript-eslint", "react-hooks", "react", @@ -4546,12 +2200,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` ], "reportUnusedDisableDirectives": true, "rules": { - "@babel/object-curly-spacing": [ - "off", - ], - "@babel/semi": [ - "off", - ], "@eslint-react/dom/no-children-in-void-dom-elements": [ "warn", ], @@ -4687,6 +2335,58 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "@rightcapital/no-ignore-return-value-of-react-hooks": [ "error", ], + "@stylistic/js/lines-between-class-members": [ + "error", + "always", + ], + "@stylistic/js/padding-line-between-statements": [ + "error", + { + "blankLine": "always", + "next": "*", + "prev": "directive", + }, + { + "blankLine": "always", + "next": "directive", + "prev": "*", + }, + { + "blankLine": "any", + "next": "directive", + "prev": "directive", + }, + ], + "@stylistic/js/spaced-comment": [ + "error", + "always", + { + "block": { + "balanced": true, + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + ":", + "::", + ], + }, + "line": { + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + "/", + ], + }, + }, + ], "@typescript-eslint/await-thenable": [ "error", ], @@ -4696,18 +2396,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "@typescript-eslint/ban-types": [ "error", ], - "@typescript-eslint/block-spacing": [ - "off", - ], - "@typescript-eslint/brace-style": [ - "off", - ], - "@typescript-eslint/comma-dangle": [ - "off", - ], - "@typescript-eslint/comma-spacing": [ - "off", - ], "@typescript-eslint/consistent-type-exports": [ "error", { @@ -4721,24 +2409,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "prefer": "type-imports", }, ], - "@typescript-eslint/func-call-spacing": [ - "off", - ], - "@typescript-eslint/indent": [ - "off", - ], - "@typescript-eslint/key-spacing": [ - "off", - ], - "@typescript-eslint/keyword-spacing": [ - "off", - ], - "@typescript-eslint/lines-around-comment": [ - 0, - ], - "@typescript-eslint/member-delimiter-style": [ - "off", - ], "@typescript-eslint/naming-convention": [ "error", { @@ -4776,12 +2446,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "@typescript-eslint/no-extra-non-null-assertion": [ "error", ], - "@typescript-eslint/no-extra-parens": [ - "off", - ], - "@typescript-eslint/no-extra-semi": [ - "off", - ], "@typescript-eslint/no-floating-promises": [ "error", ], @@ -4869,15 +2533,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "@typescript-eslint/no-var-requires": [ "error", ], - "@typescript-eslint/object-curly-spacing": [ - "off", - ], "@typescript-eslint/prefer-as-const": [ "error", ], - "@typescript-eslint/quotes": [ - 0, - ], "@typescript-eslint/require-await": [ "error", ], @@ -4895,38 +2553,12 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowRegExp": true, }, ], - "@typescript-eslint/semi": [ - "off", - ], - "@typescript-eslint/space-before-blocks": [ - "off", - ], - "@typescript-eslint/space-before-function-paren": [ - "off", - ], - "@typescript-eslint/space-infix-ops": [ - "off", - ], "@typescript-eslint/triple-slash-reference": [ "error", ], - "@typescript-eslint/type-annotation-spacing": [ - "off", - ], "@typescript-eslint/unbound-method": [ "error", ], - "accessor-pairs": [ - "off", - ], - "array-bracket-newline": [ - "off", - "consistent", - ], - "array-bracket-spacing": [ - "off", - "never", - ], "array-callback-return": [ "error", { @@ -4935,57 +2567,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "checkForEach": false, }, ], - "array-element-newline": [ - "off", - { - "minItems": 3, - "multiline": true, - }, - ], - "arrow-body-style": [ - "off", - "as-needed", - { - "requireReturnForObjectLiteral": false, - }, - ], - "arrow-parens": [ - "off", - "always", - ], - "arrow-spacing": [ - "off", - { - "after": true, - "before": true, - }, - ], - "babel/object-curly-spacing": [ - "off", - ], - "babel/quotes": [ - 0, - ], - "babel/semi": [ - "off", - ], "block-scoped-var": [ "error", ], - "block-spacing": [ - "off", - "always", - ], - "brace-style": [ - "off", - "1tbs", - { - "allowSingleLine": true, - }, - ], - "callback-return": [ - "off", - ], "camelcase": [ "error", { @@ -4995,79 +2579,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "properties": "never", }, ], - "capitalized-comments": [ - "off", - "never", - { - "block": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, - "line": { - "ignoreConsecutiveComments": true, - "ignoreInlineComments": true, - "ignorePattern": ".*", - }, - }, - ], - "class-methods-use-this": [ - "off", - { - "enforceForClassFields": true, - "exceptMethods": [], - }, - ], - "comma-dangle": [ - "off", - { - "arrays": "always-multiline", - "exports": "always-multiline", - "functions": "always-multiline", - "imports": "always-multiline", - "objects": "always-multiline", - }, - ], - "comma-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], - "comma-style": [ - "off", - "last", - { - "exceptions": { - "ArrayExpression": false, - "ArrayPattern": false, - "ArrowFunctionExpression": false, - "CallExpression": false, - "FunctionDeclaration": false, - "FunctionExpression": false, - "ImportDeclaration": false, - "NewExpression": false, - "ObjectExpression": false, - "ObjectPattern": false, - "VariableDeclaration": false, - }, - }, - ], - "complexity": [ - "off", - 20, - ], - "computed-property-spacing": [ - "off", - "never", - ], "consistent-return": [ "error", ], - "consistent-this": [ - "off", - ], "constructor-super": [ "off", ], @@ -5084,13 +2598,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "default-case-last": [ "error", ], - "default-param-last": [ - "off", - ], - "dot-location": [ - "off", - "property", - ], "dot-notation": [ "error", { @@ -5098,10 +2605,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowPattern": "", }, ], - "eol-last": [ - "off", - "always", - ], "eqeqeq": [ "error", "always", @@ -5109,126 +2612,27 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "null": "ignore", }, ], - "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", - ], "for-direction": [ "error", ], - "func-call-spacing": [ - "off", - "never", - ], - "func-name-matching": [ - "off", - "always", - { - "considerPropertyDescriptor": true, - "includeCommonJSModuleExports": false, - }, - ], "func-names": [ "warn", ], - "func-style": [ - "off", - "expression", - ], - "function-call-argument-newline": [ - "off", - "consistent", - ], - "function-paren-newline": [ - "off", - "multiline-arguments", - ], - "generator-star": [ - "off", - ], - "generator-star-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], "getter-return": [ "off", { "allowImplicit": true, }, ], - "global-require": [ - "error", - ], "grouped-accessor-pairs": [ "error", ], "guard-for-in": [ "error", ], - "handle-callback-err": [ - "off", - ], - "id-denylist": [ - "off", - ], - "id-length": [ - "off", - ], - "id-match": [ - "off", - ], - "implicit-arrow-linebreak": [ - "off", - "beside", - ], - "import/default": [ - "off", - ], - "import/dynamic-import-chunkname": [ - "off", - { - "importFunctions": [], - "webpackChunknameFormat": "[0-9a-zA-Z-_/.]+", - }, - ], "import/export": [ "error", ], - "import/exports-last": [ - "off", - ], "import/extensions": [ "warn", "ignorePackages", @@ -5242,12 +2646,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/first": [ "error", ], - "import/group-exports": [ - "off", - ], - "import/imports-first": [ - "off", - ], "import/max-dependencies": [ "off", { @@ -5257,32 +2655,12 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/named": [ "error", ], - "import/namespace": [ - "off", - ], "import/newline-after-import": [ "error", ], "import/no-absolute-path": [ "error", ], - "import/no-amd": [ - "error", - ], - "import/no-anonymous-default-export": [ - "off", - { - "allowAnonymousClass": false, - "allowAnonymousFunction": false, - "allowArray": false, - "allowArrowFunction": false, - "allowLiteral": false, - "allowObject": false, - }, - ], - "import/no-commonjs": [ - "off", - ], "import/no-cycle": [ "error", { @@ -5291,12 +2669,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "maxDepth": "∞", }, ], - "import/no-default-export": [ - "off", - ], - "import/no-deprecated": [ - "off", - ], "import/no-duplicates": [ "error", { @@ -5315,9 +2687,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "spec/**", "**/__tests__/**", "**/__mocks__/**", - "test.{js,jsx}", - "test-*.{js,jsx}", - "**/*{.,_}{test,spec}.{js,jsx}", + "test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "test-*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", + "**/*{.,_}{test,spec}.{js,cjs,mjs,jsx,ts,cts,mts,tsx}", "**/jest.config.js", "**/jest.setup.js", "**/vue.config.js", @@ -5331,7 +2703,8 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "**/protractor.conf.js", "**/protractor.conf.*.js", "**/karma.conf.js", - "**/.eslintrc.js", + "**/.eslintrc.{js,cjs}", + "**/eslint.config.{js,cjs,mjs}", ], "optionalDependencies": false, }, @@ -5342,12 +2715,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "exceptions": [], }, ], - "import/no-internal-modules": [ - "off", - { - "allow": [], - }, - ], "import/no-mutable-exports": [ "error", ], @@ -5360,30 +2727,12 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/no-named-default": [ "error", ], - "import/no-named-export": [ - "off", - ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], "import/no-relative-packages": [ "error", ], - "import/no-relative-parent-imports": [ - "off", - ], - "import/no-restricted-paths": [ - "off", - ], "import/no-self-import": [ "error", ], - "import/no-unassigned-import": [ - "off", - ], "import/no-unresolved": [ "error", { @@ -5392,14 +2741,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "commonjs": true, }, ], - "import/no-unused-modules": [ - "off", - { - "ignoreExports": [], - "missingExports": true, - "unusedExports": true, - }, - ], "import/no-useless-path-segments": [ "error", { @@ -5411,76 +2752,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` ], "import/order": [ "off", - { - "distinctGroup": true, - "groups": [ - [ - "builtin", - "external", - "internal", - ], - ], - "warnOnUnassignedImports": false, - }, - ], - "import/prefer-default-export": [ - "off", - ], - "import/unambiguous": [ - "off", - ], - "indent": [ - "off", - 2, - { - "ArrayExpression": 1, - "CallExpression": { - "arguments": 1, - }, - "FunctionDeclaration": { - "body": 1, - "parameters": 1, - }, - "FunctionExpression": { - "body": 1, - "parameters": 1, - }, - "ImportDeclaration": 1, - "ObjectExpression": 1, - "SwitchCase": 1, - "VariableDeclarator": 1, - "flatTernaryExpressions": false, - "ignoreComments": false, - "ignoredNodes": [ - "JSXElement", - "JSXElement > *", - "JSXAttribute", - "JSXIdentifier", - "JSXNamespacedName", - "JSXMemberExpression", - "JSXSpreadAttribute", - "JSXExpressionContainer", - "JSXOpeningElement", - "JSXClosingElement", - "JSXFragment", - "JSXOpeningFragment", - "JSXClosingFragment", - "JSXText", - "JSXEmptyExpression", - "JSXSpreadChild", - ], - "offsetTernaryExpressions": false, - "outerIIFEBody": 1, - }, - ], - "indent-legacy": [ - "off", - ], - "init-declarations": [ - "off", - ], - "jsx-a11y/accessible-emoji": [ - "off", ], "jsx-a11y/alt-text": [ "error", @@ -5500,23 +2771,7 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "jsx-a11y/anchor-has-content": [ "error", { - "components": [], - }, - ], - "jsx-a11y/anchor-is-valid": [ - "off", - { - "aspects": [ - "noHref", - "invalidHref", - "preferButton", - ], - "components": [ - "Link", - ], - "specialLink": [ - "to", - ], + "components": [], }, ], "jsx-a11y/aria-activedescendant-has-tabindex": [ @@ -5537,15 +2792,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "jsx-a11y/aria-unsupported-elements": [ "error", ], - "jsx-a11y/autocomplete-valid": [ - "off", - { - "inputComponents": [], - }, - ], - "jsx-a11y/click-events-have-key-events": [ - "off", - ], "jsx-a11y/control-has-associated-label": [ "error", { @@ -5607,19 +2853,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "labelComponents": [], }, ], - "jsx-a11y/label-has-for": [ - "off", - { - "allowChildren": false, - "components": [], - "required": { - "every": [ - "nesting", - "id", - ], - }, - }, - ], "jsx-a11y/lang": [ "error", ], @@ -5719,9 +2952,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "tags": [], }, ], - "jsx-a11y/no-onchange": [ - "off", - ], "jsx-a11y/no-redundant-roles": [ "error", ], @@ -5750,125 +2980,18 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "jsx-a11y/tabindex-no-positive": [ "error", ], - "jsx-quotes": [ - "off", - "prefer-double", - ], - "key-spacing": [ - "off", - { - "afterColon": true, - "beforeColon": false, - }, - ], - "keyword-spacing": [ - "off", - { - "after": true, - "before": true, - "overrides": { - "case": { - "after": true, - }, - "return": { - "after": true, - }, - "throw": { - "after": true, - }, - }, - }, - ], - "line-comment-position": [ - "off", - { - "applyDefaultPatterns": true, - "ignorePattern": "", - "position": "above", - }, - ], - "linebreak-style": [ - "off", - "unix", - ], - "lines-around-comment": [ - 0, - ], - "lines-around-directive": [ - "error", - { - "after": "always", - "before": "always", - }, - ], - "lines-between-class-members": [ - "error", - "always", - { - "exceptAfterSingleLine": false, - }, - ], "max-classes-per-file": [ "error", 1, ], - "max-depth": [ - "off", - 4, - ], - "max-len": [ - 0, - 100, - 2, - { - "ignoreComments": false, - "ignoreRegExpLiterals": true, - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreUrls": true, - }, - ], - "max-lines": [ - "off", - { - "max": 300, - "skipBlankLines": true, - "skipComments": true, - }, - ], - "max-lines-per-function": [ - "off", - { - "IIFEs": true, - "max": 50, - "skipBlankLines": true, - "skipComments": true, - }, - ], - "max-nested-callbacks": [ - "off", - ], - "max-params": [ - "off", - 3, - ], - "max-statements": [ - "off", - 10, - ], - "max-statements-per-line": [ - "off", - { - "max": 1, - }, + "n/global-require": [ + "error", ], - "multiline-comment-style": [ - "off", - "starred-block", + "n/no-new-require": [ + "error", ], - "multiline-ternary": [ - "off", - "never", + "n/no-path-concat": [ + "error", ], "new-cap": [ "error", @@ -5884,30 +3007,12 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "properties": true, }, ], - "new-parens": [ - "off", - ], - "newline-after-var": [ - "off", - ], - "newline-before-return": [ - "off", - ], - "newline-per-chained-call": [ - "off", - { - "ignoreChainWithDepth": 4, - }, - ], "no-alert": [ "warn", ], "no-array-constructor": [ "off", ], - "no-arrow-condition": [ - "off", - ], "no-async-promise-executor": [ "error", ], @@ -5926,15 +3031,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-case-declarations": [ "error", ], - "no-catch-shadow": [ - "off", - ], "no-class-assign": [ "error", ], - "no-comma-dangle": [ - "off", - ], "no-compare-neg-zero": [ "error", ], @@ -5942,13 +3041,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "error", "always", ], - "no-confusing-arrow": [ - 0, - { - "allowParens": true, - "onlyOneSimpleParam": false, - }, - ], "no-console": [ "warn", ], @@ -5973,9 +3065,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-delete-var": [ "error", ], - "no-div-regex": [ - "off", - ], "no-dupe-args": [ "off", ], @@ -5991,9 +3080,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-duplicate-case": [ "error", ], - "no-duplicate-imports": [ - "off", - ], "no-else-return": [ "error", { @@ -6019,9 +3105,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-empty-pattern": [ "error", ], - "no-eq-null": [ - "off", - ], "no-eval": [ "error", ], @@ -6040,26 +3123,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-extra-label": [ "error", ], - "no-extra-parens": [ - "off", - "all", - { - "conditionalAssign": true, - "enforceForArrowConditionals": false, - "ignoreJSX": "all", - "nestedBinaryExpressions": false, - "returnAssign": false, - }, - ], - "no-extra-semi": [ - "off", - ], "no-fallthrough": [ "error", ], - "no-floating-decimal": [ - "off", - ], "no-func-assign": [ "off", ], @@ -6069,36 +3135,18 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "exceptions": [], }, ], - "no-implicit-coercion": [ - "off", - { - "allow": [], - "boolean": false, - "number": true, - "string": true, - }, - ], - "no-implicit-globals": [ - "off", - ], "no-implied-eval": [ "off", ], "no-import-assign": [ "off", ], - "no-inline-comments": [ - "off", - ], "no-inner-declarations": [ "error", ], "no-invalid-regexp": [ "error", ], - "no-invalid-this": [ - "off", - ], "no-irregular-whitespace": [ "error", ], @@ -6127,103 +3175,15 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-loss-of-precision": [ "off", ], - "no-magic-numbers": [ - "off", - { - "detectObjects": false, - "enforceConst": true, - "ignore": [], - "ignoreArrayIndexes": true, - }, - ], "no-misleading-character-class": [ "error", ], - "no-mixed-operators": [ - 0, - { - "allowSamePrecedence": false, - "groups": [ - [ - "%", - "**", - ], - [ - "%", - "+", - ], - [ - "%", - "-", - ], - [ - "%", - "*", - ], - [ - "%", - "/", - ], - [ - "/", - "*", - ], - [ - "&", - "|", - "<<", - ">>", - ">>>", - ], - [ - "==", - "!=", - "===", - "!==", - ], - [ - "&&", - "||", - ], - ], - }, - ], - "no-mixed-requires": [ - "off", - false, - ], - "no-mixed-spaces-and-tabs": [ - "off", - ], "no-multi-assign": [ "error", ], - "no-multi-spaces": [ - "off", - { - "ignoreEOLComments": false, - }, - ], "no-multi-str": [ "error", ], - "no-multiple-empty-lines": [ - "off", - { - "max": 1, - "maxBOF": 0, - "maxEOF": 0, - }, - ], - "no-native-reassign": [ - "off", - ], - "no-negated-condition": [ - "off", - ], - "no-negated-in-lhs": [ - "off", - ], "no-nested-ternary": [ "error", ], @@ -6236,12 +3196,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-new-native-nonconstructor": [ "off", ], - "no-new-object": [ - "error", - ], - "no-new-require": [ - "error", - ], "no-new-symbol": [ "off", ], @@ -6254,6 +3208,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-obj-calls": [ "off", ], + "no-object-constructor": [ + "error", + ], "no-octal": [ "error", ], @@ -6279,18 +3236,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "props": true, }, ], - "no-path-concat": [ - "error", - ], "no-plusplus": [ "error", ], - "no-process-env": [ - "off", - ], - "no-process-exit": [ - "off", - ], "no-promise-executor-return": [ "error", ], @@ -6306,9 +3254,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-regex-spaces": [ "error", ], - "no-reserved-keys": [ - "off", - ], "no-restricted-exports": [ "error", { @@ -6387,16 +3332,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "toolbar", "top", ], - "no-restricted-imports": [ - "off", - { - "paths": [], - "patterns": [], - }, - ], - "no-restricted-modules": [ - "off", - ], "no-restricted-properties": [ "error", { @@ -6498,49 +3433,24 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-shadow-restricted-names": [ "error", ], - "no-space-before-semi": [ - "off", - ], - "no-spaced-func": [ - "off", - ], "no-sparse-arrays": [ "error", ], - "no-sync": [ - "off", - ], - "no-tabs": [ - 0, - ], "no-template-curly-in-string": [ "error", ], - "no-ternary": [ - "off", - ], "no-this-before-super": [ "off", ], "no-throw-literal": [ "error", ], - "no-trailing-spaces": [ - "off", - { - "ignoreComments": false, - "skipBlankLines": false, - }, - ], "no-undef": [ "off", ], "no-undef-init": [ "error", ], - "no-undefined": [ - "off", - ], "no-underscore-dangle": [ "error", { @@ -6556,10 +3466,7 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` }, ], "no-unexpected-multiline": [ - 0, - ], - "no-unmodified-loop-condition": [ - "off", + "error", ], "no-unneeded-ternary": [ "error", @@ -6601,7 +3508,7 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "error", ], "no-unused-private-class-members": [ - "off", + "error", ], "no-unused-vars": [ "off", @@ -6622,9 +3529,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-useless-backreference": [ "error", ], - "no-useless-call": [ - "off", - ], "no-useless-catch": [ "error", ], @@ -6657,118 +3561,24 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-void": [ "error", ], - "no-warning-comments": [ - "off", - { - "location": "start", - "terms": [ - "todo", - "fixme", - "xxx", - ], - }, - ], - "no-whitespace-before-property": [ - "off", - ], "no-with": [ "error", ], - "no-wrap-func": [ - "off", - ], - "nonblock-statement-body-position": [ - "off", - "beside", - { - "overrides": {}, - }, - ], - "object-curly-newline": [ - "off", - { - "ExportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ImportDeclaration": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectExpression": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - "ObjectPattern": { - "consistent": true, - "minProperties": 4, - "multiline": true, - }, - }, - ], - "object-curly-spacing": [ - "off", - "always", - ], - "object-property-newline": [ - "off", - { - "allowAllPropertiesOnSameLine": true, - "allowMultiplePropertiesPerLine": false, - }, - ], "object-shorthand": [ - "error", - "always", - { - "avoidQuotes": true, - "ignoreConstructors": false, - }, - ], - "one-var": [ - "error", - "never", - ], - "one-var-declaration-per-line": [ - "off", - "always", - ], - "operator-assignment": [ - "error", - "always", - ], - "operator-linebreak": [ - "off", - "before", - { - "overrides": { - "=": "none", - }, - }, - ], - "padded-blocks": [ - "off", - { - "blocks": "never", - "classes": "never", - "switches": "never", - }, + "error", + "always", { - "allowSingleLineBlocks": true, + "avoidQuotes": true, + "ignoreConstructors": false, }, ], - "padding-line-between-statements": [ - "off", + "one-var": [ + "error", + "never", ], - "prefer-arrow-callback": [ - "off", - { - "allowNamedFunctions": false, - "allowUnboundThis": true, - }, + "operator-assignment": [ + "error", + "always", ], "prefer-const": [ "error", @@ -6796,9 +3606,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "prefer-exponentiation-operator": [ "error", ], - "prefer-named-capture-group": [ - "off", - ], "prefer-numeric-literals": [ "error", ], @@ -6811,9 +3618,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowEmptyReject": true, }, ], - "prefer-reflect": [ - "off", - ], "prefer-regex-literals": [ "error", { @@ -6829,22 +3633,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "prefer-template": [ "error", ], - "quote-props": [ - "off", - "as-needed", - { - "keywords": false, - "numbers": false, - "unnecessary": true, - }, - ], - "quotes": [ - 0, - "single", - { - "avoidEscape": true, - }, - ], "radix": [ "error", ], @@ -6854,254 +3642,34 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "react-hooks/rules-of-hooks": [ "error", ], - "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-space-before-closing": [ - "off", - ], - "react/jsx-tag-spacing": [ - "off", - ], - "react/jsx-wrap-multilines": [ - "off", - ], - "require-atomic-updates": [ - "off", - ], "require-await": [ "off", ], - "require-jsdoc": [ - "off", - ], - "require-unicode-regexp": [ - "off", - ], "require-yield": [ "error", ], - "rest-spread-spacing": [ - "off", - "never", - ], - "semi": [ - "off", - "always", - ], - "semi-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], - "semi-style": [ - "off", - "last", - ], "simple-import-sort/exports": [ "error", ], "simple-import-sort/imports": [ "error", ], - "sort-imports": [ - "off", - { - "ignoreCase": false, - "ignoreDeclarationSort": false, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single", - ], - }, - ], - "sort-keys": [ - "off", - "asc", - { - "caseSensitive": false, - "natural": true, - }, - ], - "sort-vars": [ - "off", - ], - "space-after-function-name": [ - "off", - ], - "space-after-keywords": [ - "off", - ], - "space-before-blocks": [ - "off", - ], - "space-before-function-paren": [ - "off", - { - "anonymous": "always", - "asyncArrow": "always", - "named": "never", - }, - ], - "space-before-function-parentheses": [ - "off", - ], - "space-before-keywords": [ - "off", - ], - "space-in-brackets": [ - "off", - ], - "space-in-parens": [ - "off", - "never", - ], - "space-infix-ops": [ - "off", - ], - "space-return-throw-case": [ - "off", - ], - "space-unary-ops": [ - "off", - { - "nonwords": false, - "overrides": {}, - "words": true, - }, - ], - "space-unary-word-ops": [ - "off", - ], - "spaced-comment": [ - "error", - "always", - { - "block": { - "balanced": true, - "exceptions": [ - "-", - "+", - ], - "markers": [ - "=", - "!", - ":", - "::", - ], - }, - "line": { - "exceptions": [ - "-", - "+", - ], - "markers": [ - "=", - "!", - "/", - ], - }, - }, - ], - "standard/array-bracket-even-spacing": [ - "off", - ], - "standard/computed-property-even-spacing": [ - "off", - ], - "standard/object-curly-even-spacing": [ - "off", - ], - "strict": [ - "error", - "never", - ], - "switch-colon-spacing": [ - "off", - { - "after": true, - "before": false, - }, - ], "symbol-description": [ "error", ], - "template-curly-spacing": [ - "off", - ], - "template-tag-spacing": [ - "off", - "never", - ], "unicode-bom": [ "error", "never", ], - "unicorn/empty-brace-spaces": [ - "off", - ], - "unicorn/no-nested-ternary": [ - "off", - ], - "unicorn/number-literal-case": [ - "off", - ], "unicorn/prefer-node-protocol": [ "error", ], - "unicorn/template-indent": [ - 0, - ], "unicorn/text-encoding-identifier-case": [ "error", ], "use-isnan": [ "error", ], - "valid-jsdoc": [ - "off", - ], "valid-typeof": [ "error", { @@ -7111,137 +3679,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "vars-on-top": [ "error", ], - "vue/array-bracket-newline": [ - "off", - ], - "vue/array-bracket-spacing": [ - "off", - ], - "vue/array-element-newline": [ - "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/html-self-closing": [ - 0, - ], - "vue/key-spacing": [ - "off", - ], - "vue/keyword-spacing": [ - "off", - ], - "vue/max-attributes-per-line": [ - "off", - ], - "vue/max-len": [ - 0, - ], - "vue/multiline-html-element-content-newline": [ - "off", - ], - "vue/multiline-ternary": [ - "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/quote-props": [ - "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", - ], - "wrap-iife": [ - "off", - "outside", - { - "functionPrototypeMethods": false, - }, - ], - "wrap-regex": [ - "off", - ], - "yield-star-spacing": [ - "off", - "after", - ], "yoda": [ "error", ], diff --git a/specs/eslint/config-snapshot.test.ts b/specs/eslint/config-snapshot.test.ts deleted file mode 100644 index bdf58d3a..00000000 --- a/specs/eslint/config-snapshot.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { readdirSync } from 'node:fs'; -import { basename, resolve } from 'node:path'; - -import { describe, expect, test } from 'vitest'; -import { execa } from 'execa'; - -const eslintExec = resolve(__dirname, 'node_modules', '.bin', 'eslint'); -const srcDir = resolve(__dirname, 'src'); - -const sampleFiles = readdirSync(srcDir).map((filename) => - resolve(srcDir, filename), -); - -/** - * Make snapshot for the result of `eslint --print-config ` - * Thus we can easily inspect the upgrade of upstream configs. - * - * @see https://eslint.org/docs/latest/use/command-line-interface#--print-config - */ -describe('resolved config matches snapshot', () => { - for (const file of sampleFiles) { - test(basename(file), async () => { - expect({ - ...JSON.parse( - (await execa(eslintExec, ['--print-config', file])).stdout, - ), - // this field contains environment related path, which is not suitable for snapshot - parser: '', - }).toMatchSnapshot(); - }); - } -}); diff --git a/specs/eslint/package.json b/specs/eslint/package.json index 63c7aa95..ba9031eb 100644 --- a/specs/eslint/package.json +++ b/specs/eslint/package.json @@ -20,6 +20,7 @@ "@types/react": "18.3.3", "concurrently": "8.2.2", "eslint": "8.57.0", + "eslint-config-prettier": "9.1.0", "execa": "9.3.0", "prettier": "3.3.2", "typescript-eslint": "7.15.0", diff --git a/specs/eslint/presets.test.mts b/specs/eslint/presets.test.mts new file mode 100644 index 00000000..e957c516 --- /dev/null +++ b/specs/eslint/presets.test.mts @@ -0,0 +1,109 @@ +import { readdir } from 'node:fs/promises'; +import { basename, resolve } from 'node:path'; + +import { describe, test } from 'vitest'; + +import eslintConfigPrettier from 'eslint-config-prettier'; + +import { ESLint } from 'eslint'; + +const srcDir = resolve(__dirname, 'src'); +const rootDir = __dirname; + +const sampleFiles = (await readdir(srcDir)).map((filename) => + resolve(srcDir, filename), +); + +const parsedConfigs = await Promise.all( + sampleFiles.map(async (file) => [ + basename(file), + await new ESLint({ + cwd: rootDir, + }).calculateConfigForFile(file), + ]), +); + +/** + * Make snapshot for the result of parsed presets, + * Thus we can easily inspect the upgrade of upstream configs. + * + * @see https://eslint.org/docs/v8.x/integrate/nodejs-api#-eslintcalculateconfigforfilefilepath + */ +describe('Resolved config matches snapshot', async () => { + for (const [file, config] of parsedConfigs) { + test.concurrent(file, async ({ expect }) => { + expect({ + ...config, + // this field contains environment related path, which is not suitable for snapshot + parser: '', + }).toMatchSnapshot(); + }); + } +}); + +const allowedSpecialStyleRules = [ + /** + * We use `curly: ['error', 'all']` which is compatible with Prettier + * https://github.com/prettier/eslint-config-prettier?tab=readme-ov-file#curly + */ + 'curly', + + /** + * https://github.com/prettier/eslint-config-prettier?tab=readme-ov-file#no-unexpected-multiline + */ + 'no-unexpected-multiline', +]; +const disallowedStyleRules = Object.keys(eslintConfigPrettier.rules).filter( + (rule) => !allowedSpecialStyleRules.includes(rule), +); +/** + * Make presets friendly to Prettier + * + * Although we have the eslint-config-prettier CLI to + * check for rules that are not compatible with Prettier, + * we also want to avoid unnecessary rules + * like "space-after-keywords": "off" in our presets. + * + * Therefore, we add this test to ensure that + * the presets do not contain any (enable or disable) style rules. + */ +describe('Presets does not contain style rules', () => { + for (const [file, preset] of parsedConfigs) { + test.concurrent(`${file}`, async ({ expect }) => { + for (const rule of disallowedStyleRules) { + expect(preset.rules).not.toHaveProperty(rule); + } + }); + } +}); + +// FIXME: migrate these deprecated rules with alternatives or remove them? +const ignoredDeprecatedRules = ['no-buffer-constructor', 'no-return-await']; +const lintResults = await Promise.all( + sampleFiles.map(async (file) => [ + basename(file), + ( + await new ESLint({ + cwd: rootDir, + }).lintFiles(file) + )[0], + ]), +); +describe('Presets does not contain deprecated rules', () => { + for (const [file, result] of lintResults) { + test.concurrent(`${file}`, async ({ expect }) => { + expect(result).toBeTypeOf('object'); + const deprecatedRules = (result as ESLint.LintResult).usedDeprecatedRules; + + /** + * For better readability, we use `toEqual([])` to produce a more concise diff. + */ + expect( + deprecatedRules.filter( + (deprecatedRule) => + !ignoredDeprecatedRules.includes(deprecatedRule.ruleId), + ), + ).toEqual([]); + }); + } +}); diff --git a/specs/eslint/tsconfig.json b/specs/eslint/tsconfig.json index 974813f8..c08b2965 100644 --- a/specs/eslint/tsconfig.json +++ b/specs/eslint/tsconfig.json @@ -1,6 +1,8 @@ { "compilerOptions": { - "jsx": "preserve" + "jsx": "preserve", + "esModuleInterop": true, + "module": "NodeNext" }, - "include": ["./src/**/*", "./*.ts"] + "include": ["src/**/*", "*.mts", "*.ts"] }