Codegen gaps identified after config/ migration
After investigating the SDK-side batch PRs (#38557, #38574, #38580, #38583) and comparing with the codegen source in packages/rlc-common/src/metadata/, here are the specific gaps:
Gap A: test:node:esm script should be removed
- Generated file:
package.json (the scripts section)
- Codegen file:
packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts (line ~201)
- Current code:
"test:node:esm": "dev-tool run test:vitest --esm",
- Change needed: Remove this line. The
vitest.esm.config.ts file no longer exists (removed by autorest.typescript#3938), so this script is dead. The node tests already exercise the ESM build via vitest.config.ts, and the browser tests cover browser-ESM via vitest.browser.config.ts.
Gap B: test:browser script should remove build-test step
- Generated file:
package.json (the scripts section)
- Codegen file:
packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts (line ~180-181)
- Current code:
"test:browser": "dev-tool run build-test && dev-tool run test:vitest --browser",
- Change needed: Update to:
"test:browser": "dev-tool run test:vitest --browser",
The new vitest.browser.config.ts (from eng/vitestconfigs/browser.config.ts) runs tests directly against source files (test/**/*.spec.ts) using Vite's browser mode. The separate build-test step is no longer needed.
Gap C: test script should include type-check step
- Generated file:
package.json (the scripts section)
- Codegen file:
packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts (line ~202)
- Current code:
test: "npm run test:node && npm run test:browser"
- Change needed: Update to:
test: "tsc -b --noEmit && npm run test:node && npm run test:browser"
The tsc -b --noEmit type-checks against the project references (the new config/ tsconfigs) before running tests, catching type errors early without emitting files.
Gap D: Missing config/tsconfig.lint.json generation
- Generated file:
config/tsconfig.lint.json (currently NOT generated)
- Codegen file: Needs a new builder function, e.g.
buildTsLintConfig() in packages/rlc-common/src/metadata/buildTsConfig.ts, and it needs to be called from packages/typespec-ts/src/index.ts alongside the other tsconfig builders.
- Expected content:
{
"extends": "../../../../tsconfig.json",
"include": ["../src", "../test"]
}
- Why: This is used by
eslint.config.mjs for type-aware linting (see Gap E).
Gap E: eslint.config.mjs missing parserOptions block for typed linting
- Generated file:
eslint.config.mjs
- Codegen file:
packages/rlc-common/src/metadata/buildESLintConfig.ts (the esLintConfigEsm template)
- Current generated output:
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
export default azsdkEslint.config([
{
rules: { ... }
}
]);
- Change needed: Update to:
import azsdkEslint from "@azure/eslint-plugin-azure-sdk";
export default [
...azsdkEslint.config([
{
rules: { ... },
},
]),
{
files: ["src/**/*.ts", "src/**/*.mts", "test/**/*.ts"],
languageOptions: {
parserOptions: {
projectService: false,
project: "./config/tsconfig.lint.json",
},
},
},
];
This explicitly points typescript-eslint to the dedicated lint tsconfig and disables automatic projectService detection, which is required for type-aware rules to work with the new config/ directory structure. (This pairs with Gap D — both are needed together.)
Gap F: Copyright header missing from vitest configs
- Generated file:
vitest.config.ts and vitest.browser.config.ts
- Codegen file:
packages/rlc-common/src/metadata/buildVitestConfig.ts
- Change needed: Add the standard copyright header to output:
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Gap G: Stale vitest.esm.config.ts not cleaned up on regeneration
- Generated file: N/A (it's a file that should be deleted)
- Codegen file:
packages/typespec-ts/src/index.ts (the update/regeneration flow around line 611+)
- Change needed: When regenerating an existing package (the
shouldGenerateMetadata / update path), the codegen should delete vitest.esm.config.ts if it exists, since it is no longer needed.
Priority summary
| Gap |
Impact |
Notes |
| A |
High |
Every newly generated package gets a broken test:node:esm script |
| B |
High |
build-test step is unnecessary and slows down browser tests |
| C |
High |
Missing type-check means test script doesn't catch type errors |
| D |
High |
Eslint typed linting fails without this file |
| E |
High |
Eslint can't resolve types for type-aware rules |
| F |
Low |
Cosmetic, but inconsistent with SDK convention |
| G |
Medium |
Only affects regeneration of existing packages that had the old config |
Codegen gaps identified after config/ migration
After investigating the SDK-side batch PRs (#38557, #38574, #38580, #38583) and comparing with the codegen source in
packages/rlc-common/src/metadata/, here are the specific gaps:Gap A:
test:node:esmscript should be removedpackage.json(thescriptssection)packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts(line ~201)vitest.esm.config.tsfile no longer exists (removed by autorest.typescript#3938), so this script is dead. The node tests already exercise the ESM build viavitest.config.ts, and the browser tests cover browser-ESM viavitest.browser.config.ts.Gap B:
test:browserscript should removebuild-teststeppackage.json(thescriptssection)packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts(line ~180-181)vitest.browser.config.ts(fromeng/vitestconfigs/browser.config.ts) runs tests directly against source files (test/**/*.spec.ts) using Vite's browser mode. The separatebuild-teststep is no longer needed.Gap C:
testscript should include type-check steppackage.json(thescriptssection)packages/rlc-common/src/metadata/packageJson/buildAzureMonorepoPackage.ts(line ~202)test: "npm run test:node && npm run test:browser"test: "tsc -b --noEmit && npm run test:node && npm run test:browser"tsc -b --noEmittype-checks against the project references (the newconfig/tsconfigs) before running tests, catching type errors early without emitting files.Gap D: Missing
config/tsconfig.lint.jsongenerationconfig/tsconfig.lint.json(currently NOT generated)buildTsLintConfig()inpackages/rlc-common/src/metadata/buildTsConfig.ts, and it needs to be called frompackages/typespec-ts/src/index.tsalongside the other tsconfig builders.{ "extends": "../../../../tsconfig.json", "include": ["../src", "../test"] }eslint.config.mjsfor type-aware linting (see Gap E).Gap E:
eslint.config.mjsmissingparserOptionsblock for typed lintingeslint.config.mjspackages/rlc-common/src/metadata/buildESLintConfig.ts(theesLintConfigEsmtemplate)projectServicedetection, which is required for type-aware rules to work with the newconfig/directory structure. (This pairs with Gap D — both are needed together.)Gap F: Copyright header missing from vitest configs
vitest.config.tsandvitest.browser.config.tspackages/rlc-common/src/metadata/buildVitestConfig.tsGap G: Stale
vitest.esm.config.tsnot cleaned up on regenerationpackages/typespec-ts/src/index.ts(the update/regeneration flow around line 611+)shouldGenerateMetadata/ update path), the codegen should deletevitest.esm.config.tsif it exists, since it is no longer needed.Priority summary
test:node:esmscriptbuild-teststep is unnecessary and slows down browser tests