Skip to content

improvement(build-tools): address ESLint rule violations in build-tools#26152

Merged
tylerbutler merged 4 commits intomicrosoft:mainfrom
tylerbutler:eslint-rule-fixes
Jan 12, 2026
Merged

improvement(build-tools): address ESLint rule violations in build-tools#26152
tylerbutler merged 4 commits intomicrosoft:mainfrom
tylerbutler:eslint-rule-fixes

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Jan 7, 2026

These changes are in preparation for upgrading to eslint 9 in build-tools.

Summary

  • Fix low-count ESLint violations across the build-tools workspace
  • Address issues from newly enabled ESLint rules without modifying the config

Changes

  • Replace .replace(/x/g, ...) with .replaceAll() (unicorn/prefer-string-replace-all)
  • Change import * as path to import path (unicorn/import-style)
  • Remove useless undefined arguments (unicorn/no-useless-undefined)
  • Fix JSDoc @param names to match actual parameters (jsdoc/check-param-names)
  • Add inline disables for idiomatic usage patterns:
    • async.mapLimit, semver.parse, sortJson.overwrite (import-x/no-named-as-default-member)
    • prompts default export (import-x/no-named-as-default)
  • Remove unused eslint-disable directives for import-x/no-default-export
  • Change @module to @packageDocumentation for TSDoc compatibility (tsdoc/syntax)

Fix low-count ESLint violations across the build-tools workspace:

- Replace .replace(/x/g, ...) with .replaceAll() (unicorn/prefer-string-replace-all)
- Change import * as path to import path (unicorn/import-style)
- Remove useless undefined arguments (unicorn/no-useless-undefined)
- Fix JSDoc @param names to match actual parameters (jsdoc/check-param-names)
- Add inline disables for idiomatic usage patterns:
  - async.mapLimit, semver.parse, sortJson.overwrite (import-x/no-named-as-default-member)
  - prompts default export (import-x/no-named-as-default)
- Remove unused eslint-disable directives for import-x/no-default-export
- Change @module to @packageDocumentation for TSDoc compatibility (tsdoc/syntax)
@tylerbutler tylerbutler marked this pull request as ready for review January 8, 2026 00:21
Copilot AI review requested due to automatic review settings January 8, 2026 00:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses ESLint rule violations across the build-tools workspace by fixing code to comply with newly enabled ESLint rules, without modifying the ESLint configuration itself.

  • Modernizes string replacement operations using .replaceAll() instead of regex-based .replace(/x/g, ...)
  • Updates import statements to use default imports for Node.js built-in modules like path
  • Removes unnecessary undefined arguments and fixes JSDoc parameter names
  • Adds appropriate inline ESLint disable comments for idiomatic library usage patterns
  • Updates TSDoc annotations for better compatibility

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
build-tools/packages/version-tools/src/internalVersionScheme.ts Removes useless undefined arguments from validateVersionScheme calls
build-tools/packages/version-tools/src/commands/version/latest.ts Removes unused import-x/no-default-export disable directive
build-tools/packages/version-tools/src/commands/version.ts Removes unused import-x/no-default-export disable directive
build-tools/packages/build-infrastructure/src/test/packageJsonUtils.test.ts Changes path import from namespace to default import
build-tools/packages/build-infrastructure/src/test/git.test.ts Changes path import from namespace to default import
build-tools/packages/build-infrastructure/src/index.ts Updates @module to @packageDocumentation for TSDoc compatibility
build-tools/packages/build-infrastructure/src/buildProject.ts Replaces .replace(/\\/g, "/") with .replaceAll("\\", "/")
build-tools/packages/build-infrastructure/api-report/build-infrastructure.api.md Removes auto-generated comment about missing package documentation
build-tools/packages/build-cli/src/commands/release/report.ts Fixes JSDoc parameter names and adds inline disable for sortJson.overwrite
build-tools/packages/build-cli/src/commands/release/report-unreleased.ts Adds missing JSDoc parameter documentation
build-tools/packages/build-cli/src/commands/release/fromTag.ts Adds inline disable for semver.parse
build-tools/packages/build-cli/src/commands/generate/typetests.ts Replaces .replace(/x/g, ...) with .replaceAll()
build-tools/packages/build-cli/src/commands/generate/changeset.ts Adds inline disable for prompts default import
build-tools/packages/build-cli/src/commands/generate/assertTags.ts Replaces .replace(/x/g, ...) with .replaceAll()
build-tools/packages/build-cli/src/commands/check/policy.ts Changes path import and replaces .replace() with .replaceAll()
build-tools/packages/build-cli/src/commands/bump/deps.ts Adds inline disable for prompts default import
build-tools/packages/build-cli/src/codeCoverage/getCoverageMetrics.ts Fixes JSDoc parameter name
build-tools/packages/build-cli/src/BasePackageCommand.ts Adds inline disable for async.mapLimit

@tylerbutler tylerbutler requested a review from a team January 8, 2026 01:04
@tylerbutler tylerbutler changed the title fix(eslint): address ESLint rule violations in build-tools fix(build-tools): address ESLint rule violations in build-tools Jan 8, 2026
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tylerbutler tylerbutler changed the title fix(build-tools): address ESLint rule violations in build-tools improvement(build-tools): address ESLint rule violations in build-tools Jan 8, 2026
Comment on lines 7 to +9
import * as fs from "node:fs";
import { EOL as newline } from "node:os";
import * as path from "node:path";
import path from "node:path";
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does path need this but fs kept as * as? (For some reason I thought * as was preferred. Why is it one way or the other?

Copy link
Member Author

Choose a reason for hiding this comment

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

Technically I think * as is more "correct" for ESM since you end up with an object that has all the named exports, while import path imports the default export. But node's default export is an object with all the named exports anyway, so it works with either pattern and this is fewer characters. But you're aso right about the fs import - it should follow the same style. I'll fix that in a future change though as the lint config actually gets enabled.

@tylerbutler tylerbutler merged commit dd92fa3 into microsoft:main Jan 12, 2026
23 checks passed
@tylerbutler tylerbutler deleted the eslint-rule-fixes branch January 12, 2026 23:25
anthony-murphy-agent pushed a commit to anthony-murphy-agent/FluidFramework that referenced this pull request Jan 14, 2026
…ls (microsoft#26152)

These changes are in preparation for upgrading to eslint 9 in
build-tools.

## Summary
- Fix low-count ESLint violations across the build-tools workspace
- Address issues from newly enabled ESLint rules without modifying the
config

## Changes
- Replace `.replace(/x/g, ...)` with `.replaceAll()`
(unicorn/prefer-string-replace-all)
- Change `import * as path` to `import path` (unicorn/import-style)
- Remove useless `undefined` arguments (unicorn/no-useless-undefined)
- Fix JSDoc `@param` names to match actual parameters
(jsdoc/check-param-names)
- Add inline disables for idiomatic usage patterns:
- `async.mapLimit`, `semver.parse`, `sortJson.overwrite`
(import-x/no-named-as-default-member)
  - `prompts` default export (import-x/no-named-as-default)
- Remove unused eslint-disable directives for import-x/no-default-export
- Change `@module` to `@packageDocumentation` for TSDoc compatibility
(tsdoc/syntax)
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.

4 participants