From 52592ef0b9512f6f950694e20e8afe925c0403f4 Mon Sep 17 00:00:00 2001 From: JamesHenry Date: Sat, 17 May 2025 17:00:31 +0400 Subject: [PATCH] chore: clean up nx and other config --- .github/workflows/ci.yml | 20 +- knip.ts | 3 + nx.json | 79 +- package.json | 73 +- packages/ast-spec/package.json | 39 +- packages/ast-spec/project.json | 23 - packages/ast-spec/vitest.config.mts | 5 - packages/eslint-plugin-internal/package.json | 13 +- packages/eslint-plugin-internal/project.json | 15 - packages/eslint-plugin/package.json | 27 +- packages/eslint-plugin/project.json | 29 - packages/integration-tests/package.json | 9 +- packages/integration-tests/project.json | 16 - packages/parser/package.json | 13 +- packages/parser/project.json | 15 - .../package.json | 14 +- .../project.json | 12 - packages/rule-tester/package.json | 22 +- packages/rule-tester/project.json | 15 - .../tests/eslint-base/eslint-base.test.js | 3536 ----------------- .../fixtures/empty-program-parser.js | 29 - .../eslint-base/fixtures/enhanced-parser.js | 20 - .../eslint-base/fixtures/enhanced-parser2.js | 25 - .../eslint-base/fixtures/fixes-one-problem.js | 25 - .../tests/eslint-base/fixtures/messageId.js | 146 - .../fixtures/modify-ast-at-first.js | 37 - .../fixtures/modify-ast-at-last.js | 37 - .../tests/eslint-base/fixtures/modify-ast.js | 21 - .../tests/eslint-base/fixtures/no-eval.js | 19 - .../eslint-base/fixtures/no-invalid-args.js | 23 - .../eslint-base/fixtures/no-invalid-schema.js | 21 - .../fixtures/no-schema-violation.js | 22 - .../eslint-base/fixtures/no-test-filename | 19 - .../eslint-base/fixtures/no-test-global.js | 26 - .../eslint-base/fixtures/no-test-settings.js | 22 - .../tests/eslint-base/fixtures/no-var.js | 26 - .../tests/eslint-base/fixtures/suggestions.js | 260 -- packages/scope-manager/package.json | 14 +- packages/scope-manager/project.json | 15 - packages/type-utils/package.json | 13 +- packages/type-utils/project.json | 15 - packages/types/package.json | 35 +- packages/typescript-eslint/package.json | 13 +- packages/typescript-eslint/project.json | 15 - packages/typescript-estree/package.json | 13 +- packages/typescript-estree/project.json | 15 - packages/utils/package.json | 20 +- packages/utils/project.json | 16 - packages/utils/vitest.config.mts | 5 - packages/visitor-keys/package.json | 13 +- packages/visitor-keys/project.json | 15 - packages/website-eslint/package.json | 10 +- packages/website-eslint/project.json | 12 - packages/website/package.json | 26 +- packages/website/project.json | 20 - project.json | 38 - vitest.config.base.mts | 4 - yarn.lock | 358 +- 58 files changed, 422 insertions(+), 5019 deletions(-) delete mode 100644 packages/ast-spec/project.json delete mode 100644 packages/eslint-plugin-internal/project.json delete mode 100644 packages/eslint-plugin/project.json delete mode 100644 packages/integration-tests/project.json delete mode 100644 packages/parser/project.json delete mode 100644 packages/rule-schema-to-typescript-types/project.json delete mode 100644 packages/rule-tester/project.json delete mode 100644 packages/rule-tester/tests/eslint-base/eslint-base.test.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/messageId.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-eval.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-test-filename delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/no-var.js delete mode 100644 packages/rule-tester/tests/eslint-base/fixtures/suggestions.js delete mode 100644 packages/scope-manager/project.json delete mode 100644 packages/type-utils/project.json delete mode 100644 packages/typescript-eslint/project.json delete mode 100644 packages/typescript-estree/project.json delete mode 100644 packages/utils/project.json delete mode 100644 packages/visitor-keys/project.json delete mode 100644 packages/website-eslint/project.json delete mode 100644 packages/website/project.json delete mode 100644 project.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ded66ac31b3..1e4861de3cdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,6 +39,8 @@ jobs: install: name: Checkout and Install runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -51,6 +53,8 @@ jobs: name: Build All Packages needs: [install] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -65,6 +69,8 @@ jobs: name: Generate Configs needs: [build] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -84,6 +90,8 @@ jobs: strategy: matrix: lint-task: ['check-spelling', 'check-format', 'lint-markdown'] + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -103,6 +111,8 @@ jobs: strategy: matrix: lint-task: ['lint', 'typecheck', 'knip'] + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -122,6 +132,8 @@ jobs: name: Stylelint needs: [install] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -137,6 +149,8 @@ jobs: name: Run integration tests on primary Node.js version needs: [build] runs-on: ubuntu-latest + env: + NX_CI_EXECUTION_ENV: 'ubuntu-latest' steps: - name: Checkout uses: actions/checkout@v4 @@ -179,8 +193,7 @@ jobs: 'visitor-keys', ] env: - # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app - NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -' + NX_CI_EXECUTION_ENV: '${{ matrix.os }} - Node ${{ matrix.node-version }}' COLLECT_COVERAGE: false steps: - name: Checkout @@ -225,7 +238,8 @@ jobs: package: ['eslint-plugin', 'eslint-plugin-internal', 'typescript-estree'] env: - COLLECT_COVERAGE: false + NX_CI_EXECUTION_ENV: 'ubuntu-latest' + COLLECT_COVERAGE: false, steps: - name: Checkout uses: actions/checkout@v4 diff --git a/knip.ts b/knip.ts index 9f2a79146687..327290d9019a 100644 --- a/knip.ts +++ b/knip.ts @@ -2,6 +2,7 @@ import type { KnipConfig } from 'knip' with { 'resolution-mode': 'import' }; export default { rules: { + binaries: 'off', classMembers: 'off', duplicates: 'off', enumMembers: 'off', @@ -54,11 +55,13 @@ export default { }, }, 'packages/eslint-plugin': { + entry: ['tools/**'], ignore: [ 'tests/fixtures/**', 'typings/eslint-rules.d.ts', 'typings/typescript.d.ts', ], + ignoreDependencies: ['tsx'], // used in nx target definitions }, 'packages/eslint-plugin-internal': { ignore: ['tests/fixtures/**'], diff --git a/nx.json b/nx.json index 167f99ebcc2a..bea912313ce5 100644 --- a/nx.json +++ b/nx.json @@ -4,7 +4,7 @@ "plugins": [ { "plugin": "@nx/js/typescript", - "exclude": [".", "packages/integration-tests/fixtures/**"], + "exclude": ["packages/integration-tests/fixtures/**"], "options": { "typecheck": { "targetName": "typecheck" @@ -17,17 +17,9 @@ }, { "plugin": "@nx/vite/plugin", - "include": ["packages/*"], + "exclude": ["*"], "options": { - "buildTargetName": "vite:build", - "testTargetName": "test", - "serveTargetName": "serve", - "devTargetName": "dev", - "previewTargetName": "preview", - "serveStaticTargetName": "serve-static", - "typecheckTargetName": "vite:typecheck", - "buildDepsTargetName": "vite:build-deps", - "watchDepsTargetName": "vite:watch-deps" + "testTargetName": "test" } }, { @@ -59,64 +51,8 @@ } }, "targetDefaults": { - "build": { - "dependsOn": ["^build"], - "inputs": ["production", "^production"], - "outputs": ["{projectRoot}/dist"], - "options": { - "cwd": "{projectRoot}" - }, - "cache": true - }, "test": { - "dependsOn": ["^build"], - "outputs": ["{projectRoot}/coverage"], - "cache": true - }, - "@nx/vite:test": { - "dependsOn": ["^build"], - "inputs": [ - "default", - "^production", - "{workspaceRoot}/vitest.config.mts", - "{workspaceRoot}/vitest.config.base.mts", - "{projectRoot}/vitest.config.mts" - ], - "outputs": ["{projectRoot}/coverage"], - "cache": true, - "options": { - "config": "{projectRoot}/vitest.config.mts", - "watch": false - } - }, - "@nx/eslint:lint": { - "dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"], - "options": { - "noEslintrc": true, - "cache": true, - "eslintConfig": "{workspaceRoot}/eslint.config.mjs" - }, - "outputs": ["{options.outputFile}"], - "cache": true - }, - "lint": { - "executor": "@nx/eslint:lint", - "dependsOn": ["eslint-plugin-internal:build", "typescript-eslint:build"], - "inputs": [ - "default", - "{workspaceRoot}/eslint.config.mjs", - { - "dependentTasksOutputFiles": "**/*.js", - "transitive": false - } - ], - "outputs": ["{options.outputFile}"], - "cache": true - }, - "typecheck": { - "dependsOn": ["types:copy-ast-spec"], - "outputs": ["{workspaceRoot}/dist"], - "cache": true + "outputs": ["{projectRoot}/coverage"] } }, "namedInputs": { @@ -131,16 +67,15 @@ }, { "runtime": "yarn -v" - }, - "{workspaceRoot}/yarn.lock" + } ], "production": [ "default", "!{projectRoot}/**/?(*.)+(test).?(m|c)[jt]s?(x)?(.snap|.shot)", "!{projectRoot}/tests", + "!{projectRoot}/tools", "!{projectRoot}/tsconfig.spec.json", - "!{projectRoot}/vitest.config.mts", - "!{projectRoot}/src/test-setup.[jt]s" + "!{projectRoot}/vitest.config.mts" ] } } diff --git a/package.json b/package.json index a3d9c5c307bd..8dde6b1ec8fb 100644 --- a/package.json +++ b/package.json @@ -22,30 +22,30 @@ }, "homepage": "https://typescript-eslint.io", "scripts": { - "build": "nx run-many --target=build --exclude website --exclude website-eslint", + "build": "nx run-many -t build --exclude website website-eslint", "check-clean-workspace-after-install": "git diff --quiet --exit-code", "check-format": "prettier --check .", "check-spelling": "cspell --config=.cspell.json \"**/*.{md,mdx,ts,mts,cts,js,cjs,mjs,tsx,jsx}\" --no-progress --show-context --show-suggestions", - "clean": "nx run-many --target=clean --parallel=20", + "clean": "nx run-many -t clean --parallel=20", "format": "prettier --ignore-path=$PROJECT_CWD/.prettierignore --config=$PROJECT_CWD/.prettierrc.json --write $INIT_CWD", "generate-breaking-changes": "nx run eslint-plugin:generate-breaking-changes", - "generate-configs": "nx generate-configs", - "generate-contributors": "nx generate-contributors", - "generate-lib": "nx generate-lib", - "generate-sponsors": "nx generate-sponsors", + "generate-configs": "tsx tools/scripts/generate-configs.mts", + "generate-contributors": "tsx tools/scripts/generate-contributors.mts", + "generate-lib": "tsx tools/scripts/generate-lib.mts", + "generate-sponsors": "tsx tools/scripts/generate-sponsors.mts", "generate-website-dts": "nx run website:generate-website-dts", "lint-fix": "yarn lint --fix", "lint-markdown-fix": "yarn lint-markdown --fix", "lint-markdown": "markdownlint \"**/*.md\" --config=.markdownlint.json --ignore-path=.markdownlintignore", "lint-stylelint": "nx lint website stylelint", - "lint": "nx run-many --target=lint", + "lint": "nx run-many -t lint", "postinstall": "tsx tools/scripts/postinstall.mts", "pre-commit": "lint-staged", "release": "tsx tools/release/release.mts", "start": "nx run website:start", - "test": "nx run-many --target=test --exclude integration-tests --exclude website --exclude website-eslint", + "test": "nx run-many -t test --exclude integration-tests website website-eslint", "test-integration": "nx run integration-tests:test", - "typecheck": "nx run-many --target=typecheck" + "typecheck": "nx run-many -t typecheck" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -57,11 +57,11 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.26.0", - "@nx/devkit": "20.7.2", - "@nx/eslint": "20.7.2", - "@nx/js": "20.7.2", - "@nx/vite": "20.7.2", - "@nx/workspace": "20.7.2", + "@nx/devkit": "21.0.3", + "@nx/eslint": "21.0.3", + "@nx/js": "21.0.3", + "@nx/vite": "21.0.3", + "@nx/workspace": "21.0.3", "@swc/core": "^1.4.12", "@types/debug": "^4.1.12", "@types/eslint-plugin-jsx-a11y": "^6.10.0", @@ -97,7 +97,7 @@ "knip": "^5.41.1", "lint-staged": "^15.2.2", "markdownlint-cli": "^0.44.0", - "nx": "20.7.2", + "nx": "21.0.3", "prettier": "3.5.0", "rimraf": "^5.0.5", "semver": "7.7.0", @@ -122,6 +122,47 @@ }, "packageManager": "yarn@3.8.2", "nx": { - "includedScripts": [] + "name": "repo", + "includedScripts": [ + "generate-configs", + "generate-contributors", + "generate-lib", + "generate-sponsors" + ], + "targets": { + "generate-configs": { + "dependsOn": [ + "eslint-plugin:build" + ] + }, + "generate-lib": { + "dependsOn": [ + "typescript-eslint:build", + "eslint-plugin-internal:build" + ] + }, + "// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {}, + "typecheck": { + "command": "tsc -b tsconfig.repo-config-files.json", + "dependsOn": [ + "types:copy-ast-spec" + ], + "outputs": [ + "{workspaceRoot}/dist" + ], + "cache": true + }, + "lint": { + "command": "eslint . --ignore-pattern=packages --cache", + "dependsOn": [ + "typescript-eslint:build", + "eslint-plugin-internal:build" + ], + "cache": false + }, + "clean": { + "command": "rimraf dist/ coverage/ .eslintcache" + } + } } } diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index f2532092d1e2..b88610c936ca 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -31,13 +31,14 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { - "build": "tsc -b tsconfig.build.json && api-extractor run --local --config=$INIT_CWD/api-extractor.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "funding": { "type": "opencollective", @@ -59,5 +60,37 @@ "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" + }, + "nx": { + "name": "ast-spec", + "implicitDependencies": [ + "!typescript-estree" + ], + "includedScripts": [ + "clean", + "clean-fixtures" + ], + "targets": { + "build": { + "command": "tsc -b tsconfig.build.json && api-extractor run --local --config=api-extractor.json", + "options": { + "cwd": "{projectRoot}" + }, + "outputs": [ + "{projectRoot}/dist/**/*.ts" + ], + "cache": true + }, + "typecheck": { + "dependsOn": [ + "typescript-estree:build" + ] + }, + "test": { + "dependsOn": [ + "typecheck" + ] + } + } } } diff --git a/packages/ast-spec/project.json b/packages/ast-spec/project.json deleted file mode 100644 index d6c8c081f226..000000000000 --- a/packages/ast-spec/project.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ast-spec", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "implicitDependencies": ["!typescript-estree"], - "root": "packages/ast-spec", - "sourceRoot": "packages/ast-spec/src", - "targets": { - "build": { - "outputs": ["{projectRoot}/dist/**/*.ts"] - }, - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test", - "dependsOn": ["typecheck"] - }, - "typecheck": { - "dependsOn": ["typescript-estree:build"] - } - } -} diff --git a/packages/ast-spec/vitest.config.mts b/packages/ast-spec/vitest.config.mts index 090170ba88af..d79590018e5b 100644 --- a/packages/ast-spec/vitest.config.mts +++ b/packages/ast-spec/vitest.config.mts @@ -19,11 +19,6 @@ const vitestConfig = mergeConfig( './tests/util/setupVitest.mts', './tests/util/custom-matchers/custom-matchers.ts', ], - - typecheck: { - enabled: true, - tsconfig: path.join(import.meta.dirname, 'tsconfig.spec.json'), - }, }, }), ); diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index c2cde3c76ee8..303842fa29ba 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -14,12 +14,13 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@prettier/sync": "^0.5.1", @@ -33,5 +34,11 @@ "@vitest/coverage-v8": "^3.1.3", "rimraf": "*", "vitest": "^3.1.3" + }, + "nx": { + "name": "eslint-plugin-internal", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/eslint-plugin-internal/project.json b/packages/eslint-plugin-internal/project.json deleted file mode 100644 index f0bfaacd26b6..000000000000 --- a/packages/eslint-plugin-internal/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "eslint-plugin-internal", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/eslint-plugin-internal", - "sourceRoot": "packages/eslint-plugin-internal/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index f198f162124c..a48904ddb6e2 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -49,15 +49,15 @@ "typescript" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", - "generate-breaking-changes": "tsx tools/generate-breaking-changes.mts", + "generate-breaking-changes": "yarn run -BT nx generate-breaking-changes", "generate-configs": "yarn run -T generate-configs", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "test-single": "vitest --run --config=$INIT_CWD/vitest.config.mts --no-coverage", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@eslint-community/regexpp": "^4.10.0", @@ -101,5 +101,22 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "eslint-plugin", + "includedScripts": [ + "clean" + ], + "targets": { + "generate-breaking-changes": { + "command": "tsx tools/generate-breaking-changes.mts", + "options": { + "cwd": "{projectRoot}" + }, + "dependsOn": [ + "type-utils:build" + ] + } + } } } diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json deleted file mode 100644 index acfd65a8f79c..000000000000 --- a/packages/eslint-plugin/project.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "eslint-plugin", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/eslint-plugin", - "sourceRoot": "packages/eslint-plugin/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test-single": { - "executor": "@nx/vite:test", - "cache": false, - "options": { - "coverage": false - } - }, - "test": { - "executor": "@nx/vite:test" - }, - "generate-breaking-changes": { - "dependsOn": ["type-utils:build"], - "executor": "nx:run-script", - "options": { - "script": "generate-breaking-changes" - } - } - } -} diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 250cd92b8b07..df5b3ff213b8 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -12,13 +12,18 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", "vitest": "^3.1.3" + }, + "nx": { + "name": "integration-tests", + "includedScripts": [] } } diff --git a/packages/integration-tests/project.json b/packages/integration-tests/project.json deleted file mode 100644 index 7686e219f332..000000000000 --- a/packages/integration-tests/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "integration-tests", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/integration-tests", - "sourceRoot": "packages/integration-tests/tools", - "implicitDependencies": ["typescript-eslint"], - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/parser/package.json b/packages/parser/package.json index c0e124b4f28d..99d63e8e0084 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -39,12 +39,13 @@ "eslint" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", @@ -67,5 +68,11 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "parser", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/parser/project.json b/packages/parser/project.json deleted file mode 100644 index fe0a92487dde..000000000000 --- a/packages/parser/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "parser", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/parser", - "sourceRoot": "packages/parser/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index f2e18a13c669..8e4963cb2b52 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -24,12 +24,13 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/type-utils": "8.32.1", @@ -39,11 +40,18 @@ }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", + "rimraf": "*", "typescript": "*", "vitest": "^3.1.3" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "rule-schema-to-typescript-types", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/rule-schema-to-typescript-types/project.json b/packages/rule-schema-to-typescript-types/project.json deleted file mode 100644 index 954e08a4001c..000000000000 --- a/packages/rule-schema-to-typescript-types/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "rule-schema-to-typescript-types", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/rule-schema-to-typescript-types", - "sourceRoot": "packages/rule-schema-to-typescript-types/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 1689bdd5372e..dfee240b8094 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -35,14 +35,13 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "pretest-eslint-base": "tsc -b tsconfig.build.json", - "test-eslint-base": "mocha --require source-map-support/register ./tests/eslint-base/eslint-base.test.js", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", "dependencies": { @@ -61,15 +60,8 @@ "@types/json-stable-stringify-without-jsonify": "^1.0.2", "@types/lodash.merge": "4.6.9", "@vitest/coverage-v8": "^3.1.3", - "chai": "^5.2.0", "eslint": "*", - "eslint-visitor-keys": "^4.2.0", - "espree": "^10.3.0", - "esprima": "^4.0.1", - "mocha": "^11.0.0", "rimraf": "*", - "sinon": "^20.0.0", - "source-map-support": "^0.5.21", "typescript": "*", "vitest": "^3.1.3" }, @@ -79,5 +71,11 @@ }, "publishConfig": { "access": "public" + }, + "nx": { + "name": "rule-tester", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/rule-tester/project.json b/packages/rule-tester/project.json deleted file mode 100644 index 0dfef3253a40..000000000000 --- a/packages/rule-tester/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "rule-tester", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/rule-tester", - "sourceRoot": "packages/rule-tester/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/rule-tester/tests/eslint-base/eslint-base.test.js b/packages/rule-tester/tests/eslint-base/eslint-base.test.js deleted file mode 100644 index e87ece634534..000000000000 --- a/packages/rule-tester/tests/eslint-base/eslint-base.test.js +++ /dev/null @@ -1,3536 +0,0 @@ -/** - * This file intentionally does not match the standards in the rest of our codebase. - * It's intended to exactly match the test in ESLint core so we can ensure we - * have compatibility. - * It's tempting to switch this to be strictly typed in TS and to use jest - but - * it's too easy to introduce subtle changes into the test by doing that. It also - * makes it much harder to merge upstream changes into this test. - * - * The only edits we have made are to update the paths for our rep - * - * Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/lib/rule-tester/rule-tester.js - * - * @noformat - */ -/* eslint-disable */ - -"use strict"; - -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const sinon = require("sinon"), - EventEmitter = require("events"), - { RuleTester } = require("../../dist/RuleTester"), - assert = require("chai").assert, - nodeAssert = require("assert"), - espree = require("espree"); - -const NODE_ASSERT_STRICT_EQUAL_OPERATOR = (() => { - try { - nodeAssert.strictEqual(1, 2); - } catch (err) { - return err.operator; - } - throw new Error("unexpected successful assertion"); -})(); - -/** - * Do nothing. - * @returns {void} - */ -function noop() { - - // do nothing. -} - -//------------------------------------------------------------------------------ -// Rewire Things -//------------------------------------------------------------------------------ - -/* - * So here's the situation. Because RuleTester uses it() and describe() from - * Mocha, any failures would show up in the output of this test file. That means - * when we tested that a failure is thrown, that would also count as a failure - * in the testing for RuleTester. In order to remove those results from the - * results of this file, we need to overwrite it() and describe() just in - * RuleTester to do nothing but run code. Effectively, it() and describe() - * just become regular functions inside of index.js, not at all related to Mocha. - * That allows the results of this file to be untainted and therefore accurate. - * - * To assert that the right arguments are passed to RuleTester.describe/it, an - * event emitter is used which emits the arguments. - */ - -const ruleTesterTestEmitter = new EventEmitter(); - -//------------------------------------------------------------------------------ -// Tests -//------------------------------------------------------------------------------ - -describe("RuleTester", () => { - - // Stub `describe()` and `it()` while this test suite. - before(() => { - RuleTester.describe = function(text, method) { - ruleTesterTestEmitter.emit("describe", text, method); - return method.call(this); - }; - RuleTester.it = function(text, method) { - ruleTesterTestEmitter.emit("it", text, method); - return method.call(this); - }; - }); - after(() => { - RuleTester.describe = null; - RuleTester.it = null; - }); - - let ruleTester; - - /** - * A helper function to verify Node.js core error messages. - * @param {string} actual The actual input - * @param {string} expected The expected input - * @returns {Function} Error callback to verify that the message is correct - * for the actual and expected input. - */ - function assertErrorMatches(actual, expected) { - const err = new nodeAssert.AssertionError({ - actual, - expected, - operator: NODE_ASSERT_STRICT_EQUAL_OPERATOR - }); - - return err.message; - } - - beforeEach(() => { - RuleTester.resetDefaultConfig(); - ruleTester = new RuleTester(); - }); - - describe("only", () => { - describe("`itOnly` accessor", () => { - describe("when `itOnly` is set", () => { - before(() => { - RuleTester.itOnly = sinon.spy(); - }); - after(() => { - RuleTester.itOnly = void 0; - }); - beforeEach(() => { - RuleTester.itOnly.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by exclusive tests", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(RuleTester.itOnly, "const notVar = 42;"); - }); - }); - - describe("when `it` is set and has an `only()` method", () => { - before(() => { - RuleTester.it.only = () => {}; - sinon.spy(RuleTester.it, "only"); - }); - after(() => { - RuleTester.it.only = void 0; - }); - beforeEach(() => { - RuleTester.it.only.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by tests with `only` set", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(RuleTester.it.only, "const notVar = 42;"); - }); - }); - - describe("when global `it` is a function that has an `only()` method", () => { - let originalGlobalItOnly; - - before(() => { - - /* - * We run tests with `--forbid-only`, so we have to override - * `it.only` to prevent the real one from being called. - */ - originalGlobalItOnly = it.only; - it.only = () => {}; - sinon.spy(it, "only"); - }); - after(() => { - it.only = originalGlobalItOnly; - }); - beforeEach(() => { - it.only.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("is called by tests with `only` set", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - - sinon.assert.calledWith(it.only, "const notVar = 42;"); - }); - }); - - describe("when `describe` and `it` are overridden without `itOnly`", () => { - let originalGlobalItOnly; - - before(() => { - - /* - * These tests override `describe` and `it` already, so we - * don't need to override them here. We do, however, need to - * remove `only` from the global `it` to prevent it from - * being used instead. - */ - originalGlobalItOnly = it.only; - it.only = void 0; - }); - after(() => { - it.only = originalGlobalItOnly; - }); - beforeEach(() => { - ruleTester = new RuleTester(); - }); - - it("throws an error recommending overriding `itOnly`", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - }, "Set `RuleTester.itOnly` to use `only` with a custom test framework."); - }); - }); - - describe("when global `it` is a function that does not have an `only()` method", () => { - let originalGlobalIt; - let originalRuleTesterDescribe; - let originalRuleTesterIt; - - before(() => { - originalGlobalIt = global.it; - - // eslint-disable-next-line no-global-assign -- Temporarily override Mocha global - it = () => {}; - - /* - * These tests override `describe` and `it`, so we need to - * un-override them here so they won't interfere. - */ - originalRuleTesterDescribe = RuleTester.describe; - RuleTester.describe = void 0; - originalRuleTesterIt = RuleTester.it; - RuleTester.it = void 0; - }); - after(() => { - - // eslint-disable-next-line no-global-assign -- Restore Mocha global - it = originalGlobalIt; - RuleTester.describe = originalRuleTesterDescribe; - RuleTester.it = originalRuleTesterIt; - }); - beforeEach(() => { - ruleTester = new RuleTester(); - }); - - it("throws an error explaining that the current test framework does not support `only`", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [{ - code: "const notVar = 42;", - only: true - }], - invalid: [] - }); - }, "The current test framework does not support exclusive tests with `only`."); - }); - }); - }); - - describe("test cases", () => { - const ruleName = "no-var"; - const rule = require("./fixtures/no-var"); - - let originalRuleTesterIt; - let spyRuleTesterIt; - let originalRuleTesterItOnly; - let spyRuleTesterItOnly; - - before(() => { - originalRuleTesterIt = RuleTester.it; - spyRuleTesterIt = sinon.spy(); - RuleTester.it = spyRuleTesterIt; - originalRuleTesterItOnly = RuleTester.itOnly; - spyRuleTesterItOnly = sinon.spy(); - RuleTester.itOnly = spyRuleTesterItOnly; - }); - after(() => { - RuleTester.it = originalRuleTesterIt; - RuleTester.itOnly = originalRuleTesterItOnly; - }); - beforeEach(() => { - spyRuleTesterIt.resetHistory(); - spyRuleTesterItOnly.resetHistory(); - ruleTester = new RuleTester(); - }); - - it("isn't called for normal tests", () => { - ruleTester.run(ruleName, rule, { - valid: ["const notVar = 42;"], - invalid: [] - }); - sinon.assert.calledWith(spyRuleTesterIt, "const notVar = 42;"); - sinon.assert.notCalled(spyRuleTesterItOnly); - }); - - it("calls it or itOnly for every test case", () => { - - /* - * `RuleTester` doesn't implement test case exclusivity itself. - * Setting `only: true` just causes `RuleTester` to call - * whatever `only()` function is provided by the test framework - * instead of the regular `it()` function. - */ - - ruleTester.run(ruleName, rule, { - valid: [ - "const valid = 42;", - { - code: "const onlyValid = 42;", - only: true - } - ], - invalid: [ - { - code: "var invalid = 42;", - errors: [/^Bad var/u] - }, - { - code: "var onlyInvalid = 42;", - errors: [/^Bad var/u], - only: true - } - ] - }); - - sinon.assert.calledWith(spyRuleTesterIt, "const valid = 42;"); - sinon.assert.calledWith(spyRuleTesterItOnly, "const onlyValid = 42;"); - sinon.assert.calledWith(spyRuleTesterIt, "var invalid = 42;"); - sinon.assert.calledWith(spyRuleTesterItOnly, "var onlyInvalid = 42;"); - }); - }); - - describe("static helper wrapper", () => { - it("adds `only` to string test cases", () => { - const test = RuleTester.only("const valid = 42;"); - - assert.deepStrictEqual(test, { - code: "const valid = 42;", - only: true - }); - }); - - it("adds `only` to object test cases", () => { - const test = RuleTester.only({ code: "const valid = 42;" }); - - assert.deepStrictEqual(test, { - code: "const valid = 42;", - only: true - }); - }); - }); - }); - - it("should not throw an error when everything passes", () => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }); - - it("should throw an error when valid code is invalid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have no errors but had 1/u); - }); - - it("should throw an error when valid code is invalid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "eval(foo)" } - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have no errors but had 1/u); - }); - - it("should throw an error if invalid code is valid", () => { - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "Eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression" }] } - ] - }); - }, /Should have 1 error but had 0/u); - }); - - it("should throw an error when the error message is wrong", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [{ message: "Bad error message." }] } - ] - }); - }, assertErrorMatches("Bad var.", "Bad error message.")); - }); - - it("should throw an error when the error message regex does not match", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: [{ message: /Bad error message/u }] } - ] - }); - }, /Expected 'Bad var.' to match \/Bad error message\//u); - }); - - it("should throw an error when the error is not a supported type", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [42] } - ] - }); - }, /Error should be a string, object, or RegExp/u); - }); - - it("should throw an error when any of the errors is not a supported type", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar; var baz = quux", errors: [{ message: "Bad var.", type: "VariableDeclaration" }, null] } - ] - }); - }, /Error should be a string, object, or RegExp/u); - }); - - it("should throw an error when the error is a string and it does not match error message", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: ["Bad error message."] } - ] - }); - }, assertErrorMatches("Bad var.", "Bad error message.")); - }); - - it("should throw an error when the error is a string and it does not match error message", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - valid: [ - ], - invalid: [ - { code: "var foo = bar;", errors: [/Bad error message/u] } - ] - }); - }, /Expected 'Bad var.' to match \/Bad error message\//u); - }); - - it("should not throw an error when the error is a string and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - - // Only the invalid test matters here - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: ["Bad var."] } - ] - }); - }); - - it("should not throw an error when the error is a regex and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: [/^Bad var/u] } - ] - }); - }); - - it("should not throw an error when the error is a string and the suggestion fixer is failing", () => { - ruleTester.run("no-var", require("./fixtures/suggestions").withFailingFixer, { - valid: [], - invalid: [ - { code: "foo", errors: ["some message"] } - ] - }); - }); - - it("throws an error when the error is a string and the suggestion fixer provides a fix", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [ - { code: "foo", errors: ["Avoid using identifiers named 'foo'."] } - ] - }); - }, "Error at index 0 has suggestions. Please convert the test error into an object and specify 'suggestions' property on it to test suggestions."); - }); - - it("should throw an error when the error is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: [{ Message: "Bad var." }] } - ] - }); - }, /Invalid error property name 'Message'/u); - }); - - it("should throw an error when any of the errors is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { - code: "var foo = bar; var baz = quux", - errors: [ - { message: "Bad var.", type: "VariableDeclaration" }, - { message: "Bad var.", typo: "VariableDeclaration" } - ] - } - ] - }); - }, /Invalid error property name 'typo'/u); - }); - - it("should not throw an error when the error is a regex in an object and it matches error message", () => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { code: "var foo = bar;", output: " foo = bar;", errors: [{ message: /^Bad var/u }] } - ] - }); - }); - - it("should throw an error when the expected output doesn't match", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration" }] } - ] - }); - }, /Output is incorrect/u); - }); - - it("should use strict equality to compare output", () => { - const replaceProgramWith5Rule = { - meta: { - fixable: "code" - }, - - create: context => ({ - Program(node) { - context.report({ node, message: "bad", fix: fixer => fixer.replaceText(node, "5") }); - } - }) - }; - - // Should not throw. - ruleTester.run("foo", replaceProgramWith5Rule, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: "5", errors: 1 } - ] - }); - - assert.throws(() => { - ruleTester.run("foo", replaceProgramWith5Rule, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: 5, errors: 1 } - ] - }); - }, /Output is incorrect/u); - }); - - it("should throw an error when the expected output doesn't match and errors is just a number", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: 1 } - ] - }); - }, /Output is incorrect/u); - }); - - it("should not throw an error when the expected output is null and no errors produce output", () => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "eval(x)", errors: 1, output: null }, - { code: "eval(x); eval(y);", errors: 2, output: null } - ] - }); - }); - - it("should throw an error when the expected output is null and problems produce output", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: null, errors: 1 } - ] - }); - }, /Expected no autofixes to be suggested/u); - - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { - code: "var foo = bar; var qux = boop;", - output: null, - errors: 2 - } - ] - }); - }, /Expected no autofixes to be suggested/u); - }); - - it("should throw an error when the expected output is null and only some problems produce output", () => { - assert.throws(() => { - ruleTester.run("fixes-one-problem", require("./fixtures/fixes-one-problem"), { - valid: [], - invalid: [ - { code: "foo", output: null, errors: 2 } - ] - }); - }, /Expected no autofixes to be suggested/u); - }); - - it("should throw an error when the expected output is not null and the output does not differ from the code", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-eval"), { - valid: [], - invalid: [ - { code: "eval('')", output: "eval('')", errors: 1 } - ] - }); - }, "Test property 'output' matches 'code'. If no autofix is expected, then omit the 'output' property or set it to null."); - }); - - it("should throw an error when the expected output isn't specified and problems produce output", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "The rule fixed the code. Please add 'output' property."); - }); - - it("should throw an error if invalid code specifies wrong type", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression2" }] } - ] - }); - }, /Error type should be CallExpression2, found CallExpression/u); - }); - - it("should throw an error if invalid code specifies wrong line", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 5 }] } - ] - }); - }, /Error line should be 5/u); - }); - - it("should not skip line assertion if line is a falsy value", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "\neval(foo)", errors: [{ message: "eval sucks.", type: "CallExpression", line: 0 }] } - ] - }); - }, /Error line should be 0/u); - }); - - it("should throw an error if invalid code specifies wrong column", () => { - const wrongColumn = 10, - expectedErrorMessage = "Error column should be 1"; - - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{ - message: "eval sucks.", - column: wrongColumn - }] - }] - }); - }, expectedErrorMessage); - }); - - it("should throw error for empty error array", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [] - }] - }); - }, /Invalid cases must have at least one error/u); - }); - - it("should throw error for errors : 0", () => { - assert.throws(() => { - ruleTester.run( - "suggestions-messageIds", - require("./fixtures/suggestions") - .withMessageIds, - { - valid: [], - invalid: [ - { - code: "var foo;", - errors: 0 - } - ] - } - ); - }, /Invalid cases must have 'error' value greater than 0/u); - }); - - it("should not skip column assertion if column is a falsy value", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "var foo; eval(foo)", - errors: [{ message: "eval sucks.", column: 0 }] - }] - }); - }, /Error column should be 0/u); - }); - - it("should throw an error if invalid code specifies wrong endLine", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endLine: 10 }] } - ] - }); - }, "Error endLine should be 10"); - }); - - it("should throw an error if invalid code specifies wrong endColumn", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [ - "bar = baz;" - ], - invalid: [ - { code: "var foo = bar;", output: "foo = bar", errors: [{ message: "Bad var.", type: "VariableDeclaration", endColumn: 10 }] } - ] - }); - }, "Error endColumn should be 10"); - }); - - it("should throw an error if invalid code has the wrong number of errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { - code: "eval(foo)", - errors: [ - { message: "eval sucks.", type: "CallExpression" }, - { message: "eval sucks.", type: "CallExpression" } - ] - } - ] - }); - }, /Should have 2 errors but had 1/u); - }); - - it("should throw an error if invalid code does not have errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)" } - ] - }); - }, /Did not specify errors for an invalid test of no-eval/u); - }); - - it("should throw an error if invalid code has the wrong explicit number of errors", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "Eval(foo)" - ], - invalid: [ - { code: "eval(foo)", errors: 2 } - ] - }); - }, /Should have 2 errors but had 1/u); - }); - - it("should throw an error if there's a parsing error in a valid test", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "1eval('foo')" - ], - invalid: [ - { code: "eval('foo')", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if there's a parsing error in an invalid test", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "noeval('foo')" - ], - invalid: [ - { code: "1eval('foo')", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if there's a parsing error in an invalid test and errors is just a number", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - "noeval('foo')" - ], - invalid: [ - { code: "1eval('foo')", errors: 1 } - ] - }); - }, /fatal parsing error/iu); - }); - - // https://github.com/eslint/eslint/issues/4779 - it("should throw an error if there's a parsing error and output doesn't match", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [], - invalid: [ - { code: "obvious parser error", output: "string that doesnt match", errors: [{}] } - ] - }); - }, /fatal parsing error/iu); - }); - - it("should throw an error if an error object has no properties", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{}] - }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - it("should throw an error if an error has a property besides message or messageId", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: ["Eval(foo)"], - invalid: [{ - code: "eval(foo)", - errors: [{ line: 1 }] - }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - it("should pass-through the globals config of valid tests to the to rule", () => { - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - { - code: "var test2 = 'bar'", - globals: { test: true } - } - ], - invalid: [{ code: "bar", errors: 1 }] - }); - }); - - it("should pass-through the globals config of invalid tests to the to rule", () => { - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: ["var test = 'foo'"], - invalid: [ - { - code: "var test = 'foo'; var foo = 'bar'", - errors: 1 - }, - { - code: "var test = 'foo'", - globals: { foo: true }, - errors: [{ message: "Global variable foo should not be used." }] - } - ] - }); - }); - - it("should pass-through the settings config to rules", () => { - ruleTester.run("no-test-settings", require("./fixtures/no-test-settings"), { - valid: [ - { - code: "var test = 'bar'", settings: { test: 1 } - } - ], - invalid: [ - { - code: "var test = 'bar'", settings: { "no-test": 22 }, errors: 1 - } - ] - }); - }); - - it("should pass-through the filename to the rule", () => { - (function() { - ruleTester.run("", require("./fixtures/no-test-filename"), { - valid: [ - { - code: "var foo = 'bar'", - filename: "somefile.js" - } - ], - invalid: [ - { - code: "var foo = 'bar'", - errors: [ - { message: "Filename test was not defined." } - ] - } - ] - }); - }()); - }); - - it("should pass-through the options to the rule", () => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "var foo = 'bar'", - options: [false] - } - ], - invalid: [ - { - code: "var foo = 'bar'", - options: [true], - errors: [{ message: "Invalid args" }] - } - ] - }); - }); - - it("should throw an error if the options are an object", () => { - assert.throws(() => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "foo", - options: { ok: true } - } - ], - invalid: [] - }); - }, /options must be an array/u); - }); - - it("should throw an error if the options are a number", () => { - assert.throws(() => { - ruleTester.run("no-invalid-args", require("./fixtures/no-invalid-args"), { - valid: [ - { - code: "foo", - options: 0 - } - ], - invalid: [] - }); - }, /options must be an array/u); - }); - - it("should pass-through the parser to the rule", () => { - const spy = sinon.spy(ruleTester.linter, "verify"); - - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { - code: "Eval(foo)" - } - ], - invalid: [ - { - code: "eval(foo)", - parser: require.resolve("esprima"), - errors: [{ message: "eval sucks.", line: 1 }] - } - ] - }); - assert.strictEqual(spy.args[1][1].parser, require.resolve("esprima")); - }); - - // skipping because it's not something our parser cares about - it.skip("should pass normalized ecmaVersion to the rule", () => { - const reportEcmaVersionRule = { - meta: { - messages: { - ecmaVersionMessage: "context.parserOptions.ecmaVersion is {{type}} {{ecmaVersion}}." - } - }, - create: context => ({ - Program(node) { - const { ecmaVersion } = context.parserOptions; - - context.report({ - node, - messageId: "ecmaVersionMessage", - data: { type: typeof ecmaVersion, ecmaVersion } - }); - } - }) - }; - - const notEspree = require.resolve("./fixtures/empty-program-parser"); - - ruleTester.run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parserOptions: {} - }, - { - code: "
", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parserOptions: { ecmaFeatures: { jsx: true } } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: require.resolve("espree") - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parserOptions: { ecmaVersion: 6 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parserOptions: { ecmaVersion: 2015 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - env: { browser: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - env: { es6: false } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - env: { es6: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], - env: { es6: false, es2017: true } - }, - { - code: "let x", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - env: { es6: "truthy" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "8" } }], - env: { es2017: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "11" } }], - env: { es2020: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "12" } }], - env: { es2021: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parser: require.resolve("espree"), - parserOptions: { ecmaVersion: "latest" } - }, - { - code: "
", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest", ecmaFeatures: { jsx: true } } - }, - { - code: "import 'foo'", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest", sourceType: "module" } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" }, - env: { es6: true } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: String(espree.latestEcmaVersion) } }], - parserOptions: { ecmaVersion: "latest" }, - env: { es2020: true } - }, - - // Non-Espree parsers normalize ecmaVersion if it's not "latest" - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: notEspree - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }], - parser: notEspree, - parserOptions: {} - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "5" } }], - parser: notEspree, - parserOptions: { ecmaVersion: 5 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }], - parser: notEspree, - parserOptions: { ecmaVersion: 6 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: 6 } }], - parser: notEspree, - parserOptions: { ecmaVersion: 2015 } - }, - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }], - parser: notEspree, - parserOptions: { ecmaVersion: "latest" } - } - ] - }); - - [{ parserOptions: { ecmaVersion: 6 } }, { env: { es6: true } }].forEach(options => { - new RuleTester(options).run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] - }, - { - code: "", - parserOptions: {}, - errors: [{ messageId: "ecmaVersionMessage", data: { type: "number", ecmaVersion: "6" } }] - } - ] - }); - }); - - new RuleTester({ parser: notEspree }).run("report-ecma-version", reportEcmaVersionRule, { - valid: [], - invalid: [ - { - code: "", - errors: [{ messageId: "ecmaVersionMessage", data: { type: "undefined", ecmaVersion: "undefined" } }] - }, - { - code: "", - parserOptions: { ecmaVersion: "latest" }, - errors: [{ messageId: "ecmaVersionMessage", data: { type: "string", ecmaVersion: "latest" } }] - } - ] - }); - }); - - it("should pass-through services from parseForESLint to the rule", () => { - const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); - const disallowHiRule = { - create: context => ({ - Literal(node) { - const disallowed = context.parserServices.test.getMessage(); // returns "Hi!" - - if (node.value === disallowed) { - context.report({ node, message: `Don't use '${disallowed}'` }); - } - } - }) - }; - - ruleTester.run("no-hi", disallowHiRule, { - valid: [ - { - code: "'Hello!'", - parser: enhancedParserPath - } - ], - invalid: [ - { - code: "'Hi!'", - parser: enhancedParserPath, - errors: [{ message: "Don't use 'Hi!'" }] - } - ] - }); - }); - - it("should prevent invalid options schemas", () => { - assert.throws(() => { - ruleTester.run("no-invalid-schema", require("./fixtures/no-invalid-schema"), { - valid: [ - "var answer = 6 * 7;", - { code: "var answer = 6 * 7;", options: [] } - ], - invalid: [ - { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected nothing." }] } - ] - }); - }, "Schema for rule no-invalid-schema is invalid:,\titems: should be object\n\titems[0].enum: should NOT have fewer than 1 items\n\titems: should match some schema in anyOf"); - - }); - - it("should prevent schema violations in options", () => { - assert.throws(() => { - ruleTester.run("no-schema-violation", require("./fixtures/no-schema-violation"), { - valid: [ - "var answer = 6 * 7;", - { code: "var answer = 6 * 7;", options: ["foo"] } - ], - invalid: [ - { code: "var answer = 6 * 7;", options: ["bar"], errors: [{ message: "Expected foo." }] } - ] - }); - }, /Value "bar" should be equal to one of the allowed values./u); - - }); - - it("should disallow invalid defaults in rules", () => { - const ruleWithInvalidDefaults = { - meta: { - schema: [ - { - oneOf: [ - { enum: ["foo"] }, - { - type: "object", - properties: { - foo: { - enum: ["foo", "bar"], - default: "foo" - } - }, - additionalProperties: false - } - ] - } - ] - }, - create: () => ({}) - }; - - assert.throws(() => { - ruleTester.run("invalid-defaults", ruleWithInvalidDefaults, { - valid: [ - { - code: "foo", - options: [{}] - } - ], - invalid: [] - }); - }, /Schema for rule invalid-defaults is invalid: default is ignored for: data1\.foo/u); - }); - - it("throw an error when an unknown config option is included", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "Eval(foo)", foo: "bar" } - ], - invalid: [] - }); - }, /ESLint configuration in rule-tester is invalid./u); - }); - - it("throw an error when an invalid config value is included", () => { - assert.throws(() => { - ruleTester.run("no-eval", require("./fixtures/no-eval"), { - valid: [ - { code: "Eval(foo)", env: ["es6"] } - ], - invalid: [] - }); - }, /Property "env" is the wrong type./u); - }); - - it("should pass-through the tester config to the rule", () => { - ruleTester = new RuleTester({ - globals: { test: true } - }); - - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - "var test2 = test" - ], - invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] - }); - }); - - it("should correctly set the globals configuration", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - assert( - RuleTester.getDefaultConfig().globals.test, - "The default config object is incorrect" - ); - }); - - it("should correctly reset the global configuration", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - RuleTester.resetDefaultConfig(); - assert.deepStrictEqual( - RuleTester.getDefaultConfig(), - { parser: require.resolve('@typescript-eslint/parser'), rules: {} }, - "The default configuration has not reset correctly" - ); - }); - - it("should enforce the global configuration to be an object", () => { - - /** - * Set the default config for the rules tester - * @param {Object} config configuration object - * @returns {Function} Function to be executed - * @private - */ - function setConfig(config) { - return function() { - RuleTester.setDefaultConfig(config); - }; - } - assert.throw(setConfig()); - assert.throw(setConfig(1)); - assert.throw(setConfig(3.14)); - assert.throw(setConfig("foo")); - assert.throw(setConfig(null)); - assert.throw(setConfig(true)); - }); - - it("should pass-through the globals config to the tester then to the to rule", () => { - const config = { globals: { test: true } }; - - RuleTester.setDefaultConfig(config); - ruleTester = new RuleTester(); - - ruleTester.run("no-test-global", require("./fixtures/no-test-global"), { - valid: [ - "var test = 'foo'", - "var test2 = test" - ], - invalid: [{ code: "bar", errors: 1, globals: { foo: true } }] - }); - }); - - it("should throw an error if AST was modified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if AST was modified (at Program)", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-first"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if AST was modified (at Program:exit)", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [ - "var foo = 0;" - ], - invalid: [] - }); - }, "Rule should not modify AST."); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [], - invalid: [ - { code: "var bar = 0;", errors: ["error"] } - ] - }); - }, "Rule should not modify AST."); - }); - - it("should throw an error if rule uses start and end properties on nodes, tokens or comments", () => { - const usesStartEndRule = { - create(context) { - return { - CallExpression(node) { - noop(node.arguments[1].start); - }, - "BinaryExpression[operator='+']"(node) { - noop(node.end); - }, - "UnaryExpression[operator='-']"(node) { - noop(context.sourceCode.getFirstToken(node).start); - }, - ConditionalExpression(node) { - noop(context.sourceCode.getFirstToken(node).end); - }, - BlockStatement(node) { - noop(context.sourceCode.getCommentsInside(node)[0].start); - }, - ObjectExpression(node) { - noop(context.sourceCode.getCommentsInside(node)[0].end); - }, - Decorator(node) { - noop(node.start); - } - }; - } - }; - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["foo(a, b)"], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = b * (c + d) / e;", errors: 1 }] - }); - }, "Use node.range[1] instead of node.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = -b * c;", errors: 1 }] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["var a = b ? c : d;"], - invalid: [] - }); - }, "Use token.range[1] instead of token.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: ["function f() { /* comment */ }"], - invalid: [] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var x = //\n {\n //comment\n //\n}", errors: 1 }] - }); - }, "Use token.range[1] instead of token.end"); - - const enhancedParserPath = require.resolve("./fixtures/enhanced-parser"); - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "foo(a, b)", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = b * (c + d) / e;", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use node.range[1] instead of node.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var a = -b * c;", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "var a = b ? c : d;", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use token.range[1] instead of token.end"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "function f() { /* comment */ }", parser: enhancedParserPath }], - invalid: [] - }); - }, "Use token.range[0] instead of token.start"); - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [], - invalid: [{ code: "var x = //\n {\n //comment\n //\n}", parser: enhancedParserPath, errors: 1 }] - }); - }, "Use token.range[1] instead of token.end"); - - assert.throws(() => { - ruleTester.run("uses-start-end", usesStartEndRule, { - valid: [{ code: "@foo class A {}", parser: require.resolve("./fixtures/enhanced-parser2") }], - invalid: [] - }); - }, "Use node.range[0] instead of node.start"); - }); - - it("should throw an error if no test scenarios given", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last")); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - }); - - it("should throw an error if no acceptable test scenario object is given", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), []); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), ""); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), 2); - }, "Test Scenarios for rule foo : Could not find test scenario object"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), {}); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - valid: [] - }); - }, "Test Scenarios for rule foo is invalid:\nCould not find any invalid test scenarios"); - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/modify-ast-at-last"), { - invalid: [] - }); - }, "Test Scenarios for rule foo is invalid:\nCould not find any valid test scenarios"); - }); - - // Nominal message/messageId use cases - it("should assert match if message provided in both test and result.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "something" }] }] - }); - }, /Avoid using variables named/u); - - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "Avoid using variables named 'foo'." }] }] - }); - }); - - it("should assert match between messageId if provided in both test and result.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "unused" }] }] - }); - }, "messageId 'avoidFoo' does not match expected messageId 'unused'."); - - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }); - it("should assert match between resulting message output if messageId and data provided in both test and result", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "notFoo" } }] }] - }); - }, "Hydrated message \"Avoid using variables named 'notFoo'.\" does not match \"Avoid using variables named 'foo'.\""); - }); - - it("should throw if the message has a single unsubstituted placeholder when data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMissingData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has an unsubstituted placeholder 'name'. Please provide the missing value via the 'data' property in the context.report() call."); - }); - - it("should throw if the message has a single unsubstituted placeholders when data is specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMissingData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "name" } }] }] - }); - }, "Hydrated message \"Avoid using variables named 'name'.\" does not match \"Avoid using variables named '{{ name }}'."); - }); - - it("should throw if the message has multiple unsubstituted placeholders when data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMultipleMissingDataProperties, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has unsubstituted placeholders: 'type', 'name'. Please provide the missing values via the 'data' property in the context.report() call."); - }); - - it("should not throw if the data in the message contains placeholders not present in the raw message", () => { - ruleTester.run("foo", require("./fixtures/messageId").withPlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }); - - it("should throw if the data in the message contains the same placeholder and data is not specified", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withSamePlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "The reported message has an unsubstituted placeholder 'name'. Please provide the missing value via the 'data' property in the context.report() call."); - }); - - it("should not throw if the data in the message contains the same placeholder and data is specified", () => { - ruleTester.run("foo", require("./fixtures/messageId").withSamePlaceholdersInData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo", data: { name: "{{ name }}" } }] }] - }); - }); - - it("should not throw an error for specifying non-string data values", () => { - ruleTester.run("foo", require("./fixtures/messageId").withNonStringData, { - valid: [], - invalid: [{ code: "0", errors: [{ messageId: "avoid", data: { value: 0 } }] }] - }); - }); - - // messageId/message misconfiguration cases - it("should throw if user tests for both message and messageId", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ message: "something", messageId: "avoidFoo" }] }] - }); - }, "Error should not specify both 'message' and a 'messageId'."); - }); - it("should throw if user tests for messageId but the rule doesn't use the messageId meta syntax.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMessageOnly, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "avoidFoo" }] }] - }); - }, "Error can not use 'messageId' if rule under test doesn't define 'meta.messages'"); - }); - it("should throw if user tests for messageId not listed in the rule's meta syntax.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ messageId: "useFoo" }] }] - }); - }, /Invalid messageId 'useFoo'/u); - }); - it("should throw if data provided without messageId.", () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/messageId").withMetaWithData, { - valid: [], - invalid: [{ code: "foo", errors: [{ data: "something" }] }] - }); - }, "Test error must specify either a 'messageId' or 'message'."); - }); - - describe("suggestions", () => { - it("should throw if suggestions are available but not specified", () => { - assert.throw(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ message: "Avoid using identifiers named 'foo'." }] - }] - }); - }, "Error at index 0 has suggestions. Please specify 'suggestions' property on the test error object."); - }); - - it("should pass with valid suggestions (tested using desc)", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }] - }] - }] - }); - }); - - it("should pass with suggestions on multiple lines", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [ - { - code: "function foo() {\n var foo = 1;\n}", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "function bar() {\n var foo = 1;\n}" - }] - }, { - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "function foo() {\n var bar = 1;\n}" - }] - }] - } - ] - }); - }); - - it("should pass with valid suggestions (tested using messageIds)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should pass with valid suggestions (one tested using messageIds, the other using desc)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should fail with valid suggestions when testing using both desc and messageIds for the same suggestion", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - messageId: "renameFoo", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test should not specify both 'desc' and 'messageId'."); - }); - - it("should pass with valid suggestions (tested using only desc on a rule that utilizes meta.messages)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should pass with valid suggestions (tested using messageIds and data)", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }); - - it("should fail with a single missing data placeholder when data is not specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMissingPlaceholderData, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has an unsubstituted placeholder 'newName'. Please provide the missing value via the 'data' property for the suggestion in the context.report() call."); - }); - - it("should fail with a single missing data placeholder when data is specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMissingPlaceholderData, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { other: "name" }, - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has an unsubstituted placeholder 'newName'. Please provide the missing value via the 'data' property for the suggestion in the context.report() call."); - }); - - it("should fail with multiple missing data placeholders when data is not specified", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("../../fixtures/testers/rule-tester/suggestions").withMultipleMissingPlaceholderDataProperties, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "rename", - output: "var bar;" - }] - }] - }] - }); - }, "The message of the suggestion has unsubstituted placeholders: 'currentName', 'newName'. Please provide the missing values via the 'data' property for the suggestion in the context.report() call."); - }); - - - it("should fail when tested using empty suggestion test objects even if the array length is correct", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{}, {}] - }] - }] - }); - }, "Error Suggestion at index 0: Test must specify either 'messageId' or 'desc'"); - }); - - it("should fail when tested using non-empty suggestion test objects without an output property", () => { - assert.throw(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ messageId: "renameFoo" }, {}] - }] - }] - }); - }, 'Error Suggestion at index 0: The "output" property is required.'); - }); - - it("should support explicitly expecting no suggestions", () => { - [void 0, null, false, []].forEach(suggestions => { - ruleTester.run("suggestions-basic", require("./fixtures/no-eval"), { - valid: [], - invalid: [{ - code: "eval('var foo');", - errors: [{ - message: "eval sucks.", - suggestions - }] - }] - }); - }); - }); - - it("should fail when expecting no suggestions and there are suggestions", () => { - [void 0, null, false, []].forEach(suggestions => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions - }] - }] - }); - }, "Error should have no suggestions on error with message: \"Avoid using identifiers named 'foo'.\""); - }); - }); - - it("should fail when testing for suggestions that don't exist", () => { - assert.throws(() => { - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - message: "Bad var.", - messageId: "this-does-not-exist" - }] - }] - }] - }); - }, 'Error should have suggestions on error with message: "Bad var."'); - }); - - it("should support specifying only the amount of suggestions", () => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: 1 - }] - }] - }); - }); - - it("should fail when there are a different number of suggestions", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: 2 - }] - }] - }); - }, "Error should have 2 suggestions. Instead found 1 suggestions"); - }); - - it("should fail when there are a different number of suggestions for arrays", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - desc: "Rename identifier 'foo' to 'baz'", - output: "var baz;" - }] - }] - }] - }); - }, "Error should have 2 suggestions. Instead found 1 suggestions"); - }); - - it("should fail when the suggestion property is neither a number nor an array", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: "1" - }] - }] - }); - }, "Test error object property 'suggestions' should be an array or a number"); - }); - - it("should throw if suggestion fix made a syntax error.", () => { - assert.throw(() => { - ruleTester.run( - "foo", - { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "make a syntax error", - suggest: [ - { - desc: "make a syntax error", - fix(fixer) { - return fixer.replaceText(node, "one two"); - } - } - ] - }); - } - }; - } - }, - { - valid: [""], - invalid: [{ - code: "one()", - errors: [{ - message: "make a syntax error", - suggestions: [{ - desc: "make a syntax error", - output: "one two()" - }] - }] - }] - } - ); - }, /A fatal parsing error occurred in suggestion fix\.\nError: .+\nSuggestion output:\n.+/u); - }); - - it("should throw if the suggestion description doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - desc: "not right", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0 : desc should be \"not right\" but got \"Rename identifier 'foo' to 'bar'\" instead."); - }); - - it("should pass when different suggestion matchers use desc and messageId", () => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }); - - it("should throw if the suggestion messageId doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "unused", - output: "var bar;" - }, { - messageId: "renameFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: messageId should be 'unused' but got 'renameFoo' instead."); - }); - - it("should throw if test specifies messageId for a rule that doesn't have meta.messages", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test can not use 'messageId' if rule under test doesn't define 'meta.messages'."); - }); - - it("should throw if test specifies messageId that doesn't exist in the rule's meta.messages", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "removeFoo", - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Test has invalid messageId 'removeFoo', the rule under test allows only one of ['avoidFoo', 'unused', 'renameFoo']."); - }); - - it("should throw if hydrated desc doesn't match (wrong data value)", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "car" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Hydrated test desc \"Rename identifier 'foo' to 'car'\" does not match received desc \"Rename identifier 'foo' to 'bar'\"."); - }); - - it("should throw if hydrated desc doesn't match (wrong data key)", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { name: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Hydrated test desc \"Rename identifier 'foo' to '{{ newName }}'\" does not match received desc \"Rename identifier 'foo' to 'baz'\"."); - }); - - it("should throw if test specifies both desc and data", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - messageId: "renameFoo", - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 0: Test should not specify both 'desc' and 'data'."); - }); - - it("should throw if test uses data but doesn't specify messageId", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - messageId: "avoidFoo", - suggestions: [{ - messageId: "renameFoo", - data: { newName: "bar" }, - output: "var bar;" - }, { - data: { newName: "baz" }, - output: "var baz;" - }] - }] - }] - }); - }, "Error Suggestion at index 1: Test must specify 'messageId' if 'data' is used."); - }); - - it("should throw if the resulting suggestion output doesn't match", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var baz;" - }] - }] - }] - }); - }, "Expected the applied suggestion fix to match the test suggestion output"); - }); - - it("should throw if the resulting suggestion output is the same as the original source code", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").withFixerWithoutChanges, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [{ - desc: "Rename identifier 'foo' to 'bar'", - output: "var foo;" - }] - }] - }] - }); - }, "The output of a suggestion should differ from the original source code for suggestion at index: 0 on error with message: \"Avoid using identifiers named 'foo'.\""); - }); - - it("should fail when specified suggestion isn't an object", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "Avoid using identifiers named 'foo'.", - suggestions: [null] - }] - }] - }); - }, "Test suggestion in 'suggestions' array must be an object."); - - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - message: "avoidFoo", - suggestions: [ - { - messageId: "renameFoo", - output: "var bar;" - }, - "Rename identifier 'foo' to 'baz'" - ] - }] - }] - }); - }, "Test suggestion in 'suggestions' array must be an object."); - }); - - it("should fail when the suggestion is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("suggestions-basic", require("./fixtures/suggestions").basic, { - valid: [ - "var boo;" - ], - invalid: [{ - code: "var foo;", - errors: [{ - message: "avoidFoo", - suggestions: [{ - message: "Rename identifier 'foo' to 'bar'" - }] - }] - }] - }); - }, /Invalid suggestion property name 'message'/u); - }); - - it("should fail when any of the suggestions is an object with an unknown property name", () => { - assert.throws(() => { - ruleTester.run("suggestions-messageIds", require("./fixtures/suggestions").withMessageIds, { - valid: [], - invalid: [{ - code: "var foo;", - errors: [{ - suggestions: [{ - messageId: "renameFoo", - output: "var bar;" - }, { - messageId: "renameFoo", - outpt: "var baz;" - }] - }] - }] - }); - }, /Invalid suggestion property name 'outpt'/u); - }); - - it("should fail if a rule produces two suggestions with the same description", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-descriptions", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateDescriptions, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename 'foo' to 'bar'' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should fail if a rule produces two suggestions with the same messageId without data", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-messageids-no-data", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateMessageIdsNoData, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename identifier' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should fail if a rule produces two suggestions with the same messageId with data", () => { - assert.throws(() => { - ruleTester.run("suggestions-with-duplicate-messageids-with-data", require("../../fixtures/testers/rule-tester/suggestions").withDuplicateMessageIdsWithData, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - }, "Suggestion message 'Rename identifier 'foo' to 'bar'' reported from suggestion 1 was previously reported by suggestion 0. Suggestion messages should be unique within an error."); - }); - - it("should throw an error if a rule that doesn't have `meta.hasSuggestions` enabled produces suggestions", () => { - assert.throws(() => { - ruleTester.run("suggestions-missing-hasSuggestions-property", require("./fixtures/suggestions").withoutHasSuggestionsProperty, { - valid: [], - invalid: [ - { code: "var foo = bar;", output: "5", errors: 1 } - ] - }); - }, "Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); - }); - }); - - describe("deprecations", () => { - let processStub; - const ruleWithNoSchema = { - meta: { - type: "suggestion" - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - const ruleWithNoMeta = { - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - beforeEach(() => { - processStub = sinon.stub(process, "emitWarning"); - }); - - afterEach(() => { - processStub.restore(); - }); - - it("should log a deprecation warning when using the legacy function-style API for rule", () => { - - /** - * Legacy-format rule (a function instead of an object with `create` method). - * @param {RuleContext} context The ESLint rule context object. - * @returns {Object} Listeners. - */ - function functionStyleRule(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - - ruleTester.run("function-style-rule", functionStyleRule, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"function-style-rule\" rule is using the deprecated function-style format and will stop working in ESLint v9. Please use object-style format: https://eslint.org/docs/latest/extend/custom-rules", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when meta is not defined for the rule", () => { - ruleTester.run("rule-with-no-meta-1", ruleWithNoMeta, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-no-meta-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is not defined for the rule", () => { - ruleTester.run("rule-with-no-schema-1", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-no-schema-1\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is `undefined`", () => { - const ruleWithUndefinedSchema = { - meta: { - type: "problem", - // eslint-disable-next-line no-undefined -- intentionally added for test case - schema: undefined - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-undefined-schema", ruleWithUndefinedSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-undefined-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should log a deprecation warning when schema is `null`", () => { - const ruleWithNullSchema = { - meta: { - type: "problem", - schema: null - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-null-schema", ruleWithNullSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [{ foo: true }], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 1, "calls `process.emitWarning()` once"); - assert.deepStrictEqual( - processStub.getCall(0).args, - [ - "\"rule-with-null-schema\" rule has options but is missing the \"meta.schema\" property and will stop working in ESLint v9. Please add a schema: https://eslint.org/docs/latest/extend/custom-rules#options-schemas", - "DeprecationWarning" - ] - ); - }); - - it("should not log a deprecation warning when schema is an empty array", () => { - const ruleWithEmptySchema = { - meta: { - type: "suggestion", - schema: [] - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-no-options", ruleWithEmptySchema, { - valid: [], - invalid: [{ code: "var foo = bar;", errors: 1 }] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule is an object-style rule, the legacy rule API warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-2", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule has meta.schema and there are test cases with options, the missing schema warning is not emitted", () => { - const ruleWithSchema = { - meta: { - type: "suggestion", - schema: [{ - type: "boolean" - }] - }, - create(context) { - return { - Program(node) { - context.report({ node, message: "bad" }); - } - }; - } - }; - - ruleTester.run("rule-with-schema", ruleWithSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [true], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule does not have meta, but there are no test cases with options, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-meta-2", ruleWithNoMeta, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - - it("When the rule has meta without meta.schema, but there are no test cases with options, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-3", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - it("When the rule has meta without meta.schema, and some test cases have options property but it's an empty array, the missing schema warning is not emitted", () => { - ruleTester.run("rule-with-no-schema-4", ruleWithNoSchema, { - valid: [], - invalid: [ - { code: "var foo = bar;", options: [], errors: 1 } - ] - }); - - assert.strictEqual(processStub.callCount, 0, "never calls `process.emitWarning()`"); - }); - }); - - /** - * Asserts that a particular value will be emitted from an EventEmitter. - * @param {EventEmitter} emitter The emitter that should emit a value - * @param {string} emitType The type of emission to listen for - * @param {any} expectedValue The value that should be emitted - * @returns {Promise} A Promise that fulfills if the value is emitted, and rejects if something else is emitted. - * The Promise will be indefinitely pending if no value is emitted. - */ - function assertEmitted(emitter, emitType, expectedValue) { - return new Promise((resolve, reject) => { - emitter.once(emitType, emittedValue => { - if (emittedValue === expectedValue) { - resolve(); - } else { - reject(new Error(`Expected ${expectedValue} to be emitted but ${emittedValue} was emitted instead.`)); - } - }); - }); - } - - describe("naming test cases", () => { - - it("should use the first argument as the name of the test suite", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "describe", "this-is-a-rule-name"); - - ruleTester.run("this-is-a-rule-name", require("./fixtures/no-var"), { - valid: [], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for valid code (string form)", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - "valid(code);" - ], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for valid code (object form)", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "valid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - code: "valid(code);" - } - ], - invalid: [] - }); - - return assertion; - }); - - it("should use the test code as the name of the tests for invalid code", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - // https://github.com/eslint/eslint/issues/8142 - it("should use the empty string as the name of the test if the test case is an empty string", () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", ""); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - code: "" - } - ], - invalid: [] - }); - - return assertion; - }); - - it('should use the "name" property if set to a non-empty string', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - name: "my test", - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - it('should use the "name" property if set to a non-empty string for valid cases too', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "my test"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [ - { - name: "my test", - code: "valid(code);" - } - ], - invalid: [] - }); - - return assertion; - }); - - - it('should use the test code as the name if the "name" property is set to an empty string', () => { - const assertion = assertEmitted(ruleTesterTestEmitter, "it", "var x = invalid(code);"); - - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - name: "", - code: "var x = invalid(code);", - output: " x = invalid(code);", - errors: 1 - } - ] - }); - - return assertion; - }); - - it('should throw if "name" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", name: 123 }], - invalid: [{ code: "foo" }] - - }); - }, /Optional test case property 'name' must be a string/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: "foo", name: 123 }] - }); - }, /Optional test case property 'name' must be a string/u); - }); - - it('should throw if "code" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: 123 }], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [123], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: 123 }] - }); - }, /Test case must specify a string value for 'code'/u); - }); - - it('should throw if "code" property is missing', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ }], - invalid: [{ code: "foo" }] - - }); - }, /Test case must specify a string value for 'code'/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ }] - }); - }, /Test case must specify a string value for 'code'/u); - }); - }); - - // https://github.com/eslint/eslint/issues/11615 - it("should fail the case if autofix made a syntax error.", () => { - assert.throw(() => { - ruleTester.run( - "foo", - { - meta: { - fixable: "code" - }, - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "make a syntax error", - fix(fixer) { - return fixer.replaceText(node, "one two"); - } - }); - } - }; - } - }, - { - valid: ["one()"], - invalid: [] - } - ); - }, /A fatal parsing error occurred in autofix.\nError: .+\nAutofix output:\n.+/u); - }); - - describe("type checking", () => { - it('should throw if "only" property is not a boolean', () => { - - // "only" has to be falsy as itOnly is not mocked for all test cases - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", only: "" }], - invalid: [] - }); - }, /Optional test case property 'only' must be a boolean/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [], - invalid: [{ code: "foo", only: 0, errors: 1 }] - }); - }, /Optional test case property 'only' must be a boolean/u); - }); - - it('should throw if "filename" property is not a string', () => { - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: [{ code: "foo", filename: false }], - invalid: [] - - }); - }, /Optional test case property 'filename' must be a string/u); - - assert.throws(() => { - ruleTester.run("foo", require("./fixtures/no-var"), { - valid: ["foo"], - invalid: [{ code: "foo", errors: 1, filename: 0 }] - }); - }, /Optional test case property 'filename' must be a string/u); - }); - }); - - describe("sanitize test cases", () => { - let originalRuleTesterIt; - let spyRuleTesterIt; - - before(() => { - originalRuleTesterIt = RuleTester.it; - spyRuleTesterIt = sinon.spy(); - RuleTester.it = spyRuleTesterIt; - }); - after(() => { - RuleTester.it = originalRuleTesterIt; - }); - beforeEach(() => { - spyRuleTesterIt.resetHistory(); - ruleTester = new RuleTester(); - }); - it("should present newline when using back-tick as new line", () => { - const code = ` - var foo = bar;`; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, code); - }); - it("should present \\u0000 as a string", () => { - const code = "\u0000"; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, "\\u0000"); - }); - it("should present the pipe character correctly", () => { - const code = "var foo = bar || baz;"; - - ruleTester.run("no-var", require("./fixtures/no-var"), { - valid: [], - invalid: [ - { - code, - errors: [/^Bad var/u] - } - ] - }); - sinon.assert.calledWith(spyRuleTesterIt, code); - }); - - }); - - describe("SourceCode#getComments()", () => { - const useGetCommentsRule = { - create: context => ({ - Program(node) { - const sourceCode = context.getSourceCode(); - - sourceCode.getComments(node); - } - }) - }; - - it("should throw if called from a valid test case", () => { - assert.throws(() => { - ruleTester.run("use-get-comments", useGetCommentsRule, { - valid: [""], - invalid: [] - }); - }, /`SourceCode#getComments\(\)` is deprecated/u); - }); - - it("should throw if called from an invalid test case", () => { - assert.throws(() => { - ruleTester.run("use-get-comments", useGetCommentsRule, { - valid: [], - invalid: [{ - code: "", - errors: [{}] - }] - }); - }, /`SourceCode#getComments\(\)` is deprecated/u); - }); - }); - - describe("Subclassing", () => { - - it("should allow subclasses to set the describe/it/itOnly statics and should correctly use those values", () => { - const assertionDescribe = assertEmitted(ruleTesterTestEmitter, "custom describe", "this-is-a-rule-name"); - const assertionIt = assertEmitted(ruleTesterTestEmitter, "custom it", "valid(code);"); - const assertionItOnly = assertEmitted(ruleTesterTestEmitter, "custom itOnly", "validOnly(code);"); - - /** - * Subclass for testing - */ - class RuleTesterSubclass extends RuleTester { } - RuleTesterSubclass.describe = function(text, method) { - ruleTesterTestEmitter.emit("custom describe", text, method); - return method.call(this); - }; - RuleTesterSubclass.it = function(text, method) { - ruleTesterTestEmitter.emit("custom it", text, method); - return method.call(this); - }; - RuleTesterSubclass.itOnly = function(text, method) { - ruleTesterTestEmitter.emit("custom itOnly", text, method); - return method.call(this); - }; - - const ruleTesterSubclass = new RuleTesterSubclass(); - - ruleTesterSubclass.run("this-is-a-rule-name", require("./fixtures/no-var"), { - valid: [ - "valid(code);", - { - code: "validOnly(code);", - only: true - } - ], - invalid: [] - }); - - return Promise.all([ - assertionDescribe, - assertionIt, - assertionItOnly - ]); - }); - - }); - - describe("duplicate test cases", () => { - describe("valid test cases", () => { - it("throws with duplicate string test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: ["foo", "foo"], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: [{ code: "foo" }, { code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("throws with string and object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: ["foo", { code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("ignores the name property", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create() { - return {}; - } - }, { - valid: [{ code: "foo" }, { name: "bar", code: "foo" }], - invalid: [] - }); - }, "detected duplicate test case"); - }); - - it("does not ignore top level test case properties nested in other test case properties", () => { - ruleTester.run("foo", { - meta: { schema: [{ type: "object" }] }, - create() { - return {}; - } - }, { - valid: [{ options: [{ name: "foo" }], name: "foo", code: "same" }, { options: [{ name: "bar" }], name: "bar", code: "same" }], - invalid: [] - }); - }); - - it("does not throw an error for defining the same test case in different run calls", () => { - const rule = { - meta: {}, - create() { - return {}; - } - }; - - ruleTester.run("foo", rule, { - valid: ["foo"], - invalid: [] - }); - - ruleTester.run("foo", rule, { - valid: ["foo"], - invalid: [] - }); - }); - }); - - describe("invalid test cases", () => { - it("throws with duplicate object test cases", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases when options is a primitive", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: ["abc"] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: ["abc"] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases when options is a nested serializable object", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: [{ a: true, b: [1, 2, 3] }] }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: [{ a: true, b: [1, 2, 3] }] }] } - ] - }); - }, "detected duplicate test case"); - }); - - it("throws with duplicate object test cases even when property order differs", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { errors: [{ message: "foo bar" }], code: "const x = 123;" } - ] - }); - }, "detected duplicate test case"); - }); - - it("ignores duplicate test case when non-serializable property present (settings)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], settings: { foo: /abc/u } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], settings: { foo: /abc/u } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (languageOptions.parserOptions)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], languageOptions: { parserOptions: { foo: /abc/u } } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], languageOptions: { parserOptions: { foo: /abc/u } } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (plugins)", () => { - ruleTester.run("foo", { - meta: {}, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], plugins: { foo: /abc/u } }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], plugins: { foo: /abc/u } } - ] - }); - }); - - it("ignores duplicate test case when non-serializable property present (options)", () => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: ["foo"], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: /abc/u }] }, - { code: "const x = 123;", errors: [{ message: "foo bar" }], options: [{ foo: /abc/u }] } - ] - }); - }); - - it("detects duplicate test cases even if the error matchers differ", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: [], - invalid: [ - { code: "const x = 123;", errors: [{ message: "foo bar" }] }, - { code: "const x = 123;", errors: 1 } - ] - }); - }, "detected duplicate test case"); - }); - - it("detects duplicate test cases even if the presence of the output property differs", () => { - assert.throws(() => { - ruleTester.run("foo", { - meta: { schema: false }, - create(context) { - return { - VariableDeclaration(node) { - context.report(node, "foo bar"); - } - }; - } - }, { - valid: [], - invalid: [ - { code: "const x = 123;", errors: 1 }, - { code: "const x = 123;", errors: 1, output: null } - ] - }); - }, "detected duplicate test case"); - }); - }); - }); - -}); diff --git a/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js deleted file mode 100644 index 06a87c90dcde..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/empty-program-parser.js +++ /dev/null @@ -1,29 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/empty-program-parser.js - -"use strict"; - -exports.parse = function (text, parserOptions) { - return { - "type": "Program", - "start": 0, - "end": 0, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 0 - } - }, - "range": [ - 0, - 0 - ], - "body": [], - "sourceType": "script", - "comments": [], - "tokens": [] - }; -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js deleted file mode 100644 index 9aef71554d3d..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser.js +++ /dev/null @@ -1,20 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser.js - -var espree = require("espree"); - -exports.parseForESLint = function(code, options) { - return { - ast: espree.parse(code, options), - services: { - test: { - getMessage() { - return "Hi!"; - } - } - } - }; -}; - -exports.parse = function() { - throw new Error("Use parseForESLint() instead."); -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js b/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js deleted file mode 100644 index bd91282a38c6..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/enhanced-parser2.js +++ /dev/null @@ -1,25 +0,0 @@ -// Forked from https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/parsers/enhanced-parser2.js - -"use strict"; - -const assert = require("assert"); -const vk = require("eslint-visitor-keys"); -const KEYS = vk.unionWith({ - ClassDeclaration: ["experimentalDecorators"], - ClassExpression: ["experimentalDecorators"] -}) - -exports.parseForESLint = (code, options) => { - assert(code === "@foo class A {}"); - assert(options.eslintVisitorKeys === true); - assert(options.eslintScopeManager === true); - - return { - ast: { type: "Program", start: 0, end: 15, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 15 } }, comments: [], tokens: [{ type: "Punctuator", value: "@", start: 0, end: 1, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }, range: [0, 1] }, { type: "Identifier", value: "foo", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 } }, range: [1, 4] }, { type: "Keyword", value: "class", start: 5, end: 10, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 10 } }, range: [5, 10] }, { type: "Identifier", value: "A", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 } }, range: [11, 12] }, { type: "Punctuator", value: "{", start: 13, end: 14, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 14 } }, range: [13, 14] }, { type: "Punctuator", value: "}", start: 14, end: 15, loc: { start: { line: 1, column: 14 }, end: { line: 1, column: 15 } }, range: [14, 15] }], range: [5, 15], sourceType: "module", body: [{ type: "ClassDeclaration", start: 5, end: 15, loc: { start: { line: 1, column: 5 }, end: { line: 1, column: 15 } }, experimentalDecorators: [{ type: "Decorator", start: 0, end: 4, loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 4 } }, expression: { type: "Identifier", start: 1, end: 4, loc: { start: { line: 1, column: 1 }, end: { line: 1, column: 4 }, identifierName: "foo" }, name: "foo", range: [1, 4], _babelType: "Identifier" }, range: [0, 4], _babelType: "Decorator" }], id: { type: "Identifier", start: 11, end: 12, loc: { start: { line: 1, column: 11 }, end: { line: 1, column: 12 }, identifierName: "A" }, name: "A", range: [11, 12], _babelType: "Identifier" }, superClass: null, body: { type: "ClassBody", start: 13, end: 15, loc: { start: { line: 1, column: 13 }, end: { line: 1, column: 15 } }, body: [], range: [13, 15], _babelType: "ClassBody" }, range: [5, 15], _babelType: "ClassDeclaration" }] }, - visitorKeys: KEYS - }; -}; - -exports.parse = function () { - throw new Error("Use parseForESLint() instead."); -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js b/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js deleted file mode 100644 index adde04196c95..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/fixes-one-problem.js +++ /dev/null @@ -1,25 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/fixes-one-problem.js - -"use strict"; - -module.exports = { - meta: { - fixable: "code" - }, - create(context) { - return { - Program(node) { - context.report({ - node, - message: "No programs allowed." - }); - - context.report({ - node, - message: "Seriously, no programs allowed.", - fix: fixer => fixer.remove(node) - }); - } - } - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/messageId.js b/packages/rule-tester/tests/eslint-base/fixtures/messageId.js deleted file mode 100644 index 3813b878edc6..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/messageId.js +++ /dev/null @@ -1,146 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/messageId.js - -"use strict"; - -module.exports.withMetaWithData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - } - }); - } - } - }; - } -}; - -module.exports.withMessageOnly = { - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ node, message: "Avoid using variables named 'foo'."}); - } - } - }; - } -}; - -module.exports.withMissingData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - }); - } - } - }; - } -}; - -module.exports.withMultipleMissingDataProperties = { - meta: { - messages: { - avoidFoo: "Avoid using {{ type }} named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - }); - } - } - }; - } -}; - -module.exports.withPlaceholdersInData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { name: '{{ placeholder }}' }, - }); - } - } - }; - } -}; - -module.exports.withSamePlaceholdersInData = { - meta: { - messages: { - avoidFoo: "Avoid using variables named '{{ name }}'.", - unused: "An unused key" - } - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { name: '{{ name }}' }, - }); - } - } - }; - } -}; - -module.exports.withNonStringData = { - meta: { - messages: { - avoid: "Avoid using the value '{{ value }}'.", - } - }, - create(context) { - return { - Literal(node) { - if (node.value === 0) { - context.report({ - node, - messageId: "avoid", - data: { value: 0 }, - }); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js deleted file mode 100644 index 53ddcd28847e..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-first.js +++ /dev/null @@ -1,37 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-first.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program": function(node) { - node.body.push({ - "type": "Identifier", - "name": "modified", - "range": [0, 8], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }); - }, - - "Identifier": function(node) { - if (node.name === "bar") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js deleted file mode 100644 index 9fda56d02609..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast-at-last.js +++ /dev/null @@ -1,37 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast-at-last.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program:exit": function(node) { - node.body.push({ - "type": "Identifier", - "name": "modified", - "range": [0, 8], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 8 - } - } - }); - }, - - "Identifier": function(node) { - if (node.name === "bar") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js b/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js deleted file mode 100644 index 3b8a879920aa..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/modify-ast.js +++ /dev/null @@ -1,21 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/modify-ast.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Identifier": function(node) { - node.name += "!"; - - if (node.name === "bar!") { - context.report({message: "error", node: node}); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js b/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js deleted file mode 100644 index a7cba23f6128..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-eval.js +++ /dev/null @@ -1,19 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-eval.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - CallExpression: function (node) { - if (node.callee.name === "eval") { - context.report(node, "eval sucks."); - } - }, - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js deleted file mode 100644 index 7f9a1683aa07..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-args.js +++ /dev/null @@ -1,23 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-args.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - type: "boolean" - }] - }, - create(context) { - var config = context.options[0]; - - return { - "Program": function(node) { - if (config === true) { - context.report(node, "Invalid args"); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js b/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js deleted file mode 100644 index fd691f11a961..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-invalid-schema.js +++ /dev/null @@ -1,21 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-invalid-schema.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - "enum": [] - }] - }, - create(context) { - return { - "Program": function(node) { - if (config) { - context.report(node, "Expected nothing."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js b/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js deleted file mode 100644 index 1e12913c2287..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-schema-violation.js +++ /dev/null @@ -1,22 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-schema-violation.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [{ - "enum": ["foo"] - }] - }, - create(context) { - const config = context.options[0]; - return { - "Program": function(node) { - if (config && config !== "foo") { - context.report(node, "Expected foo."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename b/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename deleted file mode 100644 index 795bd0ac7af3..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-filename +++ /dev/null @@ -1,19 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-filename - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [] - }, - create(context) { - return { - "Program": function(node) { - if (context.getFilename() === '') { - context.report(node, "Filename test was not defined."); - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js deleted file mode 100644 index 94834189376a..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-global.js +++ /dev/null @@ -1,26 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/1665c029acb92bf8812267f1647ad1a7054cbcb4/tests/fixtures/testers/rule-tester/no-test-global.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - "Program": function(node) { - var globals = context.getScope().variables.map(function (variable) { - return variable.name; - }); - - if (globals.indexOf("test") === -1) { - context.report(node, "Global variable test was not defined."); - } - if (globals.indexOf("foo") !== -1) { - context.report(node, "Global variable foo should not be used."); - } - } - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js b/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js deleted file mode 100644 index 291b81b105f5..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-test-settings.js +++ /dev/null @@ -1,22 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-test-settings.js - -"use strict"; - -module.exports = { - meta: { - type: "problem", - schema: [], - }, - create(context) { - return { - Program: function (node) { - if (!context.settings || !context.settings.test) { - context.report( - node, - "Global settings test was not defined." - ); - } - }, - }; - }, -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/no-var.js b/packages/rule-tester/tests/eslint-base/fixtures/no-var.js deleted file mode 100644 index 58530de4e1d0..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/no-var.js +++ /dev/null @@ -1,26 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/no-var.js - -"use strict"; - -module.exports = { - meta: { - fixable: "code", - schema: [] - }, - create(context) { - return { - "VariableDeclaration": function(node) { - if (node.kind === "var") { - context.report({ - node: node, - loc: sourceCode.getFirstToken(node).loc, - message: "Bad var.", - fix: function(fixer) { - return fixer.remove(context.sourceCode.getFirstToken(node)); - } - }) - } - } - }; - } -}; diff --git a/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js b/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js deleted file mode 100644 index 6310d0a2104a..000000000000 --- a/packages/rule-tester/tests/eslint-base/fixtures/suggestions.js +++ /dev/null @@ -1,260 +0,0 @@ -// Forked from https://github.com/eslint/eslint/tree/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/tests/fixtures/testers/rule-tester/suggestions.js - -"use strict"; - -module.exports.basic = { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers named 'foo'.", - suggest: [{ - desc: "Rename identifier 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, 'bar') - }] - }); - } - } - }; - } -}; - -module.exports.withMessageIds = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - unused: "An unused key", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - data: { - newName: "baz" - }, - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateDescriptions = { - meta: { - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers name 'foo'.", - suggest: [{ - desc: "Rename 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, "bar") - }, { - desc: "Rename 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateMessageIdsNoData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - renameFoo: "Rename identifier" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withDuplicateMessageIdsWithData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named foo.", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - suggest: [{ - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "bar") - }, { - messageId: "renameFoo", - data: { - newName: "bar" - }, - fix: fixer => fixer.replaceText(node, "baz") - }] - }); - } - } - }; - } -}; - -module.exports.withoutHasSuggestionsProperty = { - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "some message", - suggest: [{ desc: "some suggestion", fix: fixer => fixer.replaceText(node, 'bar') }] - }); - } - }; - } -}; - -module.exports.withFixerWithoutChanges = { - meta: { hasSuggestions: true }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - message: "Avoid using identifiers named 'foo'.", - suggest: [{ - desc: "Rename identifier 'foo' to 'bar'", - fix: fixer => fixer.replaceText(node, 'foo') - }] - }); - } - } - }; - } -}; - -module.exports.withFailingFixer = { - create(context) { - return { - Identifier(node) { - context.report({ - node, - message: "some message", - suggest: [{ desc: "some suggestion", fix: fixer => null }] - }); - } - }; - } -}; - -module.exports.withMissingPlaceholderData = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - renameFoo: "Rename identifier 'foo' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "renameFoo", - fix: fixer => fixer.replaceText(node, "bar") - }] - }); - } - } - }; - } -}; - -module.exports.withMultipleMissingPlaceholderDataProperties = { - meta: { - messages: { - avoidFoo: "Avoid using identifiers named '{{ name }}'.", - rename: "Rename identifier '{{ currentName }}' to '{{ newName }}'" - }, - hasSuggestions: true - }, - create(context) { - return { - Identifier(node) { - if (node.name === "foo") { - context.report({ - node, - messageId: "avoidFoo", - data: { - name: "foo" - }, - suggest: [{ - messageId: "rename", - fix: fixer => fixer.replaceText(node, "bar") - }] - }); - } - } - }; - } -}; diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index bba61ba408a7..1587be1bcc59 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -37,14 +37,15 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "yarn run -T format", "generate-lib": "yarn run -BT nx generate-lib repo", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/types": "8.32.1", @@ -62,5 +63,12 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "scope-manager", + "includedScripts": [ + "clean", + "clean-fixtures" + ] } } diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json deleted file mode 100644 index ae939212a2d0..000000000000 --- a/packages/scope-manager/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "scope-manager", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "root": "packages/scope-manager", - "sourceRoot": "packages/scope-manager/src", - "projectType": "library", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 0505936ce0b8..89bf9a6af9dc 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -36,12 +36,13 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/typescript-estree": "8.32.1", @@ -65,5 +66,11 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "type-utils", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/type-utils/project.json b/packages/type-utils/project.json deleted file mode 100644 index a1fe512b9900..000000000000 --- a/packages/type-utils/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "type-utils", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/type-utils", - "sourceRoot": "packages/type-utils/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/types/package.json b/packages/types/package.json index aa3254dc94e5..1a121bc52240 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -37,14 +37,15 @@ "estree" ], "scripts": { - "copy-ast-spec": "tsx ./tools/copy-ast-spec.mts", - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ src/generated/ coverage/", + "copy-ast-spec": "tsx ./tools/copy-ast-spec.mts", "format": "yarn run -T format", "generate-lib": "yarn run -BT nx run scope-manager:generate-lib", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "devDependencies": { "@vitest/coverage-v8": "^3.1.3", @@ -56,5 +57,31 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "types", + "includedScripts": [ + "clean" + ], + "targets": { + "build": { + "dependsOn": [ + "copy-ast-spec" + ] + }, + "copy-ast-spec": { + "command": "tsx ./tools/copy-ast-spec.mts", + "options": { + "cwd": "{projectRoot}" + }, + "dependsOn": [ + "ast-spec:build" + ], + "outputs": [ + "{projectRoot}/src/generated" + ], + "cache": true + } + } } } diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index 98370ddace83..b8c33d720f62 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -42,12 +42,13 @@ "eslint-plugin" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/eslint-plugin": "8.32.1", @@ -67,5 +68,11 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "typescript-eslint", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/typescript-eslint/project.json b/packages/typescript-eslint/project.json deleted file mode 100644 index a2f82e64ac22..000000000000 --- a/packages/typescript-eslint/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "typescript-eslint", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/typescript-eslint", - "sourceRoot": "packages/typescript-eslint/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 5ebc1ff50d89..cfd6091e8d62 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -44,12 +44,13 @@ "syntax" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/types": "8.32.1", @@ -75,5 +76,11 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "typescript-estree", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/typescript-estree/project.json b/packages/typescript-estree/project.json deleted file mode 100644 index 4c49900749bf..000000000000 --- a/packages/typescript-estree/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "typescript-estree", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/typescript-estree", - "sourceRoot": "packages/typescript-estree/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/utils/package.json b/packages/utils/package.json index 99d3729f7cd1..e9c39408029e 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -53,12 +53,13 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", @@ -79,5 +80,18 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "utils", + "includedScripts": [ + "clean" + ], + "targets": { + "test": { + "dependsOn": [ + "^build" + ] + } + } } } diff --git a/packages/utils/project.json b/packages/utils/project.json deleted file mode 100644 index 7fe1a2d09486..000000000000 --- a/packages/utils/project.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "utils", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/utils", - "sourceRoot": "packages/utils/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test", - "dependsOn": ["^build", "typecheck"] - } - } -} diff --git a/packages/utils/vitest.config.mts b/packages/utils/vitest.config.mts index b29fd6f44121..ddc038f86b56 100644 --- a/packages/utils/vitest.config.mts +++ b/packages/utils/vitest.config.mts @@ -14,11 +14,6 @@ const vitestConfig = mergeConfig( dir: path.join(import.meta.dirname, 'tests'), name: packageJson.name.replace('@typescript-eslint/', ''), root: import.meta.dirname, - - typecheck: { - enabled: true, - tsconfig: path.join(import.meta.dirname, 'tsconfig.spec.json'), - }, }, }), ); diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 8c2574a19926..21ff63442c23 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -37,12 +37,13 @@ "estree" ], "scripts": { - "build": "tsc -b tsconfig.build.json", + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", + "build": "yarn run -BT nx build", "clean": "rimraf dist/ coverage/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "test": "vitest --run --config=$INIT_CWD/vitest.config.mts", - "check-types": "yarn run -BT nx typecheck" + "test": "yarn run -BT nx test", + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@typescript-eslint/types": "8.32.1", @@ -57,5 +58,11 @@ "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + }, + "nx": { + "name": "visitor-keys", + "includedScripts": [ + "clean" + ] } } diff --git a/packages/visitor-keys/project.json b/packages/visitor-keys/project.json deleted file mode 100644 index 62e1f7fee8d3..000000000000 --- a/packages/visitor-keys/project.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "visitor-keys", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/visitor-keys", - "sourceRoot": "packages/visitor-keys/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - }, - "test": { - "executor": "@nx/vite:test" - } - } -} diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index fa7d8b903898..2f9ac9855ab4 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -27,11 +27,12 @@ "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "scripts": { + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", "build": "tsx ./build.mts", "clean": "rimraf dist/", "format": "yarn run -T format", "lint": "yarn run -BT nx lint", - "check-types": "yarn run -BT nx typecheck" + "typecheck": "yarn run -BT nx typecheck" }, "devDependencies": { "@eslint/js": "*", @@ -45,5 +46,12 @@ "esquery": "*", "rimraf": "*", "tsx": "*" + }, + "nx": { + "name": "website-eslint", + "includedScripts": [ + "clean", + "build" + ] } } diff --git a/packages/website-eslint/project.json b/packages/website-eslint/project.json deleted file mode 100644 index 838eec579bf4..000000000000 --- a/packages/website-eslint/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "website-eslint", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/website-eslint", - "sourceRoot": "packages/website-eslint/src", - "targets": { - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/packages/website/package.json b/packages/website/package.json index 84e9bbf241c7..eb0fd1bafcce 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -12,6 +12,7 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { + "//": "These package scripts are mostly here for convenience. Task running is handled by Nx at the root level.", "build": "docusaurus build", "clear": "docusaurus clear", "clean": "rimraf dist/ build/ .docusaurus/ && yarn run clear", @@ -23,7 +24,7 @@ "serve": "docusaurus serve", "start": "yarn run -BT nx start", "swizzle": "docusaurus swizzle", - "check-types": "yarn run -BT nx typecheck" + "typecheck": "yarn run -BT nx typecheck" }, "dependencies": { "@babel/runtime": "^7.24.4", @@ -93,5 +94,28 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "nx": { + "name": "website", + "includedScripts": [ + "clean", + "build" + ], + "targets": { + "build": { + "dependsOn": [ + "^build" + ] + }, + "start": { + "command": "docusaurus start", + "options": { + "cwd": "{projectRoot}" + }, + "dependsOn": [ + "^build" + ] + } + } } } diff --git a/packages/website/project.json b/packages/website/project.json deleted file mode 100644 index 8ba9d038bdf5..000000000000 --- a/packages/website/project.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "website", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "root": "packages/website", - "sourceRoot": "packages/website/src", - "targets": { - "start": { - "dependsOn": ["website-eslint:build"], - "executor": "nx:run-commands", - "options": { - "cwd": "{projectRoot}", - "command": "docusaurus start" - } - }, - "lint": { - "executor": "@nx/eslint:lint" - } - } -} diff --git a/project.json b/project.json deleted file mode 100644 index a92e8d6ab900..000000000000 --- a/project.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "$schema": "./node_modules/nx/schemas/project-schema.json", - "name": "repo", - "projectType": "library", - "root": ".", - "sourceRoot": ".", - "// These targets are used for repo level utils and checking repo files which do not belong to specific published packages": {}, - "targets": { - "clean": { - "command": "rimraf dist/ coverage/ .eslintcache" - }, - "typecheck": { - "command": "tsc -b tsconfig.repo-config-files.json", - "dependsOn": ["types:copy-ast-spec"], - "outputs": ["{workspaceRoot}/dist"] - }, - "lint": { - "executor": "@nx/eslint:lint", - "options": { - "lintFilePatterns": ["{workspaceRoot}/!packages"] - } - }, - "generate-configs": { - "command": "tsx tools/scripts/generate-configs.mts", - "dependsOn": ["eslint-plugin:build"] - }, - "generate-contributors": { - "command": "tsx tools/scripts/generate-contributors.mts" - }, - "generate-lib": { - "command": "tsx tools/scripts/generate-lib.mts", - "dependsOn": ["typescript-eslint:build", "eslint-plugin-internal:build"] - }, - "generate-sponsors": { - "command": "tsx tools/scripts/generate-sponsors.mts" - } - } -} diff --git a/vitest.config.base.mts b/vitest.config.base.mts index caa16009e093..75ac38dbf958 100644 --- a/vitest.config.base.mts +++ b/vitest.config.base.mts @@ -25,10 +25,6 @@ export const vitestBaseConfig = { testTimeout: 10_000, - typecheck: { - include: ['**/*.test-d.?(c|m)ts?(x)'], - }, - watch: false, }, } as const satisfies ViteUserConfig; diff --git a/yarn.lock b/yarn.lock index 49103bcf9de2..0f5ac77592d6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3872,9 +3872,9 @@ __metadata: languageName: node linkType: hard -"@nx/devkit@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/devkit@npm:20.7.2" +"@nx/devkit@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/devkit@npm:21.0.3" dependencies: ejs: ^3.1.7 enquirer: ~2.3.6 @@ -3885,17 +3885,17 @@ __metadata: tslib: ^2.3.0 yargs-parser: 21.1.1 peerDependencies: - nx: ">= 19 <= 21" - checksum: 178299551b1859deccb2ba3c561e064681f6b929eb4d50f2281e6790dc7abe6e9fb17917980fd66a2c769b3575fb0a3c906a414b7e5b86755f3265f7c574be22 + nx: 21.0.3 + checksum: a742dce7d5103b585d0cb13fc2cf11fb41ad5b031b5bb2ff6c7a6f0c837a287123866a0809d411974e4f03a41b057b14b46c8b226231755563267f6a46d3c611 languageName: node linkType: hard -"@nx/eslint@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/eslint@npm:20.7.2" +"@nx/eslint@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/eslint@npm:21.0.3" dependencies: - "@nx/devkit": 20.7.2 - "@nx/js": 20.7.2 + "@nx/devkit": 21.0.3 + "@nx/js": 21.0.3 semver: ^7.5.3 tslib: ^2.3.0 typescript: ~5.7.2 @@ -3905,13 +3905,13 @@ __metadata: peerDependenciesMeta: "@zkochan/js-yaml": optional: true - checksum: 5a926f39bd51fa356d9a3bdc37f99057103de54f0a727afa1f891589fa7f1f0df4272e644fb174877f7fe43a559368a5e1cbf200630d2a89587a5869ba88accd + checksum: 1520df77239618e9a3d4475b426d2c851a1ac649672ee1ecadad6c6654eeacaa69c8876f47fac8308e2b019153cc28556f4fc01a03489f63a7441290607e70a1 languageName: node linkType: hard -"@nx/js@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/js@npm:20.7.2" +"@nx/js@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/js@npm:21.0.3" dependencies: "@babel/core": ^7.23.2 "@babel/plugin-proposal-decorators": ^7.22.7 @@ -3920,8 +3920,8 @@ __metadata: "@babel/preset-env": ^7.23.2 "@babel/preset-typescript": ^7.22.5 "@babel/runtime": ^7.22.6 - "@nx/devkit": 20.7.2 - "@nx/workspace": 20.7.2 + "@nx/devkit": 21.0.3 + "@nx/workspace": 21.0.3 "@zkochan/js-yaml": 0.0.7 babel-plugin-const-enum: ^1.0.1 babel-plugin-macros: ^3.1.0 @@ -3947,112 +3947,112 @@ __metadata: peerDependenciesMeta: verdaccio: optional: true - checksum: 05253f77916d8f524c3cef7295f1e44e1aa99514ebbffea06bff832b9055fccc9aa35a1b2ee477803513c829985c8891bbf305d14993c1a1579d74fc4a5be798 + checksum: 97af3d23ef58484011ba7e0667656c4ab15e38935176d29310c926ba42d3b78aa50724ae293c15e2f565a9752bcbee3b4007197e778d43a33329d8bd38773bb7 languageName: node linkType: hard -"@nx/nx-darwin-arm64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-darwin-arm64@npm:20.7.2" +"@nx/nx-darwin-arm64@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-darwin-arm64@npm:21.0.3" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@nx/nx-darwin-x64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-darwin-x64@npm:20.7.2" +"@nx/nx-darwin-x64@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-darwin-x64@npm:21.0.3" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@nx/nx-freebsd-x64@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-freebsd-x64@npm:20.7.2" +"@nx/nx-freebsd-x64@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-freebsd-x64@npm:21.0.3" conditions: os=freebsd & cpu=x64 languageName: node linkType: hard -"@nx/nx-linux-arm-gnueabihf@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm-gnueabihf@npm:20.7.2" +"@nx/nx-linux-arm-gnueabihf@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-linux-arm-gnueabihf@npm:21.0.3" conditions: os=linux & cpu=arm languageName: node linkType: hard -"@nx/nx-linux-arm64-gnu@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm64-gnu@npm:20.7.2" +"@nx/nx-linux-arm64-gnu@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-linux-arm64-gnu@npm:21.0.3" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-arm64-musl@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-arm64-musl@npm:20.7.2" +"@nx/nx-linux-arm64-musl@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-linux-arm64-musl@npm:21.0.3" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@nx/nx-linux-x64-gnu@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-x64-gnu@npm:20.7.2" +"@nx/nx-linux-x64-gnu@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-linux-x64-gnu@npm:21.0.3" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@nx/nx-linux-x64-musl@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-linux-x64-musl@npm:20.7.2" +"@nx/nx-linux-x64-musl@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-linux-x64-musl@npm:21.0.3" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@nx/nx-win32-arm64-msvc@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-win32-arm64-msvc@npm:20.7.2" +"@nx/nx-win32-arm64-msvc@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-win32-arm64-msvc@npm:21.0.3" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@nx/nx-win32-x64-msvc@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/nx-win32-x64-msvc@npm:20.7.2" +"@nx/nx-win32-x64-msvc@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/nx-win32-x64-msvc@npm:21.0.3" conditions: os=win32 & cpu=x64 languageName: node linkType: hard -"@nx/vite@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/vite@npm:20.7.2" +"@nx/vite@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/vite@npm:21.0.3" dependencies: - "@nx/devkit": 20.7.2 - "@nx/js": 20.7.2 + "@nx/devkit": 21.0.3 + "@nx/js": 21.0.3 "@phenomnomnominal/tsquery": ~5.0.1 "@swc/helpers": ~0.5.0 enquirer: ~2.3.6 - minimatch: 9.0.3 + picomatch: 4.0.2 semver: ^7.6.3 tsconfig-paths: ^4.1.2 peerDependencies: vite: ^5.0.0 || ^6.0.0 vitest: ^1.3.1 || ^2.0.0 || ^3.0.0 - checksum: 978cc4e8039177ad78bbf305df733c437ea5c74530f6b1efa173e8dce2ca2d781c5ab824ad11ed78a1d6da7959f02a0b8ce0ff42c405a451867247acae595548 + checksum: 4195276b94cfd310650d5fd68172e00a025b2df75424f1e930923a8703178bc8c1887d3d3854cd4cad2b5b15d70ed4331b9f2aadfba1d172f2d33bc49f098e36 languageName: node linkType: hard -"@nx/workspace@npm:20.7.2": - version: 20.7.2 - resolution: "@nx/workspace@npm:20.7.2" +"@nx/workspace@npm:21.0.3": + version: 21.0.3 + resolution: "@nx/workspace@npm:21.0.3" dependencies: - "@nx/devkit": 20.7.2 + "@nx/devkit": 21.0.3 "@zkochan/js-yaml": 0.0.7 chalk: ^4.1.0 enquirer: ~2.3.6 - nx: 20.7.2 + nx: 21.0.3 picomatch: 4.0.2 tslib: ^2.3.0 yargs-parser: 21.1.1 - checksum: aeecc9dbbb864d64b3745a8ddb88ef5677b473b21cc8c308e3fbc7e2f064636fba75005df204b6306a4cbf22a733b82304e77655269a76ff8a445a962c369dc2 + checksum: 20c4051faa3a61c28acd8578b04afb4e991da23b382ff8e70aa907d88ea2f553e4b39759a21da893fdf36814ce809a1dce97fc95683576cfb37bf7278f38efc9 languageName: node linkType: hard @@ -4584,35 +4584,6 @@ __metadata: languageName: node linkType: hard -"@sinonjs/commons@npm:^3.0.1": - version: 3.0.1 - resolution: "@sinonjs/commons@npm:3.0.1" - dependencies: - type-detect: 4.0.8 - checksum: a7c3e7cc612352f4004873747d9d8b2d4d90b13a6d483f685598c945a70e734e255f1ca5dc49702515533c403b32725defff148177453b3f3915bcb60e9d4601 - languageName: node - linkType: hard - -"@sinonjs/fake-timers@npm:^13.0.5": - version: 13.0.5 - resolution: "@sinonjs/fake-timers@npm:13.0.5" - dependencies: - "@sinonjs/commons": ^3.0.1 - checksum: b1c6ba87fadb7666d3aa126c9e8b4ac32b2d9e84c9e5fd074aa24cab3c8342fd655459de014b08e603be1e6c24c9f9716d76d6d2a36c50f59bb0091be61601dd - languageName: node - linkType: hard - -"@sinonjs/samsam@npm:^8.0.1": - version: 8.0.2 - resolution: "@sinonjs/samsam@npm:8.0.2" - dependencies: - "@sinonjs/commons": ^3.0.1 - lodash.get: ^4.4.2 - type-detect: ^4.1.0 - checksum: 7dc24a388ea108e513c88edaaacf98cf4ebcbda8c715551b02954ce50db0e26d6071d98ba9594e737da7fe750079a2af94633d7d46ff1481cb940383b441f29b - languageName: node - linkType: hard - "@slorber/remark-comment@npm:^1.0.0": version: 1.0.0 resolution: "@slorber/remark-comment@npm:1.0.0" @@ -5612,6 +5583,7 @@ __metadata: "@vitest/coverage-v8": ^3.1.3 natural-compare: ^1.4.0 prettier: ^3.2.5 + rimraf: "*" typescript: "*" vitest: ^3.1.3 languageName: unknown @@ -5628,18 +5600,11 @@ __metadata: "@typescript-eslint/utils": 8.32.1 "@vitest/coverage-v8": ^3.1.3 ajv: ^6.12.6 - chai: ^5.2.0 eslint: "*" - eslint-visitor-keys: ^4.2.0 - espree: ^10.3.0 - esprima: ^4.0.1 json-stable-stringify-without-jsonify: ^1.0.1 lodash.merge: 4.6.2 - mocha: ^11.0.0 rimraf: "*" semver: ^7.6.0 - sinon: ^20.0.0 - source-map-support: ^0.5.21 typescript: "*" vitest: ^3.1.3 peerDependencies: @@ -5706,11 +5671,11 @@ __metadata: "@eslint/compat": ^1.2.4 "@eslint/eslintrc": ^3.2.0 "@eslint/js": ^9.26.0 - "@nx/devkit": 20.7.2 - "@nx/eslint": 20.7.2 - "@nx/js": 20.7.2 - "@nx/vite": 20.7.2 - "@nx/workspace": 20.7.2 + "@nx/devkit": 21.0.3 + "@nx/eslint": 21.0.3 + "@nx/js": 21.0.3 + "@nx/vite": 21.0.3 + "@nx/workspace": 21.0.3 "@swc/core": ^1.4.12 "@types/debug": ^4.1.12 "@types/eslint-plugin-jsx-a11y": ^6.10.0 @@ -5746,7 +5711,7 @@ __metadata: knip: ^5.41.1 lint-staged: ^15.2.2 markdownlint-cli: ^0.44.0 - nx: 20.7.2 + nx: 21.0.3 prettier: 3.5.0 rimraf: ^5.0.5 semver: 7.7.0 @@ -7039,13 +7004,6 @@ __metadata: languageName: node linkType: hard -"browser-stdout@npm:^1.3.1": - version: 1.3.1 - resolution: "browser-stdout@npm:1.3.1" - checksum: b717b19b25952dd6af483e368f9bcd6b14b87740c3d226c2977a65e84666ffd67000bddea7d911f111a9b6ddc822b234de42d52ab6507bce4119a4cc003ef7b3 - languageName: node - linkType: hard - "browserslist@npm:^4.0.0, browserslist@npm:^4.18.1, browserslist@npm:^4.23.0, browserslist@npm:^4.24.0, browserslist@npm:^4.24.4": version: 4.24.5 resolution: "browserslist@npm:4.24.5" @@ -7233,7 +7191,7 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^6.0.0, camelcase@npm:^6.2.0": +"camelcase@npm:^6.2.0": version: 6.3.0 resolution: "camelcase@npm:6.3.0" checksum: 8c96818a9076434998511251dcb2761a94817ea17dbdc37f47ac080bd088fc62c7369429a19e2178b993497132c8cbcf5cc1f44ba963e76782ba469c0474938d @@ -7402,15 +7360,6 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:^4.0.1": - version: 4.0.3 - resolution: "chokidar@npm:4.0.3" - dependencies: - readdirp: ^4.0.1 - checksum: a8765e452bbafd04f3f2fad79f04222dd65f43161488bb6014a41099e6ca18d166af613d59a90771908c1c823efa3f46ba36b86ac50b701c20c1b9908c5fe36e - languageName: node - linkType: hard - "chownr@npm:^2.0.0": version: 2.0.0 resolution: "chownr@npm:2.0.0" @@ -8508,13 +8457,6 @@ __metadata: languageName: node linkType: hard -"decamelize@npm:^4.0.0": - version: 4.0.0 - resolution: "decamelize@npm:4.0.0" - checksum: b7d09b82652c39eead4d6678bb578e3bebd848add894b76d0f6b395bc45b2d692fb88d977e7cfb93c4ed6c119b05a1347cef261174916c2e75c0a8ca57da1809 - languageName: node - linkType: hard - "decode-named-character-reference@npm:^1.0.0": version: 1.0.2 resolution: "decode-named-character-reference@npm:1.0.2" @@ -8729,20 +8671,6 @@ __metadata: languageName: node linkType: hard -"diff@npm:^5.2.0": - version: 5.2.0 - resolution: "diff@npm:5.2.0" - checksum: 12b63ca9c36c72bafa3effa77121f0581b4015df18bc16bac1f8e263597735649f1a173c26f7eba17fb4162b073fee61788abe49610e6c70a2641fe1895443fd - languageName: node - linkType: hard - -"diff@npm:^7.0.0": - version: 7.0.0 - resolution: "diff@npm:7.0.0" - checksum: 5db0d339476b18dfbc8a08a7504fbcc74789eec626c8d20cf2cdd1871f1448962888128f4447c8f50a1e41a80decfe5e8489c375843b8cf1d42b7c2b611da4e1 - languageName: node - linkType: hard - "dir-glob@npm:^3.0.1": version: 3.0.1 resolution: "dir-glob@npm:3.0.1" @@ -10868,7 +10796,7 @@ __metadata: languageName: node linkType: hard -"glob@npm:^10.3.7, glob@npm:^10.4.1, glob@npm:^10.4.5, glob@npm:~10.4.5": +"glob@npm:^10.3.7, glob@npm:^10.4.1, glob@npm:~10.4.5": version: 10.4.5 resolution: "glob@npm:10.4.5" dependencies: @@ -12153,13 +12081,6 @@ __metadata: languageName: node linkType: hard -"is-plain-obj@npm:^2.1.0": - version: 2.1.0 - resolution: "is-plain-obj@npm:2.1.0" - checksum: cec9100678b0a9fe0248a81743041ed990c2d4c99f893d935545cfbc42876cbe86d207f3b895700c690ad2fa520e568c44afc1605044b535a7820c1d40e38daa - languageName: node - linkType: hard - "is-plain-obj@npm:^3.0.0": version: 3.0.0 resolution: "is-plain-obj@npm:3.0.0" @@ -13009,13 +12930,6 @@ __metadata: languageName: node linkType: hard -"lodash.get@npm:^4.4.2": - version: 4.4.2 - resolution: "lodash.get@npm:4.4.2" - checksum: e403047ddb03181c9d0e92df9556570e2b67e0f0a930fcbbbd779370972368f5568e914f913e93f3b08f6d492abc71e14d4e9b7a18916c31fa04bd2306efe545 - languageName: node - linkType: hard - "lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" @@ -13058,7 +12972,7 @@ __metadata: languageName: node linkType: hard -"log-symbols@npm:^4.0.0, log-symbols@npm:^4.1.0": +"log-symbols@npm:^4.0.0": version: 4.1.0 resolution: "log-symbols@npm:4.1.0" dependencies: @@ -14374,7 +14288,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.1, minimatch@npm:^5.1.6": +"minimatch@npm:^5.0.1": version: 5.1.6 resolution: "minimatch@npm:5.1.6" dependencies: @@ -14517,37 +14431,6 @@ __metadata: languageName: node linkType: hard -"mocha@npm:^11.0.0": - version: 11.2.2 - resolution: "mocha@npm:11.2.2" - dependencies: - browser-stdout: ^1.3.1 - chokidar: ^4.0.1 - debug: ^4.3.5 - diff: ^5.2.0 - escape-string-regexp: ^4.0.0 - find-up: ^5.0.0 - glob: ^10.4.5 - he: ^1.2.0 - js-yaml: ^4.1.0 - log-symbols: ^4.1.0 - minimatch: ^5.1.6 - ms: ^2.1.3 - picocolors: ^1.1.1 - serialize-javascript: ^6.0.2 - strip-json-comments: ^3.1.1 - supports-color: ^8.1.1 - workerpool: ^6.5.1 - yargs: ^17.7.2 - yargs-parser: ^21.1.1 - yargs-unparser: ^2.0.0 - bin: - _mocha: bin/_mocha - mocha: bin/mocha.js - checksum: ac012ac2413e1705077a30e9b7d0172095ccc027fea54da0d84688754b42c2bca32dc24aaff2502ea869f53901d2b970b5a0697cf32b19433f350f89196d6e47 - languageName: node - linkType: hard - "monaco-editor@npm:~0.52.0": version: 0.52.0 resolution: "monaco-editor@npm:0.52.0" @@ -14819,21 +14702,21 @@ __metadata: languageName: node linkType: hard -"nx@npm:20.7.2": - version: 20.7.2 - resolution: "nx@npm:20.7.2" +"nx@npm:21.0.3": + version: 21.0.3 + resolution: "nx@npm:21.0.3" dependencies: "@napi-rs/wasm-runtime": 0.2.4 - "@nx/nx-darwin-arm64": 20.7.2 - "@nx/nx-darwin-x64": 20.7.2 - "@nx/nx-freebsd-x64": 20.7.2 - "@nx/nx-linux-arm-gnueabihf": 20.7.2 - "@nx/nx-linux-arm64-gnu": 20.7.2 - "@nx/nx-linux-arm64-musl": 20.7.2 - "@nx/nx-linux-x64-gnu": 20.7.2 - "@nx/nx-linux-x64-musl": 20.7.2 - "@nx/nx-win32-arm64-msvc": 20.7.2 - "@nx/nx-win32-x64-msvc": 20.7.2 + "@nx/nx-darwin-arm64": 21.0.3 + "@nx/nx-darwin-x64": 21.0.3 + "@nx/nx-freebsd-x64": 21.0.3 + "@nx/nx-linux-arm-gnueabihf": 21.0.3 + "@nx/nx-linux-arm64-gnu": 21.0.3 + "@nx/nx-linux-arm64-musl": 21.0.3 + "@nx/nx-linux-x64-gnu": 21.0.3 + "@nx/nx-linux-x64-musl": 21.0.3 + "@nx/nx-win32-arm64-msvc": 21.0.3 + "@nx/nx-win32-x64-msvc": 21.0.3 "@yarnpkg/lockfile": ^1.1.0 "@yarnpkg/parsers": 3.0.2 "@zkochan/js-yaml": 0.0.7 @@ -14862,6 +14745,7 @@ __metadata: string-width: ^4.2.3 tar-stream: ~2.2.0 tmp: ~0.2.1 + tree-kill: ^1.2.2 tsconfig-paths: ^4.1.2 tslib: ^2.3.0 yaml: ^2.6.0 @@ -14899,7 +14783,7 @@ __metadata: bin: nx: bin/nx.js nx-cloud: bin/nx-cloud.js - checksum: e566448aa98de9fc5fd32fb20251062e4c628f97cd63dd194375fd7597ebcae2dc9ff31632499914e7dcd89a8d20abbd015745aeaecb90cbf290aa428227ce3e + checksum: 9b3ae238d5df6265bff3430e4e0680762fc3236fb2cd3aed4d3177f64f12586fa19aa8dc4f60f9f5674fb035c46dcf6e0dcad3744d717e84f4a70775aaa10d1b languageName: node linkType: hard @@ -16530,13 +16414,6 @@ __metadata: languageName: node linkType: hard -"readdirp@npm:^4.0.1": - version: 4.1.2 - resolution: "readdirp@npm:4.1.2" - checksum: 3242ee125422cb7c0e12d51452e993f507e6ed3d8c490bc8bf3366c5cdd09167562224e429b13e9cb2b98d4b8b2b11dc100d3c73883aa92d657ade5a21ded004 - languageName: node - linkType: hard - "readdirp@npm:~3.6.0": version: 3.6.0 resolution: "readdirp@npm:3.6.0" @@ -17698,19 +17575,6 @@ __metadata: languageName: node linkType: hard -"sinon@npm:^20.0.0": - version: 20.0.0 - resolution: "sinon@npm:20.0.0" - dependencies: - "@sinonjs/commons": ^3.0.1 - "@sinonjs/fake-timers": ^13.0.5 - "@sinonjs/samsam": ^8.0.1 - diff: ^7.0.0 - supports-color: ^7.2.0 - checksum: c6dcd3bc60aa360fede157fbed30c3984eb222990ff28f3014a5e31834cec74e5203c0575332a99c3f7976425167f70e0777507c0c58867473ad0a0c4c1a759c - languageName: node - linkType: hard - "sirv@npm:^2.0.3": version: 2.0.4 resolution: "sirv@npm:2.0.4" @@ -17884,7 +17748,7 @@ __metadata: languageName: node linkType: hard -"source-map-support@npm:^0.5.21, source-map-support@npm:~0.5.20": +"source-map-support@npm:~0.5.20": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -18385,7 +18249,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0, supports-color@npm:^7.2.0": +"supports-color@npm:^7.0.0, supports-color@npm:^7.1.0": version: 7.2.0 resolution: "supports-color@npm:7.2.0" dependencies: @@ -18394,7 +18258,7 @@ __metadata: languageName: node linkType: hard -"supports-color@npm:^8.0.0, supports-color@npm:^8.1.1, supports-color@npm:~8.1.1": +"supports-color@npm:^8.0.0, supports-color@npm:~8.1.1": version: 8.1.1 resolution: "supports-color@npm:8.1.1" dependencies: @@ -18707,6 +18571,15 @@ __metadata: languageName: node linkType: hard +"tree-kill@npm:^1.2.2": + version: 1.2.2 + resolution: "tree-kill@npm:1.2.2" + bin: + tree-kill: cli.js + checksum: 49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7 + languageName: node + linkType: hard + "trim-lines@npm:^3.0.0": version: 3.0.1 resolution: "trim-lines@npm:3.0.1" @@ -18792,20 +18665,6 @@ __metadata: languageName: node linkType: hard -"type-detect@npm:4.0.8": - version: 4.0.8 - resolution: "type-detect@npm:4.0.8" - checksum: 62b5628bff67c0eb0b66afa371bd73e230399a8d2ad30d852716efcc4656a7516904570cd8631a49a3ce57c10225adf5d0cbdcb47f6b0255fe6557c453925a15 - languageName: node - linkType: hard - -"type-detect@npm:^4.1.0": - version: 4.1.0 - resolution: "type-detect@npm:4.1.0" - checksum: 3b32f873cd02bc7001b00a61502b7ddc4b49278aabe68d652f732e1b5d768c072de0bc734b427abf59d0520a5f19a2e07309ab921ef02018fa1cb4af155cdb37 - languageName: node - linkType: hard - "type-fest@npm:^0.16.0": version: 0.16.0 resolution: "type-fest@npm:0.16.0" @@ -20124,13 +19983,6 @@ __metadata: languageName: node linkType: hard -"workerpool@npm:^6.5.1": - version: 6.5.1 - resolution: "workerpool@npm:6.5.1" - checksum: f86d13f9139c3a57c5a5867e81905cd84134b499849405dec2ffe5b1acd30dabaa1809f6f6ee603a7c65e1e4325f21509db6b8398eaf202c8b8f5809e26a2e16 - languageName: node - linkType: hard - "wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" @@ -20285,19 +20137,7 @@ __metadata: languageName: node linkType: hard -"yargs-unparser@npm:^2.0.0": - version: 2.0.0 - resolution: "yargs-unparser@npm:2.0.0" - dependencies: - camelcase: ^6.0.0 - decamelize: ^4.0.0 - flat: ^5.0.2 - is-plain-obj: ^2.1.0 - checksum: 68f9a542c6927c3768c2f16c28f71b19008710abd6b8f8efbac6dcce26bbb68ab6503bed1d5994bdbc2df9a5c87c161110c1dfe04c6a3fe5c6ad1b0e15d9a8a3 - languageName: node - linkType: hard - -"yargs@npm:17.7.2, yargs@npm:^17.6.2, yargs@npm:^17.7.2": +"yargs@npm:17.7.2, yargs@npm:^17.6.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: