Skip to content

Commit

Permalink
chore: refactor tsconfigs to use project references
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed May 3, 2024
1 parent 7984ef7 commit 81d9f4f
Show file tree
Hide file tree
Showing 108 changed files with 859 additions and 463 deletions.
14 changes: 0 additions & 14 deletions .yarn/patches/@nx-eslint-npm-17.3.1-a2f85d8c50.patch

This file was deleted.

11 changes: 2 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@
"@babel/types": "^7.24.0",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "^8.57.0",
"@nx/eslint": "18.2.3",
"@nx/jest": "18.2.3",
"@nx/workspace": "18.2.3",
"@nx/eslint": "19.0.0-beta.9",
"@nx/jest": "19.0.0-beta.9",
"@nx/js": "19.0.0-beta.9",
"@nx/workspace": "19.0.0-beta.9",
"@swc/core": "^1.4.12",
"@swc/jest": "^0.2.36",
"@types/babel__code-frame": "^7.0.6",
Expand Down Expand Up @@ -112,7 +113,7 @@
"markdownlint-cli": "^0.39.0",
"ncp": "^2.0.0",
"netlify": "^13.1.14",
"nx": "18.2.3",
"nx": "19.0.0-beta.9",
"prettier": "3.2.5",
"pretty-format": "^29.7.0",
"raw-loader": "^4.0.2",
Expand Down Expand Up @@ -141,8 +142,7 @@
"pretty-format": "^29",
"react-split-pane@^0.1.92": "patch:react-split-pane@npm%3A0.1.92#./.yarn/patches/react-split-pane-npm-0.1.92-93dbf51dff.patch",
"tsx": "^4.7.2",
"typescript": "5.4.3",
"@nx/eslint@17.3.1": "patch:@nx/eslint@npm%3A17.3.1#./.yarn/patches/@nx-eslint-npm-17.3.1-a2f85d8c50.patch"
"typescript": "5.4.3"
},
"packageManager": "yarn@3.8.1"
}
3 changes: 1 addition & 2 deletions packages/ast-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 -p tsconfig.json --noEmit"
"test": "jest"
},
"funding": {
"type": "opencollective",
Expand Down
1 change: 1 addition & 0 deletions packages/ast-spec/tests/BinaryOperatorToText.type-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/ast-spec/tests/util/serializers/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 =>
Expand Down
7 changes: 3 additions & 4 deletions packages/ast-spec/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
17 changes: 11 additions & 6 deletions packages/ast-spec/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
30 changes: 30 additions & 0 deletions packages/ast-spec/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
7 changes: 3 additions & 4 deletions packages/eslint-plugin-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"main": "dist/index.js",
"types": "index.d.ts",
"scripts": {
"build": "tsc -b tsconfig.build.json",
"clean": "tsc -b tsconfig.build.json --clean",
"build": "npx tsc -b tsconfig.build.json",
"clean": "npx tsc -b tsconfig.build.json --clean",
"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": "tsc -p tsconfig.json --noEmit"
"test": "jest --coverage"
},
"dependencies": {
"@prettier/sync": "^0.5.1",
Expand Down
20 changes: 16 additions & 4 deletions packages/eslint-plugin-internal/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
20 changes: 17 additions & 3 deletions packages/eslint-plugin-internal/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
3 changes: 1 addition & 2 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,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 -p tsconfig.json --noEmit"
"test-single": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --no-coverage"
},
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
2 changes: 1 addition & 1 deletion packages/eslint-plugin/src/rules/naming-convention.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,4 +784,4 @@ function requiresQuoting(
return _requiresQuoting(name, target);
}

export { MessageIds, Options };
export type { MessageIds, Options };
3 changes: 1 addition & 2 deletions packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,8 @@ export {
checkFunctionExpressionReturnType,
checkFunctionReturnType,
doesImmediatelyReturnFunctionExpression,
FunctionExpression,
FunctionNode,
isTypedFunctionExpression,
isValidFunctionExpressionReturnType,
ancestorHasReturnType,
};
export type { FunctionExpression, FunctionNode };
3 changes: 1 addition & 2 deletions packages/eslint-plugin/src/util/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export {
isObjectNotArray,
getParserServices,
nullThrows,
InferMessageIdsTypeFromRule,
InferOptionsTypeFromRule,
NullThrowsReasons,
};
export type { InferMessageIdsTypeFromRule, InferOptionsTypeFromRule };
4 changes: 1 addition & 3 deletions packages/eslint-plugin/src/util/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,6 @@ function isParenlessArrowFunction(
export {
arrayGroupByToMap,
arraysAreEqual,
Equal,
ExcludeKeys,
findFirstResult,
formatWordList,
getEnumNames,
Expand All @@ -244,8 +242,8 @@ export {
isRestParameterDeclaration,
isParenlessArrowFunction,
MemberNameType,
RequireKeys,
typeNodeRequiresParentheses,
upperCaseFirst,
findLastIndex,
};
export type { Equal, ExcludeKeys, RequireKeys };
27 changes: 20 additions & 7 deletions packages/eslint-plugin/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}

0 comments on commit 81d9f4f

Please sign in to comment.