Skip to content

Commit 9cb16e4

Browse files
Stop building test files (#9333)
fix #9232 Refactor how our tsconfig are setup so it won't build the test files. Goal - tsconfig.json -> not used for building, don't include/exclude files so just can be used by IDE for checking non project files(vitest.config.ts, etc.) - tsconfig.build.json -> actual config used for building The change involve for most - rename tsconfig.json to tsconfig.build.json - rename tsconfig.config.json to tsconfig.json - change `tsc -p .` to `tsp -p tsconfig.build.json`
1 parent 2bee42b commit 9cb16e4

File tree

117 files changed

+268
-267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+268
-267
lines changed
Lines changed: 33 additions & 0 deletions

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
node-version:
55
required: false
66
description: Node version for setup-node
7-
default: 20.x
7+
default: 24.x
88

99
runs:
1010
using: composite

eslint.config.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import eslint from "@eslint/js";
33
import vitest from "@vitest/eslint-plugin";
44
import reactHooks from "eslint-plugin-react-hooks";
55
import unicorn from "eslint-plugin-unicorn";
6+
import { defineConfig } from "eslint/config";
67
import tsEslint from "typescript-eslint";
78

89
/** Config that will apply to all files */
9-
const allFilesConfig = tsEslint.config({
10+
const allFilesConfig = defineConfig({
1011
plugins: {
1112
unicorn,
1213
},
@@ -71,7 +72,7 @@ const allFilesConfig = tsEslint.config({
7172
* @param {string} root
7273
*/
7374
export function getTypeScriptProjectRules(root) {
74-
return tsEslint.config({
75+
return defineConfig({
7576
files: [
7677
"**/packages/*/src/**/*.ts",
7778
"**/packages/*/src/**/*.tsx",
@@ -96,7 +97,7 @@ export function getTypeScriptProjectRules(root) {
9697
}
9798

9899
/** Config that will apply to all test files only */
99-
const testFilesConfig = tsEslint.config({
100+
const testFilesConfig = defineConfig({
100101
/**
101102
* Test files specific rules
102103
*/
@@ -117,8 +118,9 @@ const testFilesConfig = tsEslint.config({
117118
},
118119
});
119120

120-
const jsxFilesConfig = tsEslint.config({
121+
const jsxFilesConfig = defineConfig({
121122
files: ["**/*.tsx"],
123+
// @ts-expect-error --- plugins typing issue
122124
plugins: { "react-hooks": reactHooks },
123125
// Exclude need **/ to make sure this can be reused in typespec-azure
124126
ignores: ["**/packages/emitter-framework/src/**/*", "**/packages/http-client-js/**/*"],
@@ -136,7 +138,7 @@ export const TypeSpecCommonEslintConfigs = [
136138
...testFilesConfig,
137139
];
138140

139-
export default tsEslint.config(
141+
export default defineConfig(
140142
{
141143
ignores: [
142144
"**/dist/**/*",

packages/asset-emitter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
},
2828
"scripts": {
2929
"clean": "rimraf ./dist ./temp",
30-
"build": "tsc -p .",
31-
"watch": "tsc -p . --watch",
30+
"build": "tsc -p tsconfig.build.json",
31+
"watch": "tsc -p tsconfig.build.json --watch",
3232
"test": "vitest run",
3333
"test:watch": "vitest -w",
3434
"test:ui": "vitest --ui",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*.ts", "test/**/*.ts"]
4+
}

packages/asset-emitter/tsconfig.config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/asset-emitter/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
"rootDir": ".",
77
"tsBuildInfoFile": "temp/tsconfig.tsbuildinfo",
88
"verbatimModuleSyntax": true
9-
},
10-
"include": ["src/**/*.ts", "test/**/*.ts"]
9+
}
1110
}

packages/best-practices/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
},
2828
"scripts": {
2929
"clean": "rimraf ./dist ./temp",
30-
"build": "tsc -p .",
31-
"watch": "tsc -p . --watch",
30+
"build": "tsc -p tsconfig.build.json",
31+
"watch": "tsc -p tsconfig.build.json --watch",
3232
"test": "vitest run",
3333
"test:ui": "vitest --ui",
3434
"test:ci": "vitest run --coverage --reporter=junit --reporter=default",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*.ts", "test/**/*.ts"]
4+
}

packages/best-practices/tsconfig.config.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)