diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 2b8da214..3e533d37 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -18,6 +18,7 @@ learn how: http://kcd.im/pull-request Relevant code or config ```javascript + ``` What you did: diff --git a/.gitignore b/.gitignore index 8e0c70cb..817ea798 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules coverage dist .DS_Store +.jest-cache # these cause more harm than good # when working with contributors diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..2312dc58 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npx lint-staged diff --git a/.huskyrc.js b/.huskyrc.js deleted file mode 100644 index 5e45c45d..00000000 --- a/.huskyrc.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('kcd-scripts/husky') diff --git a/.prettierrc.js b/.prettierrc.js index 4679d9bf..03add38f 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1 +1,21 @@ -module.exports = require('kcd-scripts/prettier') +/** @type {import('prettier').Options} */ +module.exports = { + arrowParens: 'avoid', + bracketSameLine: false, + bracketSpacing: false, + embeddedLanguageFormatting: 'auto', + endOfLine: 'lf', + htmlWhitespaceSensitivity: 'css', + insertPragma: false, + jsxSingleQuote: false, + printWidth: 80, + proseWrap: 'always', + quoteProps: 'as-needed', + requirePragma: false, + semi: false, + singleAttributePerLine: false, + singleQuote: true, + tabWidth: 2, + trailingComma: 'all', + useTabs: false, +} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000..77c7288d --- /dev/null +++ b/babel.config.js @@ -0,0 +1,6 @@ +module.exports = { + presets: [ + ['@babel/preset-env', {targets: {node: 'current'}}], + '@babel/preset-typescript', + ], +} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..52df8f29 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,330 @@ +const eslintPluginImport = require('eslint-plugin-import') +const eslintPluginJest = require('eslint-plugin-jest') +const eslintPluginJestDom = require('eslint-plugin-jest-dom') +const tseslint = require('typescript-eslint') +const eslintConfigPrettier = require('eslint-config-prettier') + +module.exports = tseslint.config( + // Global ignores + { + ignores: ['node_modules', 'coverage', 'dist', 'types/__tests__'], + }, + + // Base config for all JavaScript/TypeScript files + { + files: ['**/*.{js,jsx,ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + sourceType: 'module', + globals: { + // Browser globals + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + console: 'readonly', + // Node.js globals + process: 'readonly', + __dirname: 'readonly', + __filename: 'readonly', + module: 'readonly', + require: 'readonly', + exports: 'readonly', + Buffer: 'readonly', + // ES6+ globals + Promise: 'readonly', + Set: 'readonly', + Map: 'readonly', + }, + }, + plugins: { + import: eslintPluginImport, + }, + rules: { + // ESLint core rules (based on kentcdodds config) + 'accessor-pairs': 'error', + 'array-callback-return': 'error', + 'arrow-body-style': 'off', + 'block-scoped-var': 'error', + camelcase: 'off', + complexity: ['error', 20], + 'consistent-return': 'error', + 'consistent-this': 'off', + 'constructor-super': 'error', + curly: ['error', 'multi-line'], + 'default-case': 'error', + 'default-case-last': 'error', + 'dot-notation': 'error', + eqeqeq: 'off', + 'for-direction': 'error', + 'func-name-matching': 'error', + 'func-names': 'error', + 'getter-return': ['error', {allowImplicit: true}], + 'guard-for-in': 'error', + 'id-denylist': 'error', + 'id-match': ['error', '^\\$?(__)?(([A-Z]|[a-z]|[0-9]+)|([A-Z_]))*\\$?$'], + 'max-depth': ['error', 4], + 'max-lines': ['error', {max: 2500, skipBlankLines: false}], + 'max-nested-callbacks': ['error', 7], + 'max-params': ['error', 7], + 'max-statements-per-line': ['error', {max: 1}], + 'new-cap': 'error', + 'no-alert': 'error', + 'no-array-constructor': 'error', + 'no-async-promise-executor': 'off', + 'no-await-in-loop': 'error', + 'no-bitwise': 'error', + 'no-caller': 'error', + 'no-case-declarations': 'error', + 'no-class-assign': 'error', + 'no-compare-neg-zero': 'error', + 'no-cond-assign': 'error', + 'no-console': 'off', + 'no-const-assign': 'error', + 'no-constant-binary-expression': 'error', + 'no-constant-condition': 'error', + 'no-constructor-return': 'error', + 'no-control-regex': 'error', + 'no-debugger': 'error', + 'no-delete-var': 'error', + 'no-div-regex': 'error', + 'no-dupe-args': 'error', + 'no-dupe-class-members': 'error', + 'no-dupe-else-if': 'error', + 'no-dupe-keys': 'error', + 'no-duplicate-case': 'error', + 'no-duplicate-imports': 'error', + 'no-else-return': 'off', + 'no-empty': 'error', + 'no-empty-character-class': 'error', + 'no-empty-pattern': 'error', + 'no-eval': 'error', + 'no-extend-native': 'error', + 'no-extra-bind': 'error', + 'no-fallthrough': 'error', + 'no-func-assign': 'error', + 'no-global-assign': 'error', + 'no-implicit-coercion': 'off', + 'no-implied-eval': 'error', + 'no-import-assign': 'error', + 'no-invalid-this': 'off', + 'no-irregular-whitespace': 'error', + 'no-iterator': 'error', + 'no-labels': 'error', + 'no-lone-blocks': 'error', + 'no-loop-func': 'error', + 'no-loss-of-precision': 'error', + 'no-misleading-character-class': 'error', + 'no-multi-assign': 'off', + 'no-multi-str': 'error', + 'no-new': 'error', + 'no-new-func': 'error', + 'no-new-native-nonconstructor': 'error', + 'no-new-wrappers': 'error', + 'no-obj-calls': 'error', + 'no-octal': 'error', + 'no-octal-escape': 'error', + 'no-param-reassign': 'off', + 'no-proto': 'error', + 'no-redeclare': 'error', + 'no-regex-spaces': 'error', + 'no-return-assign': ['error', 'except-parens'], + 'no-return-await': 'error', + 'no-script-url': 'error', + 'no-self-assign': 'error', + 'no-self-compare': 'error', + 'no-sequences': 'error', + 'no-shadow': 'off', + 'no-shadow-restricted-names': 'error', + 'no-sparse-arrays': 'error', + 'no-this-before-super': 'error', + 'no-throw-literal': 'error', + 'no-undef': 'error', + 'no-undef-init': 'error', + 'no-unexpected-multiline': 'error', + 'no-unmodified-loop-condition': 'error', + 'no-unneeded-ternary': 'error', + 'no-unreachable': 'error', + 'no-unsafe-finally': 'error', + 'no-unsafe-negation': 'error', + 'no-unsafe-optional-chaining': 'error', + 'no-unused-expressions': 'error', + 'no-unused-labels': 'error', + 'no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + 'no-use-before-define': 'off', + 'no-useless-backreference': 'error', + 'no-useless-call': 'error', + 'no-useless-catch': 'off', + 'no-useless-concat': 'error', + 'no-useless-constructor': 'off', + 'no-useless-escape': 'error', + 'no-useless-return': 'error', + 'no-var': 'error', + 'no-void': 'off', + 'no-with': 'error', + 'object-shorthand': 'off', + 'one-var': ['error', 'never'], + 'prefer-arrow-callback': ['error', {allowNamedFunctions: true}], + 'prefer-const': 'error', + 'prefer-promise-reject-errors': 'error', + 'prefer-rest-params': 'error', + 'prefer-spread': 'error', + 'prefer-template': 'off', + radix: 'error', + 'require-await': 'off', + 'require-yield': 'error', + 'use-isnan': 'error', + 'valid-typeof': 'error', + + // Import plugin rules + 'import/consistent-type-specifier-style': ['error', 'prefer-inline'], + 'import/default': 'error', + 'import/export': 'error', + 'import/first': 'error', + 'import/named': 'error', + 'import/namespace': 'error', + 'import/no-absolute-path': 'error', + 'import/no-amd': 'error', + 'import/no-duplicates': 'error', + 'import/no-empty-named-blocks': 'error', + 'import/no-extraneous-dependencies': 'error', + 'import/no-mutable-exports': 'error', + 'import/no-named-as-default': 'error', + 'import/no-named-as-default-member': 'error', + 'import/no-named-default': 'error', + 'import/no-self-import': 'error', + 'import/no-webpack-loader-syntax': 'error', + 'import/order': [ + 'warn', + { + groups: [ + 'builtin', + ['external', 'internal'], + 'parent', + ['sibling', 'index'], + ], + }, + ], + }, + }, + + // TypeScript files + ...tseslint.configs.recommended.map(config => ({ + ...config, + files: ['**/*.ts', '**/*.tsx'], + })), + { + files: ['**/*.ts', '**/*.tsx'], + rules: { + // Disable JS rules that conflict with TS + 'no-undef': 'off', // TypeScript handles this + 'no-unused-vars': 'off', // Use TypeScript version instead + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', + varsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_', + }, + ], + }, + }, + + // TypeScript definition files + { + files: ['**/*.d.ts'], + rules: { + '@typescript-eslint/no-empty-interface': 'off', + '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/triple-slash-reference': 'off', + }, + }, + + // Test files + { + files: [ + 'src/__tests__/**/*.{js,jsx,ts,tsx}', + 'tests/**/*.{js,jsx,ts,tsx}', + '**/*.{spec,test}.{js,jsx,ts,tsx}', + ], + plugins: { + jest: eslintPluginJest, + 'jest-dom': eslintPluginJestDom, + }, + languageOptions: { + globals: { + ...eslintPluginJest.environments.globals.globals, + global: 'readonly', // Node.js global + }, + }, + rules: { + // Test-specific rule overrides + 'max-lines-per-function': 'off', + + // Jest rules + 'jest/max-nested-describe': 'error', + 'jest/no-commented-out-tests': 'warn', + 'jest/no-conditional-expect': 'error', + 'jest/no-conditional-in-test': 'error', + 'jest/no-deprecated-functions': 'error', + 'jest/no-disabled-tests': 'warn', + 'jest/no-done-callback': 'error', + 'jest/no-export': 'error', + 'jest/no-focused-tests': 'error', + 'jest/no-identical-title': 'error', + 'jest/no-interpolation-in-snapshots': 'error', + 'jest/no-large-snapshots': ['warn', {maxSize: 300}], + 'jest/no-mocks-import': 'error', + 'jest/no-test-prefixes': 'error', + 'jest/prefer-called-with': 'error', + 'jest/prefer-comparison-matcher': 'error', + 'jest/prefer-each': 'error', + 'jest/prefer-equality-matcher': 'error', + 'jest/prefer-hooks-in-order': 'error', + 'jest/prefer-hooks-on-top': 'error', + 'jest/prefer-mock-promise-shorthand': 'error', + 'jest/prefer-snapshot-hint': 'error', + 'jest/prefer-to-contain': 'warn', + 'jest/prefer-to-have-length': 'warn', + 'jest/prefer-todo': 'warn', + 'jest/valid-describe-callback': 'error', + 'jest/valid-expect': 'error', + 'jest/valid-expect-in-promise': 'error', + 'jest/valid-title': 'warn', + + // jest-dom rules + 'jest-dom/prefer-checked': 'error', + 'jest-dom/prefer-empty': 'error', + 'jest-dom/prefer-enabled-disabled': 'error', + 'jest-dom/prefer-focus': 'error', + 'jest-dom/prefer-in-document': 'error', + 'jest-dom/prefer-required': 'error', + 'jest-dom/prefer-to-have-attribute': 'error', + 'jest-dom/prefer-to-have-class': 'error', + 'jest-dom/prefer-to-have-style': 'error', + 'jest-dom/prefer-to-have-text-content': 'error', + 'jest-dom/prefer-to-have-value': 'error', + }, + }, + + // Files that use Jest globals outside of test files + { + files: ['src/index.js', 'tests/setup-env.js'], + languageOptions: { + globals: { + ...eslintPluginJest.environments.globals.globals, + }, + }, + }, + + // Disable Prettier-conflicting rules (must be last) + eslintConfigPrettier, +) diff --git a/jest.config.js b/jest.config.js index 0cdd1adc..abdb964a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,44 @@ -const config = require('kcd-scripts/jest') +const ignores = [ + '/node_modules/', + '/__fixtures__/', + '/fixtures/', + '/__tests__/helpers/', + '/__tests__/utils/', + '__mocks__', +] +/** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { - ...config, + roots: ['/src'], + testEnvironment: 'jsdom', + testEnvironmentOptions: { + url: 'http://localhost', + }, + moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'], + modulePaths: ['/src', 'shared', '/tests'], + collectCoverageFrom: ['src/**/*.+(js|jsx|ts|tsx)'], + testMatch: ['**/__tests__/**/*.+(js|jsx|ts|tsx)'], + testPathIgnorePatterns: [...ignores], + coveragePathIgnorePatterns: [...ignores, 'src/(umd|cjs|esm)-entry.js$'], + transformIgnorePatterns: ['[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$'], + coverageThreshold: { + global: { + branches: 100, + functions: 100, + lines: 100, + statements: 100, + }, + }, watchPlugins: [ - ...config.watchPlugins, + require.resolve('jest-watch-typeahead/filename'), + require.resolve('jest-watch-typeahead/testname'), require.resolve('jest-watch-select-projects'), ], + snapshotSerializers: [ + require.resolve('jest-serializer-path'), + require.resolve('jest-snapshot-serializer-raw/always'), + ], + setupFilesAfterEnv: ['/tests/setup-env.js'], projects: [ require.resolve('./tests/jest.config.dom'), require.resolve('./tests/jest.config.node'), diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 00000000..ba5b73c5 --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,9 @@ +module.exports = { + 'README.md': ['doctoc --maxlevel 3 --notitle'], + '*.+(js|jsx|json|yml|yaml|css|less|scss|ts|tsx|md|gql|graphql|mdx|vue)': [ + 'prettier --write', + ], + '*.+(js|jsx|ts|tsx)': [ + 'eslint --cache --cache-location ./node_modules/.cache/eslint --fix', + ], +} diff --git a/other/CODE_OF_CONDUCT.md b/other/CODE_OF_CONDUCT.md index cfe82c06..8649c632 100644 --- a/other/CODE_OF_CONDUCT.md +++ b/other/CODE_OF_CONDUCT.md @@ -60,8 +60,8 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at -TestingLibraryOSS@gmail.com. All complaints will be reviewed and investigated promptly -and fairly. +TestingLibraryOSS@gmail.com. All complaints will be reviewed and investigated +promptly and fairly. All community leaders are obligated to respect the privacy and security of the reporter of any incident. diff --git a/package.json b/package.json index e3da3012..a099ffe2 100644 --- a/package.json +++ b/package.json @@ -55,13 +55,14 @@ }, "scripts": { "build": "rollup -c", - "format": "kcd-scripts format", - "lint": "kcd-scripts lint", + "format": "prettier --write .", + "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint .", "setup": "npm install && npm run validate -s", - "test": "kcd-scripts test", + "test": "jest", "test:update": "npm test -- --updateSnapshot --coverage", "test:types": "tsc -p types/__tests__/jest && tsc -p types/__tests__/jest-globals && tsc -p types/__tests__/vitest && tsc -p types/__tests__/bun", - "validate": "kcd-scripts validate && npm run test:types" + "validate": "concurrently --names \"build,types,lint,test\" \"npm run build\" \"npm run test:types\" \"npm run lint\" \"npm test -- --coverage\"", + "prepare": "husky" }, "files": [ "dist", @@ -88,59 +89,42 @@ "redent": "^3.0.0" }, "devDependencies": { + "@babel/core": "^7.25.0", + "@babel/preset-env": "^7.25.0", + "@babel/preset-typescript": "^7.25.0", "@jest/globals": "^29.6.2", "@rollup/plugin-commonjs": "^25.0.4", "@types/bun": "latest", + "@types/jest": "^29.5.0", "@types/web": "latest", + "babel-jest": "^29.7.0", + "concurrently": "^9.0.0", + "cross-env": "^7.0.3", + "doctoc": "^2.2.0", + "eslint": "^9.15.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.9.0", + "eslint-plugin-jest-dom": "^5.4.0", "expect": "^29.6.2", + "husky": "^9.1.7", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "jest-environment-jsdom-sixteen": "^1.0.3", + "jest-serializer-path": "^0.1.15", + "jest-snapshot-serializer-raw": "^1.2.0", "jest-watch-select-projects": "^2.0.0", + "jest-watch-typeahead": "^2.2.2", "jsdom": "^16.2.1", - "kcd-scripts": "^14.0.0", + "lint-staged": "^15.2.0", + "prettier": "^2.8.8", "pretty-format": "^25.1.0", "rollup": "^3.28.1", "rollup-plugin-delete": "^2.0.0", "typescript": "^5.1.6", + "typescript-eslint": "^8.15.0", "vitest": "^0.34.1" }, - "eslintConfig": { - "extends": "./node_modules/kcd-scripts/eslint.js", - "parserOptions": { - "sourceType": "module", - "ecmaVersion": 2020 - }, - "rules": { - "no-invalid-this": "off" - }, - "overrides": [ - { - "files": [ - "src/__tests__/*.js" - ], - "rules": { - "max-lines-per-function": "off" - } - }, - { - "files": [ - "**/*.d.ts" - ], - "rules": { - "@typescript-eslint/no-empty-interface": "off", - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/no-invalid-void-type": "off", - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/triple-slash-reference": "off" - } - } - ] - }, - "eslintIgnore": [ - "node_modules", - "coverage", - "dist", - "types/__tests__" - ], "repository": { "type": "git", "url": "https://github.com/testing-library/jest-dom" diff --git a/src/__tests__/to-be-empty-dom-element.js b/src/__tests__/to-be-empty-dom-element.js index 0d16bff9..055ae88e 100644 --- a/src/__tests__/to-be-empty-dom-element.js +++ b/src/__tests__/to-be-empty-dom-element.js @@ -44,11 +44,15 @@ test('.toBeEmptyDOMElement', () => { expect(() => expect(withComment).not.toBeEmptyDOMElement()).toThrowError() - expect(() => expect(withMultipleComments).not.toBeEmptyDOMElement()).toThrowError() + expect(() => + expect(withMultipleComments).not.toBeEmptyDOMElement(), + ).toThrowError() expect(() => expect(withElement).toBeEmptyDOMElement()).toThrowError() - expect(() => expect(withElementAndComment).toBeEmptyDOMElement()).toThrowError() + expect(() => + expect(withElementAndComment).toBeEmptyDOMElement(), + ).toThrowError() expect(() => expect(withWhitespace).toBeEmptyDOMElement()).toThrowError() diff --git a/src/__tests__/to-have-selection.js b/src/__tests__/to-have-selection.js index 9ddcc2c8..f74a0713 100644 --- a/src/__tests__/to-have-selection.js +++ b/src/__tests__/to-have-selection.js @@ -143,7 +143,7 @@ describe('.toHaveSelection', () => { const selection = queryByTestId('child').ownerDocument.getSelection() const range = queryByTestId('child').ownerDocument.createRange() selection.removeAllRanges() - selection.empty() + selection.empty() selection.addRange(range) range.selectNodeContents(queryByTestId('child')) diff --git a/src/to-be-empty-dom-element.js b/src/to-be-empty-dom-element.js index 652f5299..63a9044a 100644 --- a/src/to-be-empty-dom-element.js +++ b/src/to-be-empty-dom-element.js @@ -22,13 +22,15 @@ export function toBeEmptyDOMElement(element) { /** * Identifies if an element doesn't contain child nodes (excluding comments) - * ℹ Node.COMMENT_NODE can't be used because of the following issue + * ℹ Node.COMMENT_NODE can't be used because of the following issue * https://github.com/jsdom/jsdom/issues/2220 * * @param {*} element an HtmlElement or SVGElement * @return {*} true if the element only contains comments or none */ -function isEmptyElement(element){ - const nonCommentChildNodes = [...element.childNodes].filter(node => node.nodeType !== 8); - return nonCommentChildNodes.length === 0; +function isEmptyElement(element) { + const nonCommentChildNodes = [...element.childNodes].filter( + node => node.nodeType !== 8, + ) + return nonCommentChildNodes.length === 0 } diff --git a/src/to-have-description.js b/src/to-have-description.js index 28a21347..a27e1260 100644 --- a/src/to-have-description.js +++ b/src/to-have-description.js @@ -2,10 +2,7 @@ import {checkHtmlElement, getMessage, normalize, deprecate} from './utils' // See algoritm: https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description export function toHaveDescription(htmlElement, checkWith) { - deprecate( - 'toHaveDescription', - 'Please use toHaveAccessibleDescription.', - ) + deprecate('toHaveDescription', 'Please use toHaveAccessibleDescription.') checkHtmlElement(htmlElement, toHaveDescription, this) diff --git a/src/to-have-form-values.js b/src/to-have-form-values.js index 7a9fc503..8b132497 100644 --- a/src/to-have-form-values.js +++ b/src/to-have-form-values.js @@ -1,9 +1,5 @@ import escape from 'css.escape' -import { - checkHtmlElement, - compareAsSet, - getSingleElementValue, -} from './utils' +import {checkHtmlElement, compareAsSet, getSingleElementValue} from './utils' // Returns the combined value of several elements that have the same name // e.g. radio buttons or groups of checkboxes diff --git a/tests/jest.config.dom.js b/tests/jest.config.dom.js index e3c4c598..46de156f 100644 --- a/tests/jest.config.dom.js +++ b/tests/jest.config.dom.js @@ -1,9 +1,12 @@ const path = require('path') -const config = require('kcd-scripts/jest') +const baseConfig = require('../jest.config') module.exports = { - ...config, + ...baseConfig, rootDir: path.resolve(__dirname, '..'), displayName: 'jsdom', testEnvironment: 'jsdom', + // Remove projects and watchPlugins config for sub-projects + projects: undefined, + watchPlugins: undefined, } diff --git a/tests/jest.config.node.js b/tests/jest.config.node.js index 0c3f3894..52eec31d 100644 --- a/tests/jest.config.node.js +++ b/tests/jest.config.node.js @@ -1,9 +1,12 @@ const path = require('path') -const config = require('kcd-scripts/jest') +const baseConfig = require('../jest.config') module.exports = { - ...config, + ...baseConfig, rootDir: path.resolve(__dirname, '..'), displayName: 'node', testEnvironment: 'node', + // Remove projects and watchPlugins config for sub-projects + projects: undefined, + watchPlugins: undefined, } diff --git a/types/matchers-standalone.d.ts b/types/matchers-standalone.d.ts index 175e9157..4a0f31be 100644 --- a/types/matchers-standalone.d.ts +++ b/types/matchers-standalone.d.ts @@ -6,12 +6,12 @@ interface MatcherReturnType { } interface OverloadedMatchers { - toHaveClass(expected: any, ...rest: string[]) : MatcherReturnType + toHaveClass(expected: any, ...rest: string[]): MatcherReturnType toHaveClass( expected: any, className: string, options?: {exact: boolean}, - ) : MatcherReturnType + ): MatcherReturnType } declare namespace matchersStandalone { diff --git a/types/vitest.d.ts b/types/vitest.d.ts index 3ee9eb2f..c2cc4e7f 100644 --- a/types/vitest.d.ts +++ b/types/vitest.d.ts @@ -2,14 +2,7 @@ import 'vitest' import {type TestingLibraryMatchers} from './matchers' declare module 'vitest' { - interface Assertion - extends TestingLibraryMatchers< - any, - T - > {} + interface Assertion extends TestingLibraryMatchers {} interface AsymmetricMatchersContaining - extends TestingLibraryMatchers< - any, - any - > {} + extends TestingLibraryMatchers {} }