diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 3d5e598e27..0000000000 --- a/.eslintignore +++ /dev/null @@ -1,19 +0,0 @@ -!.* -**/coverage/** -**/node_modules/** -bin/ -packages/*/build/** -packages/*/dist/** -website/.docusaurus -website/build -website/node_modules -website/i18n/*.js -website/static - -# Third-party script -packages/jest-diff/src/cleanupSemantic.ts -e2e/native-esm/wasm-bindgen/index_bg.js - -**/.yarn -**/.pnp.* - diff --git a/.eslintplugin/index.js b/.eslintplugin/index.js deleted file mode 100644 index fa90db7d42..0000000000 --- a/.eslintplugin/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -exports.rules = { - 'ban-types-eventually': require('@typescript-eslint/eslint-plugin').rules[ - 'ban-types' - ], - 'prefer-rest-params-eventually': - require('eslint/use-at-your-own-risk').builtinRules.get( - 'prefer-rest-params', - ), - 'prefer-spread-eventually': - require('eslint/use-at-your-own-risk').builtinRules.get('prefer-spread'), -}; diff --git a/.eslintplugin/index.mjs b/.eslintplugin/index.mjs new file mode 100644 index 0000000000..4caa613bb2 --- /dev/null +++ b/.eslintplugin/index.mjs @@ -0,0 +1,18 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import {builtinRules} from 'eslint/use-at-your-own-risk'; +import typescriptEslint from 'typescript-eslint'; + +const rules = { + 'no-restricted-types-eventually': + typescriptEslint.plugin.rules['no-restricted-types'], + 'prefer-rest-params-eventually': builtinRules.get('prefer-rest-params'), + 'prefer-spread-eventually': builtinRules.get('prefer-spread'), +}; + +export default {rules}; diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 7651d317e9..0000000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,734 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -/* eslint-disable sort-keys */ - -const fs = require('fs'); -const path = require('path'); -const {sync: readPkg} = require('read-pkg'); - -function getPackages() { - const PACKAGES_DIR = path.resolve(__dirname, 'packages'); - const packages = fs - .readdirSync(PACKAGES_DIR) - .map(file => path.resolve(PACKAGES_DIR, file)) - .filter(f => fs.lstatSync(path.resolve(f)).isDirectory()) - .filter(f => fs.existsSync(path.join(path.resolve(f), 'package.json'))); - return packages.map(packageDir => { - const pkg = readPkg({cwd: packageDir}); - return pkg.name; - }); -} - -module.exports = { - env: { - es2020: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:markdown/recommended', - 'plugin:import/errors', - 'plugin:@eslint-community/eslint-comments/recommended', - 'plugin:unicorn/recommended', - 'plugin:promise/recommended', - 'plugin:prettier/recommended', - ], - globals: { - console: 'readonly', - }, - overrides: [ - { - extends: [ - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:@typescript-eslint/strict', - 'plugin:@typescript-eslint/stylistic', - 'plugin:import/typescript', - ], - files: ['*.ts', '*.tsx'], - plugins: ['@typescript-eslint/eslint-plugin', 'local'], - rules: { - '@typescript-eslint/array-type': ['error', {default: 'generic'}], - '@typescript-eslint/ban-types': 'error', - '@typescript-eslint/consistent-type-imports': [ - 'error', - {fixStyle: 'inline-type-imports', disallowTypeAnnotations: false}, - ], - '@typescript-eslint/no-import-type-side-effects': 'error', - '@typescript-eslint/no-inferrable-types': 'error', - '@typescript-eslint/no-unused-vars': [ - 'error', - {argsIgnorePattern: '^_'}, - ], - '@typescript-eslint/prefer-ts-expect-error': 'error', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/consistent-indexed-object-style': 'off', - // TS verifies these - 'consistent-return': 'off', - 'no-dupe-class-members': 'off', - 'no-unused-vars': 'off', - '@typescript-eslint/no-dynamic-delete': 'off', - // TODO: enable at some point - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-invalid-void-type': 'off', - '@typescript-eslint/consistent-type-definitions': 'off', - - // not needed to be enforced for TS - 'import/namespace': 'off', - }, - }, - { - files: [ - 'packages/jest-mock/src/__tests__/index.test.ts', - 'packages/jest-mock/src/index.ts', - 'packages/pretty-format/src/__tests__/Immutable.test.ts', - 'packages/pretty-format/src/__tests__/prettyFormat.test.ts', - ], - rules: { - 'local/prefer-rest-params-eventually': 'warn', - 'prefer-rest-params': 'off', - }, - }, - { - files: [ - 'packages/expect/src/index.ts', - 'packages/jest-fake-timers/src/legacyFakeTimers.ts', - 'packages/jest-jasmine2/src/jestExpect.ts', - ], - rules: { - 'local/prefer-spread-eventually': 'warn', - 'prefer-spread': 'off', - }, - }, - { - files: [ - 'e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts', - 'e2e/coverage-remapping/covered.ts', - 'packages/expect/src/matchers.ts', - 'packages/expect/src/print.ts', - 'packages/expect/src/toThrowMatchers.ts', - 'packages/expect-utils/src/utils.ts', - 'packages/jest-core/src/collectHandles.ts', - 'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts', - 'packages/jest-leak-detector/src/index.ts', - 'packages/jest-matcher-utils/src/index.ts', - 'packages/jest-mock/src/__tests__/index.test.ts', - 'packages/jest-mock/src/index.ts', - 'packages/jest-snapshot/src/index.ts', - 'packages/jest-snapshot/src/printSnapshot.ts', - 'packages/jest-snapshot/src/types.ts', - 'packages/jest-util/src/convertDescriptorToString.ts', - 'packages/pretty-format/src/index.ts', - 'packages/pretty-format/src/plugins/DOMCollection.ts', - ], - rules: { - '@typescript-eslint/ban-types': [ - 'error', - // TODO: remove these overrides: https://github.com/jestjs/jest/issues/10177 - {types: {Function: false, object: false, '{}': false}}, - ], - 'local/ban-types-eventually': [ - 'warn', - { - types: { - // none of these types are in use, so can be errored on - Boolean: false, - Number: false, - Object: false, - String: false, - Symbol: false, - }, - }, - ], - }, - }, - { - files: 'e2e/coverage-remapping/covered.ts', - rules: { - 'no-constant-binary-expression': 'off', - 'no-constant-condition': 'off', - }, - }, - - // 'eslint-plugin-jest' rules for test and test related files - { - files: [ - '**/__mocks__/**', - '**/__tests__/**', - '**/*.md/**', - '**/*.test.*', - 'e2e/babel-plugin-jest-hoist/mockFile.js', - 'e2e/failures/macros.js', - 'e2e/test-in-root/*.js', - 'e2e/test-match/test-suites/*', - 'e2e/test-match-default/dot-spec-tests/*', - 'packages/test-utils/src/ConditionalTest.ts', - ], - env: {'jest/globals': true}, - excludedFiles: ['**/__typetests__/**'], - extends: ['plugin:jest/style'], - plugins: ['jest'], - rules: { - 'jest/no-alias-methods': 'error', - 'jest/no-focused-tests': 'error', - 'jest/no-identical-title': 'error', - 'jest/require-to-throw-message': 'error', - 'jest/valid-expect': 'error', - }, - }, - - { - files: ['e2e/__tests__/*'], - rules: { - 'jest/no-restricted-jest-methods': [ - 'error', - { - fn: 'Please use fixtures instead of mocks in the end-to-end tests.', - mock: 'Please use fixtures instead of mocks in the end-to-end tests.', - doMock: - 'Please use fixtures instead of mocks in the end-to-end tests.', - setMock: - 'Please use fixtures instead of mocks in the end-to-end tests.', - spyOn: - 'Please use fixtures instead of mocks in the end-to-end tests.', - }, - ], - }, - }, - - // to make it more suitable for running on code examples in docs/ folder - { - files: ['**/*.md/**'], - rules: { - '@typescript-eslint/no-unused-vars': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-namespace': 'off', - '@typescript-eslint/no-empty-interface': 'off', - 'consistent-return': 'off', - 'import/export': 'off', - 'import/no-extraneous-dependencies': 'off', - 'import/no-unresolved': 'off', - 'jest/no-focused-tests': 'off', - 'jest/require-to-throw-message': 'off', - 'no-console': 'off', - 'no-constant-condition': 'off', - 'no-undef': 'off', - 'no-unused-vars': 'off', - 'sort-keys': 'off', - 'unicorn/consistent-function-scoping': 'off', - 'unicorn/error-message': 'off', - 'unicorn/no-anonymous-default-export': 'off', - 'unicorn/no-await-expression-member': 'off', - 'unicorn/no-static-only-class': 'off', - 'unicorn/prefer-number-properties': 'off', - 'unicorn/prefer-string-raw': 'off', - 'unicorn/prefer-global-this': 'off', - }, - }, - // demonstration of matchers usage - { - files: ['**/UsingMatchers.md/**'], - rules: { - 'jest/prefer-to-be': 'off', - }, - }, - // demonstration of 'jest/valid-expect' rule - { - files: [ - '**/2017-05-06-jest-20-delightful-testing-multi-project-runner.md/**', - ], - rules: { - 'jest/valid-expect': 'off', - }, - }, - // Jest 11 did not had `toHaveLength` matcher - { - files: ['**/2016-04-12-jest-11.md/**'], - rules: { - 'jest/prefer-to-have-length': 'off', - }, - }, - // snapshot in an example needs to keep escapes - { - files: [ - '**/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md/**', - ], - rules: { - 'no-useless-escape': 'off', - }, - }, - - // snapshots in examples plus inline snapshots need to keep backtick - { - files: ['**/*.md/**', 'e2e/custom-inline-snapshot-matchers/__tests__/*'], - rules: { - quotes: [ - 'error', - 'single', - {allowTemplateLiterals: true, avoidEscape: true}, - ], - }, - }, - { - files: ['docs/**/*', 'website/**/*'], - rules: { - 'no-redeclare': 'off', - 'import/order': 'off', - 'import/sort-keys': 'off', - 'no-restricted-globals': ['off'], - 'sort-keys': 'off', - }, - }, - { - files: ['examples/**/*'], - rules: { - 'no-restricted-imports': 'off', - }, - }, - { - files: ['examples/angular/**/*'], - rules: { - // Angular DI for some reason doesn't work with type imports - '@typescript-eslint/consistent-type-imports': [ - 'error', - {prefer: 'no-type-imports', disallowTypeAnnotations: false}, - ], - }, - }, - { - files: 'packages/**/*.ts', - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'error', - 'import/no-anonymous-default-export': [ - 'error', - { - allowAnonymousClass: false, - allowAnonymousFunction: false, - allowArray: false, - allowArrowFunction: false, - allowCallExpression: false, - allowLiteral: false, - allowObject: true, - }, - ], - }, - }, - { - files: ['**/__tests__/**', '**/__mocks__/**'], - rules: { - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/class-literal-property-style': 'off', - }, - }, - { - files: [ - '**/__tests__/**', - '**/__mocks__/**', - 'packages/jest-jasmine2/src/jasmine/**/*', - 'packages/expect/src/jasmineUtils.ts', - '**/vendor/**/*', - ], - rules: { - '@typescript-eslint/explicit-module-boundary-types': 'off', - 'unicorn/consistent-function-scoping': 'off', - 'unicorn/no-await-expression-member': 'off', - 'unicorn/prefer-spread': 'off', - 'unicorn/prefer-string-raw': 'off', - }, - }, - { - files: [ - 'packages/jest-jasmine2/src/jasmine/**/*', - 'packages/expect-utils/src/jasmineUtils.ts', - ], - rules: { - '@typescript-eslint/ban-types': 'off', - '@eslint-community/eslint-comments/disable-enable-pair': 'off', - '@eslint-community/eslint-comments/no-unlimited-disable': 'off', - 'prefer-rest-params': 'off', - 'prefer-spread': 'off', - 'sort-keys ': 'off', - }, - }, - { - files: [ - 'e2e/error-on-deprecated/__tests__/*', - 'e2e/jasmine-async/__tests__/*', - ], - globals: { - fail: 'readonly', - jasmine: 'readonly', - pending: 'readonly', - }, - }, - { - files: [ - 'e2e/**', - 'website/**', - '**/__benchmarks__/**', - '**/__tests__/**', - '**/__typetests__/**', - '.eslintplugin/**', - ], - rules: { - 'import/no-extraneous-dependencies': 'off', - 'unicorn/consistent-function-scoping': 'off', - 'unicorn/error-message': 'off', - }, - }, - { - files: ['**/__typetests__/**'], - rules: { - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-invalid-void-type': 'off', - '@typescript-eslint/no-useless-constructor': 'off', - }, - }, - { - env: {node: true}, - files: ['*.js', '*.jsx', '*.mjs', '*.cjs'], - }, - { - files: [ - 'scripts/*', - 'packages/*/__benchmarks__/test.js', - 'packages/create-jest/src/runCreate.ts', - 'packages/jest-repl/src/cli/runtime-cli.ts', - ], - rules: { - 'no-console': 'off', - }, - }, - { - files: [ - 'e2e/**', - 'examples/**', - 'website/**', - '**/__benchmarks__/**', - '**/__mocks__/**', - '**/__tests__/**', - '**/__typetests__/**', - ], - rules: { - '@typescript-eslint/no-extraneous-class': 'off', - '@typescript-eslint/no-unused-vars': 'off', - 'import/no-unresolved': 'off', - 'no-console': 'off', - 'no-unused-vars': 'off', - 'unicorn/no-anonymous-default-export': 'off', - }, - }, - { - files: 'scripts/**/*', - rules: { - 'unicorn/no-anonymous-default-export': 'off', - }, - }, - { - files: 'packages/jest-mock/src/__tests__/**/*', - rules: { - 'unicorn/no-static-only-class': 'off', - }, - }, - { - files: '**/*.mjs', - rules: { - 'unicorn/prefer-top-level-await': 'error', - }, - }, - { - files: [ - 'e2e/coverage-report/__mocks__/sumDependency.js', - 'e2e/require-main-after-create-require/empty.js', - 'packages/create-jest/src/__tests__/__fixtures__/**/*', - 'packages/jest-core/src/__tests__/**/*', - 'packages/jest-haste-map/src/__tests__/test_dotfiles_root/**/*', - 'packages/jest-resolve/src/__mocks__/**/*', - ], - rules: { - 'unicorn/no-empty-file': 'off', - }, - }, - { - files: 'packages/expect/src/__tests__/*.test.js', - rules: { - 'unicorn/prefer-number-properties': 'off', - }, - }, - ], - parser: '@typescript-eslint/parser', - parserOptions: { - sourceType: 'module', - }, - plugins: ['import', 'jsdoc'], - rules: { - 'accessor-pairs': ['warn', {setWithoutGet: true}], - 'block-scoped-var': 'off', - 'callback-return': 'off', - camelcase: ['off', {properties: 'always'}], - complexity: 'off', - 'consistent-return': 'warn', - 'consistent-this': ['off', 'self'], - 'constructor-super': 'error', - 'default-case': 'off', - 'dot-notation': 'off', - eqeqeq: ['error', 'smart'], - '@eslint-community/eslint-comments/disable-enable-pair': [ - 'error', - {allowWholeFile: true}, - ], - '@eslint-community/eslint-comments/no-unused-disable': 'error', - 'func-names': 'off', - 'func-style': ['off', 'declaration'], - 'global-require': 'off', - 'guard-for-in': 'off', - 'handle-callback-err': 'off', - 'id-length': 'off', - 'id-match': 'off', - 'import/no-duplicates': 'error', - 'import/no-extraneous-dependencies': [ - 'error', - { - devDependencies: [ - '**/__mocks__/**', - '**/__tests__/**', - '**/__typetests__/**', - '**/?(*.)(spec|test).js?(x)', - 'scripts/**', - 'babel.config.js', - 'testSetupFile.js', - '.eslintrc.cjs', - ], - }, - ], - 'import/no-unresolved': ['error', {ignore: ['fsevents']}], - 'import/order': [ - 'error', - { - alphabetize: { - order: 'asc', - }, - // this is the default order except for added `internal` in the middle - groups: [ - 'builtin', - 'external', - 'internal', - 'parent', - 'sibling', - 'index', - ], - 'newlines-between': 'never', - }, - ], - 'init-declarations': 'off', - 'jsdoc/check-alignment': 'error', - 'lines-around-comment': 'off', - 'max-depth': 'off', - 'max-nested-callbacks': 'off', - 'max-params': 'off', - 'max-statements': 'off', - 'new-cap': 'off', - 'new-parens': 'error', - 'newline-after-var': 'off', - 'no-alert': 'off', - 'no-array-constructor': 'error', - 'no-bitwise': 'warn', - 'no-caller': 'error', - 'no-case-declarations': 'off', - 'no-class-assign': 'warn', - 'no-cond-assign': 'off', - 'no-confusing-arrow': 'off', - 'no-console': [ - 'warn', - {allow: ['warn', 'error', 'time', 'timeEnd', 'timeStamp']}, - ], - 'no-const-assign': 'error', - 'no-constant-condition': 'error', - 'no-constant-binary-expression': 'error', - 'no-continue': 'off', - 'no-control-regex': 'off', - 'no-debugger': 'error', - 'no-delete-var': 'error', - 'no-div-regex': 'off', - 'no-dupe-args': 'error', - 'no-dupe-class-members': 'error', - 'no-dupe-keys': 'error', - 'no-duplicate-case': 'error', - 'no-duplicate-imports': 'error', - 'no-else-return': 'off', - 'no-empty': 'off', - 'no-empty-character-class': 'warn', - 'no-empty-pattern': 'warn', - 'no-eq-null': 'off', - 'no-eval': 'error', - 'no-ex-assign': 'warn', - 'no-extend-native': 'warn', - 'no-extra-bind': 'warn', - 'no-extra-boolean-cast': 'warn', - 'no-fallthrough': 'warn', - 'no-floating-decimal': 'error', - 'no-func-assign': 'error', - 'no-implicit-coercion': 'off', - 'no-implied-eval': 'error', - 'no-inline-comments': 'off', - 'no-inner-declarations': 'off', - 'no-invalid-regexp': 'warn', - 'no-invalid-this': 'off', - 'no-irregular-whitespace': 'error', - 'no-iterator': 'off', - 'no-label-var': 'warn', - 'no-labels': ['error', {allowLoop: true, allowSwitch: true}], - 'no-lonely-if': 'off', - 'no-loop-func': 'off', - 'no-magic-numbers': 'off', - 'no-mixed-requires': 'off', - 'no-mixed-spaces-and-tabs': 'error', - 'no-multi-str': 'error', - 'no-multiple-empty-lines': 'off', - 'no-native-reassign': ['error', {exceptions: ['Map', 'Set']}], - 'no-negated-in-lhs': 'error', - 'no-new': 'warn', - 'no-new-func': 'error', - 'no-new-object': 'warn', - 'no-new-require': 'off', - 'no-new-wrappers': 'warn', - 'no-obj-calls': 'error', - 'no-octal': 'warn', - 'no-octal-escape': 'warn', - 'no-param-reassign': 'off', - 'no-plusplus': 'off', - 'no-process-env': 'off', - 'no-process-exit': 'off', - 'no-proto': 'error', - 'no-prototype-builtins': 'error', - 'no-redeclare': 'warn', - 'no-regex-spaces': 'warn', - 'no-restricted-globals': [ - 'error', - {message: 'Use `globalThis` instead.', name: 'global'}, - ], - 'no-restricted-imports': [ - 'error', - {message: 'Please use graceful-fs instead.', name: 'fs'}, - ], - 'no-restricted-modules': 'off', - 'no-restricted-syntax': 'off', - 'no-return-assign': 'off', - 'no-script-url': 'error', - 'no-self-compare': 'warn', - 'no-sequences': 'warn', - 'no-shadow': 'off', - 'no-shadow-restricted-names': 'warn', - 'no-sparse-arrays': 'error', - 'no-sync': 'off', - 'no-ternary': 'off', - 'no-this-before-super': 'error', - 'no-throw-literal': 'error', - 'no-undef': 'error', - 'no-undef-init': 'off', - 'no-undefined': 'off', - 'no-underscore-dangle': 'off', - 'no-unneeded-ternary': 'warn', - 'no-unreachable': 'error', - 'no-unused-expressions': 'off', - 'no-unused-vars': ['error', {argsIgnorePattern: '^_'}], - 'no-use-before-define': 'off', - 'no-useless-call': 'error', - 'no-useless-computed-key': 'error', - 'no-useless-concat': 'error', - 'no-var': 'error', - 'no-void': 'off', - 'no-warn-comments': 'off', - 'no-with': 'off', - 'object-shorthand': 'error', - 'one-var': ['warn', {initialized: 'never'}], - 'operator-assignment': ['warn', 'always'], - 'operator-linebreak': 'off', - 'padded-blocks': 'off', - 'prefer-arrow-callback': ['error', {allowNamedFunctions: true}], - 'prefer-const': 'error', - 'prefer-template': 'error', - - 'promise/always-return': 'off', - 'promise/catch-or-return': 'off', - 'promise/no-callback-in-promise': 'off', - - quotes: [ - 'error', - 'single', - {allowTemplateLiterals: false, avoidEscape: true}, - ], - radix: 'warn', - 'require-jsdoc': 'off', - 'require-yield': 'off', - 'sort-imports': ['error', {ignoreDeclarationSort: true}], - 'sort-keys': 'error', - 'sort-vars': 'off', - 'spaced-comment': ['off', 'always', {exceptions: ['eslint', 'global']}], - strict: 'off', - 'use-isnan': 'error', - 'valid-jsdoc': 'off', - 'valid-typeof': 'error', - 'vars-on-top': 'off', - 'wrap-iife': 'off', - 'wrap-regex': 'off', - yoda: 'off', - - // doesn't work without ESModuleInterop - 'unicorn/import-style': 'off', - // we're a CJS project - 'unicorn/prefer-module': 'off', - - // enforced by `@typescript-eslint/no-this-alias` already - 'unicorn/no-this-assignment': 'off', - - // Not an issue with TypeScript - 'unicorn/no-array-callback-reference': 'off', - - // reduce is fine - 'unicorn/no-array-reduce': 'off', - - // this is very aggressive (600+ files changed). might make sense to apply bit by bit over time? - 'unicorn/prevent-abbreviations': 'off', - - // nah - 'unicorn/consistent-destructuring': 'off', - 'unicorn/no-lonely-if': 'off', - 'unicorn/no-null': 'off', - 'unicorn/no-process-exit': 'off', - 'unicorn/no-useless-undefined': 'off', - 'unicorn/prefer-event-target': 'off', - 'unicorn/prefer-switch': 'off', - 'unicorn/prefer-ternary': 'off', - 'unicorn/prefer-top-level-await': 'off', - 'unicorn/switch-case-braces': 'off', - - // TODO: decide whether or not we want these - 'unicorn/filename-case': 'off', - 'unicorn/prefer-reflect-apply': 'off', - 'unicorn/prefer-string-raw': 'off', - 'unicorn/prefer-structured-clone': 'off', - - // enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780 - 'unicorn/prefer-export-from': 'off', - // enabling this is blocked by https://github.com/jestjs/jest/pull/14297 - 'unicorn/prefer-node-protocol': 'off', - }, - settings: { - 'import/ignore': ['react-native'], - // using `new RegExp` makes sure to escape `/` - 'import/internal-regex': new RegExp( - getPackages() - .map(pkg => `^${pkg}$`) - .join('|'), - ).source, - 'import/resolver': { - typescript: {}, - }, - }, -}; diff --git a/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap b/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap index 39c4e0d779..dde24987cd 100644 --- a/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap +++ b/e2e/__tests__/__snapshots__/coverageRemapping.test.ts.snap @@ -27,32 +27,32 @@ Object { "loc": Object { "end": Object { "column": 39, - "line": 11, + "line": 9, }, "start": Object { "column": 27, - "line": 11, + "line": 9, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 11, + "line": 9, }, "start": Object { "column": 34, - "line": 11, + "line": 9, }, }, Object { "end": Object { "column": 39, - "line": 11, + "line": 9, }, "start": Object { "column": 38, - "line": 11, + "line": 9, }, }, ], @@ -62,32 +62,32 @@ Object { "loc": Object { "end": Object { "column": 39, - "line": 12, + "line": 10, }, "start": Object { "column": 27, - "line": 12, + "line": 10, }, }, "locations": Array [ Object { "end": Object { "column": 35, - "line": 12, + "line": 10, }, "start": Object { "column": 34, - "line": 12, + "line": 10, }, }, Object { "end": Object { "column": 39, - "line": 12, + "line": 10, }, "start": Object { "column": 38, - "line": 12, + "line": 10, }, }, ], @@ -97,42 +97,42 @@ Object { "loc": Object { "end": Object { "column": 48, - "line": 13, + "line": 11, }, "start": Object { "column": 27, - "line": 13, + "line": 11, }, }, "locations": Array [ Object { "end": Object { "column": 31, - "line": 13, + "line": 11, }, "start": Object { "column": 27, - "line": 13, + "line": 11, }, }, Object { "end": Object { "column": 39, - "line": 13, + "line": 11, }, "start": Object { "column": 35, - "line": 13, + "line": 11, }, }, Object { "end": Object { "column": 48, - "line": 13, + "line": 11, }, "start": Object { "column": 43, - "line": 13, + "line": 11, }, }, ], @@ -142,32 +142,32 @@ Object { "loc": Object { "end": Object { "column": 53, - "line": 14, + "line": 12, }, "start": Object { "column": 23, - "line": 14, + "line": 12, }, }, "locations": Array [ Object { "end": Object { "column": 40, - "line": 14, + "line": 12, }, "start": Object { "column": 30, - "line": 14, + "line": 12, }, }, Object { "end": Object { "column": 53, - "line": 14, + "line": 12, }, "start": Object { "column": 43, - "line": 14, + "line": 12, }, }, ], @@ -184,21 +184,21 @@ Object { "decl": Object { "end": Object { "column": 26, - "line": 10, + "line": 8, }, "start": Object { "column": 16, - "line": 10, + "line": 8, }, }, "loc": Object { "end": Object { "column": 1, - "line": 17, + "line": 15, }, "start": Object { "column": 47, - "line": 10, + "line": 8, }, }, "name": "difference", @@ -207,21 +207,21 @@ Object { "decl": Object { "end": Object { "column": 36, - "line": 14, + "line": 12, }, "start": Object { "column": 30, - "line": 14, + "line": 12, }, }, "loc": Object { "end": Object { "column": 40, - "line": 14, + "line": 12, }, "start": Object { "column": 30, - "line": 14, + "line": 12, }, }, "name": "(anonymous_1)", @@ -230,21 +230,21 @@ Object { "decl": Object { "end": Object { "column": 49, - "line": 14, + "line": 12, }, "start": Object { "column": 43, - "line": 14, + "line": 12, }, }, "loc": Object { "end": Object { "column": 53, - "line": 14, + "line": 12, }, "start": Object { "column": 43, - "line": 14, + "line": 12, }, }, "name": "(anonymous_2)", @@ -265,81 +265,81 @@ Object { "0": Object { "end": Object { "column": 16, - "line": 10, + "line": 8, }, "start": Object { "column": 0, - "line": 10, + "line": 8, }, }, "1": Object { "end": Object { "column": 39, - "line": 11, + "line": 9, }, "start": Object { "column": 27, - "line": 11, + "line": 9, }, }, "2": Object { "end": Object { "column": 39, - "line": 12, + "line": 10, }, "start": Object { "column": 27, - "line": 12, + "line": 10, }, }, "3": Object { "end": Object { "column": 48, - "line": 13, + "line": 11, }, "start": Object { "column": 27, - "line": 13, + "line": 11, }, }, "4": Object { "end": Object { "column": 53, - "line": 14, + "line": 12, }, "start": Object { "column": 23, - "line": 14, + "line": 12, }, }, "5": Object { "end": Object { "column": 41, - "line": 14, + "line": 12, }, "start": Object { "column": 36, - "line": 14, + "line": 12, }, }, "6": Object { "end": Object { "column": 54, - "line": 14, + "line": 12, }, "start": Object { "column": 49, - "line": 14, + "line": 12, }, }, "7": Object { "end": Object { "column": 15, - "line": 16, + "line": 14, }, "start": Object { "column": 2, - "line": 16, + "line": 14, }, }, }, diff --git a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap index 92b214d76d..19bec39f95 100644 --- a/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap +++ b/e2e/__tests__/__snapshots__/moduleNameMapper.test.ts.snap @@ -41,7 +41,7 @@ exports[`moduleNameMapper wrong array configuration 1`] = ` 12 | module.exports = () => 'test'; 13 | - at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1184:17) + at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1182:17) at Object.require (index.js:10:1) at Object.require (__tests__/index.js:10:20)" `; @@ -71,7 +71,7 @@ exports[`moduleNameMapper wrong configuration 1`] = ` 12 | module.exports = () => 'test'; 13 | - at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1184:17) + at createNoMappedModuleFoundError (../../packages/jest-resolve/build/index.js:1182:17) at Object.require (index.js:10:1) at Object.require (__tests__/index.js:10:20)" `; diff --git a/e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap b/e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap index 12ed22b1f0..f9d27cdf9b 100644 --- a/e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap +++ b/e2e/__tests__/__snapshots__/requireMissingExt.test.ts.snap @@ -26,7 +26,7 @@ exports[`shows a proper error from deep requires 1`] = ` 12 | test('dummy', () => { 13 | expect(1).toBe(1); - at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:937:11) + at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:935:11) at Object. (node_modules/discord.js/src/index.js:21:12) at Object.require (__tests__/test.js:10:1)" `; diff --git a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap index 959ff25f30..699128c0e5 100644 --- a/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap +++ b/e2e/__tests__/__snapshots__/resolveNoFileExtensions.test.ts.snap @@ -37,7 +37,7 @@ exports[`show error message with matching files 1`] = ` | ^ 9 | - at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:937:11) + at Resolver._throwModNotFoundError (../../packages/jest-resolve/build/index.js:935:11) at Object.require (index.js:8:18) at Object.require (__tests__/test.js:8:11)" `; diff --git a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap index 456c38ef13..8fe08b6429 100644 --- a/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap +++ b/e2e/__tests__/__snapshots__/wrongEnv.test.ts.snap @@ -103,7 +103,7 @@ exports[`Wrong globals for environment print useful error when it explodes durin ReferenceError: document is not defined - 11 | /* eslint-env browser */ + 11 | /* global document */ 12 | > 13 | const div = document.createElement('div'); | ^ diff --git a/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts b/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts index 64d7cec8c0..329ae870da 100644 --- a/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts +++ b/e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts @@ -6,11 +6,10 @@ * */ -/* eslint-disable local/ban-types-eventually */ - import {color} from '../entry'; import type {Color} from '../types'; +// eslint-disable-next-line @typescript-eslint/no-empty-object-type jest.mock('some-module', () => ({}) as Partial<{}>, {virtual: true}); jest.mock('../entry', () => { diff --git a/e2e/browser-resolver/__tests__/test.js b/e2e/browser-resolver/__tests__/test.js index 8eb8033161..21eae59819 100644 --- a/e2e/browser-resolver/__tests__/test.js +++ b/e2e/browser-resolver/__tests__/test.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-env browser */ +/* global HTMLDivElement */ 'use strict'; diff --git a/e2e/browser-resolver/fake-pkg/main.js b/e2e/browser-resolver/fake-pkg/main.js index adf4db27d9..f86aa39ba2 100644 --- a/e2e/browser-resolver/fake-pkg/main.js +++ b/e2e/browser-resolver/fake-pkg/main.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-env browser */ +/* global document */ 'use strict'; diff --git a/e2e/console-jsdom/__tests__/console.test.js b/e2e/console-jsdom/__tests__/console.test.js index 65fdf871cd..19ef4c9757 100644 --- a/e2e/console-jsdom/__tests__/console.test.js +++ b/e2e/console-jsdom/__tests__/console.test.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -/* eslint-env browser */ +/* global document */ 'use strict'; beforeEach(() => { diff --git a/e2e/coverage-provider-v8/empty-sourcemap/types.ts b/e2e/coverage-provider-v8/empty-sourcemap/types.ts index 6da19728c9..8b988c96cc 100644 --- a/e2e/coverage-provider-v8/empty-sourcemap/types.ts +++ b/e2e/coverage-provider-v8/empty-sourcemap/types.ts @@ -5,5 +5,5 @@ * LICENSE file in the root directory of this source tree. */ -// eslint-disable-next-line @typescript-eslint/no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-object-type export interface obj {} diff --git a/e2e/coverage-remapping/covered.ts b/e2e/coverage-remapping/covered.ts index 0b2ccad01d..ff5dc098fa 100644 --- a/e2e/coverage-remapping/covered.ts +++ b/e2e/coverage-remapping/covered.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually */ - export function difference(a: number, b: number): number { const branch1: boolean = true ? 1 : 0; const branch2: boolean = true ? 1 : 0; diff --git a/e2e/dom-diffing/__tests__/dom.test.js b/e2e/dom-diffing/__tests__/dom.test.js index 8370900d95..e11c21a46b 100644 --- a/e2e/dom-diffing/__tests__/dom.test.js +++ b/e2e/dom-diffing/__tests__/dom.test.js @@ -6,7 +6,7 @@ * */ -/* eslint-env browser */ +/* global document */ test('use toBe compare two div', () => { const div1 = document.createElement('div'); diff --git a/e2e/environmentOptions/__tests__/environmentOptions.test.js b/e2e/environmentOptions/__tests__/environmentOptions.test.js index 8ff8622cc8..d617460f0d 100644 --- a/e2e/environmentOptions/__tests__/environmentOptions.test.js +++ b/e2e/environmentOptions/__tests__/environmentOptions.test.js @@ -5,7 +5,6 @@ * LICENSE file in the root directory of this source tree. */ 'use strict'; -/*eslint-env browser */ test('found url jestjs.io', () => { expect(globalThis.location.href).toBe('https://jestjs.io/'); diff --git a/e2e/nested-event-loop/__tests__/nestedEventLoop.test.js b/e2e/nested-event-loop/__tests__/nestedEventLoop.test.js index b729778e50..f8038f81b8 100644 --- a/e2e/nested-event-loop/__tests__/nestedEventLoop.test.js +++ b/e2e/nested-event-loop/__tests__/nestedEventLoop.test.js @@ -7,7 +7,7 @@ * @jest-environment jsdom */ -/* eslint-env browser */ +/* global document */ 'use strict'; diff --git a/e2e/test-environment/__tests__/env.test.js b/e2e/test-environment/__tests__/env.test.js index c9bd67eeca..641a2de995 100644 --- a/e2e/test-environment/__tests__/env.test.js +++ b/e2e/test-environment/__tests__/env.test.js @@ -7,7 +7,7 @@ * @jest-environment jsdom */ 'use strict'; -/* eslint-env browser*/ +/* global document */ test('stub', () => { const element = document.createElement('div'); diff --git a/e2e/test-environment/__tests__/environmentOptionsFromDocblock.test.js b/e2e/test-environment/__tests__/environmentOptionsFromDocblock.test.js index f955b2ac6d..c3e9bd5355 100644 --- a/e2e/test-environment/__tests__/environmentOptionsFromDocblock.test.js +++ b/e2e/test-environment/__tests__/environmentOptionsFromDocblock.test.js @@ -8,7 +8,6 @@ * @jest-environment-options {"url": "https://jestjs.io/"} */ 'use strict'; -/*eslint-env browser */ test('use jsdom and set the URL in this test file', () => { expect(globalThis.location.href).toBe('https://jestjs.io/'); diff --git a/e2e/wrong-env/__tests__/beforeTest.js b/e2e/wrong-env/__tests__/beforeTest.js index 0cd8a21990..24d284ceb5 100644 --- a/e2e/wrong-env/__tests__/beforeTest.js +++ b/e2e/wrong-env/__tests__/beforeTest.js @@ -8,7 +8,7 @@ * */ -/* eslint-env browser */ +/* global document */ const div = document.createElement('div'); diff --git a/e2e/wrong-env/__tests__/node.js b/e2e/wrong-env/__tests__/node.js index ef97f4d877..d024779054 100644 --- a/e2e/wrong-env/__tests__/node.js +++ b/e2e/wrong-env/__tests__/node.js @@ -8,7 +8,7 @@ * */ -/* eslint-env browser */ +/* global document, window */ 'use strict'; diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..d8dc00b742 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,839 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +/* eslint-disable sort-keys */ + +import fs from 'fs'; +import path from 'path'; +import eslintJs from '@eslint/js'; +import eslintPluginEslintCommentsConfigs from '@eslint-community/eslint-plugin-eslint-comments/configs'; +import eslintPluginImport from 'eslint-plugin-import'; +import eslintPluginJest from 'eslint-plugin-jest'; +import eslintPluginJsdoc from 'eslint-plugin-jsdoc'; +import eslintPluginMarkdown from 'eslint-plugin-markdown'; +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; +import eslintPluginPromise from 'eslint-plugin-promise'; +import eslintPluginUnicorn from 'eslint-plugin-unicorn'; +import globals from 'globals'; +import {sync as readPkg} from 'read-pkg'; +import typescriptEslint from 'typescript-eslint'; +import eslintPluginLocal from './.eslintplugin/index.mjs'; + +function getPackages() { + const PACKAGES_DIR = path.resolve(import.meta.dirname, 'packages'); + const packages = fs + .readdirSync(PACKAGES_DIR) + .map(file => path.resolve(PACKAGES_DIR, file)) + .filter(f => fs.lstatSync(path.resolve(f)).isDirectory()) + .filter(f => fs.existsSync(path.join(path.resolve(f), 'package.json'))); + return packages.map(packageDir => { + const pkg = readPkg({cwd: packageDir}); + return pkg.name; + }); +} + +const config = typescriptEslint.config( + eslintJs.configs.recommended, + eslintPluginMarkdown.configs.recommended, + eslintPluginImport.flatConfigs.errors, + eslintPluginEslintCommentsConfigs.recommended, + eslintPluginUnicorn.configs.recommended, + eslintPluginPromise.configs['flat/recommended'], + eslintPluginPrettierRecommended, + { + languageOptions: {globals: {...globals.builtins, console: 'readonly'}}, + plugins: {jsdoc: eslintPluginJsdoc, local: eslintPluginLocal}, + settings: { + 'import/ignore': ['react-native'], + // using `new RegExp` makes sure to escape `/` + 'import/internal-regex': new RegExp( + getPackages() + .map(pkg => `^${pkg}$`) + .join('|'), + ).source, + 'import/resolver': { + typescript: {}, + }, + }, + rules: { + 'accessor-pairs': ['warn', {setWithoutGet: true}], + 'block-scoped-var': 'off', + 'callback-return': 'off', + camelcase: ['off', {properties: 'always'}], + complexity: 'off', + 'consistent-return': 'warn', + 'consistent-this': ['off', 'self'], + 'constructor-super': 'error', + 'default-case': 'off', + 'dot-notation': 'off', + eqeqeq: ['error', 'smart'], + '@eslint-community/eslint-comments/disable-enable-pair': [ + 'error', + {allowWholeFile: true}, + ], + '@eslint-community/eslint-comments/no-unused-disable': 'error', + 'func-names': 'off', + 'func-style': ['off', 'declaration'], + 'global-require': 'off', + 'guard-for-in': 'off', + 'handle-callback-err': 'off', + 'id-length': 'off', + 'id-match': 'off', + 'import/no-duplicates': 'error', + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: [ + '**/__mocks__/**', + '**/__tests__/**', + '**/__typetests__/**', + '**/?(*.)(spec|test).js?(x)', + 'scripts/**', + 'babel.config.js', + 'testSetupFile.js', + 'eslint.config.mjs', + ], + }, + ], + 'import/no-unresolved': ['error', {ignore: ['fsevents']}], + 'import/order': [ + 'error', + { + alphabetize: { + order: 'asc', + }, + // this is the default order except for added `internal` in the middle + groups: [ + 'builtin', + 'external', + 'internal', + 'parent', + 'sibling', + 'index', + ], + 'newlines-between': 'never', + }, + ], + 'init-declarations': 'off', + 'jsdoc/check-alignment': 'error', + 'lines-around-comment': 'off', + 'max-depth': 'off', + 'max-nested-callbacks': 'off', + 'max-params': 'off', + 'max-statements': 'off', + 'new-cap': 'off', + 'new-parens': 'error', + 'newline-after-var': 'off', + 'no-alert': 'off', + 'no-array-constructor': 'error', + 'no-bitwise': 'warn', + 'no-caller': 'error', + 'no-case-declarations': 'off', + 'no-class-assign': 'warn', + 'no-cond-assign': 'off', + 'no-confusing-arrow': 'off', + 'no-console': [ + 'warn', + {allow: ['warn', 'error', 'time', 'timeEnd', 'timeStamp']}, + ], + 'no-const-assign': 'error', + 'no-constant-condition': 'error', + 'no-constant-binary-expression': 'error', + 'no-continue': 'off', + 'no-control-regex': 'off', + 'no-debugger': 'error', + 'no-delete-var': 'error', + 'no-div-regex': 'off', + 'no-dupe-args': 'error', + 'no-dupe-class-members': 'error', + 'no-dupe-keys': 'error', + 'no-duplicate-case': 'error', + 'no-duplicate-imports': 'error', + 'no-else-return': 'off', + 'no-empty': 'off', + 'no-empty-character-class': 'warn', + 'no-empty-pattern': 'warn', + 'no-eq-null': 'off', + 'no-eval': 'error', + 'no-ex-assign': 'warn', + 'no-extend-native': 'warn', + 'no-extra-bind': 'warn', + 'no-extra-boolean-cast': 'warn', + 'no-fallthrough': 'warn', + 'no-floating-decimal': 'error', + 'no-func-assign': 'error', + 'no-implicit-coercion': 'off', + 'no-implied-eval': 'error', + 'no-inline-comments': 'off', + 'no-inner-declarations': 'off', + 'no-invalid-regexp': 'warn', + 'no-invalid-this': 'off', + 'no-irregular-whitespace': 'error', + 'no-iterator': 'off', + 'no-label-var': 'warn', + 'no-labels': ['error', {allowLoop: true, allowSwitch: true}], + 'no-lonely-if': 'off', + 'no-loop-func': 'off', + 'no-magic-numbers': 'off', + 'no-mixed-requires': 'off', + 'no-mixed-spaces-and-tabs': 'error', + 'no-multi-str': 'error', + 'no-multiple-empty-lines': 'off', + 'no-native-reassign': ['error', {exceptions: ['Map', 'Set']}], + 'no-negated-in-lhs': 'error', + 'no-new': 'warn', + 'no-new-func': 'error', + 'no-new-object': 'warn', + 'no-new-require': 'off', + 'no-new-wrappers': 'warn', + 'no-obj-calls': 'error', + 'no-octal': 'warn', + 'no-octal-escape': 'warn', + 'no-param-reassign': 'off', + 'no-plusplus': 'off', + 'no-process-env': 'off', + 'no-process-exit': 'off', + 'no-proto': 'error', + 'no-prototype-builtins': 'error', + 'no-redeclare': 'warn', + 'no-regex-spaces': 'warn', + 'no-restricted-globals': [ + 'error', + {message: 'Use `globalThis` instead.', name: 'global'}, + ], + 'no-restricted-imports': [ + 'error', + {message: 'Please use graceful-fs instead.', name: 'fs'}, + ], + 'no-restricted-modules': 'off', + 'no-restricted-syntax': 'off', + 'no-return-assign': 'off', + 'no-script-url': 'error', + 'no-self-compare': 'warn', + 'no-sequences': 'warn', + 'no-shadow': 'off', + 'no-shadow-restricted-names': 'warn', + 'no-sparse-arrays': 'error', + 'no-sync': 'off', + 'no-ternary': 'off', + 'no-this-before-super': 'error', + 'no-throw-literal': 'error', + 'no-undef': 'error', + 'no-undef-init': 'off', + 'no-undefined': 'off', + 'no-underscore-dangle': 'off', + 'no-unneeded-ternary': 'warn', + 'no-unreachable': 'error', + 'no-unused-expressions': 'off', + 'no-unused-vars': ['error', {argsIgnorePattern: '^_'}], + 'no-use-before-define': 'off', + 'no-useless-call': 'error', + 'no-useless-computed-key': 'error', + 'no-useless-concat': 'error', + 'no-var': 'error', + 'no-void': 'off', + 'no-warn-comments': 'off', + 'no-with': 'off', + 'object-shorthand': 'error', + 'one-var': ['warn', {initialized: 'never'}], + 'operator-assignment': ['warn', 'always'], + 'operator-linebreak': 'off', + 'padded-blocks': 'off', + 'prefer-arrow-callback': ['error', {allowNamedFunctions: true}], + 'prefer-const': 'error', + 'prefer-template': 'error', + + 'promise/always-return': 'off', + 'promise/catch-or-return': 'off', + 'promise/no-callback-in-promise': 'off', + + quotes: [ + 'error', + 'single', + {allowTemplateLiterals: false, avoidEscape: true}, + ], + radix: 'warn', + 'require-jsdoc': 'off', + 'require-yield': 'off', + 'sort-imports': ['error', {ignoreDeclarationSort: true}], + 'sort-keys': 'error', + 'sort-vars': 'off', + 'spaced-comment': ['off', 'always', {exceptions: ['eslint', 'global']}], + strict: 'off', + 'use-isnan': 'error', + 'valid-jsdoc': 'off', + 'valid-typeof': 'error', + 'vars-on-top': 'off', + 'wrap-iife': 'off', + 'wrap-regex': 'off', + yoda: 'off', + + // doesn't work without ESModuleInterop + 'unicorn/import-style': 'off', + // we're a CJS project + 'unicorn/prefer-module': 'off', + + // enforced by `@typescript-eslint/no-this-alias` already + 'unicorn/no-this-assignment': 'off', + + // Not an issue with TypeScript + 'unicorn/no-array-callback-reference': 'off', + + // reduce is fine + 'unicorn/no-array-reduce': 'off', + + // this is very aggressive (600+ files changed). might make sense to apply bit by bit over time? + 'unicorn/prevent-abbreviations': 'off', + + // nah + 'unicorn/consistent-destructuring': 'off', + 'unicorn/no-lonely-if': 'off', + 'unicorn/no-null': 'off', + 'unicorn/no-process-exit': 'off', + 'unicorn/no-useless-undefined': 'off', + 'unicorn/prefer-event-target': 'off', + 'unicorn/prefer-switch': 'off', + 'unicorn/prefer-ternary': 'off', + 'unicorn/prefer-top-level-await': 'off', + 'unicorn/switch-case-braces': 'off', + + // TODO: decide whether or not we want these + 'unicorn/filename-case': 'off', + 'unicorn/prefer-reflect-apply': 'off', + 'unicorn/prefer-string-raw': 'off', + 'unicorn/prefer-structured-clone': 'off', + + // enabling this is blocked by https://github.com/microsoft/rushstack/issues/2780 + 'unicorn/prefer-export-from': 'off', + // enabling this is blocked by https://github.com/jestjs/jest/pull/14297 + 'unicorn/prefer-node-protocol': 'off', + }, + }, + [ + typescriptEslint.configs.eslintRecommended, + typescriptEslint.configs.strict, + typescriptEslint.configs.stylistic, + eslintPluginImport.flatConfigs.typescript, + { + rules: { + '@typescript-eslint/array-type': ['error', {default: 'generic'}], + '@typescript-eslint/no-restricted-types': 'error', + '@typescript-eslint/consistent-type-imports': [ + 'error', + {fixStyle: 'inline-type-imports', disallowTypeAnnotations: false}, + ], + '@typescript-eslint/no-import-type-side-effects': 'error', + '@typescript-eslint/no-inferrable-types': 'error', + '@typescript-eslint/no-unused-vars': [ + 'error', + {argsIgnorePattern: '^_'}, + ], + '@typescript-eslint/prefer-ts-expect-error': 'error', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/consistent-indexed-object-style': 'off', + // TS verifies these + 'consistent-return': 'off', + 'no-dupe-class-members': 'off', + 'no-unused-vars': 'off', + '@typescript-eslint/no-dynamic-delete': 'off', + // TODO: enable at some point + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-invalid-void-type': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + '@typescript-eslint/no-require-imports': 'off', + 'import/no-unresolved': 'off', + '@typescript-eslint/no-unsafe-function-type': 'off', + + // not needed to be enforced for TS + 'import/namespace': 'off', + }, + }, + ] + .flat() + .map(config => ({...config, files: ['**/*.ts', '**/*.tsx']})), + + { + files: [ + 'packages/jest-mock/src/__tests__/index.test.ts', + 'packages/jest-mock/src/index.ts', + 'packages/pretty-format/src/__tests__/Immutable.test.ts', + 'packages/pretty-format/src/__tests__/prettyFormat.test.ts', + ], + rules: { + 'local/prefer-rest-params-eventually': 'warn', + 'prefer-rest-params': 'off', + }, + }, + { + files: [ + 'packages/expect/src/index.ts', + 'packages/jest-fake-timers/src/legacyFakeTimers.ts', + 'packages/jest-jasmine2/src/jestExpect.ts', + ], + rules: { + 'local/prefer-spread-eventually': 'warn', + 'prefer-spread': 'off', + }, + }, + { + files: [ + 'e2e/babel-plugin-jest-hoist/__tests__/typescript.test.ts', + 'e2e/coverage-remapping/covered.ts', + 'packages/expect/src/matchers.ts', + 'packages/expect/src/print.ts', + 'packages/expect/src/toThrowMatchers.ts', + 'packages/expect-utils/src/utils.ts', + 'packages/jest-core/src/collectHandles.ts', + 'packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts', + 'packages/jest-leak-detector/src/index.ts', + 'packages/jest-matcher-utils/src/index.ts', + 'packages/jest-mock/src/__tests__/index.test.ts', + 'packages/jest-mock/src/index.ts', + 'packages/jest-snapshot/src/index.ts', + 'packages/jest-snapshot/src/printSnapshot.ts', + 'packages/jest-snapshot/src/types.ts', + 'packages/jest-util/src/convertDescriptorToString.ts', + 'packages/pretty-format/src/index.ts', + 'packages/pretty-format/src/plugins/DOMCollection.ts', + ], + rules: { + 'local/no-restricted-types-eventually': [ + 'warn', + { + types: { + // none of these types are in use, so can be errored on + Boolean: true, + Number: true, + Object: true, + String: true, + Symbol: true, + }, + }, + ], + }, + }, + { + files: ['e2e/coverage-remapping/covered.ts'], + rules: { + 'no-constant-binary-expression': 'off', + 'no-constant-condition': 'off', + }, + }, + + // 'eslint-plugin-jest' rules for test and test related files + { + files: [ + '**/__mocks__/**', + '**/__tests__/**', + '**/*.md/**', + '**/*.test.*', + 'e2e/babel-plugin-jest-hoist/mockFile.js', + 'e2e/failures/macros.js', + 'e2e/test-in-root/*.js', + 'e2e/test-match/test-suites/*', + 'e2e/test-match-default/dot-spec-tests/*', + 'packages/test-utils/src/ConditionalTest.ts', + ], + ...eslintPluginJest.configs['flat/style'], + ignores: ['**/__typetests__/**'], + rules: { + ...eslintPluginJest.configs['flat/style'].rules, + 'jest/no-alias-methods': 'error', + 'jest/no-focused-tests': 'error', + 'jest/no-identical-title': 'error', + 'jest/require-to-throw-message': 'error', + 'jest/valid-expect': 'error', + 'import/order': 'off', + }, + }, + + { + files: ['e2e/__tests__/*'], + rules: { + 'jest/no-restricted-jest-methods': [ + 'error', + { + fn: 'Please use fixtures instead of mocks in the end-to-end tests.', + mock: 'Please use fixtures instead of mocks in the end-to-end tests.', + doMock: + 'Please use fixtures instead of mocks in the end-to-end tests.', + setMock: + 'Please use fixtures instead of mocks in the end-to-end tests.', + spyOn: + 'Please use fixtures instead of mocks in the end-to-end tests.', + }, + ], + }, + }, + + { + files: [ + 'website/docusaurus.config.js', + 'website/fetchSupporters.js', + 'website/src/prism/themeLight.js', + 'website/src/prism/themeDark.js', + 'website/babel.config.js', + 'website/i18n.js', + 'website/fetchSupporters.js', + ], + languageOptions: { + sourceType: 'commonjs', + globals: globals.node, + }, + }, + + { + files: ['website/src/**/*.js', 'examples/**/*.js'], + languageOptions: { + parserOptions: {ecmaFeatures: {jsx: true}}, + globals: globals.browser, + }, + }, + + // to make it more suitable for running on code examples in docs/ folder + { + files: ['**/*.md/**'], + languageOptions: {parserOptions: {ecmaFeatures: {jsx: true}}}, + linterOptions: {reportUnusedDisableDirectives: 'off'}, + rules: { + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-empty-interface': 'off', + 'consistent-return': 'off', + 'import/export': 'off', + 'import/no-extraneous-dependencies': 'off', + 'import/no-unresolved': 'off', + 'jest/no-focused-tests': 'off', + 'jest/require-to-throw-message': 'off', + 'no-console': 'off', + 'no-constant-condition': 'off', + 'no-undef': 'off', + 'no-unused-vars': 'off', + 'sort-keys': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/error-message': 'off', + 'unicorn/no-anonymous-default-export': 'off', + 'unicorn/no-await-expression-member': 'off', + 'unicorn/no-static-only-class': 'off', + 'unicorn/prefer-number-properties': 'off', + 'unicorn/prefer-string-raw': 'off', + 'unicorn/prefer-global-this': 'off', + // The following disabled when upgrade ESLint to v9, some of them make sense to enable + 'prefer-template': 'off', + '@typescript-eslint/no-require-imports': 'off', + 'import/default': 'off', + 'jest/prefer-to-have-length': 'off', + 'unicorn/prefer-at': 'off', + 'unicorn/numeric-separators-style': 'off', + }, + }, + // demonstration of matchers usage + { + files: ['**/UsingMatchers.md/**'], + rules: { + 'jest/prefer-to-be': 'off', + }, + }, + // demonstration of 'jest/valid-expect' rule + { + files: [ + '**/2017-05-06-jest-20-delightful-testing-multi-project-runner.md/**', + ], + rules: { + 'jest/valid-expect': 'off', + }, + }, + // Jest 11 did not had `toHaveLength` matcher + { + files: ['**/2016-04-12-jest-11.md/**'], + rules: { + 'jest/prefer-to-have-length': 'off', + }, + }, + // snapshot in an example needs to keep escapes + { + files: [ + '**/2017-02-21-jest-19-immersive-watch-mode-test-platform-improvements.md/**', + ], + rules: { + 'no-useless-escape': 'off', + }, + }, + + // snapshots in examples plus inline snapshots need to keep backtick + { + files: ['**/*.md/**', 'e2e/custom-inline-snapshot-matchers/__tests__/*'], + rules: { + quotes: [ + 'error', + 'single', + {allowTemplateLiterals: true, avoidEscape: true}, + ], + }, + }, + + { + files: ['docs/**/*', 'website/**/*'], + rules: { + 'no-redeclare': 'off', + 'import/order': 'off', + 'import/sort-keys': 'off', + 'no-restricted-globals': ['off'], + 'sort-keys': 'off', + }, + }, + { + files: ['examples/**/*', 'eslint.config.mjs'], + rules: { + 'no-restricted-imports': 'off', + }, + }, + { + files: ['examples/angular/**/*.ts'], + rules: { + // Angular DI for some reason doesn't work with type imports + '@typescript-eslint/consistent-type-imports': [ + 'error', + {prefer: 'no-type-imports', disallowTypeAnnotations: false}, + ], + }, + }, + { + files: ['packages/**/*.ts'], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'error', + 'import/no-anonymous-default-export': [ + 'error', + { + allowAnonymousClass: false, + allowAnonymousFunction: false, + allowArray: false, + allowArrowFunction: false, + allowCallExpression: false, + allowLiteral: false, + allowObject: true, + }, + ], + }, + }, + { + files: ['**/__tests__/**', '**/__mocks__/**'], + rules: { + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/class-literal-property-style': 'off', + }, + }, + { + files: [ + '**/__tests__/**', + '**/__mocks__/**', + 'packages/jest-jasmine2/src/jasmine/**/*', + 'packages/expect/src/jasmineUtils.ts', + '**/vendor/**/*', + ], + rules: { + '@typescript-eslint/explicit-module-boundary-types': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/no-await-expression-member': 'off', + 'unicorn/prefer-spread': 'off', + 'unicorn/prefer-string-raw': 'off', + }, + }, + { + files: [ + 'packages/jest-jasmine2/src/jasmine/**/*', + 'packages/expect-utils/src/jasmineUtils.ts', + ], + rules: { + '@typescript-eslint/ban-types': 'off', + '@eslint-community/eslint-comments/disable-enable-pair': 'off', + '@eslint-community/eslint-comments/no-unlimited-disable': 'off', + 'prefer-rest-params': 'off', + 'prefer-spread': 'off', + 'sort-keys ': 'off', + }, + }, + { + files: [ + 'e2e/error-on-deprecated/__tests__/*', + 'e2e/jasmine-async/__tests__/*', + ], + languageOptions: { + globals: { + fail: 'readonly', + jasmine: 'readonly', + pending: 'readonly', + }, + }, + }, + { + files: [ + 'e2e/**', + 'website/**', + '**/__benchmarks__/**', + '**/__tests__/**', + '**/__typetests__/**', + '.eslintplugin/**', + ], + rules: { + 'import/no-extraneous-dependencies': 'off', + 'unicorn/consistent-function-scoping': 'off', + 'unicorn/error-message': 'off', + }, + }, + { + files: ['**/__typetests__/**'], + rules: { + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-invalid-void-type': 'off', + '@typescript-eslint/no-useless-constructor': 'off', + }, + }, + { + languageOptions: {globals: globals.node}, + files: ['**/*.js', '**/*.jsx', '**/*.mjs', '**/*.cjs'], + }, + { + files: [ + 'scripts/*', + 'packages/*/__benchmarks__/test.js', + 'packages/create-jest/src/runCreate.ts', + 'packages/jest-repl/src/cli/runtime-cli.ts', + ], + rules: { + 'no-console': 'off', + }, + }, + { + files: [ + 'e2e/**', + 'examples/**', + 'website/**', + '**/__benchmarks__/**', + '**/__mocks__/**', + '**/__tests__/**', + '**/__typetests__/**', + ], + rules: { + '@typescript-eslint/no-extraneous-class': 'off', + '@typescript-eslint/no-unused-vars': 'off', + 'import/no-unresolved': 'off', + 'no-console': 'off', + 'no-unused-vars': 'off', + 'unicorn/no-anonymous-default-export': 'off', + }, + }, + { + files: ['scripts/**/*'], + rules: { + 'unicorn/no-anonymous-default-export': 'off', + }, + }, + { + files: ['packages/jest-mock/src/__tests__/**/*'], + rules: { + 'unicorn/no-static-only-class': 'off', + }, + }, + { + files: ['**/*.mjs'], + rules: { + 'unicorn/prefer-top-level-await': 'error', + }, + }, + { + files: [ + 'e2e/expect-async-matcher/__tests__/failure.test.js', + 'e2e/expect-async-matcher/__tests__/success.test.js', + 'e2e/transform/babel-jest-async/__tests__/babelJest.test.js', + ], + rules: { + 'import/namespace': 'off', + 'import/default': 'off', + }, + }, + { + files: [ + 'e2e/coverage-report/__mocks__/sumDependency.js', + 'e2e/require-main-after-create-require/empty.js', + 'packages/create-jest/src/__tests__/__fixtures__/**/*', + 'packages/jest-core/src/__tests__/**/*', + 'packages/jest-haste-map/src/__tests__/test_dotfiles_root/**/*', + 'packages/jest-resolve/src/__mocks__/**/*', + ], + rules: { + 'unicorn/no-empty-file': 'off', + }, + }, + { + files: ['packages/expect/src/__tests__/*.test.js'], + rules: { + 'unicorn/prefer-number-properties': 'off', + }, + }, + + { + ignores: [ + '!.*', + '**/coverage/**', + '**/node_modules/**', + 'bin/', + 'packages/*/build/**', + 'packages/*/dist/**', + 'website/.docusaurus', + 'website/build', + 'website/node_modules', + 'website/i18n/*.js', + 'website/static', + + // Third-party script + 'packages/jest-diff/src/cleanupSemantic.ts', + 'e2e/native-esm/wasm-bindgen/index_bg.js', + + '**/.yarn', + '**/.pnp.*', + + '**/*.snap', + '**/*.json', + + // JS Syntax error + '{docs,website/versioned_docs/version-*}/ECMAScriptModules.md', + '{docs,website/versioned_docs/version-*}/JestObjectAPI.md', + + // Bug? Uses TS syntax + 'e2e/babel-plugin-jest-hoist/__tests__/integration.test.js', + 'e2e/coverage-report/notRequiredInTestSuite.js', + 'e2e/expect-async-matcher/matchers.js', + 'e2e/explicit-resource-management/__tests__/index.js', + 'e2e/failures/__tests__/errorWithCause.test.js', + 'e2e/failures/__tests__/errorWithCauseInDescribe.test.js', + 'e2e/failures/macros.js', + 'e2e/global-setup/invalidSetupWithNamedExport.js', + 'e2e/global-setup/setup.js', + 'e2e/global-setup/setupWithDefaultExport.js', + 'e2e/global-teardown/invalidTeardownWithNamedExport.js', + 'e2e/global-teardown/teardownWithDefaultExport.js', + 'e2e/multi-project-babel/prj-1/index.js', + 'e2e/multi-project-babel/prj-2/index.js', + 'e2e/multi-project-babel/prj-3/src/index.js', + 'e2e/multi-project-babel/prj-4/src/index.js', + 'e2e/multi-project-babel/prj-5/src/index.js', + 'e2e/native-esm/__tests__/native-esm-import-assertions.test.js', + 'e2e/transform-linked-modules/ignored/symlink.js', + 'e2e/global-setup/setupWithDefaultExport.js', + 'e2e/global-setup/setupWithDefaultExport.js', + 'e2e/failures/macros.js', + 'e2e/transform/**/*', + 'examples/react-native/index.js', + ], + }, +); + +export default config; diff --git a/examples/jquery/__tests__/display_user.test.js b/examples/jquery/__tests__/display_user.test.js index 3878ae904c..58431bccfb 100644 --- a/examples/jquery/__tests__/display_user.test.js +++ b/examples/jquery/__tests__/display_user.test.js @@ -1,7 +1,5 @@ // Copyright (c) Meta Platforms, Inc. and affiliates.. All Rights Reserved. -/* global document */ - 'use strict'; jest.mock('../fetchCurrentUser.js'); diff --git a/package.json b/package.json index dc2100f385..d5b8ebc0d1 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "@babel/preset-typescript": "^7.0.0", "@babel/register": "^7.0.0", "@crowdin/cli": "^4.0.0", - "@eslint-community/eslint-plugin-eslint-comments": "^4.0.0", + "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1", + "@eslint/js": "^9.21.0", "@jest/globals": "workspace:*", "@jest/test-utils": "workspace:*", "@lerna-lite/cli": "^3.0.0", @@ -22,8 +23,6 @@ "@types/babel__template": "^7.0.2", "@types/node": "^16.10.0", "@types/which": "^3.0.0", - "@typescript-eslint/eslint-plugin": "^6.6.0", - "@typescript-eslint/parser": "^6.6.0", "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", "babel-jest": "workspace:*", @@ -31,20 +30,20 @@ "camelcase": "^6.2.0", "chalk": "^4.0.0", "dedent": "^1.0.0", - "eslint": "^8.8.0", - "eslint-config-prettier": "^10.0.0", - "eslint-import-resolver-typescript": "^3.2.5", - "eslint-plugin-import": "^2.6.0", - "eslint-plugin-jest": "^28.0.0", + "eslint": "^9.21.0", + "eslint-config-prettier": "^10.0.2", + "eslint-import-resolver-typescript": "^3.8.3", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.11.0", "eslint-plugin-jsdoc": "^50.0.0", - "eslint-plugin-local": "link:./.eslintplugin", - "eslint-plugin-markdown": "^3.0.0", - "eslint-plugin-prettier": "^5.0.0", - "eslint-plugin-promise": "^6.1.1", - "eslint-plugin-unicorn": "^56.0.0", + "eslint-plugin-markdown": "^5.1.0", + "eslint-plugin-prettier": "^5.2.3", + "eslint-plugin-promise": "^7.2.1", + "eslint-plugin-unicorn": "^57.0.0", "execa": "^5.0.0", "find-process": "^1.4.1", "glob": "^10.3.10", + "globals": "^16.0.0", "graceful-fs": "^4.2.9", "isbinaryfile": "^5.0.0", "istanbul-lib-coverage": "^3.0.0", @@ -80,6 +79,7 @@ "ts-node": "^10.5.0", "tstyche": "^3.0.0", "typescript": "^5.0.4", + "typescript-eslint": "^8.26.0", "webpack": "^5.68.0", "webpack-node-externals": "^3.0.0", "which": "^4.0.0" diff --git a/packages/babel-plugin-jest-hoist/src/index.ts b/packages/babel-plugin-jest-hoist/src/index.ts index 2885e386ac..c59632ce9e 100644 --- a/packages/babel-plugin-jest-hoist/src/index.ts +++ b/packages/babel-plugin-jest-hoist/src/index.ts @@ -371,7 +371,7 @@ export default function jestHoist(): PluginObj<{ if (hoistedJestGetters.has(callExpr.node)) { const mockStmt = callExpr.getStatementParent(); - if (mockStmt && mockStmt.parentPath.isBlock()) { + if (mockStmt?.parentPath.isBlock()) { stack.at(-1)!.calls.push(mockStmt.node); mockStmt.remove(); } diff --git a/packages/create-jest/src/modifyPackageJson.ts b/packages/create-jest/src/modifyPackageJson.ts index 09bc8cedd4..695b38c43a 100644 --- a/packages/create-jest/src/modifyPackageJson.ts +++ b/packages/create-jest/src/modifyPackageJson.ts @@ -15,9 +15,11 @@ const modifyPackageJson = ({ shouldModifyScripts: boolean; }): string => { if (shouldModifyScripts) { - projectPackageJson.scripts - ? (projectPackageJson.scripts.test = 'jest') - : (projectPackageJson.scripts = {test: 'jest'}); + if (projectPackageJson.scripts) { + projectPackageJson.scripts.test = 'jest'; + } else { + projectPackageJson.scripts = {test: 'jest'}; + } } delete projectPackageJson.jest; diff --git a/packages/expect-utils/src/__tests__/isError.test.ts b/packages/expect-utils/src/__tests__/isError.test.ts index 24ac7b75cd..00a64ee35a 100644 --- a/packages/expect-utils/src/__tests__/isError.test.ts +++ b/packages/expect-utils/src/__tests__/isError.test.ts @@ -9,8 +9,6 @@ /// -/* eslint-env browser */ - import {isError} from '../utils'; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/test/AngularSpec.js#L1883 diff --git a/packages/expect/src/__tests__/toEqual-dom.test.ts b/packages/expect/src/__tests__/toEqual-dom.test.ts index 58195d5014..e4bb092803 100644 --- a/packages/expect/src/__tests__/toEqual-dom.test.ts +++ b/packages/expect/src/__tests__/toEqual-dom.test.ts @@ -9,7 +9,7 @@ /// -/* eslint-env browser*/ +/* global document */ import {expect} from '@jest/globals'; diff --git a/packages/expect/src/asymmetricMatchers.ts b/packages/expect/src/asymmetricMatchers.ts index 8eaa17d85b..3784273cbf 100644 --- a/packages/expect/src/asymmetricMatchers.ts +++ b/packages/expect/src/asymmetricMatchers.ts @@ -97,26 +97,32 @@ class Any extends AsymmetricMatcher { asymmetricMatch(other: unknown) { if (this.sample === String) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'string' || other instanceof String; } if (this.sample === Number) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'number' || other instanceof Number; } if (this.sample === Function) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'function' || other instanceof Function; } if (this.sample === Boolean) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'boolean' || other instanceof Boolean; } if (this.sample === BigInt) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'bigint' || other instanceof BigInt; } if (this.sample === Symbol) { + // eslint-disable-next-line unicorn/no-instanceof-builtins return typeof other === 'symbol' || other instanceof Symbol; } diff --git a/packages/expect/src/matchers.ts b/packages/expect/src/matchers.ts index 446936ee3d..60ad4b4d66 100644 --- a/packages/expect/src/matchers.ts +++ b/packages/expect/src/matchers.ts @@ -6,8 +6,6 @@ * */ -/* eslint-disable local/ban-types-eventually */ - import { arrayBufferEquality, equals, diff --git a/packages/expect/src/print.ts b/packages/expect/src/print.ts index b0d363bed4..2a8de8cf59 100644 --- a/packages/expect/src/print.ts +++ b/packages/expect/src/print.ts @@ -6,8 +6,6 @@ * */ -/* eslint-disable local/ban-types-eventually */ - import { EXPECTED_COLOR, INVERTED_COLOR, diff --git a/packages/expect/src/toThrowMatchers.ts b/packages/expect/src/toThrowMatchers.ts index dfda024afb..46fd5c6c42 100644 --- a/packages/expect/src/toThrowMatchers.ts +++ b/packages/expect/src/toThrowMatchers.ts @@ -6,8 +6,6 @@ * */ -/* eslint-disable local/ban-types-eventually */ - import {isError} from '@jest/expect-utils'; import { EXPECTED_COLOR, diff --git a/packages/jest-circus/README.md b/packages/jest-circus/README.md index 6c5c683633..addb2e82ad 100644 --- a/packages/jest-circus/README.md +++ b/packages/jest-circus/README.md @@ -13,8 +13,8 @@ Circus is a flux-based test runner for Jest that is fast, maintainable, and simp Circus allows you to bind to events via an optional event handler on any [custom environment](https://jestjs.io/docs/configuration#testenvironment-string). See the [type definitions][type-definitions] for more information on the events and state data currently available. -```js -import {Event, State} from 'jest-circus'; +```ts +import type {Event, State} from 'jest-circus'; import {TestEnvironment as NodeEnvironment} from 'jest-environment-node'; class MyCustomEnvironment extends NodeEnvironment { diff --git a/packages/jest-console/src/BufferedConsole.ts b/packages/jest-console/src/BufferedConsole.ts index 21162ac142..dbf283a7ff 100644 --- a/packages/jest-console/src/BufferedConsole.ts +++ b/packages/jest-console/src/BufferedConsole.ts @@ -73,7 +73,7 @@ export default class BufferedConsole extends Console { override assert(value: unknown, message?: string | Error): void { try { - assert(value, message); + assert.ok(value, message); } catch (error) { if (!(error instanceof AssertionError)) { throw error; diff --git a/packages/jest-console/src/CustomConsole.ts b/packages/jest-console/src/CustomConsole.ts index 41457aa7fc..0e4341d210 100644 --- a/packages/jest-console/src/CustomConsole.ts +++ b/packages/jest-console/src/CustomConsole.ts @@ -52,7 +52,7 @@ export default class CustomConsole extends Console { override assert(value: unknown, message?: string | Error): asserts value { try { - assert(value, message); + assert.ok(value, message); } catch (error) { if (!(error instanceof AssertionError)) { throw error; diff --git a/packages/jest-core/src/ReporterDispatcher.ts b/packages/jest-core/src/ReporterDispatcher.ts index 451bb5bd61..3a02c3776a 100644 --- a/packages/jest-core/src/ReporterDispatcher.ts +++ b/packages/jest-core/src/ReporterDispatcher.ts @@ -66,7 +66,9 @@ export default class ReporterDispatcher { options: ReporterOnStartOptions, ): Promise { for (const reporter of this._reporters) { - reporter.onRunStart && (await reporter.onRunStart(results, options)); + if (reporter.onRunStart) { + await reporter.onRunStart(results, options); + } } } diff --git a/packages/jest-core/src/TestScheduler.ts b/packages/jest-core/src/TestScheduler.ts index 11a38233fd..ee19d9cfb6 100644 --- a/packages/jest-core/src/TestScheduler.ts +++ b/packages/jest-core/src/TestScheduler.ts @@ -351,15 +351,18 @@ class TestScheduler { switch (reporter) { case 'default': summaryOptions = options; - verbose - ? this.addReporter(new VerboseReporter(this._globalConfig)) - : this.addReporter(new DefaultReporter(this._globalConfig)); + this.addReporter( + verbose + ? new VerboseReporter(this._globalConfig) + : new DefaultReporter(this._globalConfig), + ); break; case 'github-actions': - GITHUB_ACTIONS && + if (GITHUB_ACTIONS) { this.addReporter( new GitHubActionsReporter(this._globalConfig, options), ); + } break; case 'summary': summaryOptions = options; diff --git a/packages/jest-core/src/__tests__/watch.test.js b/packages/jest-core/src/__tests__/watch.test.js index 2ed12541f8..cf826281a7 100644 --- a/packages/jest-core/src/__tests__/watch.test.js +++ b/packages/jest-core/src/__tests__/watch.test.js @@ -8,7 +8,6 @@ import chalk from 'chalk'; import {TestPathPatterns} from '@jest/pattern'; -// eslint-disable-next-line import/order import {JestHook, KEYS, TestWatcher} from 'jest-watcher'; const runJestMock = jest.fn(); diff --git a/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js b/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js index 0a775ffad1..0cefe12774 100644 --- a/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js +++ b/packages/jest-core/src/__tests__/watchFilenamePatternMode.test.js @@ -8,7 +8,6 @@ import chalk from 'chalk'; import {TestPathPatterns} from '@jest/pattern'; -// eslint-disable-next-line import/order import {KEYS} from 'jest-watcher'; const runJestMock = jest.fn(); diff --git a/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js b/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js index 265a97dc1f..dd890c13a1 100644 --- a/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js +++ b/packages/jest-core/src/__tests__/watchTestNamePatternMode.test.js @@ -8,7 +8,6 @@ import chalk from 'chalk'; import {TestPathPatterns} from '@jest/pattern'; -// eslint-disable-next-line import/order import {KEYS} from 'jest-watcher'; const runJestMock = jest.fn(); diff --git a/packages/jest-core/src/cli/index.ts b/packages/jest-core/src/cli/index.ts index 352cdefeb0..ef5a98c3b6 100644 --- a/packages/jest-core/src/cli/index.ts +++ b/packages/jest-core/src/cli/index.ts @@ -225,24 +225,26 @@ const _run10000 = async ( ); performance.mark('jest/buildContextsAndHasteMaps:end'); - globalConfig.watch || globalConfig.watchAll - ? await runWatch( - contexts, - configs, - hasDeprecationWarnings, - globalConfig, - outputStream, - hasteMapInstances, - filter, - ) - : await runWithoutWatch( - globalConfig, - contexts, - outputStream, - onComplete, - changedFilesPromise, - filter, - ); + if (globalConfig.watch || globalConfig.watchAll) { + await runWatch( + contexts, + configs, + hasDeprecationWarnings, + globalConfig, + outputStream, + hasteMapInstances, + filter, + ); + } else { + await runWithoutWatch( + globalConfig, + contexts, + outputStream, + onComplete, + changedFilesPromise, + filter, + ); + } }; const runWatch = async ( diff --git a/packages/jest-core/src/collectHandles.ts b/packages/jest-core/src/collectHandles.ts index ae3c2cdce5..cbd9c5da1b 100644 --- a/packages/jest-core/src/collectHandles.ts +++ b/packages/jest-core/src/collectHandles.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually */ - import * as asyncHooks from 'async_hooks'; import {promisify} from 'util'; import * as v8 from 'v8'; @@ -77,6 +75,7 @@ export default function collectHandles(): HandleCollectionResult { asyncId, type, triggerAsyncId, + // eslint-disable-next-line @typescript-eslint/no-empty-object-type resource: {} | NodeJS.Timeout, ) { // Skip resources that should not generally prevent the process from diff --git a/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts b/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts index 5e975371ef..8b6293f650 100644 --- a/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts +++ b/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually */ - import type {AggregatedResult, AssertionLocation} from '@jest/test-result'; import type {Config} from '@jest/types'; import { diff --git a/packages/jest-core/src/runJest.ts b/packages/jest-core/src/runJest.ts index 5f9ed2e063..d26742c811 100644 --- a/packages/jest-core/src/runJest.ts +++ b/packages/jest-core/src/runJest.ts @@ -234,7 +234,7 @@ export default async function runJest({ console.log(testsListOutput); } - onComplete && onComplete(makeEmptyAggregatedTestResult()); + onComplete?.(makeEmptyAggregatedTestResult()); return; } diff --git a/packages/jest-core/src/watch.ts b/packages/jest-core/src/watch.ts index 2f173263f5..55a6da7239 100644 --- a/packages/jest-core/src/watch.ts +++ b/packages/jest-core/src/watch.ts @@ -287,7 +287,9 @@ export default async function watch( } testWatcher = new TestWatcher({isWatchMode: true}); - isInteractive && outputStream.write(specialChars.CLEAR); + if (isInteractive) { + outputStream.write(specialChars.CLEAR); + } preRunMessagePrint(outputStream); isRunning = true; const configs = contexts.map(context => context.config); diff --git a/packages/jest-each/src/bind.ts b/packages/jest-each/src/bind.ts index c6003c8819..91c7cd706f 100644 --- a/packages/jest-each/src/bind.ts +++ b/packages/jest-each/src/bind.ts @@ -52,18 +52,20 @@ export default function bind( : buildTemplateTests(title, table, taggedTemplateData); for (const row of tests) { - needsEachError - ? cb( - row.title, - applyArguments(supportsDone, row.arguments, test), - timeout, - errorWithStack, - ) - : cb( - row.title, - applyArguments(supportsDone, row.arguments, test), - timeout, - ); + if (needsEachError) { + cb( + row.title, + applyArguments(supportsDone, row.arguments, test), + timeout, + errorWithStack, + ); + } else { + cb( + row.title, + applyArguments(supportsDone, row.arguments, test), + timeout, + ); + } } return; diff --git a/packages/jest-haste-map/src/watchers/FSEventsWatcher.ts b/packages/jest-haste-map/src/watchers/FSEventsWatcher.ts index fd3fbbdc83..bc8e0a711b 100644 --- a/packages/jest-haste-map/src/watchers/FSEventsWatcher.ts +++ b/packages/jest-haste-map/src/watchers/FSEventsWatcher.ts @@ -11,7 +11,7 @@ import * as path from 'path'; import anymatch, {type Matcher} from 'anymatch'; import * as fs from 'graceful-fs'; import micromatch = require('micromatch'); -// @ts-expect-error no types +// @ts-expect-error -- no types import walker from 'walker'; // eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error, @typescript-eslint/ban-ts-comment diff --git a/packages/jest-jasmine2/src/setup_jest_globals.ts b/packages/jest-jasmine2/src/setup_jest_globals.ts index da758fff00..df0da3d855 100644 --- a/packages/jest-jasmine2/src/setup_jest_globals.ts +++ b/packages/jest-jasmine2/src/setup_jest_globals.ts @@ -79,7 +79,7 @@ const patchJasmine = () => { const onStart = attr.onStart; attr.onStart = (context: JasmineSpec) => { jestExpect.setState({currentTestName: context.getFullName()}); - onStart && onStart.call(attr, context); + onStart?.call(attr, context); }; super(attr); } diff --git a/packages/jest-matcher-utils/src/__tests__/deepCyclicCopyReplaceableDom.test.ts b/packages/jest-matcher-utils/src/__tests__/deepCyclicCopyReplaceableDom.test.ts index fc0906f91e..e4f43135bd 100644 --- a/packages/jest-matcher-utils/src/__tests__/deepCyclicCopyReplaceableDom.test.ts +++ b/packages/jest-matcher-utils/src/__tests__/deepCyclicCopyReplaceableDom.test.ts @@ -9,7 +9,7 @@ /// -/* eslint-env browser*/ +/* global document */ import deepCyclicCopyReplaceable from '../deepCyclicCopyReplaceable'; diff --git a/packages/jest-matcher-utils/src/index.ts b/packages/jest-matcher-utils/src/index.ts index e8f2a8b250..3f74440811 100644 --- a/packages/jest-matcher-utils/src/index.ts +++ b/packages/jest-matcher-utils/src/index.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually */ - import chalk = require('chalk'); import { DIFF_DELETE, diff --git a/packages/jest-message-util/src/index.ts b/packages/jest-message-util/src/index.ts index fd6efbb88e..659b37c1ff 100644 --- a/packages/jest-message-util/src/index.ts +++ b/packages/jest-message-util/src/index.ts @@ -140,7 +140,7 @@ export const formatExecError = ( const subErrors = []; if (typeof error === 'string' || !error) { - error || (error = 'EMPTY ERROR'); + error ||= 'EMPTY ERROR'; message = ''; stack = error; } else { diff --git a/packages/jest-mock/__typetests__/mock-functions.test.ts b/packages/jest-mock/__typetests__/mock-functions.test.ts index fff6feedce..4594af507d 100644 --- a/packages/jest-mock/__typetests__/mock-functions.test.ts +++ b/packages/jest-mock/__typetests__/mock-functions.test.ts @@ -86,7 +86,6 @@ describe('jest.fn()', () => { }); test('models typings of mocked function', () => { - // eslint-disable-next-line @typescript-eslint/ban-types expect(fn()).type.toBeAssignableTo(); expect(fn()).type.toBe) => unknown>>(); @@ -423,7 +422,6 @@ describe('jest.spyOn()', () => { const spy = spyOn(spiedObject, 'methodA'); test('models typings of spied object', () => { - // eslint-disable-next-line @typescript-eslint/ban-types expect(spy).type.not.toBeAssignableTo(); expect(spy()).type.toRaiseError(); @@ -469,10 +467,9 @@ describe('jest.spyOn()', () => { ).type.toBe>(); expect(spyOn(spiedArray, 'isArray')).type.toRaiseError(); - expect( - // eslint-disable-next-line @typescript-eslint/ban-types - spyOn(spiedFunction as unknown as Function, 'toString'), - ).type.toBe>(); + expect(spyOn(spiedFunction as unknown as Function, 'toString')).type.toBe< + SpiedFunction + >(); expect(spyOn(spiedFunction, 'toString')).type.toRaiseError(); expect(spyOn(globalThis, 'Date')).type.toBe>(); diff --git a/packages/jest-mock/__typetests__/utility-types.test.ts b/packages/jest-mock/__typetests__/utility-types.test.ts index c1a2c8df94..8f150ba7e7 100644 --- a/packages/jest-mock/__typetests__/utility-types.test.ts +++ b/packages/jest-mock/__typetests__/utility-types.test.ts @@ -17,6 +17,7 @@ import type { class SomeClass { propertyB = 123; private _propertyC: undefined; + // eslint-disable-next-line no-unused-private-class-members #propertyD = 'abc'; constructor(public propertyA: string) {} @@ -42,6 +43,7 @@ class IndexClass { propertyB = {b: 123}; private _propertyC = {c: undefined}; + // eslint-disable-next-line no-unused-private-class-members #propertyD = 'abc'; constructor(public propertyA: {a: string}) {} diff --git a/packages/jest-mock/src/__tests__/index.test.ts b/packages/jest-mock/src/__tests__/index.test.ts index 94b24165bb..0b03678c40 100644 --- a/packages/jest-mock/src/__tests__/index.test.ts +++ b/packages/jest-mock/src/__tests__/index.test.ts @@ -6,7 +6,7 @@ * */ -/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */ +/* eslint-disable local/prefer-rest-params-eventually */ import * as util from 'util'; import {type Context, createContext, runInContext, runInNewContext} from 'vm'; diff --git a/packages/jest-mock/src/__tests__/window-spy.test.ts b/packages/jest-mock/src/__tests__/window-spy.test.ts index c7f3cab8fe..f910efa60f 100644 --- a/packages/jest-mock/src/__tests__/window-spy.test.ts +++ b/packages/jest-mock/src/__tests__/window-spy.test.ts @@ -9,8 +9,6 @@ /// -/* eslint-env browser*/ - function exampleDispatch() { globalThis.dispatchEvent(new CustomEvent('event', {})); } diff --git a/packages/jest-mock/src/index.ts b/packages/jest-mock/src/index.ts index 92dee53036..b9582dbf87 100644 --- a/packages/jest-mock/src/index.ts +++ b/packages/jest-mock/src/index.ts @@ -7,7 +7,7 @@ /// -/* eslint-disable local/ban-types-eventually, local/prefer-rest-params-eventually */ +/* eslint-disable local/prefer-rest-params-eventually */ import {isPromise} from 'jest-util'; diff --git a/packages/jest-resolve/src/fileWalkers.ts b/packages/jest-resolve/src/fileWalkers.ts index 82ea9d6c41..bf2c964532 100644 --- a/packages/jest-resolve/src/fileWalkers.ts +++ b/packages/jest-resolve/src/fileWalkers.ts @@ -95,7 +95,6 @@ export function findClosestPackageJson(start: string): string | undefined { dir = dirname(dir); } - // eslint-disable-next-line no-constant-condition while (true) { const pkgJsonFile = resolve(dir, './package.json'); const hasPackageJson = isFile(pkgJsonFile); diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index 5a20296dd2..f88a8770eb 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -324,6 +324,7 @@ async function runTestInternal( // Access all stacks before uninstalling sourcemaps let e = error; while (typeof e === 'object' && e !== null && 'stack' in e) { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions e.stack; e = e?.cause; } diff --git a/packages/jest-runtime/src/index.ts b/packages/jest-runtime/src/index.ts index df54c27fb9..0cb14e2ad9 100644 --- a/packages/jest-runtime/src/index.ts +++ b/packages/jest-runtime/src/index.ts @@ -589,7 +589,7 @@ export default class Runtime { 'You are trying to `import` a file after the Jest environment has been torn down.', ); process.exitCode = 1; - // @ts-expect-error - exiting + // @ts-expect-error -- exiting return; } if (this.isInsideTestCode === false) { diff --git a/packages/jest-snapshot/src/index.ts b/packages/jest-snapshot/src/index.ts index c7361b2511..99f1dbf659 100644 --- a/packages/jest-snapshot/src/index.ts +++ b/packages/jest-snapshot/src/index.ts @@ -481,7 +481,7 @@ const _toThrowErrorMatchingSnapshot = ( const {context, hint, inlineSnapshot, isInline, matcherName, received} = config; - context.dontThrow && context.dontThrow(); + context.dontThrow?.(); const {isNot, promise} = context; diff --git a/packages/jest-transform/src/ScriptTransformer.ts b/packages/jest-transform/src/ScriptTransformer.ts index e2c3e4f29a..a6bff9d8c0 100644 --- a/packages/jest-transform/src/ScriptTransformer.ts +++ b/packages/jest-transform/src/ScriptTransformer.ts @@ -426,7 +426,7 @@ class ScriptTransformer { // That means that the transform has a custom instrumentation // logic and will handle it based on `config.collectCoverage` option const transformWillInstrument = - shouldCallTransform && transformer && transformer.canInstrument; + shouldCallTransform && transformer?.canInstrument; // Apply instrumentation to the code if necessary, keeping the instrumented code and new map let map = transformed.map; diff --git a/packages/jest-types/src/Global.ts b/packages/jest-types/src/Global.ts index bbd681d3cd..b54a26bfc5 100644 --- a/packages/jest-types/src/Global.ts +++ b/packages/jest-types/src/Global.ts @@ -25,7 +25,6 @@ export type GeneratorReturningTestFn = ( this: TestContext, ) => TestReturnValueGenerator; -// eslint-disable-next-line @typescript-eslint/ban-types export type NameLike = number | Function; export type TestName = string; diff --git a/packages/jest-validate/src/validate.ts b/packages/jest-validate/src/validate.ts index efdeb0f986..58392c410f 100644 --- a/packages/jest-validate/src/validate.ts +++ b/packages/jest-validate/src/validate.ts @@ -74,8 +74,7 @@ const _validate = ( ) { // skip validating unknown options inside blacklisted paths } else { - options.unknown && - options.unknown(config, exampleConfig, key, options, path); + options.unknown?.(config, exampleConfig, key, options, path); } if ( diff --git a/packages/jest-worker/src/PriorityQueue.ts b/packages/jest-worker/src/PriorityQueue.ts index 39f3a2dc05..be6f7b2ace 100644 --- a/packages/jest-worker/src/PriorityQueue.ts +++ b/packages/jest-worker/src/PriorityQueue.ts @@ -133,7 +133,6 @@ class MinHeap { nodes[0] = lastElement ?? null; const element = nodes[0]!; - // eslint-disable-next-line no-constant-condition while (true) { let swapIndex = null; const rightChildIndex = (index + 1) * 2; diff --git a/packages/jest-worker/src/workers/WorkerAbstract.ts b/packages/jest-worker/src/workers/WorkerAbstract.ts index 831a73d171..1e84e2f715 100644 --- a/packages/jest-worker/src/workers/WorkerAbstract.ts +++ b/packages/jest-worker/src/workers/WorkerAbstract.ts @@ -125,6 +125,7 @@ export default abstract class WorkerAbstract * killed off. */ protected _shutdown(): void { + // eslint-disable-next-line @typescript-eslint/no-unused-expressions this.state === WorkerStates.SHUT_DOWN; // End the permanent stream so the merged stream end too diff --git a/packages/jest-worker/src/workers/__tests__/__fixtures__/EdgeCasesWorker.js b/packages/jest-worker/src/workers/__tests__/__fixtures__/EdgeCasesWorker.js index d447c22525..99311ef7cf 100644 --- a/packages/jest-worker/src/workers/__tests__/__fixtures__/EdgeCasesWorker.js +++ b/packages/jest-worker/src/workers/__tests__/__fixtures__/EdgeCasesWorker.js @@ -20,7 +20,6 @@ async function leakMemory() { ); let i = Number.MAX_SAFE_INTEGER / 2; - // eslint-disable-next-line no-constant-condition while (true) { i++; diff --git a/packages/pretty-format/src/__tests__/DOMCollection.test.ts b/packages/pretty-format/src/__tests__/DOMCollection.test.ts index 6d501dca28..a8fd943cd0 100644 --- a/packages/pretty-format/src/__tests__/DOMCollection.test.ts +++ b/packages/pretty-format/src/__tests__/DOMCollection.test.ts @@ -9,7 +9,7 @@ /// -/* eslint-env browser*/ +/* global document */ import {plugins} from '../'; import setPrettyPrint from './setPrettyPrint'; diff --git a/packages/pretty-format/src/__tests__/DOMElement.test.ts b/packages/pretty-format/src/__tests__/DOMElement.test.ts index 8e94af1611..92079cb2f7 100644 --- a/packages/pretty-format/src/__tests__/DOMElement.test.ts +++ b/packages/pretty-format/src/__tests__/DOMElement.test.ts @@ -9,7 +9,7 @@ /// -/* eslint-env browser*/ +/* global document */ import prettyFormat, {plugins} from '../'; import setPrettyPrint from './setPrettyPrint'; diff --git a/packages/pretty-format/src/index.ts b/packages/pretty-format/src/index.ts index eeee255f95..11b35a38dd 100644 --- a/packages/pretty-format/src/index.ts +++ b/packages/pretty-format/src/index.ts @@ -5,8 +5,6 @@ * LICENSE file in the root directory of this source tree. */ -/* eslint-disable local/ban-types-eventually */ - import style = require('ansi-styles'); import { printIteratorEntries, diff --git a/scripts/lintTs.mjs b/scripts/lintTs.mjs index 01c4d353a7..90deb58477 100644 --- a/scripts/lintTs.mjs +++ b/scripts/lintTs.mjs @@ -12,7 +12,9 @@ import * as path from 'path'; import * as url from 'url'; import chalk from 'chalk'; import {ESLint} from 'eslint'; +import eslintPluginJest from 'eslint-plugin-jest'; import pLimit from 'p-limit'; +import typescriptEslint from 'typescript-eslint'; import {getPackagesWithTsConfig} from './buildUtils.mjs'; // we want to limit the number of processes we spawn @@ -83,84 +85,134 @@ try { cache: true, cacheLocation: path.resolve(packageDir, '.eslintcache'), cwd: monorepoRoot, - extensions: ['.ts'], fix, fixTypes: ['problem', 'suggestion', 'layout'], - overrideConfig: { - extends: [ - 'plugin:@typescript-eslint/recommended-type-checked', - 'plugin:@typescript-eslint/stylistic-type-checked', - ], - overrides: [ - { - files: ['**/__tests__/**'], - plugins: ['jest'], - rules: { - '@typescript-eslint/unbound-method': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - 'jest/unbound-method': 'error', + overrideConfig: typescriptEslint.config( + typescriptEslint.configs.recommendedTypeChecked, + typescriptEslint.configs.stylisticTypeChecked, + { + languageOptions: { + parserOptions: { + EXPERIMENTAL_useProjectService: true, + project: ['./tsconfig.json', `${packageDir}/tsconfig.json`], + tsconfigRootDir: monorepoRoot, }, }, - { - files: 'packages/jest-types/src/Circus.ts', - rules: { - // We're faking nominal types - '@typescript-eslint/no-duplicate-type-constituents': 'off', - // this file has `Exception`, which is `unknown` - '@typescript-eslint/no-redundant-type-constituents': 'off', - }, + rules: { + '@typescript-eslint/consistent-type-exports': 'error', + '@typescript-eslint/dot-notation': 'error', + '@typescript-eslint/no-base-to-string': [ + 'error', + // https://github.com/typescript-eslint/typescript-eslint/issues/1655#issuecomment-593639305 + {ignoredTypeNames: ['AssertionError', 'Error']}, + ], + '@typescript-eslint/no-duplicate-type-constituents': 'error', + '@typescript-eslint/no-redundant-type-constituents': 'error', + '@typescript-eslint/no-unnecessary-template-expression': + 'error', + '@typescript-eslint/non-nullable-type-assertion-style': 'error', + '@typescript-eslint/prefer-nullish-coalescing': 'error', + '@typescript-eslint/prefer-readonly': 'error', + // TODO: activate this at some point + // '@typescript-eslint/prefer-readonly-parameter-types': 'error', + '@typescript-eslint/prefer-reduce-type-parameter': 'error', + '@typescript-eslint/return-await': 'error', + '@typescript-eslint/strict-boolean-expressions': 'error', + '@typescript-eslint/switch-exhaustiveness-check': 'error', + + // TODO: enable this + '@typescript-eslint/no-explicit-any': 'off', + + // disable the ones we disable in main config + '@typescript-eslint/no-invalid-void-type': 'off', + '@typescript-eslint/no-dynamic-delete': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/consistent-type-definitions': 'off', + + // nah + '@typescript-eslint/consistent-indexed-object-style': 'off', + '@typescript-eslint/require-await': 'off', + + // TODO: enable these + '@typescript-eslint/no-require-imports': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-unsafe-return': 'off', + '@typescript-eslint/prefer-regexp-exec': 'off', }, - // { - // files: ['packages/babel-plugin-jest-hoist/src/index.ts'], - // rules: { - // '@typescript-eslint/strict-boolean-expressions': 'off', - // }, - // }, - ], - parser: '@typescript-eslint/parser', - parserOptions: { - EXPERIMENTAL_useProjectService: true, - project: ['./tsconfig.json', `${packageDir}/tsconfig.json`], - tsconfigRootDir: monorepoRoot, }, - plugins: ['@typescript-eslint'], - root: true, - rules: { - '@typescript-eslint/consistent-type-exports': 'error', - '@typescript-eslint/dot-notation': 'error', - '@typescript-eslint/no-base-to-string': [ - 'error', - // https://github.com/typescript-eslint/typescript-eslint/issues/1655#issuecomment-593639305 - {ignoredTypeNames: ['AssertionError', 'Error']}, + + { + files: ['**/__tests__/**'], + plugins: {jest: eslintPluginJest}, + rules: { + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + 'jest/unbound-method': 'error', + }, + }, + { + files: ['packages/jest-types/src/Global.ts'], + rules: { + '@typescript-eslint/no-unsafe-function-type': 'off', + }, + }, + { + files: ['packages/create-jest/src/generateConfigFile.ts'], + rules: { + '@typescript-eslint/restrict-template-expressions': 'off', + }, + }, + { + files: [ + 'packages/jest-types/src/Circus.ts', + 'packages/create-jest/src/generateConfigFile.ts', + 'packages/jest-environment-jsdom-abstract/src/index.ts', + 'packages/jest-environment/src/index.ts', + 'packages/jest-globals/src/index.ts', + 'packages/jest-test-result/src/types.ts', + 'packages/jest-test-sequencer/src/index.ts', + 'packages/jest-types/src/Circus.ts', + 'packages/jest-types/src/Config.ts', + 'packages/jest-types/src/Global.ts', + 'packages/test-globals/src/index.ts', ], - '@typescript-eslint/no-duplicate-type-constituents': 'error', - '@typescript-eslint/no-redundant-type-constituents': 'error', - '@typescript-eslint/no-useless-template-literals': 'error', - '@typescript-eslint/non-nullable-type-assertion-style': 'error', - '@typescript-eslint/prefer-nullish-coalescing': 'error', - '@typescript-eslint/prefer-readonly': 'error', - // TODO: activate this at some point - // '@typescript-eslint/prefer-readonly-parameter-types': 'error', - '@typescript-eslint/prefer-reduce-type-parameter': 'error', - '@typescript-eslint/return-await': 'error', - '@typescript-eslint/strict-boolean-expressions': 'error', - '@typescript-eslint/switch-exhaustiveness-check': 'error', - - // TODO: enable this - '@typescript-eslint/no-explicit-any': 'off', - - // disable the ones we disable in main config - '@typescript-eslint/no-invalid-void-type': 'off', - '@typescript-eslint/no-dynamic-delete': 'off', - '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/consistent-type-definitions': 'off', - - // nah - '@typescript-eslint/consistent-indexed-object-style': 'off', - '@typescript-eslint/require-await': 'off', + rules: { + // We're faking nominal types + '@typescript-eslint/no-duplicate-type-constituents': 'off', + // this file has `Exception`, which is `unknown` + '@typescript-eslint/no-redundant-type-constituents': 'off', + }, }, - }, + { + files: [ + 'packages/babel-plugin-jest-hoist/src/index.ts', + 'packages/babel-jest/src/index.ts', + 'packages/babel-plugin-jest-hoist/src/index.ts', + 'packages/packages/create-jest/src/runCreate.ts', + 'packages/babel-jest/src/index.ts', + 'packages/babel-jest/src/index.ts', + 'packages/create-jest/src/runCreate.ts', + 'packages/jest-changed-files/src/index.ts', + 'packages/jest-console/src/BufferedConsole.ts', + 'packages/jest-console/src/CustomConsole.ts', + 'packages/jest-environment-jsdom-abstract/src/index.ts', + 'packages/jest-resolve-dependencies/src/index.ts', + 'packages/jest-test-result/src/formatTestResults.ts', + 'packages/jest-test-result/src/helpers.ts', + 'packages/jest-test-sequencer/src/index.ts', + 'packages/jest-transform/src/ScriptTransformer.ts', + 'packages/jest-transform/src/shouldInstrument.ts', + ], + rules: { + '@typescript-eslint/strict-boolean-expressions': 'off', + }, + }, + {ignores: ['**/*.js', '**/*.cjs', '**/*.mjs']}, + ), }); const filesToLint = packageDir.endsWith('e2e') diff --git a/yarn.lock b/yarn.lock index 883b24fe45..5d52ce6644 100644 --- a/yarn.lock +++ b/yarn.lock @@ -563,7 +563,7 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.7, @babel/helper-validator-identifier@npm:^7.25.9": +"@babel/helper-validator-identifier@npm:^7.25.9": version: 7.25.9 resolution: "@babel/helper-validator-identifier@npm:7.25.9" checksum: 5b85918cb1a92a7f3f508ea02699e8d2422fe17ea8e82acd445006c0ef7520fbf48e3dbcdaf7b0a1d571fc3a2715a29719e5226636cb6042e15fe6ed2a590944 @@ -3302,7 +3302,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-plugin-eslint-comments@npm:^4.0.0": +"@eslint-community/eslint-plugin-eslint-comments@npm:^4.4.1": version: 4.4.1 resolution: "@eslint-community/eslint-plugin-eslint-comments@npm:4.4.1" dependencies: @@ -3314,7 +3314,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": +"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0, @eslint-community/eslint-utils@npm:^4.4.1": version: 4.4.1 resolution: "@eslint-community/eslint-utils@npm:4.4.1" dependencies: @@ -3325,34 +3325,71 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.5.1, @eslint-community/regexpp@npm:^4.6.1": +"@eslint-community/regexpp@npm:^4.10.0, @eslint-community/regexpp@npm:^4.12.1": version: 4.12.1 resolution: "@eslint-community/regexpp@npm:4.12.1" checksum: 0d628680e204bc316d545b4993d3658427ca404ae646ce541fcc65306b8c712c340e5e573e30fb9f85f4855c0c5f6dca9868931f2fcced06417fbe1a0c6cd2d6 languageName: node linkType: hard -"@eslint/eslintrc@npm:^2.1.4": - version: 2.1.4 - resolution: "@eslint/eslintrc@npm:2.1.4" +"@eslint/config-array@npm:^0.19.2": + version: 0.19.2 + resolution: "@eslint/config-array@npm:0.19.2" + dependencies: + "@eslint/object-schema": ^2.1.6 + debug: ^4.3.1 + minimatch: ^3.1.2 + checksum: 1c707e04fc2951079b32d2cb1c939ce25e863cd1329c1bd363a285b2a5caaaf88b97ddbf354cc46d1334097dc749f79b0fae33151dc2dfb9a60ba14288c65b39 + languageName: node + linkType: hard + +"@eslint/core@npm:^0.12.0": + version: 0.12.0 + resolution: "@eslint/core@npm:0.12.0" + dependencies: + "@types/json-schema": ^7.0.15 + checksum: 3979af324102a3af2742060360563ba6b9525b8e1e524ad3d3e31e65af27db554b61d1cdfeaa42e15fb7d9ce9097c44225fd9e4f8193576accc1772457b88c12 + languageName: node + linkType: hard + +"@eslint/eslintrc@npm:^3.3.0": + version: 3.3.0 + resolution: "@eslint/eslintrc@npm:3.3.0" dependencies: ajv: ^6.12.4 debug: ^4.3.2 - espree: ^9.6.0 - globals: ^13.19.0 + espree: ^10.0.1 + globals: ^14.0.0 ignore: ^5.2.0 import-fresh: ^3.2.1 js-yaml: ^4.1.0 minimatch: ^3.1.2 strip-json-comments: ^3.1.1 - checksum: 10957c7592b20ca0089262d8c2a8accbad14b4f6507e35416c32ee6b4dbf9cad67dfb77096bbd405405e9ada2b107f3797fe94362e1c55e0b09d6e90dd149127 + checksum: 1d8a4205c2db0c46dee8251800725f6c7dfd0b1594813ddcc41f2091a53223cd78334a6664efe348118cc0963c1176d4fa873b1673c853fc76031aaa1fc49b98 languageName: node linkType: hard -"@eslint/js@npm:8.57.1": - version: 8.57.1 - resolution: "@eslint/js@npm:8.57.1" - checksum: 2afb77454c06e8316793d2e8e79a0154854d35e6782a1217da274ca60b5044d2c69d6091155234ed0551a1e408f86f09dd4ece02752c59568fa403e60611e880 +"@eslint/js@npm:9.21.0, @eslint/js@npm:^9.21.0": + version: 9.21.0 + resolution: "@eslint/js@npm:9.21.0" + checksum: 238cf810270a13ada3db5fcc05b8031bef8a56186f795f45f1c5b89f5ae1e86240622cd5c39ae4444f34670b4896ebc8ab8e868050d174755bb4caba59c4b8d5 + languageName: node + linkType: hard + +"@eslint/object-schema@npm:^2.1.6": + version: 2.1.6 + resolution: "@eslint/object-schema@npm:2.1.6" + checksum: e32e565319f6544d36d3fa69a3e163120722d12d666d1a4525c9a6f02e9b54c29d9b1f03139e25d7e759e08dda8da433590bc23c09db8d511162157ef1b86a4c + languageName: node + linkType: hard + +"@eslint/plugin-kit@npm:^0.2.7": + version: 0.2.7 + resolution: "@eslint/plugin-kit@npm:0.2.7" + dependencies: + "@eslint/core": ^0.12.0 + levn: ^0.4.1 + checksum: e5d9be6ae54c7abd4605025e5831ac16dd0636ac5d41fbfcd8898a5d29711a2fb1fc8c784aa68a1469e66c8d41965da70d7a7516f9c2bca1c84342dd344bbb8e languageName: node linkType: hard @@ -3399,14 +3436,20 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.13.0": - version: 0.13.0 - resolution: "@humanwhocodes/config-array@npm:0.13.0" +"@humanfs/core@npm:^0.19.1": + version: 0.19.1 + resolution: "@humanfs/core@npm:0.19.1" + checksum: 611e0545146f55ddfdd5c20239cfb7911f9d0e28258787c4fc1a1f6214250830c9367aaaeace0096ed90b6739bee1e9c52ad5ba8adaf74ab8b449119303babfe + languageName: node + linkType: hard + +"@humanfs/node@npm:^0.16.6": + version: 0.16.6 + resolution: "@humanfs/node@npm:0.16.6" dependencies: - "@humanwhocodes/object-schema": ^2.0.3 - debug: ^4.3.1 - minimatch: ^3.0.5 - checksum: eae69ff9134025dd2924f0b430eb324981494be26f0fddd267a33c28711c4db643242cf9fddf7dadb9d16c96b54b2d2c073e60a56477df86e0173149313bd5d6 + "@humanfs/core": ^0.19.1 + "@humanwhocodes/retry": ^0.3.0 + checksum: f9cb52bb235f8b9c6fcff43a7e500669a38f8d6ce26593404a9b56365a1644e0ed60c720dc65ff6a696b1f85f3563ab055bb554ec8674f2559085ba840e47710 languageName: node linkType: hard @@ -3417,10 +3460,17 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/object-schema@npm:^2.0.3": - version: 2.0.3 - resolution: "@humanwhocodes/object-schema@npm:2.0.3" - checksum: d3b78f6c5831888c6ecc899df0d03bcc25d46f3ad26a11d7ea52944dc36a35ef543fad965322174238d677a43d5c694434f6607532cff7077062513ad7022631 +"@humanwhocodes/retry@npm:^0.3.0": + version: 0.3.1 + resolution: "@humanwhocodes/retry@npm:0.3.1" + checksum: 7e5517bb51dbea3e02ab6cacef59a8f4b0ca023fc4b0b8cbc40de0ad29f46edd50b897c6e7fba79366a0217e3f48e2da8975056f6c35cfe19d9cc48f1d03c1dd + languageName: node + linkType: hard + +"@humanwhocodes/retry@npm:^0.4.2": + version: 0.4.2 + resolution: "@humanwhocodes/retry@npm:0.4.2" + checksum: 764127449a9f97d807b9c47f898fce8d7e0e8e8438366116b9ddcaacded99b2c285b8eed2cfdd5fdcb68be47728218db949f9618a58c0d3898d9fd14a6d6671e languageName: node linkType: hard @@ -3741,7 +3791,8 @@ __metadata: "@babel/preset-typescript": ^7.0.0 "@babel/register": ^7.0.0 "@crowdin/cli": ^4.0.0 - "@eslint-community/eslint-plugin-eslint-comments": ^4.0.0 + "@eslint-community/eslint-plugin-eslint-comments": ^4.4.1 + "@eslint/js": ^9.21.0 "@jest/globals": "workspace:*" "@jest/test-utils": "workspace:*" "@lerna-lite/cli": ^3.0.0 @@ -3753,8 +3804,6 @@ __metadata: "@types/babel__template": ^7.0.2 "@types/node": ^16.10.0 "@types/which": ^3.0.0 - "@typescript-eslint/eslint-plugin": ^6.6.0 - "@typescript-eslint/parser": ^6.6.0 ansi-regex: ^5.0.1 ansi-styles: ^5.0.0 babel-jest: "workspace:*" @@ -3762,20 +3811,20 @@ __metadata: camelcase: ^6.2.0 chalk: ^4.0.0 dedent: ^1.0.0 - eslint: ^8.8.0 - eslint-config-prettier: ^10.0.0 - eslint-import-resolver-typescript: ^3.2.5 - eslint-plugin-import: ^2.6.0 - eslint-plugin-jest: ^28.0.0 + eslint: ^9.21.0 + eslint-config-prettier: ^10.0.2 + eslint-import-resolver-typescript: ^3.8.3 + eslint-plugin-import: ^2.31.0 + eslint-plugin-jest: ^28.11.0 eslint-plugin-jsdoc: ^50.0.0 - eslint-plugin-local: "link:./.eslintplugin" - eslint-plugin-markdown: ^3.0.0 - eslint-plugin-prettier: ^5.0.0 - eslint-plugin-promise: ^6.1.1 - eslint-plugin-unicorn: ^56.0.0 + eslint-plugin-markdown: ^5.1.0 + eslint-plugin-prettier: ^5.2.3 + eslint-plugin-promise: ^7.2.1 + eslint-plugin-unicorn: ^57.0.0 execa: ^5.0.0 find-process: ^1.4.1 glob: ^10.3.10 + globals: ^16.0.0 graceful-fs: ^4.2.9 isbinaryfile: ^5.0.0 istanbul-lib-coverage: ^3.0.0 @@ -3811,6 +3860,7 @@ __metadata: ts-node: ^10.5.0 tstyche: ^3.0.0 typescript: ^5.0.4 + typescript-eslint: ^8.26.0 webpack: ^5.68.0 webpack-node-externals: ^3.0.0 which: ^4.0.0 @@ -4404,7 +4454,7 @@ __metadata: languageName: node linkType: hard -"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": +"@nodelib/fs.walk@npm:^1.2.3": version: 1.2.8 resolution: "@nodelib/fs.walk@npm:1.2.8" dependencies: @@ -5953,7 +6003,7 @@ __metadata: languageName: node linkType: hard -"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.12, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": +"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.15, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9": version: 7.0.15 resolution: "@types/json-schema@npm:7.0.15" checksum: 97ed0cb44d4070aecea772b7b2e2ed971e10c81ec87dd4ecc160322ffa55ff330dace1793489540e3e318d90942064bb697cc0f8989391797792d919737b3b98 @@ -6235,7 +6285,7 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7.1.0, @types/semver@npm:^7.5.0": +"@types/semver@npm:^7.1.0": version: 7.5.8 resolution: "@types/semver@npm:7.5.8" checksum: ea6f5276f5b84c55921785a3a27a3cd37afee0111dfe2bcb3e03c31819c197c782598f17f0b150a69d453c9584cd14c4c4d7b9a55d2c5e6cacd4d66fdb3b3663 @@ -6396,186 +6446,115 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^6.6.0": - version: 6.21.0 - resolution: "@typescript-eslint/eslint-plugin@npm:6.21.0" +"@typescript-eslint/eslint-plugin@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.26.0" dependencies: - "@eslint-community/regexpp": ^4.5.1 - "@typescript-eslint/scope-manager": 6.21.0 - "@typescript-eslint/type-utils": 6.21.0 - "@typescript-eslint/utils": 6.21.0 - "@typescript-eslint/visitor-keys": 6.21.0 - debug: ^4.3.4 + "@eslint-community/regexpp": ^4.10.0 + "@typescript-eslint/scope-manager": 8.26.0 + "@typescript-eslint/type-utils": 8.26.0 + "@typescript-eslint/utils": 8.26.0 + "@typescript-eslint/visitor-keys": 8.26.0 graphemer: ^1.4.0 - ignore: ^5.2.4 + ignore: ^5.3.1 natural-compare: ^1.4.0 - semver: ^7.5.4 - ts-api-utils: ^1.0.1 + ts-api-utils: ^2.0.1 peerDependencies: - "@typescript-eslint/parser": ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 5ef2c502255e643e98051e87eb682c2a257e87afd8ec3b9f6274277615e1c2caf3131b352244cfb1987b8b2c415645eeacb9113fa841fc4c9b2ac46e8aed6efd + "@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: fbfc0e65b928ce37d51cc95d78061a752b8c2fb43e91a9c34ebf44b13e4cd5a0778f9aad9b67f6dd9dc98d9d35c41686fcf4b50e9b58bfa738639cdd71016303 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.6.0": - version: 6.21.0 - resolution: "@typescript-eslint/parser@npm:6.21.0" +"@typescript-eslint/parser@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/parser@npm:8.26.0" dependencies: - "@typescript-eslint/scope-manager": 6.21.0 - "@typescript-eslint/types": 6.21.0 - "@typescript-eslint/typescript-estree": 6.21.0 - "@typescript-eslint/visitor-keys": 6.21.0 + "@typescript-eslint/scope-manager": 8.26.0 + "@typescript-eslint/types": 8.26.0 + "@typescript-eslint/typescript-estree": 8.26.0 + "@typescript-eslint/visitor-keys": 8.26.0 debug: ^4.3.4 peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 162fe3a867eeeffda7328bce32dae45b52283c68c8cb23258fb9f44971f761991af61f71b8c9fe1aa389e93dfe6386f8509c1273d870736c507d76dd40647b68 + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 6d8a8fcca1ff823cff4a7a6ac60bd079a0ff7261f907b19eb209d7df172bc484616a826db7f501f6a2e1fa501b5735b356cb5a1053839e26b97df58d860bd739 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/scope-manager@npm:6.21.0" +"@typescript-eslint/scope-manager@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/scope-manager@npm:8.26.0" dependencies: - "@typescript-eslint/types": 6.21.0 - "@typescript-eslint/visitor-keys": 6.21.0 - checksum: 71028b757da9694528c4c3294a96cc80bc7d396e383a405eab3bc224cda7341b88e0fc292120b35d3f31f47beac69f7083196c70616434072fbcd3d3e62d3376 + "@typescript-eslint/types": 8.26.0 + "@typescript-eslint/visitor-keys": 8.26.0 + checksum: b1d35e8b4ef8f20ee32c373b6206883253d724b07373462a9532160a46f1c125c3d08fe112c22a990f3eb010218bad851d8ee5e7834ebc046e40e2a4ec05ea59 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:8.20.0": - version: 8.20.0 - resolution: "@typescript-eslint/scope-manager@npm:8.20.0" +"@typescript-eslint/type-utils@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/type-utils@npm:8.26.0" dependencies: - "@typescript-eslint/types": 8.20.0 - "@typescript-eslint/visitor-keys": 8.20.0 - checksum: d90d89f3dc8394e44652526b88c81a977b251702a9dc5be89ac0bf7412d79d18879e03c2d6018980a09bc7c50d28dbf91ba06e056e081e6000783d69bd280761 - languageName: node - linkType: hard - -"@typescript-eslint/type-utils@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/type-utils@npm:6.21.0" - dependencies: - "@typescript-eslint/typescript-estree": 6.21.0 - "@typescript-eslint/utils": 6.21.0 + "@typescript-eslint/typescript-estree": 8.26.0 + "@typescript-eslint/utils": 8.26.0 debug: ^4.3.4 - ts-api-utils: ^1.0.1 + ts-api-utils: ^2.0.1 peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 77025473f4d80acf1fafcce99c5c283e557686a61861febeba9c9913331f8a41e930bf5cd8b7a54db502a57b6eb8ea6d155cbd4f41349ed00e3d7aeb1f477ddc + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: eab175e5be4b6fbb260a0ecc15e72f7ab04b796d53c114481105591f3ef07e651f5242ca91bf4d497090a445471fc04509774073dbb06f5ad39c5623a564cd66 languageName: node linkType: hard -"@typescript-eslint/types@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/types@npm:6.21.0" - checksum: 9501b47d7403417af95fc1fb72b2038c5ac46feac0e1598a46bcb43e56a606c387e9dcd8a2a0abe174c91b509f2d2a8078b093786219eb9a01ab2fbf9ee7b684 +"@typescript-eslint/types@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/types@npm:8.26.0" + checksum: dea8535575d5bbc5f4d9b5a677a098e356db550b833e9c9a84204337c0a4302be3c328baa417b9cabdd4f6f4feb4921304f610e23cc31a9ab6faae9a8b921b5f languageName: node linkType: hard -"@typescript-eslint/types@npm:8.20.0": - version: 8.20.0 - resolution: "@typescript-eslint/types@npm:8.20.0" - checksum: 4cb0af48411f282db33e7110e2f97de874c637e7b90ded91b77304e96f49663ca4b7308afc569bdd93766fe5f2c194686e32078d5513b5ba4e7d56191998190c - languageName: node - linkType: hard - -"@typescript-eslint/typescript-estree@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.21.0" +"@typescript-eslint/typescript-estree@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.26.0" dependencies: - "@typescript-eslint/types": 6.21.0 - "@typescript-eslint/visitor-keys": 6.21.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - minimatch: 9.0.3 - semver: ^7.5.4 - ts-api-utils: ^1.0.1 - peerDependenciesMeta: - typescript: - optional: true - checksum: dec02dc107c4a541e14fb0c96148f3764b92117c3b635db3a577b5a56fc48df7a556fa853fb82b07c0663b4bf2c484c9f245c28ba3e17e5cb0918ea4cab2ea21 - languageName: node - linkType: hard - -"@typescript-eslint/typescript-estree@npm:8.20.0": - version: 8.20.0 - resolution: "@typescript-eslint/typescript-estree@npm:8.20.0" - dependencies: - "@typescript-eslint/types": 8.20.0 - "@typescript-eslint/visitor-keys": 8.20.0 + "@typescript-eslint/types": 8.26.0 + "@typescript-eslint/visitor-keys": 8.26.0 debug: ^4.3.4 fast-glob: ^3.3.2 is-glob: ^4.0.3 minimatch: ^9.0.4 semver: ^7.6.0 - ts-api-utils: ^2.0.0 + ts-api-utils: ^2.0.1 peerDependencies: - typescript: ">=4.8.4 <5.8.0" - checksum: 9690df2d4ec90966b8d5752ad0f1658a951fe76ea3cae8e6935e698715a25c1eb0b118fa8e044065f04ea9f6bef41d991de5298590ef2a4aa98d435bf1df6e15 + typescript: ">=4.8.4 <5.9.0" + checksum: 492ad542c1105111f67d83a3fa1acf9353d491dee059cc81890cd4c2bec58c7bfa6b6fdd1b3909d4b3be54044d7912f0c3d78a7d21dd2b902b99e79b5e33af6e languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/utils@npm:6.21.0" +"@typescript-eslint/utils@npm:8.26.0, @typescript-eslint/utils@npm:^6.0.0 || ^7.0.0 || ^8.0.0": + version: 8.26.0 + resolution: "@typescript-eslint/utils@npm:8.26.0" dependencies: "@eslint-community/eslint-utils": ^4.4.0 - "@types/json-schema": ^7.0.12 - "@types/semver": ^7.5.0 - "@typescript-eslint/scope-manager": 6.21.0 - "@typescript-eslint/types": 6.21.0 - "@typescript-eslint/typescript-estree": 6.21.0 - semver: ^7.5.4 - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - checksum: b129b3a4aebec8468259f4589985cb59ea808afbfdb9c54f02fad11e17d185e2bf72bb332f7c36ec3c09b31f18fc41368678b076323e6e019d06f74ee93f7bf2 - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:^6.0.0 || ^7.0.0 || ^8.0.0": - version: 8.20.0 - resolution: "@typescript-eslint/utils@npm:8.20.0" - dependencies: - "@eslint-community/eslint-utils": ^4.4.0 - "@typescript-eslint/scope-manager": 8.20.0 - "@typescript-eslint/types": 8.20.0 - "@typescript-eslint/typescript-estree": 8.20.0 + "@typescript-eslint/scope-manager": 8.26.0 + "@typescript-eslint/types": 8.26.0 + "@typescript-eslint/typescript-estree": 8.26.0 peerDependencies: eslint: ^8.57.0 || ^9.0.0 - typescript: ">=4.8.4 <5.8.0" - checksum: 5c9d72eb0d4014e41de1faa4597371f19362ce47a491359be408bfba899277f8d5660f014651f7bd41435158ae4655ade205e92f175e2355ca51a07af35a53ed + typescript: ">=4.8.4 <5.9.0" + checksum: 6bb6e7c9bd532b09d4776cfc8fd94876cd8ff5698642993ea5b900d5202d73b958483e75e8066b9ad57382ef697f48188d219425695f50b3d92b774aefbb492e languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.21.0": - version: 6.21.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.21.0" +"@typescript-eslint/visitor-keys@npm:8.26.0": + version: 8.26.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.26.0" dependencies: - "@typescript-eslint/types": 6.21.0 - eslint-visitor-keys: ^3.4.1 - checksum: 67c7e6003d5af042d8703d11538fca9d76899f0119130b373402819ae43f0bc90d18656aa7add25a24427ccf1a0efd0804157ba83b0d4e145f06107d7d1b7433 - languageName: node - linkType: hard - -"@typescript-eslint/visitor-keys@npm:8.20.0": - version: 8.20.0 - resolution: "@typescript-eslint/visitor-keys@npm:8.20.0" - dependencies: - "@typescript-eslint/types": 8.20.0 + "@typescript-eslint/types": 8.26.0 eslint-visitor-keys: ^4.2.0 - checksum: d0bf89e431a686197c517fbb7d63ce4c8ef31e6629a545fd08198c67810ddd68c047c01fcfed8ffc3fe438654a2647b3dedf28f04beac23a65614b2e788d929a + checksum: 4209794bbdecbebb4105b00d42794bec30cffc2f4e6e6fd91b0be42fd97c73374c43ad2bb4ff1f7dcf97f7edde52b6137b8f98eb720d84f10ec03925fc5104c2 languageName: node linkType: hard @@ -6814,7 +6793,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.11.0, acorn@npm:^8.14.0, acorn@npm:^8.4.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0": +"acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.11.0, acorn@npm:^8.14.0, acorn@npm:^8.4.1, acorn@npm:^8.8.2": version: 8.14.0 resolution: "acorn@npm:8.14.0" bin: @@ -7737,7 +7716,7 @@ __metadata: languageName: node linkType: hard -"browserslist@npm:^4.0.0, browserslist@npm:^4.18.1, browserslist@npm:^4.23.0, browserslist@npm:^4.23.1, browserslist@npm:^4.23.3, browserslist@npm:^4.24.0, browserslist@npm:^4.24.3": +"browserslist@npm:^4.0.0, browserslist@npm:^4.18.1, browserslist@npm:^4.23.0, browserslist@npm:^4.23.1, browserslist@npm:^4.23.3, browserslist@npm:^4.24.0, browserslist@npm:^4.24.4": version: 4.24.4 resolution: "browserslist@npm:4.24.4" dependencies: @@ -7774,10 +7753,10 @@ __metadata: languageName: node linkType: hard -"builtin-modules@npm:^3.3.0": - version: 3.3.0 - resolution: "builtin-modules@npm:3.3.0" - checksum: db021755d7ed8be048f25668fe2117620861ef6703ea2c65ed2779c9e3636d5c3b82325bd912244293959ff3ae303afa3471f6a15bf5060c103e4cc3a839749d +"builtin-modules@npm:^4.0.0": + version: 4.0.0 + resolution: "builtin-modules@npm:4.0.0" + checksum: cea28dd8fa3060d39bee0f3e9f141987ac99d2dd7913c2fa15eb34a98372399f3be3b1bf1f849790ecad602d52e57d45a9c54bcde28c0bbf25bfe947ca8ffe55 languageName: node linkType: hard @@ -8718,12 +8697,12 @@ __metadata: languageName: node linkType: hard -"core-js-compat@npm:^3.38.0, core-js-compat@npm:^3.38.1": - version: 3.40.0 - resolution: "core-js-compat@npm:3.40.0" +"core-js-compat@npm:^3.38.0, core-js-compat@npm:^3.38.1, core-js-compat@npm:^3.40.0": + version: 3.41.0 + resolution: "core-js-compat@npm:3.41.0" dependencies: - browserslist: ^4.24.3 - checksum: 7ad00607c481ab2ded13d72be9ca5db5bbf42e221a175e905fb425e1ef520864aea28736c7283f57e9552d570eb6204bed87fbc8b9eab0fcfd9a7830dacccd43 + browserslist: ^4.24.4 + checksum: 060f6d6ede3a5f201462ae6f54975ca4eefdb731c4983950c54bc81411fc1c2865a9e916091d034b5229d4dcb79e0f5f8aeda5eeb7a31d940550a5c14e8e8729 languageName: node linkType: hard @@ -8841,7 +8820,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.3, cross-spawn@npm:^7.0.6": version: 7.0.6 resolution: "cross-spawn@npm:7.0.6" dependencies: @@ -9540,15 +9519,6 @@ __metadata: languageName: node linkType: hard -"doctrine@npm:^3.0.0": - version: 3.0.0 - resolution: "doctrine@npm:3.0.0" - dependencies: - esutils: ^2.0.2 - checksum: fd7673ca77fe26cd5cba38d816bc72d641f500f1f9b25b83e8ce28827fe2da7ad583a8da26ab6af85f834138cf8dae9f69b0cd6ab925f52ddab1754db44d99ce - languageName: node - linkType: hard - "docusaurus-remark-plugin-tab-blocks@npm:^3.0.0": version: 3.1.0 resolution: "docusaurus-remark-plugin-tab-blocks@npm:3.1.0" @@ -10185,14 +10155,14 @@ __metadata: languageName: node linkType: hard -"eslint-config-prettier@npm:^10.0.0": - version: 10.0.1 - resolution: "eslint-config-prettier@npm:10.0.1" +"eslint-config-prettier@npm:^10.0.2": + version: 10.0.2 + resolution: "eslint-config-prettier@npm:10.0.2" peerDependencies: eslint: ">=7.0.0" bin: eslint-config-prettier: build/bin/cli.js - checksum: f827d9b0df5e088bb22c938e59bd4ade4df756ae73b13150652dcc64ee3b6b81d06f53baa47a51b4a44e3ece19e3a5357b79d01e5048fd7667af332dcca8473e + checksum: 76c30d85b29320c631aafe7e10fa4d065c574d3e5491f7f9c888bfc1351e9ded6b0e0821c4d7b8f49e86b056206c91fb2f5d4b30c8f2c57a6c44fdafa75716c8 languageName: node linkType: hard @@ -10207,18 +10177,17 @@ __metadata: languageName: node linkType: hard -"eslint-import-resolver-typescript@npm:^3.2.5": - version: 3.7.0 - resolution: "eslint-import-resolver-typescript@npm:3.7.0" +"eslint-import-resolver-typescript@npm:^3.8.3": + version: 3.8.3 + resolution: "eslint-import-resolver-typescript@npm:3.8.3" dependencies: "@nolyfill/is-core-module": 1.0.39 debug: ^4.3.7 enhanced-resolve: ^5.15.0 - fast-glob: ^3.3.2 - get-tsconfig: ^4.7.5 + get-tsconfig: ^4.10.0 is-bun-module: ^1.0.2 - is-glob: ^4.0.3 stable-hash: ^0.0.4 + tinyglobby: ^0.2.12 peerDependencies: eslint: "*" eslint-plugin-import: "*" @@ -10228,7 +10197,7 @@ __metadata: optional: true eslint-plugin-import-x: optional: true - checksum: e24659fbd91957c9db8de72243a6ffcf891ffd1175bca54d6993a9ddecc352e76d512c7ee22a48ae7d3ec1ae4c492fd2ab649cde636a993f4a42bf4d1ae4d34a + checksum: 5d26f0147905a96428955ea2e88a16c0ba7cebb44a006b8fe5ea3d6c0d3046a0c55ce69407705d617f3d50d00110ed4fab11bcdb982fbfa53af646bf44b7292d languageName: node linkType: hard @@ -10244,7 +10213,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:^2.6.0": +"eslint-plugin-import@npm:^2.31.0": version: 2.31.0 resolution: "eslint-plugin-import@npm:2.31.0" dependencies: @@ -10273,7 +10242,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-jest@npm:^28.0.0": +"eslint-plugin-jest@npm:^28.11.0": version: 28.11.0 resolution: "eslint-plugin-jest@npm:28.11.0" dependencies: @@ -10312,24 +10281,18 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-local@link:./.eslintplugin::locator=%40jest%2Fmonorepo%40workspace%3A.": - version: 0.0.0-use.local - resolution: "eslint-plugin-local@link:./.eslintplugin::locator=%40jest%2Fmonorepo%40workspace%3A." - languageName: node - linkType: soft - -"eslint-plugin-markdown@npm:^3.0.0": - version: 3.0.1 - resolution: "eslint-plugin-markdown@npm:3.0.1" +"eslint-plugin-markdown@npm:^5.1.0": + version: 5.1.0 + resolution: "eslint-plugin-markdown@npm:5.1.0" dependencies: mdast-util-from-markdown: ^0.8.5 peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 91233d35777517a290377233eecbdbbe17d583f40b11b9adf371d051a98012ad6b540967aae59c2786fb8b66aa7c1abb27108947034b1f0f3e0df1c8aae9f2e7 + eslint: ">=8" + checksum: 3fa9a8dcc4a8868ca3e831c19c45465ce09fc6135d6f8ffea58805768df7a26d339905c677967a7867686c2511063f5f2abf5f5b9c1edd3b69af51a5422b03dd languageName: node linkType: hard -"eslint-plugin-prettier@npm:^5.0.0": +"eslint-plugin-prettier@npm:^5.2.3": version: 5.2.3 resolution: "eslint-plugin-prettier@npm:5.2.3" dependencies: @@ -10349,38 +10312,40 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-promise@npm:^6.1.1": - version: 6.6.0 - resolution: "eslint-plugin-promise@npm:6.6.0" +"eslint-plugin-promise@npm:^7.2.1": + version: 7.2.1 + resolution: "eslint-plugin-promise@npm:7.2.1" + dependencies: + "@eslint-community/eslint-utils": ^4.4.0 peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: 5098fbf38585ad411737c389c462df72b11a7db2f0241eca23cf990e5535a2de3fac7fb24258c3e6bf05433ef2a59425ec1ca1cef456360614eb7cdbfefcec66 + checksum: 9101a93efd79f5202d0239d7666935c1d5655f64f4527cea6e82e1438b4de4304351de60f2c26201289a22eed1da4b3a21e7996fa3268b9943b98d12c80b2030 languageName: node linkType: hard -"eslint-plugin-unicorn@npm:^56.0.0": - version: 56.0.1 - resolution: "eslint-plugin-unicorn@npm:56.0.1" +"eslint-plugin-unicorn@npm:^57.0.0": + version: 57.0.0 + resolution: "eslint-plugin-unicorn@npm:57.0.0" dependencies: - "@babel/helper-validator-identifier": ^7.24.7 - "@eslint-community/eslint-utils": ^4.4.0 - ci-info: ^4.0.0 + "@babel/helper-validator-identifier": ^7.25.9 + "@eslint-community/eslint-utils": ^4.4.1 + ci-info: ^4.1.0 clean-regexp: ^1.0.0 - core-js-compat: ^3.38.1 + core-js-compat: ^3.40.0 esquery: ^1.6.0 - globals: ^15.9.0 - indent-string: ^4.0.0 - is-builtin-module: ^3.2.1 - jsesc: ^3.0.2 + globals: ^15.15.0 + indent-string: ^5.0.0 + is-builtin-module: ^4.0.0 + jsesc: ^3.1.0 pluralize: ^8.0.0 - read-pkg-up: ^7.0.1 + read-package-up: ^11.0.0 regexp-tree: ^0.1.27 - regjsparser: ^0.10.0 - semver: ^7.6.3 - strip-indent: ^3.0.0 + regjsparser: ^0.12.0 + semver: ^7.7.1 + strip-indent: ^4.0.0 peerDependencies: - eslint: ">=8.56.0" - checksum: 2c27f46beb1c2681749cc2591508c9904aa02de6147cc41fa06e602763d2dbe4a9587f13a8c1dcd870a85c6ddcdaa803d3fcce0e3551435afa28fd266365ada7 + eslint: ">=9.20.0" + checksum: bc4a3ef348f6a7bed5bef885ef2ef4c887a4b4cd62446708e17bf0d90ef87dd8db4a3e13e3df4fffcb4640a05f0a1f8e2ff67aee85a5d8b47d09278f77b94da8 languageName: node linkType: hard @@ -10394,17 +10359,17 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^7.2.2": - version: 7.2.2 - resolution: "eslint-scope@npm:7.2.2" +"eslint-scope@npm:^8.2.0": + version: 8.2.0 + resolution: "eslint-scope@npm:8.2.0" dependencies: esrecurse: ^4.3.0 estraverse: ^5.2.0 - checksum: ec97dbf5fb04b94e8f4c5a91a7f0a6dd3c55e46bfc7bbcd0e3138c3a76977570e02ed89a1810c778dcd72072ff0e9621ba1379b4babe53921d71e2e4486fda3e + checksum: 750eff4672ca2bf274ec0d1bbeae08aadd53c1907d5c6aff5564d8e047a5f49afa8ae6eee333cab637fd3ebcab2141659d8f2f040f6fdc982b0f61f8bf03136f languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.4.1, eslint-visitor-keys@npm:^3.4.3": +"eslint-visitor-keys@npm:^3.4.3": version: 3.4.3 resolution: "eslint-visitor-keys@npm:3.4.3" checksum: 36e9ef87fca698b6fd7ca5ca35d7b2b6eeaaf106572e2f7fd31c12d3bfdaccdb587bba6d3621067e5aece31c8c3a348b93922ab8f7b2cbc6aaab5e1d89040c60 @@ -10418,55 +10383,56 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.8.0": - version: 8.57.1 - resolution: "eslint@npm:8.57.1" +"eslint@npm:^9.21.0": + version: 9.21.0 + resolution: "eslint@npm:9.21.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 - "@eslint-community/regexpp": ^4.6.1 - "@eslint/eslintrc": ^2.1.4 - "@eslint/js": 8.57.1 - "@humanwhocodes/config-array": ^0.13.0 + "@eslint-community/regexpp": ^4.12.1 + "@eslint/config-array": ^0.19.2 + "@eslint/core": ^0.12.0 + "@eslint/eslintrc": ^3.3.0 + "@eslint/js": 9.21.0 + "@eslint/plugin-kit": ^0.2.7 + "@humanfs/node": ^0.16.6 "@humanwhocodes/module-importer": ^1.0.1 - "@nodelib/fs.walk": ^1.2.8 - "@ungap/structured-clone": ^1.2.0 + "@humanwhocodes/retry": ^0.4.2 + "@types/estree": ^1.0.6 + "@types/json-schema": ^7.0.15 ajv: ^6.12.4 chalk: ^4.0.0 - cross-spawn: ^7.0.2 + cross-spawn: ^7.0.6 debug: ^4.3.2 - doctrine: ^3.0.0 escape-string-regexp: ^4.0.0 - eslint-scope: ^7.2.2 - eslint-visitor-keys: ^3.4.3 - espree: ^9.6.1 - esquery: ^1.4.2 + eslint-scope: ^8.2.0 + eslint-visitor-keys: ^4.2.0 + espree: ^10.3.0 + esquery: ^1.5.0 esutils: ^2.0.2 fast-deep-equal: ^3.1.3 - file-entry-cache: ^6.0.1 + file-entry-cache: ^8.0.0 find-up: ^5.0.0 glob-parent: ^6.0.2 - globals: ^13.19.0 - graphemer: ^1.4.0 ignore: ^5.2.0 imurmurhash: ^0.1.4 is-glob: ^4.0.0 - is-path-inside: ^3.0.3 - js-yaml: ^4.1.0 json-stable-stringify-without-jsonify: ^1.0.1 - levn: ^0.4.1 lodash.merge: ^4.6.2 minimatch: ^3.1.2 natural-compare: ^1.4.0 optionator: ^0.9.3 - strip-ansi: ^6.0.1 - text-table: ^0.2.0 + peerDependencies: + jiti: "*" + peerDependenciesMeta: + jiti: + optional: true bin: eslint: bin/eslint.js - checksum: e2489bb7f86dd2011967759a09164e65744ef7688c310bc990612fc26953f34cc391872807486b15c06833bdff737726a23e9b4cdba5de144c311377dc41d91b + checksum: 83a493877fe1cda3a0c3028de6ebfbc16abc2b26decd304a4e424961fa1ba7fc4e950ed1d7c37f85f5c7053c7e1d990fd92c46c0cdd9dedbbb002076745b4ce5 languageName: node linkType: hard -"espree@npm:^10.1.0": +"espree@npm:^10.0.1, espree@npm:^10.1.0, espree@npm:^10.3.0": version: 10.3.0 resolution: "espree@npm:10.3.0" dependencies: @@ -10477,17 +10443,6 @@ __metadata: languageName: node linkType: hard -"espree@npm:^9.6.0, espree@npm:^9.6.1": - version: 9.6.1 - resolution: "espree@npm:9.6.1" - dependencies: - acorn: ^8.9.0 - acorn-jsx: ^5.3.2 - eslint-visitor-keys: ^3.4.1 - checksum: eb8c149c7a2a77b3f33a5af80c10875c3abd65450f60b8af6db1bfcfa8f101e21c1e56a561c6dc13b848e18148d43469e7cd208506238554fb5395a9ea5a1ab9 - languageName: node - linkType: hard - "esprima@npm:^4.0.0, esprima@npm:~4.0.0": version: 4.0.1 resolution: "esprima@npm:4.0.1" @@ -10498,7 +10453,7 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.4.2, esquery@npm:^1.6.0": +"esquery@npm:^1.5.0, esquery@npm:^1.6.0": version: 1.6.0 resolution: "esquery@npm:1.6.0" dependencies: @@ -11072,7 +11027,7 @@ __metadata: languageName: node linkType: hard -"fdir@npm:^6.4.2": +"fdir@npm:^6.4.3": version: 6.4.3 resolution: "fdir@npm:6.4.3" peerDependencies: @@ -11112,12 +11067,12 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^6.0.1": - version: 6.0.1 - resolution: "file-entry-cache@npm:6.0.1" +"file-entry-cache@npm:^8.0.0": + version: 8.0.0 + resolution: "file-entry-cache@npm:8.0.0" dependencies: - flat-cache: ^3.0.4 - checksum: f49701feaa6314c8127c3c2f6173cfefff17612f5ed2daaafc6da13b5c91fd43e3b2a58fd0d63f9f94478a501b167615931e7200e31485e320f74a33885a9c74 + flat-cache: ^4.0.0 + checksum: f67802d3334809048c69b3d458f672e1b6d26daefda701761c81f203b80149c35dea04d78ea4238969dd617678e530876722a0634c43031a0957f10cc3ed190f languageName: node linkType: hard @@ -11222,6 +11177,13 @@ __metadata: languageName: node linkType: hard +"find-up-simple@npm:^1.0.0": + version: 1.0.1 + resolution: "find-up-simple@npm:1.0.1" + checksum: 6e374bffda9f8425314eab47ef79752b6e77dcc95c0ad17d257aef48c32fe07bbc41bcafbd22941c25bb94fffaaaa8e178d928867d844c58100c7fe19ec82f72 + languageName: node + linkType: hard + "find-up@npm:^3.0.0": version: 3.0.0 resolution: "find-up@npm:3.0.0" @@ -11261,14 +11223,13 @@ __metadata: languageName: node linkType: hard -"flat-cache@npm:^3.0.4": - version: 3.2.0 - resolution: "flat-cache@npm:3.2.0" +"flat-cache@npm:^4.0.0": + version: 4.0.1 + resolution: "flat-cache@npm:4.0.1" dependencies: flatted: ^3.2.9 - keyv: ^4.5.3 - rimraf: ^3.0.2 - checksum: e7e0f59801e288b54bee5cb9681e9ee21ee28ef309f886b312c9d08415b79fc0f24ac842f84356ce80f47d6a53de62197ce0e6e148dc42d5db005992e2a756ec + keyv: ^4.5.4 + checksum: 899fc86bf6df093547d76e7bfaeb900824b869d7d457d02e9b8aae24836f0a99fbad79328cfd6415ee8908f180699bf259dc7614f793447cb14f707caf5996f6 languageName: node linkType: hard @@ -11628,12 +11589,12 @@ __metadata: languageName: node linkType: hard -"get-tsconfig@npm:^4.7.5": - version: 4.8.1 - resolution: "get-tsconfig@npm:4.8.1" +"get-tsconfig@npm:^4.10.0": + version: 4.10.0 + resolution: "get-tsconfig@npm:4.10.0" dependencies: resolve-pkg-maps: ^1.0.0 - checksum: 12df01672e691d2ff6db8cf7fed1ddfef90ed94a5f3d822c63c147a26742026d582acd86afcd6f65db67d809625d17dd7f9d34f4d3f38f69bc2f48e19b2bdd5b + checksum: cebf14d38ecaa9a1af25fc3f56317402a4457e7e20f30f52a0ab98b4c85962a259f75065e483824f73a1ce4a8e4926c149ead60f0619842b8cd13b94e15fbdec languageName: node linkType: hard @@ -11786,19 +11747,24 @@ __metadata: languageName: node linkType: hard -"globals@npm:^13.19.0": - version: 13.24.0 - resolution: "globals@npm:13.24.0" - dependencies: - type-fest: ^0.20.2 - checksum: 56066ef058f6867c04ff203b8a44c15b038346a62efbc3060052a1016be9f56f4cf0b2cd45b74b22b81e521a889fc7786c73691b0549c2f3a6e825b3d394f43c +"globals@npm:^14.0.0": + version: 14.0.0 + resolution: "globals@npm:14.0.0" + checksum: 534b8216736a5425737f59f6e6a5c7f386254560c9f41d24a9227d60ee3ad4a9e82c5b85def0e212e9d92162f83a92544be4c7fd4c902cb913736c10e08237ac languageName: node linkType: hard -"globals@npm:^15.9.0": - version: 15.14.0 - resolution: "globals@npm:15.14.0" - checksum: fa993433a01bf4a118904fbafbcff34db487fce83f73da75fb4a8653afc6dcd72905e6208c49bab307ff0980928273d0ecd1cfc67e1a4782dabfbd92c234ab68 +"globals@npm:^15.15.0": + version: 15.15.0 + resolution: "globals@npm:15.15.0" + checksum: a2a92199a112db00562a2f85eeef2a7e3943e171f7f7d9b17dfa9231e35fd612588f3c199d1509ab1757273467e413b08c80424cf6e399e96acdaf93deb3ee88 + languageName: node + linkType: hard + +"globals@npm:^16.0.0": + version: 16.0.0 + resolution: "globals@npm:16.0.0" + checksum: 41df1cb6f86c36dfdf8fb6c270247105c85cc3aec8d8238c5e691b0d2aad9eed8ff390d1035f4b5a27ee24bf75b095c7b84717e9d2050d2122e61f37d9c6131a languageName: node linkType: hard @@ -12573,7 +12539,7 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.2.0, ignore@npm:^5.2.4": +"ignore@npm:^5.2.0, ignore@npm:^5.2.4, ignore@npm:^5.3.1": version: 5.3.2 resolution: "ignore@npm:5.3.2" checksum: 2acfd32a573260ea522ea0bfeff880af426d68f6831f973129e2ba7363f422923cf53aab62f8369cbf4667c7b25b6f8a3761b34ecdb284ea18e87a5262a865be @@ -12658,6 +12624,13 @@ __metadata: languageName: node linkType: hard +"indent-string@npm:^5.0.0": + version: 5.0.0 + resolution: "indent-string@npm:5.0.0" + checksum: e466c27b6373440e6d84fbc19e750219ce25865cb82d578e41a6053d727e5520dc5725217d6eb1cc76005a1bb1696a0f106d84ce7ebda3033b963a38583fb3b3 + languageName: node + linkType: hard + "index-to-position@npm:^0.1.2": version: 0.1.2 resolution: "index-to-position@npm:0.1.2" @@ -12877,12 +12850,12 @@ __metadata: languageName: node linkType: hard -"is-builtin-module@npm:^3.2.1": - version: 3.2.1 - resolution: "is-builtin-module@npm:3.2.1" +"is-builtin-module@npm:^4.0.0": + version: 4.0.0 + resolution: "is-builtin-module@npm:4.0.0" dependencies: - builtin-modules: ^3.3.0 - checksum: e8f0ffc19a98240bda9c7ada84d846486365af88d14616e737d280d378695c8c448a621dcafc8332dbf0fcd0a17b0763b845400709963fa9151ddffece90ae88 + builtin-modules: ^4.0.0 + checksum: 61e31a8730cc0babfc29af52250178220f4a2cefd23c54f614e5256f0e4e37643f0eb709a92ccfd6ad84732e48e8c4d10cd9d3e29a47197598d5ad2c9c19a765 languageName: node linkType: hard @@ -13143,7 +13116,7 @@ __metadata: languageName: node linkType: hard -"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3": +"is-path-inside@npm:^3.0.2": version: 3.0.3 resolution: "is-path-inside@npm:3.0.3" checksum: abd50f06186a052b349c15e55b182326f1936c89a78bf6c8f2b707412517c097ce04bc49a0ca221787bc44e1049f51f09a2ffb63d22899051988d3a618ba13e9 @@ -14390,7 +14363,7 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:^3.0.2": +"jsesc@npm:^3.0.2, jsesc@npm:^3.1.0": version: 3.1.0 resolution: "jsesc@npm:3.1.0" bin: @@ -14399,15 +14372,6 @@ __metadata: languageName: node linkType: hard -"jsesc@npm:~0.5.0": - version: 0.5.0 - resolution: "jsesc@npm:0.5.0" - bin: - jsesc: bin/jsesc - checksum: b8b44cbfc92f198ad972fba706ee6a1dfa7485321ee8c0b25f5cedd538dcb20cde3197de16a7265430fce8277a12db066219369e3d51055038946039f6e20e17 - languageName: node - linkType: hard - "jsesc@npm:~3.0.2": version: 3.0.2 resolution: "jsesc@npm:3.0.2" @@ -14560,7 +14524,7 @@ __metadata: languageName: node linkType: hard -"keyv@npm:^4.5.3": +"keyv@npm:^4.5.3, keyv@npm:^4.5.4": version: 4.5.4 resolution: "keyv@npm:4.5.4" dependencies: @@ -16191,7 +16155,7 @@ __metadata: languageName: node linkType: hard -"min-indent@npm:^1.0.0": +"min-indent@npm:^1.0.0, min-indent@npm:^1.0.1": version: 1.0.1 resolution: "min-indent@npm:1.0.1" checksum: bfc6dd03c5eaf623a4963ebd94d087f6f4bbbfd8c41329a7f09706b0cb66969c4ddd336abeb587bc44bc6f08e13bf90f0b374f9d71f9f01e04adc2cd6f083ef1 @@ -16226,15 +16190,6 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:9.0.3": - version: 9.0.3 - resolution: "minimatch@npm:9.0.3" - dependencies: - brace-expansion: ^2.0.1 - checksum: 253487976bf485b612f16bf57463520a14f512662e592e95c571afdab1442a6a6864b6c88f248ce6fc4ff0b6de04ac7aa6c8bb51e868e99d1d65eb0658a708b5 - languageName: node - linkType: hard - "minimatch@npm:^5.0.1": version: 5.1.6 resolution: "minimatch@npm:5.1.6" @@ -19185,6 +19140,17 @@ __metadata: languageName: node linkType: hard +"read-package-up@npm:^11.0.0": + version: 11.0.0 + resolution: "read-package-up@npm:11.0.0" + dependencies: + find-up-simple: ^1.0.0 + read-pkg: ^9.0.0 + type-fest: ^4.6.0 + checksum: 535b7554d47fae5fb5c2e7aceebd48b5de4142cdfe7b21f942fa9a0f56db03d3b53cce298e19438e1149292279c285e6ba6722eca741d590fd242519c4bdbc17 + languageName: node + linkType: hard + "read-pkg-up@npm:^10.0.0": version: 10.1.0 resolution: "read-pkg-up@npm:10.1.0" @@ -19196,17 +19162,6 @@ __metadata: languageName: node linkType: hard -"read-pkg-up@npm:^7.0.1": - version: 7.0.1 - resolution: "read-pkg-up@npm:7.0.1" - dependencies: - find-up: ^4.1.0 - read-pkg: ^5.2.0 - type-fest: ^0.8.1 - checksum: e4e93ce70e5905b490ca8f883eb9e48b5d3cebc6cd4527c25a0d8f3ae2903bd4121c5ab9c5a3e217ada0141098eeb661313c86fa008524b089b8ed0b7f165e44 - languageName: node - linkType: hard - "read-pkg@npm:^5.2.0": version: 5.2.0 resolution: "read-pkg@npm:5.2.0" @@ -19231,7 +19186,7 @@ __metadata: languageName: node linkType: hard -"read-pkg@npm:^9.0.1": +"read-pkg@npm:^9.0.0, read-pkg@npm:^9.0.1": version: 9.0.1 resolution: "read-pkg@npm:9.0.1" dependencies: @@ -19488,17 +19443,6 @@ __metadata: languageName: node linkType: hard -"regjsparser@npm:^0.10.0": - version: 0.10.0 - resolution: "regjsparser@npm:0.10.0" - dependencies: - jsesc: ~0.5.0 - bin: - regjsparser: bin/parser - checksum: 17550661f43ba792f8365fb95b3dbdb64e25f14e31ef7c2c11876c240a60e87b7bfc28c98589f4e76b7cf49307e45fb24d030f57d68dd0cc41c56b4d378e9254 - languageName: node - linkType: hard - "regjsparser@npm:^0.12.0": version: 0.12.0 resolution: "regjsparser@npm:0.12.0" @@ -20068,12 +20012,12 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.1.1, semver@npm:^7.1.3, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3": - version: 7.6.3 - resolution: "semver@npm:7.6.3" +"semver@npm:^7.1.1, semver@npm:^7.1.3, semver@npm:^7.3.2, semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.5.2, semver@npm:^7.5.3, semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3, semver@npm:^7.7.1": + version: 7.7.1 + resolution: "semver@npm:7.7.1" bin: semver: bin/semver.js - checksum: 4110ec5d015c9438f322257b1c51fe30276e5f766a3f64c09edd1d7ea7118ecbc3f379f3b69032bacf13116dc7abc4ad8ce0d7e2bd642e26b0d271b56b61a7d8 + checksum: 586b825d36874007c9382d9e1ad8f93888d8670040add24a28e06a910aeebd673a2eb9e3bf169c6679d9245e66efb9057e0852e70d9daa6c27372aab1dda7104 languageName: node linkType: hard @@ -20988,6 +20932,15 @@ __metadata: languageName: node linkType: hard +"strip-indent@npm:^4.0.0": + version: 4.0.0 + resolution: "strip-indent@npm:4.0.0" + dependencies: + min-indent: ^1.0.1 + checksum: 06cbcd93da721c46bc13caeb1c00af93a9b18146a1c95927672d2decab6a25ad83662772417cea9317a2507fb143253ecc23c4415b64f5828cef9b638a744598 + languageName: node + linkType: hard + "strip-json-comments@npm:^3.1.1, strip-json-comments@npm:~3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" @@ -21298,13 +21251,13 @@ __metadata: languageName: node linkType: hard -"tinyglobby@npm:^0.2.10": - version: 0.2.10 - resolution: "tinyglobby@npm:0.2.10" +"tinyglobby@npm:^0.2.10, tinyglobby@npm:^0.2.12": + version: 0.2.12 + resolution: "tinyglobby@npm:0.2.12" dependencies: - fdir: ^6.4.2 + fdir: ^6.4.3 picomatch: ^4.0.2 - checksum: 7e2ffe262ebc149036bdef37c56b32d02d52cf09efa7d43dbdab2ea3c12844a4da881058835ce4c74d1891190e5ad5ec5133560a11ec8314849b68ad0d99d3f4 + checksum: ef9357fa1b2b661afdccd315cb4995f5f36bce948faaace68aae85fe57bdd8f837883045c88efc50d3186bac6586e4ae2f31026b9a3aac061b884217e6092e23 languageName: node linkType: hard @@ -21403,21 +21356,12 @@ __metadata: languageName: node linkType: hard -"ts-api-utils@npm:^1.0.1": - version: 1.4.3 - resolution: "ts-api-utils@npm:1.4.3" - peerDependencies: - typescript: ">=4.2.0" - checksum: ea00dee382d19066b2a3d8929f1089888b05fec797e32e7a7004938eda1dccf2e77274ee2afcd4166f53fab9b8d7ee90ebb225a3183f9ba8817d636f688a148d - languageName: node - linkType: hard - -"ts-api-utils@npm:^2.0.0": - version: 2.0.0 - resolution: "ts-api-utils@npm:2.0.0" +"ts-api-utils@npm:^2.0.1": + version: 2.0.1 + resolution: "ts-api-utils@npm:2.0.1" peerDependencies: typescript: ">=4.8.4" - checksum: f16f3e4e3308e7ad7ccf0bec3e0cb2e06b46c2d6919c40b6439e37912409c72f14340d231343b2b1b8cc17c2b8b01c5f2418690ea788312db6ca4e72cf2df6d8 + checksum: ca31f4dc3c0d69691599de2955b41879c27cb91257f2a468bbb444d3f09982a5f717a941fcebd3aaa092b778710647a0be1c2b1dd75cf6c82ceffc3bf4c7d27d languageName: node linkType: hard @@ -21564,13 +21508,6 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^0.20.2": - version: 0.20.2 - resolution: "type-fest@npm:0.20.2" - checksum: 4fb3272df21ad1c552486f8a2f8e115c09a521ad7a8db3d56d53718d0c907b62c6e9141ba5f584af3f6830d0872c521357e512381f24f7c44acae583ad517d73 - languageName: node - linkType: hard - "type-fest@npm:^0.6.0": version: 0.6.0 resolution: "type-fest@npm:0.6.0" @@ -21585,13 +21522,6 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^0.8.1": - version: 0.8.1 - resolution: "type-fest@npm:0.8.1" - checksum: d61c4b2eba24009033ae4500d7d818a94fd6d1b481a8111612ee141400d5f1db46f199c014766b9fa9b31a6a7374d96fc748c6d688a78a3ce5a33123839becb7 - languageName: node - linkType: hard - "type-fest@npm:^1.0.1": version: 1.4.0 resolution: "type-fest@npm:1.4.0" @@ -21692,6 +21622,20 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^8.26.0": + version: 8.26.0 + resolution: "typescript-eslint@npm:8.26.0" + dependencies: + "@typescript-eslint/eslint-plugin": 8.26.0 + "@typescript-eslint/parser": 8.26.0 + "@typescript-eslint/utils": 8.26.0 + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + typescript: ">=4.8.4 <5.9.0" + checksum: 87ac61b003e5015fd6b4e84876a74ffb77e1d97f3b35dae72174b5ad053abb65587bd5f0c0c91c8e236741b79fbb98f03c1ff991215e0cf7411c4d1bd101d9a4 + languageName: node + linkType: hard + "typescript@npm:5.7.2": version: 5.7.2 resolution: "typescript@npm:5.7.2"