Skip to content

[eslint-config] Remove rig ignore stopgap and eliminate config casts - #6045

Open
Ian Clanton-Thuon (iclanton) wants to merge 1 commit into
microsoft:mainfrom
iclanton:feature/eslint-config-followups
Open

Ian Clanton-Thuon (iclanton) wants to merge 1 commit into
microsoft:mainfrom
iclanton:feature/eslint-config-followups

Conversation

@iclanton

Copy link
Copy Markdown
Member

Summary

Follow-ups to #6006 / #6026, now that @rushstack/eslint-config@4.8.0 is published and pulled back into the repo.

Remove the build-output-ignore stopgap from decoupled-local-node-rig

#6006 temporarily duplicated the build-output ignores (lib, lib-*, dist, temp, coverage) into the rig, because the published @rushstack/eslint-config did not yet ignore them and the rig consumes the published version. 4.8.0 now globally ignores those folders, so the rig-level duplication is removed — consumers inherit the ignores from the base profile.

Eliminate avoidable casts in the eslint-config flat profile

  • Replace globalIgnores(...) as Linter.Config with plain { name, ignores } config objects, which are directly assignable to Linter.Config (and remove the now-unused globalIgnores import). These are ordinary flat-config global-ignores objects, so behavior is unchanged.
  • Use as object as ESLint.Plugin (rather than as unknown as) in the friendly-locals mixin, for consistency with the profile.

The one remaining @typescript-eslint plugin cast is unavoidable: a direct as ESLint.Plugin fails with TS2352 because typescript-eslint's RuleModule types are intentionally not assignable to ESLint's RuleDefinition. It stays as the tighter as object as ESLint.Plugin.

Not included: TypeScript conversion of the rig's ESLint configs

We considered converting decoupled-local-node-rig's ESLint configs to TypeScript (as was done for @rushstack/eslint-config) but decided against it:

  • The rig is a build-tooling package accessed ~54 ways by literal/package paths (tsconfig extends, and heft/jest/api-extractor extends via package specifiers). Standing up a TS build would require either an exhaustive/fragile exports map (risking heft/jest/api-extractor resolution) or an in-place build — a lot of surface area/risk to type-check a handful of tiny config files that are already runtime-validated by every lint run.
  • The rig is already a thin overlay that consumes @rushstack/eslint-config and selectively overrides it (its localCommonConfig has 0 rules that merely duplicate the published profile; it is 5 intentional overrides plus 19 repo-specific additions).

How it was tested

  • heft build in @rushstack/eslint-config: passed (TypeScript + self-lint)
  • heft test --clean in build-tests/eslint-9-test: passed; build output (lib-commonjs/lib-esm) is still ignored and eslint.config.js is still linted (confirms the ignores are inherited from the base profile after removing the rig stopgap)
  • rush rebuild for @rushstack/eslint-plugin (a decoupled-rig consumer): self-lints clean
  • rush change --verify

Now that @rushstack/eslint-config 4.8.0 globally ignores the build-output folders,
remove the duplicated build-output `ignores` that were temporarily added to
decoupled-local-node-rig.

Also eliminate avoidable casts in the eslint-config flat profile:
- Replace `globalIgnores(...) as Linter.Config` with plain `{ name, ignores }`
  config objects, which are directly assignable to `Linter.Config` (removing the
  now-unused `globalIgnores` import).
- Use `as object as ESLint.Plugin` (rather than `as unknown as`) in the
  friendly-locals mixin for consistency. The single remaining `@typescript-eslint`
  plugin cast is unavoidable: a direct `as ESLint.Plugin` fails (TS2352) because
  typescript-eslint's rule types are intentionally not assignable to ESLint's.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

1 participant