From 3b58e058c9a9b25ef2b224d74f157337951ce56b 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 + ...-552d208c-9bb9-490a-9443-a528bfa11cfe.json | 7 + packages/eslint-config-base/package.json | 8 +- packages/eslint-config-base/src/index.ts | 69 +- .../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 | 88 +- 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-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} | 4120 ++--------------- specs/eslint/config-snapshot.test.ts | 32 - specs/eslint/package.json | 1 + specs/eslint/presets.test.mts | 109 + specs/eslint/tsconfig.json | 6 +- 25 files changed, 668 insertions(+), 4777 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-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} (53%) 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-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..406a4cd8 100644 --- a/packages/eslint-config-base/src/index.ts +++ b/packages/eslint-config-base/src/index.ts @@ -12,82 +12,15 @@ 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..2c833a73 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,69 +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', 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-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 53% rename from specs/eslint/__snapshots__/config-snapshot.test.ts.snap rename to specs/eslint/__snapshots__/presets.test.mts.snap index 14106966..f436e3b5 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": [ + "n", + "@stylistic/js", "import", "unicorn", "simple-import-sort", ], "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,113 +131,24 @@ 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", { @@ -417,9 +178,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/group-exports": [ "off", ], - "import/imports-first": [ - "off", - ], "import/max-dependencies": [ "off", { @@ -429,18 +187,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", { @@ -452,9 +204,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "allowObject": false, }, ], - "import/no-commonjs": [ - "off", - ], "import/no-cycle": [ "error", { @@ -466,9 +215,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/no-default-export": [ "off", ], - "import/no-deprecated": [ - "off", - ], "import/no-duplicates": [ "error", ], @@ -484,9 +230,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 +246,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, }, @@ -532,12 +279,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "import/no-named-export": [ "off", ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], "import/no-relative-packages": [ "error", ], @@ -580,193 +321,25 @@ exports[`resolved config matches snapshot > javascript.js 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-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": [ + "max-classes-per-file": [ "error", - { - "after": "always", - "before": "always", - }, + 1, ], - "lines-between-class-members": [ + "n/global-require": [ "error", - "always", - { - "exceptAfterSingleLine": false, - }, ], - "max-classes-per-file": [ + "n/no-new-require": [ "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", + "n/no-path-concat": [ + "error", ], "new-cap": [ "error", @@ -782,30 +355,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", ], @@ -830,9 +385,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-class-assign": [ "error", ], - "no-comma-dangle": [ - "off", - ], "no-compare-neg-zero": [ "error", ], @@ -840,13 +392,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "error", "always", ], - "no-confusing-arrow": [ - 0, - { - "allowParens": true, - "onlyOneSimpleParam": false, - }, - ], "no-console": [ "warn", ], @@ -871,9 +416,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-delete-var": [ "error", ], - "no-div-regex": [ - "off", - ], "no-dupe-args": [ "error", ], @@ -889,9 +431,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-duplicate-case": [ "error", ], - "no-duplicate-imports": [ - "off", - ], "no-else-return": [ "error", { @@ -917,9 +456,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-empty-pattern": [ "error", ], - "no-eq-null": [ - "off", - ], "no-eval": [ "error", ], @@ -938,26 +474,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 +486,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 +526,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 +544,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 +556,9 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-obj-calls": [ "error", ], + "no-object-constructor": [ + "error", + ], "no-octal": [ "error", ], @@ -1174,18 +584,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 +602,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-regex-spaces": [ "error", ], - "no-reserved-keys": [ - "off", - ], "no-restricted-exports": [ "error", { @@ -1282,16 +680,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,40 +781,18 @@ 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", ], @@ -1451,10 +817,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 +859,7 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "error", ], "no-unused-private-class-members": [ - "off", + "error", ], "no-unused-vars": [ "error", @@ -1517,9 +880,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "no-useless-backreference": [ "error", ], - "no-useless-call": [ - "off", - ], "no-useless-catch": [ "error", ], @@ -1552,69 +912,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 +927,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 +957,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "prefer-exponentiation-operator": [ "error", ], - "prefer-named-capture-group": [ - "off", - ], "prefer-numeric-literals": [ "error", ], @@ -1706,9 +969,6 @@ exports[`resolved config matches snapshot > javascript.js 1`] = ` "allowEmptyReject": true, }, ], - "prefer-reflect": [ - "off", - ], "prefer-regex-literals": [ "error", { @@ -1724,186 +984,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", + "simple-import-sort/exports": [ + "error", ], - "react/jsx-curly-newline": [ - "off", + "simple-import-sort/imports": [ + "error", ], - "react/jsx-curly-spacing": [ - "off", + "symbol-description": [ + "error", ], - "react/jsx-equals-spacing": [ - "off", + "unicode-bom": [ + "error", + "never", ], - "react/jsx-first-prop-new-line": [ - "off", + "unicorn/prefer-node-protocol": [ + "error", ], - "react/jsx-indent": [ - "off", + "unicorn/text-encoding-identifier-case": [ + "error", ], - "react/jsx-indent-props": [ - "off", + "use-isnan": [ + "error", ], - "react/jsx-max-props-per-line": [ - "off", + "valid-typeof": [ + "error", + { + "requireStringLiterals": true, + }, ], - "react/jsx-newline": [ - "off", + "vars-on-top": [ + "error", ], - "react/jsx-one-expression-per-line": [ - "off", + "yoda": [ + "error", ], - "react/jsx-props-no-multi-spaces": [ - "off", + }, + "settings": { + "import/core-modules": [], + "import/extensions": [ + ".js", + ".mjs", + ".jsx", ], - "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", + "import/ignore": [ + "node_modules", + "\\.(coffee|scss|css|less|hbs|svg|json)$", ], - "semi-spacing": [ - "off", - { - "after": true, - "before": false, + "import/resolver": { + "node": { + "extensions": [ + ".mjs", + ".js", + ".json", + ], }, - ], - "semi-style": [ - "off", - "last", - ], - "simple-import-sort/exports": [ + "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": [ + "n", + "@stylistic/js", + "import", + "unicorn", + "simple-import-sort", + "@typescript-eslint", + "@rightcapital", + ], + "reportUnusedDisableDirectives": true, + "rules": { + "@rightcapital/no-explicit-type-on-function-component-identifier": [ "error", ], - "simple-import-sort/imports": [ + "@stylistic/js/lines-between-class-members": [ "error", + "always", ], - "sort-imports": [ - "off", - { - "ignoreCase": false, - "ignoreDeclarationSort": false, - "ignoreMemberSort": false, - "memberSyntaxSortOrder": [ - "none", - "all", - "multiple", - "single", - ], - }, - ], - "sort-keys": [ - "off", - "asc", + "@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,466 +1134,160 @@ 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", + "@typescript-eslint/no-unsafe-declaration-merging": [ + "error", ], - "vue/html-indent": [ - "off", + "@typescript-eslint/no-unsafe-enum-comparison": [ + "error", ], - "vue/html-quotes": [ - "off", + "@typescript-eslint/no-unsafe-member-access": [ + "error", ], - "vue/html-self-closing": [ - 0, + "@typescript-eslint/no-unsafe-return": [ + "error", ], - "vue/key-spacing": [ - "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_", + }, ], - "vue/keyword-spacing": [ - "off", + "@typescript-eslint/no-use-before-define": [ + "error", + { + "classes": false, + "functions": false, + "typedefs": false, + "variables": false, + }, ], - "vue/max-attributes-per-line": [ - "off", + "@typescript-eslint/no-useless-constructor": [ + "error", ], - "vue/max-len": [ - 0, + "@typescript-eslint/no-var-requires": [ + "error", ], - "vue/multiline-html-element-content-newline": [ - "off", + "@typescript-eslint/prefer-as-const": [ + "error", ], - "vue/multiline-ternary": [ - "off", + "@typescript-eslint/require-await": [ + "error", ], - "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", - ], - }, - "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": { - "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": [ - "error", - ], - "@typescript-eslint/await-thenable": [ - "error", - ], - "@typescript-eslint/ban-ts-comment": [ - "error", - ], - "@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", - { - "fixMixedExportsWithInlineTypeSpecifier": true, - }, - ], - "@typescript-eslint/consistent-type-imports": [ - "error", - { - "fixStyle": "inline-type-imports", - "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", - { - "custom": { - "match": true, - "regex": "^I[A-Z]", - }, - "format": [ - "PascalCase", - ], - "selector": "interface", - }, - ], - "@typescript-eslint/no-array-constructor": [ - "error", - ], - "@typescript-eslint/no-base-to-string": [ - "error", - ], - "@typescript-eslint/no-duplicate-enum-values": [ - "error", - ], - "@typescript-eslint/no-duplicate-type-constituents": [ - "error", - ], - "@typescript-eslint/no-empty-function": [ - "error", - ], - "@typescript-eslint/no-empty-interface": [ - "error", - ], - "@typescript-eslint/no-explicit-any": [ - "error", - ], - "@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", - ], - "@typescript-eslint/no-for-in-array": [ - "error", - ], - "@typescript-eslint/no-implied-eval": [ - "error", - ], - "@typescript-eslint/no-import-type-side-effects": [ - "error", - ], - "@typescript-eslint/no-loss-of-precision": [ - "error", - ], - "@typescript-eslint/no-misused-new": [ - "error", - ], - "@typescript-eslint/no-misused-promises": [ - "error", - ], - "@typescript-eslint/no-namespace": [ - "error", - ], - "@typescript-eslint/no-non-null-asserted-optional-chain": [ - "error", - ], - "@typescript-eslint/no-non-null-assertion": [ - "error", - ], - "@typescript-eslint/no-redundant-type-constituents": [ - "error", - ], - "@typescript-eslint/no-shadow": [ - "error", - ], - "@typescript-eslint/no-this-alias": [ - "error", - ], - "@typescript-eslint/no-unnecessary-type-assertion": [ - "error", - ], - "@typescript-eslint/no-unnecessary-type-constraint": [ - "error", - ], - "@typescript-eslint/no-unsafe-argument": [ - "error", - ], - "@typescript-eslint/no-unsafe-assignment": [ - "error", - ], - "@typescript-eslint/no-unsafe-call": [ - "error", - ], - "@typescript-eslint/no-unsafe-declaration-merging": [ - "error", - ], - "@typescript-eslint/no-unsafe-enum-comparison": [ - "error", - ], - "@typescript-eslint/no-unsafe-member-access": [ - "error", - ], - "@typescript-eslint/no-unsafe-return": [ - "error", - ], - "@typescript-eslint/no-unused-vars": [ - "error", - { - "argsIgnorePattern": "^_", - }, - ], - "@typescript-eslint/no-use-before-define": [ - "error", - { - "classes": false, - "functions": false, - "typedefs": false, - "variables": false, - }, - ], - "@typescript-eslint/no-useless-constructor": [ - "error", - ], - "@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", - ], - "@typescript-eslint/restrict-plus-operands": [ - "error", + "@typescript-eslint/restrict-plus-operands": [ + "error", ], "@typescript-eslint/restrict-template-expressions": [ "error", @@ -2405,38 +1300,12 @@ exports[`resolved config matches snapshot > typescript.ts 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", { @@ -2445,57 +1314,9 @@ exports[`resolved config matches snapshot > typescript.ts 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", { @@ -2505,79 +1326,9 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -2594,13 +1345,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "default-case-last": [ "error", ], - "default-param-last": [ - "off", - ], - "dot-location": [ - "off", - "property", - ], "dot-notation": [ "error", { @@ -2608,10 +1352,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "allowPattern": "", }, ], - "eol-last": [ - "off", - "always", - ], "eqeqeq": [ "error", "always", @@ -2619,113 +1359,24 @@ exports[`resolved config matches snapshot > typescript.ts 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", { @@ -2755,9 +1406,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "import/group-exports": [ "off", ], - "import/imports-first": [ - "off", - ], "import/max-dependencies": [ "off", { @@ -2767,18 +1415,12 @@ exports[`resolved config matches snapshot > typescript.ts 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", { @@ -2790,9 +1432,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "allowObject": false, }, ], - "import/no-commonjs": [ - "off", - ], "import/no-cycle": [ "error", { @@ -2804,9 +1443,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "import/no-default-export": [ "off", ], - "import/no-deprecated": [ - "off", - ], "import/no-duplicates": [ "error", { @@ -2825,9 +1461,9 @@ exports[`resolved config matches snapshot > typescript.ts 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", @@ -2841,7 +1477,8 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "**/protractor.conf.js", "**/protractor.conf.*.js", "**/karma.conf.js", - "**/.eslintrc.js", + "**/.eslintrc.{js,cjs}", + "**/eslint.config.{js,cjs,mjs}", ], "optionalDependencies": false, }, @@ -2873,12 +1510,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "import/no-named-export": [ "off", ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], "import/no-relative-packages": [ "error", ], @@ -2921,193 +1552,25 @@ exports[`resolved config matches snapshot > typescript.ts 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-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", @@ -3123,30 +1586,12 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -3171,9 +1616,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-class-assign": [ "error", ], - "no-comma-dangle": [ - "off", - ], "no-compare-neg-zero": [ "error", ], @@ -3181,13 +1623,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "error", "always", ], - "no-confusing-arrow": [ - 0, - { - "allowParens": true, - "onlyOneSimpleParam": false, - }, - ], "no-console": [ "warn", ], @@ -3212,9 +1647,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-delete-var": [ "error", ], - "no-div-regex": [ - "off", - ], "no-dupe-args": [ "off", ], @@ -3230,9 +1662,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-duplicate-case": [ "error", ], - "no-duplicate-imports": [ - "off", - ], "no-else-return": [ "error", { @@ -3258,9 +1687,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-empty-pattern": [ "error", ], - "no-eq-null": [ - "off", - ], "no-eval": [ "error", ], @@ -3279,26 +1705,9 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -3308,36 +1717,18 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -3366,103 +1757,15 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -3475,12 +1778,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-new-native-nonconstructor": [ "off", ], - "no-new-object": [ - "error", - ], - "no-new-require": [ - "error", - ], "no-new-symbol": [ "off", ], @@ -3493,6 +1790,9 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-obj-calls": [ "off", ], + "no-object-constructor": [ + "error", + ], "no-octal": [ "error", ], @@ -3518,18 +1818,9 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "props": true, }, ], - "no-path-concat": [ - "error", - ], "no-plusplus": [ "error", ], - "no-process-env": [ - "off", - ], - "no-process-exit": [ - "off", - ], "no-promise-executor-return": [ "error", ], @@ -3545,9 +1836,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-regex-spaces": [ "error", ], - "no-reserved-keys": [ - "off", - ], "no-restricted-exports": [ "error", { @@ -3626,16 +1914,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "toolbar", "top", ], - "no-restricted-imports": [ - "off", - { - "paths": [], - "patterns": [], - }, - ], - "no-restricted-modules": [ - "off", - ], "no-restricted-properties": [ "error", { @@ -3737,40 +2015,18 @@ exports[`resolved config matches snapshot > typescript.ts 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", ], @@ -3795,10 +2051,7 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` }, ], "no-unexpected-multiline": [ - 0, - ], - "no-unmodified-loop-condition": [ - "off", + "error", ], "no-unneeded-ternary": [ "error", @@ -3840,7 +2093,7 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "error", ], "no-unused-private-class-members": [ - "off", + "error", ], "no-unused-vars": [ "off", @@ -3861,9 +2114,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "no-useless-backreference": [ "error", ], - "no-useless-call": [ - "off", - ], "no-useless-catch": [ "error", ], @@ -3896,118 +2146,24 @@ exports[`resolved config matches snapshot > typescript.ts 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", - }, - { - "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", @@ -4035,9 +2191,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "prefer-exponentiation-operator": [ "error", ], - "prefer-named-capture-group": [ - "off", - ], "prefer-numeric-literals": [ "error", ], @@ -4050,9 +2203,6 @@ exports[`resolved config matches snapshot > typescript.ts 1`] = ` "allowEmptyReject": true, }, ], - "prefer-reflect": [ - "off", - ], "prefer-regex-literals": [ "error", { @@ -4068,412 +2218,45 @@ exports[`resolved config matches snapshot > typescript.ts 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", - ], - "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", - { - "requireStringLiterals": true, - }, - ], - "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", + "use-isnan": [ + "error", ], - "wrap-iife": [ - "off", - "outside", + "valid-typeof": [ + "error", { - "functionPrototypeMethods": false, + "requireStringLiterals": true, }, ], - "wrap-regex": [ - "off", - ], - "yield-star-spacing": [ - "off", - "after", + "vars-on-top": [ + "error", ], "yoda": [ "error", @@ -4514,26 +2297,27 @@ 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": [ + "n", + "@stylistic/js", "import", "unicorn", "simple-import-sort", @@ -4546,12 +2330,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,26 +2465,66 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "@rightcapital/no-ignore-return-value-of-react-hooks": [ "error", ], - "@typescript-eslint/await-thenable": [ + "@stylistic/js/lines-between-class-members": [ "error", + "always", ], - "@typescript-eslint/ban-ts-comment": [ + "@stylistic/js/padding-line-between-statements": [ "error", + { + "blankLine": "always", + "next": "*", + "prev": "directive", + }, + { + "blankLine": "always", + "next": "directive", + "prev": "*", + }, + { + "blankLine": "any", + "next": "directive", + "prev": "directive", + }, ], - "@typescript-eslint/ban-types": [ + "@stylistic/js/spaced-comment": [ "error", + "always", + { + "block": { + "balanced": true, + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + ":", + "::", + ], + }, + "line": { + "exceptions": [ + "-", + "+", + ], + "markers": [ + "=", + "!", + "/", + ], + }, + }, ], - "@typescript-eslint/block-spacing": [ - "off", - ], - "@typescript-eslint/brace-style": [ - "off", + "@typescript-eslint/await-thenable": [ + "error", ], - "@typescript-eslint/comma-dangle": [ - "off", + "@typescript-eslint/ban-ts-comment": [ + "error", ], - "@typescript-eslint/comma-spacing": [ - "off", + "@typescript-eslint/ban-types": [ + "error", ], "@typescript-eslint/consistent-type-exports": [ "error", @@ -4721,24 +2539,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 +2576,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 +2663,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 +2683,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 +2697,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 +2709,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 +2728,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 +2735,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowPattern": "", }, ], - "eol-last": [ - "off", - "always", - ], "eqeqeq": [ "error", "always", @@ -5109,113 +2742,24 @@ 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", { @@ -5245,9 +2789,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/group-exports": [ "off", ], - "import/imports-first": [ - "off", - ], "import/max-dependencies": [ "off", { @@ -5257,18 +2798,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", { @@ -5280,9 +2815,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowObject": false, }, ], - "import/no-commonjs": [ - "off", - ], "import/no-cycle": [ "error", { @@ -5294,9 +2826,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/no-default-export": [ "off", ], - "import/no-deprecated": [ - "off", - ], "import/no-duplicates": [ "error", { @@ -5315,9 +2844,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 +2860,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, }, @@ -5363,12 +2893,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "import/no-named-export": [ "off", ], - "import/no-namespace": [ - "off", - ], - "import/no-nodejs-modules": [ - "off", - ], "import/no-relative-packages": [ "error", ], @@ -5411,75 +2935,11 @@ 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": [ + "init-declarations": [ "off", ], "jsx-a11y/alt-text": [ @@ -5503,22 +2963,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "components": [], }, ], - "jsx-a11y/anchor-is-valid": [ - "off", - { - "aspects": [ - "noHref", - "invalidHref", - "preferButton", - ], - "components": [ - "Link", - ], - "specialLink": [ - "to", - ], - }, - ], "jsx-a11y/aria-activedescendant-has-tabindex": [ "error", ], @@ -5537,15 +2981,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 +3042,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 +3141,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "tags": [], }, ], - "jsx-a11y/no-onchange": [ - "off", - ], "jsx-a11y/no-redundant-roles": [ "error", ], @@ -5750,125 +3169,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 +3196,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", ], @@ -5932,9 +3226,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-class-assign": [ "error", ], - "no-comma-dangle": [ - "off", - ], "no-compare-neg-zero": [ "error", ], @@ -5942,13 +3233,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 +3257,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-delete-var": [ "error", ], - "no-div-regex": [ - "off", - ], "no-dupe-args": [ "off", ], @@ -5991,9 +3272,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-duplicate-case": [ "error", ], - "no-duplicate-imports": [ - "off", - ], "no-else-return": [ "error", { @@ -6019,9 +3297,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-empty-pattern": [ "error", ], - "no-eq-null": [ - "off", - ], "no-eval": [ "error", ], @@ -6040,26 +3315,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 +3327,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 +3367,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 +3388,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 +3400,9 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-obj-calls": [ "off", ], + "no-object-constructor": [ + "error", + ], "no-octal": [ "error", ], @@ -6279,18 +3428,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 +3446,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-regex-spaces": [ "error", ], - "no-reserved-keys": [ - "off", - ], "no-restricted-exports": [ "error", { @@ -6387,16 +3524,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,40 +3625,18 @@ 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", ], @@ -6556,10 +3661,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 +3703,7 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "error", ], "no-unused-private-class-members": [ - "off", + "error", ], "no-unused-vars": [ "off", @@ -6622,9 +3724,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "no-useless-backreference": [ "error", ], - "no-useless-call": [ - "off", - ], "no-useless-catch": [ "error", ], @@ -6657,118 +3756,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 +3801,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 +3813,6 @@ exports[`resolved config matches snapshot > typescript-react.tsx 1`] = ` "allowEmptyReject": true, }, ], - "prefer-reflect": [ - "off", - ], "prefer-regex-literals": [ "error", { @@ -6829,22 +3828,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 +3837,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 +3874,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"] }