Skip to content

Fix config/script gaps between JS emitter and SDK libraries#4006

Merged
JialinHuang803 merged 7 commits into
mainfrom
copilot/fix-config-gaps-sdk-js-emitter-again
May 29, 2026
Merged

Fix config/script gaps between JS emitter and SDK libraries#4006
JialinHuang803 merged 7 commits into
mainfrom
copilot/fix-config-gaps-sdk-js-emitter-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

Several codegen gaps were identified after the config/ migration in azure-sdk-for-js, causing newly generated packages to have stale/incorrect scripts and missing lint config files.

Changes

packages/typespec-ts/src/rlc-common/metadata/packageJson/buildAzureMonorepoPackage.ts

  • Gap A: Remove test:node:esm script (vitest.esm.config.ts no longer exists)
  • Gap B: Remove build-test && from test:browser — new vitest.browser.config.ts runs directly against source
  • Gap C: Prefix test script with tsc -b --noEmit && for early type-checking against project references

packages/typespec-ts/src/rlc-common/metadata/buildTsConfig.ts

  • Gap D: Add buildTsLintConfig() emitting config/tsconfig.lint.json:
    { "extends": "../../../../tsconfig.json", "include": ["../src", "../test"] }

packages/typespec-ts/src/rlc-common/metadata/buildESLintConfig.ts

  • Gap E: Update esLintConfigEsm template to spread the azure-sdk config and append a parserOptions block pointing to ./config/tsconfig.lint.json for type-aware linting:
    export default [
      ...azsdkEslint.config([{ rules: { ... } }]),
      {
        files: ["src/**/*.ts", "src/**/*.mts", "test/**/*.ts"],
        languageOptions: {
          parserOptions: { projectService: false, project: "./config/tsconfig.lint.json" },
        },
      },
    ];

packages/typespec-ts/src/index.ts

  • Wire buildTsLintConfig into the generation pipeline (Azure flavor + azureSdkForJs only)
  • Gap G: vitest.esm.config.ts is no longer emitted by the generator — buildVitestConfig only produces vitest.config.ts and vitest.browser.config.ts

… add tsconfig.lint.json, update eslint config, cleanup vitest.esm.config.ts
Copilot AI changed the title [WIP] Fix config-related gaps between SDK libraries and JS emitter Fix config/script gaps between JS emitter and SDK libraries May 27, 2026
Copilot AI requested a review from kazrael2119 May 27, 2026 07:02
Comment thread packages/typespec-ts/src/index.ts Outdated
@kazrael2119
Copy link
Copy Markdown
Member

@copilot fix ci failures

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot fix ci failures

Fixed in the latest commit. There were two root causes:

  1. TypeSpec_Smoke_Test: The parserOptions block in esLintConfigEsm was incorrectly applied to all azure-flavor ESM packages, including typespec-test packages with azure-sdk-for-js: false (which don't have config/tsconfig.lint.json). Fixed by adding a separate esLintConfigEsmAzureSdk template and only using it when azureSdkForJs: true.

  2. AutoRest_Generation / RLC_Generation: The warp.config.yml template was updated (from ./config/tsconfig.src.*.json to ../../../tsconfig.src.*.json) but 81 snapshot files were still using the old paths. Updated all of them to match the new template output.

},
},
},
];
Copy link
Copy Markdown
Member

@kazrael2119 kazrael2119 May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot I believe both the old and new configurations should be retained here, with the new version used when model.options?.azureSdkForJs is true, and the old version otherwise?
The file /config/tsconfig.lint.json exists only in the azureSdkForJs repository. Therefore, if the current changes are applied, this configuration will be missing when azureSdkForJs is set to false

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already addressed in 1e895cd — both configs are now retained: esLintConfigEsm (without parserOptions) is used when azureSdkForJs is falsy, and esLintConfigEsmAzureSdk (with parserOptions pointing to ./config/tsconfig.lint.json) is used only when azureSdkForJs is true.

@kazrael2119
Copy link
Copy Markdown
Member

@copilot fix ci failure

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 28, 2026

@copilot fix ci failure

Fixed in the latest commit. The check-format step in Spector_Standard_Test was failing because buildESLintConfig.ts had a project.createSourceFile() call formatted in a way that didn't match prettier's output. Reformatted the call to match.

@kazrael2119 kazrael2119 marked this pull request as ready for review May 29, 2026 02:15
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JialinHuang803 JialinHuang803 merged commit ffd258b into main May 29, 2026
16 checks passed
@JialinHuang803 JialinHuang803 deleted the copilot/fix-config-gaps-sdk-js-emitter-again branch May 29, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config-related gaps between the existing SDK libraries and the JS emitter

3 participants