diff --git a/eslint.config.mjs b/eslint.config.mjs index 3e71ec470c9..bd0c3320603 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -85,15 +85,8 @@ export default tseslint.config( project: [ 'tsconfig.json', 'packages/*/tsconfig.json', - /** - * We are currently in the process of transitioning to nx's out of the box structure and - * so need to manually specify converted packages' tsconfig.build.json and tsconfig.spec.json - * files here for now in addition to the tsconfig.json glob pattern. - * - * TODO(#4665): Clean this up once all packages have been transitioned. - */ - 'packages/scope-manager/tsconfig.build.json', - 'packages/scope-manager/tsconfig.spec.json', + 'packages/*/tsconfig.build.json', + 'packages/*/tsconfig.spec.json', ], tsconfigRootDir: __dirname, warnOnUnsupportedTypeScriptVersion: false, diff --git a/nx.json b/nx.json index 9cf30d6daed..21869d84c18 100644 --- a/nx.json +++ b/nx.json @@ -1,6 +1,12 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", "nxCloudAccessToken": "YjIzMmMxMWItMjhiMS00NWY2LTk1NWYtYWU3YWQ0YjE4YjBlfHJlYWQ=", + "plugins": [ + { + "plugin": "@nx/js/typescript", + "exclude": ["*", "packages/integration-tests/fixtures/**"] + } + ], "release": { "projects": ["*"], "changelog": { diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index 549ca869eb2..1a490f3987f 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -36,8 +36,7 @@ "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest", - "typecheck": "tsc --noEmit" + "test": "jest" }, "funding": { "type": "opencollective", diff --git a/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts b/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts index 95f993b9e4d..bf14b128695 100644 --- a/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts +++ b/packages/ast-spec/tests/BinaryOperatorToText.type-test.ts @@ -12,6 +12,7 @@ type BinaryOperatorWithoutInvalidTypes = Exclude< | SyntaxKind.CommaToken // -> SequenceExpression | SyntaxKind.QuestionQuestionToken // -> LogicalExpression >; + type _Test = { readonly [T in BinaryOperatorWithoutInvalidTypes]: BinaryOperatorToText[T]; // If there are any BinaryOperator members that don't have a corresponding diff --git a/packages/ast-spec/tests/util/serializers/Node.ts b/packages/ast-spec/tests/util/serializers/Node.ts index a0fe170f450..e3bda1872e3 100644 --- a/packages/ast-spec/tests/util/serializers/Node.ts +++ b/packages/ast-spec/tests/util/serializers/Node.ts @@ -54,7 +54,7 @@ const serializer: NewPlugin = { const loc = node.loc; const range = node.range; - const outputLines = []; + const outputLines: string[] = []; const childIndentation = indentation + config.indent; const printValue = (value: unknown): string => diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json index 2812814bb30..d4ceb62e34d 100644 --- a/packages/ast-spec/tsconfig.build.json +++ b/packages/ast-spec/tsconfig.build.json @@ -1,10 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "jsx": "preserve", - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src", "typings"], diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json index f1eefac4eb9..33414b7f1ec 100644 --- a/packages/ast-spec/tsconfig.json +++ b/packages/ast-spec/tsconfig.json @@ -1,10 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/ast-spec" }, - "include": ["src", "typings", "tests", "tools", "**/fixtures/**/config.ts"], - "exclude": ["**/fixtures/**/fixture.ts", "**/fixtures/**/fixture.tsx"], - "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/ast-spec/tsconfig.spec.json b/packages/ast-spec/tsconfig.spec.json new file mode 100644 index 00000000000..381385a9fe4 --- /dev/null +++ b/packages/ast-spec/tsconfig.spec.json @@ -0,0 +1,30 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/ast-spec", + "types": ["jest", "node"], + "noImplicitAny": false + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "tools", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "../typescript-estree/tsconfig.build.json" + }, + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 5f36d0d94e9..e2a4ea65310 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -10,8 +10,7 @@ "postclean": "rimraf dist && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "npx tsc --noEmit" + "test": "jest --coverage" }, "dependencies": { "@prettier/sync": "^0.5.1", diff --git a/packages/eslint-plugin-internal/tsconfig.build.json b/packages/eslint-plugin-internal/tsconfig.build.json index 744454d20b2..00baaa7c4d1 100644 --- a/packages/eslint-plugin-internal/tsconfig.build.json +++ b/packages/eslint-plugin-internal/tsconfig.build.json @@ -1,13 +1,25 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - // specifically disable declarations for the plugin + // specifically disable declarations for the plugin (which requires disabling composite) + "composite": false, "declaration": false, "declarationMap": false, - "outDir": "./dist", - "rootDir": "./src", + "emitDeclarationOnly": false, + "rootDir": "src", + "outDir": "dist", "resolveJsonModule": true }, "include": ["src", "typings"], - "references": [{ "path": "../utils/tsconfig.build.json" }] + "references": [ + { + "path": "../rule-tester/tsconfig.build.json" + }, + { + "path": "../utils/tsconfig.build.json" + }, + { + "path": "../type-utils/tsconfig.build.json" + } + ] } diff --git a/packages/eslint-plugin-internal/tsconfig.json b/packages/eslint-plugin-internal/tsconfig.json index 83713e5c8bf..03051233e62 100644 --- a/packages/eslint-plugin-internal/tsconfig.json +++ b/packages/eslint-plugin-internal/tsconfig.json @@ -1,10 +1,24 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { + // specifically disable declarations for the plugin (which requires disabling composite) "composite": false, - "target": "ES2022", + "emitDeclarationOnly": false, + "noEmit": true, + "declaration": false, + "declarationMap": false, "rootDir": "." }, "include": ["src", "typings", "tests", "index.d.ts"], - "references": [{ "path": "../utils/tsconfig.build.json" }] + "references": [ + { + "path": "../rule-tester/tsconfig.build.json" + }, + { + "path": "../utils/tsconfig.build.json" + }, + { + "path": "../type-utils/tsconfig.build.json" + } + ] } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 922f653ba17..aaab6510189 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -55,8 +55,7 @@ "generate:configs": "npx nx run repo-tools:generate-configs", "lint": "npx nx lint", "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage --logHeapUsage", - "test-single": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --no-coverage", - "typecheck": "tsc --noEmit" + "test-single": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --no-coverage" }, "dependencies": { "@eslint-community/regexpp": "^4.10.0", diff --git a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts index c30029882e1..bbe7a3f0509 100644 --- a/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts +++ b/packages/eslint-plugin/src/rules/naming-convention-utils/enums.ts @@ -134,17 +134,19 @@ enum TypeModifiers { type TypeModifiersString = keyof typeof TypeModifiers; export { - IndividualAndMetaSelectorsString, MetaSelectors, - MetaSelectorsString, Modifiers, - ModifiersString, PredefinedFormats, - PredefinedFormatsString, Selectors, - SelectorsString, TypeModifiers, - TypeModifiersString, UnderscoreOptions, +}; +export type { + IndividualAndMetaSelectorsString, + MetaSelectorsString, + ModifiersString, + PredefinedFormatsString, + SelectorsString, + TypeModifiersString, UnderscoreOptionsString, }; diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index c5c36436bc2..e5190f72430 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -787,4 +787,4 @@ function requiresQuoting( return _requiresQuoting(name, target); } -export { MessageIds, Options }; +export type { MessageIds, Options }; diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts index f65273a502e..3eb5c2708ae 100644 --- a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -365,9 +365,8 @@ export { checkFunctionExpressionReturnType, checkFunctionReturnType, doesImmediatelyReturnFunctionExpression, - FunctionExpression, - FunctionNode, isTypedFunctionExpression, isValidFunctionExpressionReturnType, ancestorHasReturnType, }; +export type { FunctionExpression, FunctionNode }; diff --git a/packages/eslint-plugin/src/util/index.ts b/packages/eslint-plugin/src/util/index.ts index 1f8d657cd54..5c5bb34937c 100644 --- a/packages/eslint-plugin/src/util/index.ts +++ b/packages/eslint-plugin/src/util/index.ts @@ -37,7 +37,6 @@ export { isObjectNotArray, getParserServices, nullThrows, - InferMessageIdsTypeFromRule, - InferOptionsTypeFromRule, NullThrowsReasons, }; +export type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule }; diff --git a/packages/eslint-plugin/src/util/misc.ts b/packages/eslint-plugin/src/util/misc.ts index 9ba55c9d87f..b7af0336994 100644 --- a/packages/eslint-plugin/src/util/misc.ts +++ b/packages/eslint-plugin/src/util/misc.ts @@ -233,8 +233,6 @@ function isParenlessArrowFunction( export { arrayGroupByToMap, arraysAreEqual, - Equal, - ExcludeKeys, findFirstResult, formatWordList, getEnumNames, @@ -244,8 +242,8 @@ export { isRestParameterDeclaration, isParenlessArrowFunction, MemberNameType, - RequireKeys, typeNodeRequiresParentheses, upperCaseFirst, findLastIndex, }; +export type { Equal, ExcludeKeys, RequireKeys }; diff --git a/packages/eslint-plugin/tsconfig.build.json b/packages/eslint-plugin/tsconfig.build.json index 49f58646073..fb20bc4c774 100644 --- a/packages/eslint-plugin/tsconfig.build.json +++ b/packages/eslint-plugin/tsconfig.build.json @@ -1,19 +1,32 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - // specifically disable declarations for the plugin + // specifically disable declarations for the plugin (which requires disabling composite) // see reasoning in packages/eslint-plugin/rules.d.ts + "composite": false, "declaration": false, "declarationMap": false, - "outDir": "./dist", - "rootDir": "./src", + "emitDeclarationOnly": false, + "rootDir": "src", + "outDir": "dist", "resolveJsonModule": true }, "include": ["src", "typings"], "references": [ - { "path": "../utils/tsconfig.build.json" }, - { "path": "../parser/tsconfig.build.json" }, - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../type-utils/tsconfig.build.json" } + { + "path": "../utils/tsconfig.build.json" + }, + { + "path": "../parser/tsconfig.build.json" + }, + { + "path": "../rule-tester/tsconfig.build.json" + }, + { + "path": "../scope-manager/tsconfig.build.json" + }, + { + "path": "../type-utils/tsconfig.build.json" + } ] } diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index ae5a5e0f988..e20ba57770a 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -1,14 +1,30 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { + "outDir": "../../dist/out-tsc/eslint-plugin", + // specifically disable declarations for the plugin (which requires disabling composite) + // see reasoning in packages/eslint-plugin/rules.d.ts "composite": false, + "emitDeclarationOnly": false, + "noEmit": true, + "declaration": false, + "declarationMap": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "index.d.ts", "rules.d.ts"], + "include": [ + "src", + "typings", + "tests", + "tools", + "index.d.ts", + "rules.d.ts", + "eslint-recommended-raw.d.ts" + ], "references": [ { "path": "../utils/tsconfig.build.json" }, { "path": "../parser/tsconfig.build.json" }, { "path": "../rule-schema-to-typescript-types/tsconfig.build.json" }, + { "path": "../rule-tester/tsconfig.build.json" }, { "path": "../scope-manager/tsconfig.build.json" }, { "path": "../type-utils/tsconfig.build.json" } ] diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 7825b0a02cd..d10a63046ca 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -5,8 +5,7 @@ "scripts": { "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --no-coverage", - "typecheck": "tsc --noEmit" + "test": "jest --no-coverage" }, "devDependencies": { "@jest/types": "29.6.3", diff --git a/packages/integration-tests/tsconfig.build.json b/packages/integration-tests/tsconfig.build.json index e7d657f8c5b..d4eb4bb3b7f 100644 --- a/packages/integration-tests/tsconfig.build.json +++ b/packages/integration-tests/tsconfig.build.json @@ -1,13 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - // specifically disable declarations for the plugin - "declaration": false, - "declarationMap": false, - "outDir": "./dist", - "rootDir": "./src", + "outDir": "dist", "resolveJsonModule": true }, - "include": ["src", "typings"], - "references": [] + "include": ["typings", "tools"] } diff --git a/packages/integration-tests/tsconfig.json b/packages/integration-tests/tsconfig.json index 23640f1c418..9d84e73d8ea 100644 --- a/packages/integration-tests/tsconfig.json +++ b/packages/integration-tests/tsconfig.json @@ -1,9 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/integration-tests" }, - "include": ["src", "typings", "tests", "jest.config.js", "tools"], - "references": [] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/integration-tests/tsconfig.spec.json b/packages/integration-tests/tsconfig.spec.json new file mode 100644 index 00000000000..d01707fa567 --- /dev/null +++ b/packages/integration-tests/tsconfig.spec.json @@ -0,0 +1,24 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/integration-tests", + "types": ["jest", "node"] + }, + "include": [ + "tests", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/parser/package.json b/packages/parser/package.json index a267395f33c..8de16501276 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -45,8 +45,7 @@ "postclean": "rimraf dist && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "test": "jest --coverage" }, "peerDependencies": { "eslint": "^8.56.0" diff --git a/packages/parser/src/index.ts b/packages/parser/src/index.ts index 9799bc982d0..90e76ea460e 100644 --- a/packages/parser/src/index.ts +++ b/packages/parser/src/index.ts @@ -1,12 +1,15 @@ -export { parse, parseForESLint, ParserOptions } from './parser'; export { - ParserServices, - ParserServicesWithTypeInformation, - ParserServicesWithoutTypeInformation, clearCaches, createProgram, withoutProjectParserOptions, } from '@typescript-eslint/typescript-estree'; +export type { + ParserServices, + ParserServicesWithTypeInformation, + ParserServicesWithoutTypeInformation, +} from '@typescript-eslint/typescript-estree'; +export { parse, parseForESLint } from './parser'; +export type { ParserOptions } from './parser'; // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index ea2107e67aa..ac87e220f4f 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -3,8 +3,7 @@ import type { ScopeManager, } from '@typescript-eslint/scope-manager'; import { analyze } from '@typescript-eslint/scope-manager'; -import type { Lib, TSESTree } from '@typescript-eslint/types'; -import { ParserOptions } from '@typescript-eslint/types'; +import type { Lib, ParserOptions, TSESTree } from '@typescript-eslint/types'; import type { ParserServices, TSESTreeOptions, @@ -177,4 +176,5 @@ function parseForESLint( return { ast, services, scopeManager, visitorKeys }; } -export { parse, parseForESLint, ParserOptions }; +export { parse, parseForESLint }; +export type { ParserOptions }; diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index 4a72f7a3d46..ad5b1e53ea3 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -1,15 +1,21 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src"], "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { + "path": "../scope-manager/tsconfig.build.json" + }, + { + "path": "../types/tsconfig.build.json" + }, + { + "path": "../typescript-estree/tsconfig.build.json" + } ] } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index eebdf92705d..d0033ffc464 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -1,14 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/parser" }, - "include": ["src", "tests", "tools"], - "exclude": ["tests/fixtures"], + "files": [], "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } ] } diff --git a/packages/parser/tsconfig.spec.json b/packages/parser/tsconfig.spec.json new file mode 100644 index 00000000000..c1a3a0760c9 --- /dev/null +++ b/packages/parser/tsconfig.spec.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/parser", + "types": ["jest", "node"] + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/repo-tools/package.json b/packages/repo-tools/package.json index 8d43f4357e0..58f6d91eb78 100644 --- a/packages/repo-tools/package.json +++ b/packages/repo-tools/package.json @@ -12,8 +12,7 @@ "generate-lib": "npx tsx ./src/generate-lib.mts", "lint": "npx nx lint", "postinstall-script": "npx tsx ./src/postinstall.mts", - "test": "npx jest --coverage", - "typecheck": "npx tsc --noEmit" + "test": "npx jest --coverage" }, "devDependencies": { "@jest/types": "29.6.3", diff --git a/packages/repo-tools/tsconfig.build.json b/packages/repo-tools/tsconfig.build.json index 992e2f19be7..93a02bb2301 100644 --- a/packages/repo-tools/tsconfig.build.json +++ b/packages/repo-tools/tsconfig.build.json @@ -3,12 +3,14 @@ "compilerOptions": { // repo tools are executed with tsx "allowImportingTsExtensions": true, - "noEmit": true, - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", "resolveJsonModule": true }, "include": ["src", "typings"], - "references": [] + "references": [ + { + "path": "../utils/tsconfig.build.json" + } + ] } diff --git a/packages/repo-tools/tsconfig.json b/packages/repo-tools/tsconfig.json index 60f0b96451e..3728177c0f9 100644 --- a/packages/repo-tools/tsconfig.json +++ b/packages/repo-tools/tsconfig.json @@ -1,12 +1,12 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - // repo tools are executed with tsx - "allowImportingTsExtensions": true, - "noEmit": true, - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/repo-tools" }, - "include": ["src", "tests", "typings"], - "references": [] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] } diff --git a/packages/rule-schema-to-typescript-types/package.json b/packages/rule-schema-to-typescript-types/package.json index cd73870f020..df9527d116f 100644 --- a/packages/rule-schema-to-typescript-types/package.json +++ b/packages/rule-schema-to-typescript-types/package.json @@ -24,14 +24,13 @@ "homepage": "https://typescript-eslint.io", "license": "MIT", "scripts": { - "build": "tsc -b tsconfig.build.json", + "build": "npx tsc -b tsconfig.build.json", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate-contributors": "tsx ./src/generate-contributors.ts", "generate-sponsors": "tsx ./src/generate-sponsors.ts", "lint": "npx nx lint", "postinstall-script": "tsx ./src/postinstall.ts", - "test": "npx jest --coverage", - "typecheck": "tsc --noEmit" + "test": "npx jest --coverage" }, "dependencies": { "@typescript-eslint/type-utils": "7.13.0", diff --git a/packages/rule-schema-to-typescript-types/tsconfig.build.json b/packages/rule-schema-to-typescript-types/tsconfig.build.json index b9ac3e1b977..b08be0b3f05 100644 --- a/packages/rule-schema-to-typescript-types/tsconfig.build.json +++ b/packages/rule-schema-to-typescript-types/tsconfig.build.json @@ -1,11 +1,18 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, - "include": ["src", "typings"], - "references": [] + "include": ["src"], + "references": [ + { + "path": "../utils/tsconfig.build.json" + }, + { + "path": "../type-utils/tsconfig.build.json" + } + ] } diff --git a/packages/rule-schema-to-typescript-types/tsconfig.json b/packages/rule-schema-to-typescript-types/tsconfig.json index 06b94d057fa..f710c5a22da 100644 --- a/packages/rule-schema-to-typescript-types/tsconfig.json +++ b/packages/rule-schema-to-typescript-types/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/rule-schema-to-typescript-types" }, - "include": ["src", "tests", "typings"], - "references": [] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] } diff --git a/packages/rule-tester/package.json b/packages/rule-tester/package.json index 197bad98254..16c19feade7 100644 --- a/packages/rule-tester/package.json +++ b/packages/rule-tester/package.json @@ -43,8 +43,7 @@ "lint": "npx 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": "npx jest --coverage", - "typecheck": "tsc --noEmit" + "test": "npx jest --coverage" }, "//": "NOTE - AJV is out-of-date, but it's intentionally synced with ESLint - https://github.com/eslint/eslint/blob/ad9dd6a933fd098a0d99c6a9aa059850535c23ee/package.json#L70", "dependencies": { diff --git a/packages/rule-tester/tests/RuleTester.test.ts b/packages/rule-tester/tests/RuleTester.test.ts index 20bc0c9cb4a..fed0e86a5f8 100644 --- a/packages/rule-tester/tests/RuleTester.test.ts +++ b/packages/rule-tester/tests/RuleTester.test.ts @@ -74,8 +74,6 @@ const mockedAfterAll = jest.mocked(RuleTester.afterAll); const mockedDescribe = jest.mocked(RuleTester.describe); const mockedDescribeSkip = jest.mocked(RuleTester.describeSkip); const mockedIt = jest.mocked(RuleTester.it); -const _mockedItOnly = jest.mocked(RuleTester.itOnly); -const _mockedItSkip = jest.mocked(RuleTester.itSkip); const runRuleForItemSpy = jest.spyOn( RuleTester.prototype, // @ts-expect-error -- method is private @@ -92,7 +90,9 @@ const EMPTY_PROGRAM: TSESTree.Program = { tokens: [], range: [0, 0], }; -runRuleForItemSpy.mockImplementation((_1, _2, testCase) => { +// TODO: Fix need for any +// eslint-disable-next-line @typescript-eslint/no-explicit-any +runRuleForItemSpy.mockImplementation((_1, _2, testCase: any) => { return { messages: 'errors' in testCase @@ -135,7 +135,9 @@ const NOOP_RULE: RuleModule<'error'> = { }; function getTestConfigFromCall(): unknown[] { - return runRuleForItemSpy.mock.calls.map(c => { + // TODO: Fix need for any + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return runRuleForItemSpy.mock.calls.map((c: any) => { return { ...c[2], filename: c[2].filename?.replaceAll('\\', '/') }; }); } @@ -284,7 +286,7 @@ describe('RuleTester', () => { it('schedules the parser caches to be cleared afterAll', () => { // it should schedule the afterAll expect(mockedAfterAll).toHaveBeenCalledTimes(0); - const _ruleTester = new RuleTester({ + new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { project: 'tsconfig.json', diff --git a/packages/rule-tester/tsconfig.build.json b/packages/rule-tester/tsconfig.build.json index 782f14402ae..1bd809981c7 100644 --- a/packages/rule-tester/tsconfig.build.json +++ b/packages/rule-tester/tsconfig.build.json @@ -1,11 +1,15 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src", "typings"], - "references": [{ "path": "../utils/tsconfig.build.json" }] + "references": [ + { + "path": "../utils/tsconfig.build.json" + } + ] } diff --git a/packages/rule-tester/tsconfig.json b/packages/rule-tester/tsconfig.json index 9cea515ba6b..bf87f1a8864 100644 --- a/packages/rule-tester/tsconfig.json +++ b/packages/rule-tester/tsconfig.json @@ -1,8 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/rule-tester" }, - "include": ["src", "typings", "tests", "tools"] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/rule-tester/tsconfig.spec.json b/packages/rule-tester/tsconfig.spec.json new file mode 100644 index 00000000000..caa179f827c --- /dev/null +++ b/packages/rule-tester/tsconfig.spec.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/rule-tester", + "types": ["jest", "node"] + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index e53429213f9..344fbac5c91 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -42,8 +42,7 @@ "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate-lib": "npx nx generate-lib", "lint": "npx nx lint", - "test": "npx nx test --code-coverage", - "typecheck": "npx nx typecheck" + "test": "npx nx test --code-coverage" }, "dependencies": { "@typescript-eslint/types": "7.13.0", diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json index 690b6f2ca7f..fa0969f7919 100644 --- a/packages/scope-manager/project.json +++ b/packages/scope-manager/project.json @@ -18,17 +18,6 @@ ] } }, - "typecheck": { - "executor": "nx:run-commands", - "options": { - "parallel": true, - "cwd": "packages/scope-manager", - "commands": [ - "tsc -p tsconfig.build.json --noEmit", - "tsc -p tsconfig.spec.json --noEmit" - ] - } - }, "clean": { "executor": "nx:run-commands", "options": { diff --git a/packages/scope-manager/src/analyze.ts b/packages/scope-manager/src/analyze.ts index 307adfe0905..cd1ce6fdee6 100644 --- a/packages/scope-manager/src/analyze.ts +++ b/packages/scope-manager/src/analyze.ts @@ -110,4 +110,5 @@ function analyze( return scopeManager; } -export { analyze, AnalyzeOptions }; +export { analyze }; +export type { AnalyzeOptions }; diff --git a/packages/scope-manager/src/definition/Definition.ts b/packages/scope-manager/src/definition/Definition.ts index 35b380ee662..7d614862dca 100644 --- a/packages/scope-manager/src/definition/Definition.ts +++ b/packages/scope-manager/src/definition/Definition.ts @@ -23,4 +23,4 @@ type Definition = | TypeDefinition | VariableDefinition; -export { Definition }; +export type { Definition }; diff --git a/packages/scope-manager/src/index.ts b/packages/scope-manager/src/index.ts index 8dc52ac4ac8..3ebc1e03573 100644 --- a/packages/scope-manager/src/index.ts +++ b/packages/scope-manager/src/index.ts @@ -1,9 +1,10 @@ -export { analyze, AnalyzeOptions } from './analyze'; +export { analyze } from './analyze'; +export type { AnalyzeOptions } from './analyze'; export * from './definition'; export { Reference } from './referencer/Reference'; export { Visitor } from './referencer/Visitor'; -export { - PatternVisitor, +export { PatternVisitor } from './referencer/PatternVisitor'; +export type { PatternVisitorCallback, PatternVisitorOptions, } from './referencer/PatternVisitor'; diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index cf5d7022b25..ddce0593a39 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -27,7 +27,7 @@ class ClassVisitor extends Visitor { classVisitor.visitClass(node); } - visit(node: TSESTree.Node | null | undefined): void { + override visit(node: TSESTree.Node | null | undefined): void { // make sure we only handle the nodes we are designed to handle if (node && node.type in this) { super.visit(node); diff --git a/packages/scope-manager/src/referencer/PatternVisitor.ts b/packages/scope-manager/src/referencer/PatternVisitor.ts index 51564882ef8..66ad69d7038 100644 --- a/packages/scope-manager/src/referencer/PatternVisitor.ts +++ b/packages/scope-manager/src/referencer/PatternVisitor.ts @@ -138,4 +138,5 @@ class PatternVisitor extends VisitorBase { } } -export { PatternVisitor, PatternVisitorCallback, PatternVisitorOptions }; +export { PatternVisitor }; +export type { PatternVisitorCallback, PatternVisitorOptions }; diff --git a/packages/scope-manager/src/referencer/Reference.ts b/packages/scope-manager/src/referencer/Reference.ts index d74b628d8cc..2c0183bd323 100644 --- a/packages/scope-manager/src/referencer/Reference.ts +++ b/packages/scope-manager/src/referencer/Reference.ts @@ -146,4 +146,5 @@ class Reference { } } -export { Reference, ReferenceFlag, ReferenceTypeFlag, ReferenceImplicitGlobal }; +export { Reference, ReferenceFlag, ReferenceTypeFlag }; +export type { ReferenceImplicitGlobal }; diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index dac19c71a2c..b6f07f7c13c 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -326,6 +326,7 @@ class Referencer extends Visitor { let left = node.left; switch (left.type) { case AST_NODE_TYPES.TSAsExpression: + // eslint-disable-next-line no-fallthrough -- This is intentional for identical node handling case AST_NODE_TYPES.TSTypeAssertion: // explicitly visit the type annotation this.visitType(left.typeAnnotation); @@ -815,4 +816,5 @@ class Referencer extends Visitor { } } -export { Referencer, ReferencerOptions }; +export { Referencer }; +export type { ReferencerOptions }; diff --git a/packages/scope-manager/src/referencer/Visitor.ts b/packages/scope-manager/src/referencer/Visitor.ts index bbcf348734d..9f2f807c858 100644 --- a/packages/scope-manager/src/referencer/Visitor.ts +++ b/packages/scope-manager/src/referencer/Visitor.ts @@ -5,7 +5,8 @@ import type { PatternVisitorOptions, } from './PatternVisitor'; import { PatternVisitor } from './PatternVisitor'; -import { VisitorBase, VisitorOptions } from './VisitorBase'; +import type { VisitorOptions } from './VisitorBase'; +import { VisitorBase } from './VisitorBase'; interface VisitPatternOptions extends PatternVisitorOptions { processRightHandNodes?: boolean; @@ -42,4 +43,5 @@ class Visitor extends VisitorBase { } } -export { Visitor, VisitorBase, VisitorOptions }; +export { Visitor, VisitorBase }; +export type { VisitorOptions }; diff --git a/packages/scope-manager/src/referencer/VisitorBase.ts b/packages/scope-manager/src/referencer/VisitorBase.ts index 43af065b4c6..fe1324420b4 100644 --- a/packages/scope-manager/src/referencer/VisitorBase.ts +++ b/packages/scope-manager/src/referencer/VisitorBase.ts @@ -1,5 +1,6 @@ import type { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/types'; -import { VisitorKeys, visitorKeys } from '@typescript-eslint/visitor-keys'; +import type { VisitorKeys } from '@typescript-eslint/visitor-keys'; +import { visitorKeys } from '@typescript-eslint/visitor-keys'; interface VisitorOptions { childVisitorKeys?: VisitorKeys | null; @@ -83,4 +84,5 @@ abstract class VisitorBase { } } -export { VisitorBase, VisitorOptions, VisitorKeys }; +export { VisitorBase }; +export type { VisitorOptions, VisitorKeys }; diff --git a/packages/scope-manager/src/referencer/index.ts b/packages/scope-manager/src/referencer/index.ts index 6ac29bd3e0e..7c43a0aac89 100644 --- a/packages/scope-manager/src/referencer/index.ts +++ b/packages/scope-manager/src/referencer/index.ts @@ -1 +1,2 @@ -export { Referencer, ReferencerOptions } from './Referencer'; +export { Referencer } from './Referencer'; +export type { ReferencerOptions } from './Referencer'; diff --git a/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts b/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts index d3c8825a306..0779bb3a3f1 100644 --- a/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts +++ b/packages/scope-manager/src/scope/FunctionExpressionNameScope.ts @@ -11,7 +11,7 @@ class FunctionExpressionNameScope extends ScopeBase< TSESTree.FunctionExpression, Scope > { - public readonly functionExpressionScope: true; + public override readonly functionExpressionScope: true; constructor( scopeManager: ScopeManager, upperScope: FunctionExpressionNameScope['upper'], diff --git a/packages/scope-manager/src/scope/FunctionScope.ts b/packages/scope-manager/src/scope/FunctionScope.ts index 8e8b405cd6a..2d370d21e14 100644 --- a/packages/scope-manager/src/scope/FunctionScope.ts +++ b/packages/scope-manager/src/scope/FunctionScope.ts @@ -45,7 +45,10 @@ class FunctionScope extends ScopeBase< // const x = 2 // console.log(a) // } - protected isValidResolution(ref: Reference, variable: Variable): boolean { + protected override isValidResolution( + ref: Reference, + variable: Variable, + ): boolean { // If `options.globalReturn` is true, `this.block` becomes a Program node. if (this.block.type === AST_NODE_TYPES.Program) { return true; diff --git a/packages/scope-manager/src/scope/GlobalScope.ts b/packages/scope-manager/src/scope/GlobalScope.ts index 6bf32a12f53..8942fabbad1 100644 --- a/packages/scope-manager/src/scope/GlobalScope.ts +++ b/packages/scope-manager/src/scope/GlobalScope.ts @@ -52,7 +52,7 @@ class GlobalScope extends ScopeBase< ); } - public close(scopeManager: ScopeManager): Scope | null { + public override close(scopeManager: ScopeManager): Scope | null { assert(this.leftToResolve); for (const ref of this.leftToResolve) { diff --git a/packages/scope-manager/src/scope/Scope.ts b/packages/scope-manager/src/scope/Scope.ts index 87999d4b74b..0f5090f1919 100644 --- a/packages/scope-manager/src/scope/Scope.ts +++ b/packages/scope-manager/src/scope/Scope.ts @@ -37,4 +37,4 @@ type Scope = | TypeScope | WithScope; -export { Scope }; +export type { Scope }; diff --git a/packages/scope-manager/src/scope/WithScope.ts b/packages/scope-manager/src/scope/WithScope.ts index 7058ab70faa..07e348959be 100644 --- a/packages/scope-manager/src/scope/WithScope.ts +++ b/packages/scope-manager/src/scope/WithScope.ts @@ -18,7 +18,7 @@ class WithScope extends ScopeBase< ) { super(scopeManager, ScopeType.with, upperScope, block, false); } - close(scopeManager: ScopeManager): Scope | null { + override close(scopeManager: ScopeManager): Scope | null { if (this.shouldStaticallyClose()) { return super.close(scopeManager); } diff --git a/packages/scope-manager/src/variable/ImplicitLibVariable.ts b/packages/scope-manager/src/variable/ImplicitLibVariable.ts index 2ebb8fef0ee..a7823fe7e2a 100644 --- a/packages/scope-manager/src/variable/ImplicitLibVariable.ts +++ b/packages/scope-manager/src/variable/ImplicitLibVariable.ts @@ -42,4 +42,5 @@ class ImplicitLibVariable extends ESLintScopeVariable implements Variable { } } -export { ImplicitLibVariable, ImplicitLibVariableOptions }; +export { ImplicitLibVariable }; +export type { ImplicitLibVariableOptions }; diff --git a/packages/scope-manager/src/variable/index.ts b/packages/scope-manager/src/variable/index.ts index 912aebcf05c..ede1872accf 100644 --- a/packages/scope-manager/src/variable/index.ts +++ b/packages/scope-manager/src/variable/index.ts @@ -1,6 +1,4 @@ export { ESLintScopeVariable } from './ESLintScopeVariable'; -export { - ImplicitLibVariable, - ImplicitLibVariableOptions, -} from './ImplicitLibVariable'; +export { ImplicitLibVariable } from './ImplicitLibVariable'; +export type { ImplicitLibVariableOptions } from './ImplicitLibVariable'; export { Variable } from './Variable'; diff --git a/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts b/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts index 225c240a0c0..618f95537ad 100644 --- a/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts +++ b/packages/scope-manager/tests/eslint-scope/es6-destructuring-assignments.test.ts @@ -157,8 +157,12 @@ describe('ES6 destructuring assignments', () => { expect(scope.references).toHaveLength(0); expect(scope['implicit'].leftToBeResolved).toHaveLength(2); expect(scope['implicit'].leftToBeResolved[0].identifier.name).toBe('d'); + // TODO: Investigate lint error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument expectToBeForScope(scope['implicit'].leftToBeResolved[0].from); expect(scope['implicit'].leftToBeResolved[1].identifier.name).toBe('array'); + // TODO: Investigate lint error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument expectToBeForScope(scope['implicit'].leftToBeResolved[1].from); scope = scopeManager.scopes[2]; @@ -280,10 +284,16 @@ describe('ES6 destructuring assignments', () => { expect(scope.references).toHaveLength(0); expect(scope['implicit'].leftToBeResolved).toHaveLength(3); expect(scope['implicit'].leftToBeResolved[0].identifier.name).toBe('d'); + // TODO: Investigate lint error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument expectToBeForScope(scope['implicit'].leftToBeResolved[0].from); expect(scope['implicit'].leftToBeResolved[1].identifier.name).toBe('e'); + // TODO: Investigate lint error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument expectToBeForScope(scope['implicit'].leftToBeResolved[1].from); expect(scope['implicit'].leftToBeResolved[2].identifier.name).toBe('array'); + // TODO: Investigate lint error + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument expectToBeForScope(scope['implicit'].leftToBeResolved[2].from); scope = scopeManager.scopes[2]; diff --git a/packages/scope-manager/tests/test-utils/parse.ts b/packages/scope-manager/tests/test-utils/parse.ts index 1ba739d66ed..50a75a98d10 100644 --- a/packages/scope-manager/tests/test-utils/parse.ts +++ b/packages/scope-manager/tests/test-utils/parse.ts @@ -1,6 +1,7 @@ import * as tseslint from '@typescript-eslint/typescript-estree'; -import { analyze, AnalyzeOptions } from '../../src/analyze'; +import type { AnalyzeOptions } from '../../src/analyze'; +import { analyze } from '../../src/analyze'; type SourceType = AnalyzeOptions['sourceType']; @@ -59,4 +60,5 @@ function parseAndAnalyze( return { ast, scopeManager }; } -export { parse, parseAndAnalyze, AnalyzeOptions }; +export { parse, parseAndAnalyze }; +export type { AnalyzeOptions }; diff --git a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts index cb619d683a5..ec13bb792d5 100644 --- a/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts +++ b/packages/scope-manager/tests/test-utils/serializers/baseSerializer.ts @@ -50,7 +50,7 @@ function createSerializer( SEEN_THINGS.add(thing); } - const outputLines = []; + const outputLines: string[] = []; const childIndentation = indentation + config.indent; for (const key of keys) { let value = thing[key as string]; diff --git a/packages/scope-manager/tsconfig.build.json b/packages/scope-manager/tsconfig.build.json index b407e24d704..17e4796b1ac 100644 --- a/packages/scope-manager/tsconfig.build.json +++ b/packages/scope-manager/tsconfig.build.json @@ -1,17 +1,18 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", - "resolveJsonModule": true, - "declaration": true, - "types": ["node", "jest"] + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, + "resolveJsonModule": true }, - "include": ["src", "typings"], - "exclude": ["**/*.spec.ts", "**/*.test.ts"], + "include": ["src"], "references": [ - { "path": "../types/tsconfig.build.json" }, - { "path": "../visitor-keys/tsconfig.build.json" } + { + "path": "../types/tsconfig.build.json" + }, + { + "path": "../visitor-keys/tsconfig.build.json" + } ] } diff --git a/packages/scope-manager/tsconfig.json b/packages/scope-manager/tsconfig.json index c25e84fa6c6..4dbdbb72885 100644 --- a/packages/scope-manager/tsconfig.json +++ b/packages/scope-manager/tsconfig.json @@ -1,7 +1,10 @@ { "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/scope-manager", + "noImplicitAny": false + }, "files": [], - "include": [], "references": [ { "path": "./tsconfig.build.json" @@ -9,11 +12,5 @@ { "path": "./tsconfig.spec.json" } - ], - "compilerOptions": { - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": false - } + ] } diff --git a/packages/scope-manager/tsconfig.spec.json b/packages/scope-manager/tsconfig.spec.json index 46896b9eaf3..1fa9aff5b63 100644 --- a/packages/scope-manager/tsconfig.spec.json +++ b/packages/scope-manager/tsconfig.spec.json @@ -1,9 +1,9 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "Node16", - "types": ["jest", "node"] + "outDir": "../../dist/out-tsc/scope-manager", + "types": ["jest", "node"], + "noImplicitAny": false }, "exclude": ["tests/fixtures"], "include": [ @@ -18,5 +18,10 @@ "**/*.test.jsx", "**/*.spec.jsx", "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } ] } diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index 4fc8c8f4264..a0f9c899beb 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -42,8 +42,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "test": "jest --coverage" }, "dependencies": { "@typescript-eslint/typescript-estree": "7.13.0", diff --git a/packages/type-utils/tsconfig.build.json b/packages/type-utils/tsconfig.build.json index 782f14402ae..1bd809981c7 100644 --- a/packages/type-utils/tsconfig.build.json +++ b/packages/type-utils/tsconfig.build.json @@ -1,11 +1,15 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src", "typings"], - "references": [{ "path": "../utils/tsconfig.build.json" }] + "references": [ + { + "path": "../utils/tsconfig.build.json" + } + ] } diff --git a/packages/type-utils/tsconfig.json b/packages/type-utils/tsconfig.json index 93bec73e74a..157261a8f90 100644 --- a/packages/type-utils/tsconfig.json +++ b/packages/type-utils/tsconfig.json @@ -1,9 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/type-utils" }, - "include": ["src", "typings", "tests", "tools"], - "references": [{ "path": "../utils/tsconfig.build.json" }] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/type-utils/tsconfig.spec.json b/packages/type-utils/tsconfig.spec.json new file mode 100644 index 00000000000..4b25ac115d7 --- /dev/null +++ b/packages/type-utils/tsconfig.spec.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/type-utils", + "types": ["jest", "node"] + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/types/package.json b/packages/types/package.json index df30745e4da..9415490ca14 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -44,8 +44,7 @@ "postclean": "rimraf dist && rimraf src/generated && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "generate-lib": "npx nx run scope-manager:generate-lib", - "lint": "npx nx lint", - "typecheck": "tsc --noEmit" + "lint": "npx nx lint" }, "nx": { "targets": { diff --git a/packages/types/src/lib.ts b/packages/types/src/lib.ts index a63601f2165..f9bc56ded9a 100644 --- a/packages/types/src/lib.ts +++ b/packages/types/src/lib.ts @@ -98,4 +98,4 @@ type Lib = | 'esnext.full' | 'lib'; -export { Lib }; +export type { Lib }; diff --git a/packages/types/src/parser-options.ts b/packages/types/src/parser-options.ts index 36bec80b4b6..8f975fe4598 100644 --- a/packages/types/src/parser-options.ts +++ b/packages/types/src/parser-options.ts @@ -83,7 +83,7 @@ interface ParserOptions { [additionalProperties: string]: unknown; } -export { +export type { CacheDurationSeconds, DebugLevel, EcmaVersion, diff --git a/packages/types/tsconfig.build.json b/packages/types/tsconfig.build.json index b9ac3e1b977..174d132ccb0 100644 --- a/packages/types/tsconfig.build.json +++ b/packages/types/tsconfig.build.json @@ -1,11 +1,11 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, - "include": ["src", "typings"], + "include": ["src"], "references": [] } diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json index d1305674c8b..0dfad4e320d 100644 --- a/packages/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,9 +1,12 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/types" }, - "include": ["src", "typings", "tests", "tools"], - "references": [] + "include": ["src", "tools"], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] } diff --git a/packages/typescript-eslint/package.json b/packages/typescript-eslint/package.json index 2a2b50248f6..cf1e90210ce 100644 --- a/packages/typescript-eslint/package.json +++ b/packages/typescript-eslint/package.json @@ -48,8 +48,7 @@ "postclean": "rimraf dist && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "nx lint", - "test": "jest --coverage --passWithNoTests", - "typecheck": "tsc --noEmit" + "test": "jest --coverage --passWithNoTests" }, "peerDependencies": { "eslint": "^8.56.0" diff --git a/packages/typescript-eslint/tsconfig.build.json b/packages/typescript-eslint/tsconfig.build.json index 8833d225ce3..5d16be4a517 100644 --- a/packages/typescript-eslint/tsconfig.build.json +++ b/packages/typescript-eslint/tsconfig.build.json @@ -1,11 +1,15 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src"], - "references": [{ "path": "../parser/tsconfig.build.json" }] + "references": [ + { + "path": "../parser/tsconfig.build.json" + } + ] } diff --git a/packages/typescript-eslint/tsconfig.json b/packages/typescript-eslint/tsconfig.json index ac9e78203f6..fd982999941 100644 --- a/packages/typescript-eslint/tsconfig.json +++ b/packages/typescript-eslint/tsconfig.json @@ -1,10 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/typescript-eslint" }, - "include": ["src", "tests", "tools"], - "exclude": ["tests/fixtures"], - "references": [{ "path": "../parser/tsconfig.build.json" }] + "files": [], + "references": [ + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] } diff --git a/packages/typescript-eslint/tsconfig.spec.json b/packages/typescript-eslint/tsconfig.spec.json new file mode 100644 index 00000000000..397791270e1 --- /dev/null +++ b/packages/typescript-eslint/tsconfig.spec.json @@ -0,0 +1,27 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/typescript-eslint", + "types": ["jest", "node"], + "noImplicitAny": false + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "tools", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 3a1b7a24600..42043f47156 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -50,8 +50,7 @@ "postclean": "rimraf dist && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage --runInBand --verbose", - "typecheck": "tsc --noEmit" + "test": "jest --coverage --runInBand --verbose" }, "dependencies": { "@typescript-eslint/types": "7.13.0", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 525f03481c3..5414a6d6d10 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -601,8 +601,9 @@ export class Converter { // this is intentional we can ignore conversion if `:` is in first character if (colonIndex > 0) { const range = getRange(node, this.ast); - // @ts-expect-error -- TypeScript@<5.1 doesn't have ts.JsxNamespacedName - const result = this.createNode(node, { + // TODO: Fix as any usage + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const result = this.createNode(node as any, { type: AST_NODE_TYPES.JSXNamespacedName, namespace: this.createNode(node, { type: AST_NODE_TYPES.JSXIdentifier, @@ -1310,6 +1311,7 @@ export class Converter { } case SyntaxKind.GetAccessor: + // eslint-disable-next-line no-fallthrough -- This is intentional for identical node handling case SyntaxKind.SetAccessor: { if ( node.parent.kind === SyntaxKind.InterfaceDeclaration || @@ -1783,7 +1785,7 @@ export class Converter { } // Classes - + // eslint-disable-next-line no-fallthrough -- This is intentional for identical node handling case SyntaxKind.ClassDeclaration: if ( !node.name && @@ -2679,7 +2681,8 @@ export class Converter { getTextForTokenKind(node.readonlyToken.kind)), typeAnnotation: node.type && this.convertChild(node.type), typeParameter: this.convertChild(node.typeParameter), - }); + // TODO: Fix type error + } as TSESTree.TSMappedType); } case SyntaxKind.ParenthesizedExpression: @@ -2753,7 +2756,7 @@ export class Converter { ), }); } - + // eslint-disable-next-line no-fallthrough -- This is intentional for identical node handling case SyntaxKind.FunctionType: { // eslint-disable-next-line deprecation/deprecation const { modifiers } = node; @@ -2929,7 +2932,8 @@ export class Converter { declare: hasModifier(SyntaxKind.DeclareKeyword, node), id: this.convertChild(node.name), members: node.members.map(el => this.convertChild(el)), - }); + // TODO: Fix type error + } as TSESTree.TSEnumDeclaration); return this.fixExports(node, result); } diff --git a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts index 04799b89580..21d0c24516f 100644 --- a/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts +++ b/packages/typescript-estree/src/create-program/WatchCompilerHostOfConfigFile.ts @@ -35,4 +35,4 @@ interface WatchCompilerHostOfConfigFile extraFileExtensions?: readonly ts.FileExtensionInfo[]; } -export { WatchCompilerHostOfConfigFile }; +export type { WatchCompilerHostOfConfigFile }; diff --git a/packages/typescript-estree/src/create-program/shared.ts b/packages/typescript-estree/src/create-program/shared.ts index 84784797051..647d4c3b848 100644 --- a/packages/typescript-estree/src/create-program/shared.ts +++ b/packages/typescript-estree/src/create-program/shared.ts @@ -127,15 +127,17 @@ function createHash(content: string): string { } export { - ASTAndDefiniteProgram, - ASTAndNoProgram, - ASTAndProgram, CORE_COMPILER_OPTIONS, canonicalDirname, - CanonicalPath, createDefaultCompilerOptionsFromExtra, createHash, ensureAbsolutePath, getCanonicalFileName, getAstFromProgram, }; +export type { + ASTAndDefiniteProgram, + ASTAndNoProgram, + ASTAndProgram, + CanonicalPath, +}; diff --git a/packages/typescript-estree/src/index.ts b/packages/typescript-estree/src/index.ts index 5f6e8768d0c..ef42032c916 100644 --- a/packages/typescript-estree/src/index.ts +++ b/packages/typescript-estree/src/index.ts @@ -1,10 +1,6 @@ -export { - AST, - parse, - parseAndGenerateServices, - ParseAndGenerateServicesResult, -} from './parser'; -export { +export { parse, parseAndGenerateServices } from './parser'; +export type { AST, ParseAndGenerateServicesResult } from './parser'; +export type { ParserServices, ParserServicesWithTypeInformation, ParserServicesWithoutTypeInformation, diff --git a/packages/typescript-estree/src/parser.ts b/packages/typescript-estree/src/parser.ts index d724d81e379..10e2e8cf36f 100644 --- a/packages/typescript-estree/src/parser.ts +++ b/packages/typescript-estree/src/parser.ts @@ -288,11 +288,10 @@ function parseAndGenerateServices( } export { - AST, parse, parseAndGenerateServices, - ParseAndGenerateServicesResult, clearDefaultProjectMatchedFiles, clearProgramCache, clearParseAndGenerateServicesCalls, }; +export type { AST, ParseAndGenerateServicesResult }; diff --git a/packages/typescript-estree/tsconfig.build.json b/packages/typescript-estree/tsconfig.build.json index 191f1df748a..80b5ebd83ab 100644 --- a/packages/typescript-estree/tsconfig.build.json +++ b/packages/typescript-estree/tsconfig.build.json @@ -1,15 +1,18 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", - "resolveJsonModule": true, - "removeComments": false + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, + "resolveJsonModule": true }, "include": ["src", "typings"], "references": [ - { "path": "../types/tsconfig.build.json" }, - { "path": "../visitor-keys/tsconfig.build.json" } + { + "path": "../types/tsconfig.build.json" + }, + { + "path": "../visitor-keys/tsconfig.build.json" + } ] } diff --git a/packages/typescript-estree/tsconfig.json b/packages/typescript-estree/tsconfig.json index bc1141dd051..7c3bdfe6e18 100644 --- a/packages/typescript-estree/tsconfig.json +++ b/packages/typescript-estree/tsconfig.json @@ -1,13 +1,15 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/typescript-estree" }, - "include": ["src", "typings", "tests", "tools"], - "exclude": ["tests/fixtures/**/*"], + "files": [], "references": [ - { "path": "../types/tsconfig.build.json" }, - { "path": "../visitor-keys/tsconfig.build.json" } + { + "path": "./tsconfig.build.json" + }, + { + "path": "./tsconfig.spec.json" + } ] } diff --git a/packages/typescript-estree/tsconfig.spec.json b/packages/typescript-estree/tsconfig.spec.json new file mode 100644 index 00000000000..bf0d46e48ea --- /dev/null +++ b/packages/typescript-estree/tsconfig.spec.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc/typescript-estree", + "types": ["jest", "node"] + }, + "exclude": ["tests/fixtures"], + "include": [ + "tests", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] +} diff --git a/packages/utils/package.json b/packages/utils/package.json index bc10c1aac99..d1c14e0e875 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -63,8 +63,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "test": "jest --coverage" }, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", diff --git a/packages/utils/src/eslint-utils/InferTypesFromRule.ts b/packages/utils/src/eslint-utils/InferTypesFromRule.ts index c716912cdf1..bb9c143364d 100644 --- a/packages/utils/src/eslint-utils/InferTypesFromRule.ts +++ b/packages/utils/src/eslint-utils/InferTypesFromRule.ts @@ -20,4 +20,4 @@ type InferMessageIdsTypeFromRule = ? MessageIds : unknown; -export { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule }; +export type { InferOptionsTypeFromRule, InferMessageIdsTypeFromRule }; diff --git a/packages/utils/src/ts-eslint/AST.ts b/packages/utils/src/ts-eslint/AST.ts index 4cace04f13f..a8462faa890 100644 --- a/packages/utils/src/ts-eslint/AST.ts +++ b/packages/utils/src/ts-eslint/AST.ts @@ -12,4 +12,4 @@ namespace AST { export type Range = TSESTree.Range; } -export { AST }; +export type { AST }; diff --git a/packages/utils/src/ts-eslint/ParserOptions.ts b/packages/utils/src/ts-eslint/ParserOptions.ts index 5a64049f335..12fa08ba635 100644 --- a/packages/utils/src/ts-eslint/ParserOptions.ts +++ b/packages/utils/src/ts-eslint/ParserOptions.ts @@ -1,4 +1,4 @@ -export { +export type { DebugLevel, EcmaVersion, ParserOptions, diff --git a/packages/utils/src/ts-eslint/RuleTester.ts b/packages/utils/src/ts-eslint/RuleTester.ts index 11696716222..42ea087f34b 100644 --- a/packages/utils/src/ts-eslint/RuleTester.ts +++ b/packages/utils/src/ts-eslint/RuleTester.ts @@ -200,10 +200,10 @@ declare class RuleTesterBase { class RuleTester extends (ESLintRuleTester as typeof RuleTesterBase) {} -export { +export { RuleTester }; +export type { InvalidTestCase, SuggestionOutput, - RuleTester, RuleTesterConfig, RuleTesterTestFrameworkFunction, RunTests, diff --git a/packages/utils/tsconfig.build.json b/packages/utils/tsconfig.build.json index e5c1077c5e5..ea04d6c5932 100644 --- a/packages/utils/tsconfig.build.json +++ b/packages/utils/tsconfig.build.json @@ -1,15 +1,21 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src", "typings"], "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { + "path": "../scope-manager/tsconfig.build.json" + }, + { + "path": "../types/tsconfig.build.json" + }, + { + "path": "../typescript-estree/tsconfig.build.json" + } ] } diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 20ea2496c6b..42c5024cc22 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,13 +1,12 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/utils" }, "include": ["src", "typings", "tests", "tools"], "references": [ - { "path": "../scope-manager/tsconfig.build.json" }, - { "path": "../types/tsconfig.build.json" }, - { "path": "../typescript-estree/tsconfig.build.json" } + { + "path": "./tsconfig.build.json" + } ] } diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 3b95fa05357..e76c2dec281 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -43,8 +43,7 @@ "postclean": "rimraf dist && rimraf _ts3.4 && rimraf _ts4.3 && rimraf coverage", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", "lint": "npx nx lint", - "test": "jest --coverage", - "typecheck": "tsc --noEmit" + "test": "jest --coverage" }, "dependencies": { "@typescript-eslint/types": "7.13.0", diff --git a/packages/visitor-keys/src/index.ts b/packages/visitor-keys/src/index.ts index 04aa6515863..32439b9d379 100644 --- a/packages/visitor-keys/src/index.ts +++ b/packages/visitor-keys/src/index.ts @@ -1,2 +1,3 @@ export { getKeys } from './get-keys'; -export { visitorKeys, VisitorKeys } from './visitor-keys'; +export { visitorKeys } from './visitor-keys'; +export type { VisitorKeys } from './visitor-keys'; diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 04aa32e5af2..1cdc54c0c3d 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -275,4 +275,5 @@ const additionalKeys: AdditionalKeys = { const visitorKeys: VisitorKeys = eslintVisitorKeys.unionWith(additionalKeys); -export { visitorKeys, VisitorKeys }; +export type { VisitorKeys }; +export { visitorKeys }; diff --git a/packages/visitor-keys/tsconfig.build.json b/packages/visitor-keys/tsconfig.build.json index 215a0282df2..0f2483b57f3 100644 --- a/packages/visitor-keys/tsconfig.build.json +++ b/packages/visitor-keys/tsconfig.build.json @@ -1,9 +1,9 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": true, - "outDir": "./dist", - "rootDir": "./src", + "rootDir": "src", + "outDir": "dist", + "emitDeclarationOnly": false, "resolveJsonModule": true }, "include": ["src", "typings"] diff --git a/packages/visitor-keys/tsconfig.json b/packages/visitor-keys/tsconfig.json index 9cea515ba6b..445a7045138 100644 --- a/packages/visitor-keys/tsconfig.json +++ b/packages/visitor-keys/tsconfig.json @@ -1,8 +1,12 @@ { - "extends": "./tsconfig.build.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "composite": false, - "rootDir": "." + "outDir": "../../dist/out-tsc/visitor-keys" }, - "include": ["src", "typings", "tests", "tools"] + "include": ["src", "typings", "tests", "tools"], + "references": [ + { + "path": "./tsconfig.build.json" + } + ] } diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index 7dc1549b84a..b51fbb55bb8 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -19,16 +19,17 @@ "scripts": { "build": "tsx ./build.ts", "format": "prettier --write \"./**/*.{ts,mts,cts,tsx,js,mjs,cjs,jsx,json,md,css}\" --ignore-path ../../.prettierignore", - "lint": "npx nx lint", - "typecheck": "tsc --noEmit" + "lint": "npx nx lint" }, - "devDependencies": { - "@eslint/js": "*", + "dependencies": { "@typescript-eslint/eslint-plugin": "7.13.0", "@typescript-eslint/parser": "7.13.0", "@typescript-eslint/scope-manager": "7.13.0", "@typescript-eslint/typescript-estree": "7.13.0", - "@typescript-eslint/visitor-keys": "7.13.0", + "@typescript-eslint/visitor-keys": "7.13.0" + }, + "devDependencies": { + "@eslint/js": "*", "esbuild": "~0.21.0", "eslint": "*", "esquery": "*", diff --git a/packages/website-eslint/tsconfig.json b/packages/website-eslint/tsconfig.json index aeafdb4d3f3..b5a6009b29e 100644 --- a/packages/website-eslint/tsconfig.json +++ b/packages/website-eslint/tsconfig.json @@ -1,13 +1,21 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + "outDir": "../../dist/out-tsc/website-eslint", "allowJs": true, - // opt-in files for checking - "checkJs": false, - // build is done via esbuild - "noEmit": true, - "skipLibCheck": true + "skipLibCheck": true, + "noImplicitAny": false }, "include": ["src", "types", "build.ts"], - "references": [] + "references": [ + { + "path": "../scope-manager/tsconfig.build.json" + }, + { + "path": "../typescript-estree/tsconfig.build.json" + }, + { + "path": "../visitor-keys/tsconfig.build.json" + } + ] } diff --git a/packages/website/package.json b/packages/website/package.json index 71167c790ad..410f743a8d8 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -12,8 +12,7 @@ "lint": "npx nx lint", "serve": "docusaurus serve", "start": "npx nx start", - "swizzle": "docusaurus swizzle", - "typecheck": "tsc -b ./tsconfig.json" + "swizzle": "docusaurus swizzle" }, "dependencies": { "@babel/runtime": "^7.24.4", @@ -23,7 +22,10 @@ "@docusaurus/preset-classic": "^3.2.1", "@docusaurus/remark-plugin-npm2yarn": "^3.2.1", "@docusaurus/theme-common": "^3.2.1", + "@mdx-js/react": "^3.0.1", + "@prettier/sync": "*", "@typescript-eslint/parser": "7.13.0", + "@typescript-eslint/rule-schema-to-typescript-types": "7.13.0", "@typescript-eslint/website-eslint": "7.13.0", "@uiw/react-shields": "2.0.1", "clsx": "^2.1.0", @@ -46,6 +48,8 @@ "@docusaurus/module-type-aliases": "^3.2.1", "@types/mdast": "^4.0.3", "@types/react": "*", + "@types/react-helmet": "^6.1.11", + "@types/react-router-dom": "^5.3.3", "@types/unist": "^3.0.2", "@typescript-eslint/eslint-plugin": "7.13.0", "@typescript-eslint/rule-schema-to-typescript-types": "7.13.0", diff --git a/packages/website/tsconfig.json b/packages/website/tsconfig.json index fd5a209a978..548d97d2acf 100644 --- a/packages/website/tsconfig.json +++ b/packages/website/tsconfig.json @@ -1,13 +1,16 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { + // disable composite and emitDeclarationOnly for docusaurus usage + "composite": false, + "emitDeclarationOnly": false, + "noEmit": true, "module": "ESNext", "moduleResolution": "Bundler", "allowJs": true, "esModuleInterop": true, "jsx": "react", "lib": ["DOM", "ESNext"], - "noEmit": true, "noImplicitAny": false, "resolveJsonModule": true, "baseUrl": ".", @@ -25,5 +28,10 @@ "sidebars/*.js", "./*.mts", "./*.ts" + ], + "references": [ + { + "path": "../rule-schema-to-typescript-types/tsconfig.build.json" + } ] } diff --git a/tsconfig.base.json b/tsconfig.base.json index a00dd38697a..51c354ac0f0 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,21 +1,34 @@ { "compilerOptions": { + "allowJs": false, "allowSyntheticDefaultImports": true, "allowUnreachableCode": false, "allowUnusedLabels": false, + "composite": true, "declaration": true, "declarationMap": true, + "emitDeclarationOnly": true, + "emitDecoratorMetadata": false, "esModuleInterop": true, - "lib": ["ES2021"], - "module": "Node16", - "moduleResolution": "Node16", + "experimentalDecorators": false, + "forceConsistentCasingInFileNames": true, + "incremental": true, + "isolatedModules": true, + "lib": ["es2022"], + "module": "NodeNext", + "noEmitOnError": true, + "noImplicitOverride": true, "noImplicitReturns": true, - "paths": {}, + "noFallthroughCasesInSwitch": false, + "noUnusedLocals": false, "pretty": true, - "resolveJsonModule": true, + "removeComments": false, + "resolveJsonModule": false, + "skipDefaultLibCheck": false, "skipLibCheck": true, "sourceMap": true, "strict": true, - "target": "ES2021" + "target": "es2022", + "verbatimModuleSyntax": false } } diff --git a/tsconfig.json b/tsconfig.json index cea4b651f67..4c8d927e2a6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,44 @@ { - "compilerOptions": { - "types": ["@types/node"], - "noEmit": true, - "allowJs": true - }, - "extends": "./tsconfig.base.json", - "include": [ - "typings", - "tools/**/*.ts", - "tools/**/*.mts", - "eslint.config.js", - "eslint.config.mjs", - "jest.config.base.js", - "jest.config.js", - "jest.preset.js" + "compileOnSave": false, + "files": [], + "references": [ + { "path": "packages/ast-spec/tsconfig.build.json" }, + { "path": "packages/types/tsconfig.build.json" }, + { "path": "packages/visitor-keys/tsconfig.build.json" }, + { "path": "packages/typescript-estree/tsconfig.build.json" }, + { "path": "packages/ast-spec/tsconfig.spec.json" }, + { "path": "packages/ast-spec/tsconfig.json" }, + { "path": "packages/scope-manager/tsconfig.build.json" }, + { "path": "packages/utils/tsconfig.build.json" }, + { "path": "packages/parser/tsconfig.build.json" }, + { "path": "packages/type-utils/tsconfig.build.json" }, + { "path": "packages/rule-schema-to-typescript-types/tsconfig.build.json" }, + { "path": "packages/rule-tester/tsconfig.build.json" }, + { "path": "packages/eslint-plugin/tsconfig.json" }, + { "path": "packages/eslint-plugin-internal/tsconfig.json" }, + { "path": "packages/integration-tests/tsconfig.build.json" }, + { "path": "packages/integration-tests/tsconfig.spec.json" }, + { "path": "packages/integration-tests/tsconfig.json" }, + { "path": "packages/parser/tsconfig.spec.json" }, + { "path": "packages/parser/tsconfig.json" }, + { "path": "packages/repo-tools/tsconfig.build.json" }, + { "path": "packages/repo-tools/tsconfig.json" }, + { "path": "packages/rule-schema-to-typescript-types/tsconfig.json" }, + { "path": "packages/rule-tester/tsconfig.spec.json" }, + { "path": "packages/rule-tester/tsconfig.json" }, + { "path": "packages/scope-manager/tsconfig.spec.json" }, + { "path": "packages/scope-manager/tsconfig.json" }, + { "path": "packages/type-utils/tsconfig.spec.json" }, + { "path": "packages/type-utils/tsconfig.json" }, + { "path": "packages/types/tsconfig.json" }, + { "path": "packages/typescript-eslint/tsconfig.build.json" }, + { "path": "packages/typescript-eslint/tsconfig.spec.json" }, + { "path": "packages/typescript-eslint/tsconfig.json" }, + { "path": "packages/typescript-estree/tsconfig.spec.json" }, + { "path": "packages/typescript-estree/tsconfig.json" }, + { "path": "packages/utils/tsconfig.json" }, + { "path": "packages/visitor-keys/tsconfig.json" }, + { "path": "packages/website/tsconfig.json" }, + { "path": "packages/website-eslint/tsconfig.json" } ] } diff --git a/yarn.lock b/yarn.lock index d3648972750..876bdc9c499 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3787,7 +3787,7 @@ __metadata: languageName: node linkType: hard -"@mdx-js/react@npm:^3.0.0": +"@mdx-js/react@npm:^3.0.0, @mdx-js/react@npm:^3.0.1": version: 3.0.1 resolution: "@mdx-js/react@npm:3.0.1" dependencies: @@ -4382,7 +4382,7 @@ __metadata: languageName: node linkType: hard -"@prettier/sync@npm:^0.5.1": +"@prettier/sync@npm:*, @prettier/sync@npm:^0.5.1": version: 0.5.2 resolution: "@prettier/sync@npm:0.5.2" dependencies: @@ -5430,6 +5430,15 @@ __metadata: languageName: node linkType: hard +"@types/react-helmet@npm:^6.1.11": + version: 6.1.11 + resolution: "@types/react-helmet@npm:6.1.11" + dependencies: + "@types/react": "*" + checksum: e329d8ad82c365fec7dd7d91c8b6d167faac30cef0d9f1e27d7e895172a0ebfa65829fb4acabbe79283b01cbbe5840a845caeb50148ceef6f3fad42b3c2c4bdc + languageName: node + linkType: hard + "@types/react-router-config@npm:*, @types/react-router-config@npm:^5.0.7": version: 5.0.11 resolution: "@types/react-router-config@npm:5.0.11" @@ -5441,7 +5450,7 @@ __metadata: languageName: node linkType: hard -"@types/react-router-dom@npm:*": +"@types/react-router-dom@npm:*, @types/react-router-dom@npm:^5.3.3": version: 5.3.3 resolution: "@types/react-router-dom@npm:5.3.3" dependencies: @@ -20503,8 +20512,12 @@ __metadata: "@docusaurus/preset-classic": ^3.2.1 "@docusaurus/remark-plugin-npm2yarn": ^3.2.1 "@docusaurus/theme-common": ^3.2.1 + "@mdx-js/react": ^3.0.1 + "@prettier/sync": "*" "@types/mdast": ^4.0.3 "@types/react": "*" + "@types/react-helmet": ^6.1.11 + "@types/react-router-dom": ^5.3.3 "@types/unist": ^3.0.2 "@typescript-eslint/eslint-plugin": 7.13.0 "@typescript-eslint/parser": 7.13.0