Skip to content

feat(gamut-codemods): rename the ESLint plugin prefix in scope-swap - #42

Merged
dreamwasp merged 15 commits into
mainfrom
cass-gmt-1790-eslint
Oct 28, 2026
Merged

dreamwasp merged 15 commits into
mainfrom
cass-gmt-1790-eslint

Conversation

@dreamwasp

@dreamwasp dreamwasp commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Breaking change: the ESLint plugin is now @skillsoft/eslint-plugin-gamut, so the gamut/ rule prefix becomes @skillsoft/gamut/. The rule names don't change.

Stack (split from #28, merge in order):

  1. feat(gamut-codemods): add the codemods CLI and an empty scope-swap preset #38 Scaffold, based on main
  2. feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39 Package scope rename and gamut-kit removal, based on feat(gamut-codemods): add the codemods CLI and an empty scope-swap preset #38
  3. feat(gamut-codemods): move Video imports and add Markdown video overrides #40 Video and Markdown, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  4. feat(gamut)!: promote deep imports to the root, renaming Menu and SelectDropdown elements #41 Deep imports and Menu/SelectDropdown renames, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  5. feat(gamut-codemods): rename the ESLint plugin prefix in scope-swap #42 ESLint plugin prefix, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39 👈 this PR
  6. feat(gamut-codemods): warn about esmExternals: false in next.config #43 Next.js esmExternals warning, based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39
  7. build(deps): make @skillsoft packages easier to install #44 Simpler dependencies (independent), based on main
  8. feat(gamut-agent-tools): add the gamut-scope-swap skill #45 gamut-scope-swap skill (open last), based on feat(gamut-codemods): rename packages and replace gamut-kit in scope-swap #39, includes feat(gamut-codemods): move Video imports and add Markdown video overrides #40–feat(gamut-codemods): warn about esmExternals: false in next.config #43
  • eslint-comments rewrites // eslint-disable-next-line gamut/x (and the other directive forms) to @skillsoft/gamut/x.
  • eslint-config updates legacy .eslintrc / .eslintrc.json: the plugin name, plugin: extends, and rule keys. It does a targeted text rewrite, because these files are often JSONC.
  • Flat configs: the prefix is whatever key the plugin is registered under (plugins: { gamut }). So eslint-comments skips itself when it finds an eslint.config.*, and the checklist explains why. Flat configs and .eslintrc.js are left for the leftovers report.
  • @skillsoft/eslint-plugin-gamut: configs.recommended uses literal 'error' severities (as const), so the plugin type-checks as an ESLint Plugin in a typed flat config.

PR Checklist

  • Related to designs: N/A
  • Related to JIRA ticket: GMT-1790
  • Changeset added
  • I have run this code to verify it works
  • This PR includes unit tests for the code change
  • This PR includes testing instructions for the code change
  • Package previews from this PR are passing end-to-end tests in all relevant consuming repositories

Testing Instructions

  1. yarn nx test gamut-codemods (expect 71 tests) and yarn nx test eslint-plugin-gamut.

  2. Legacy config run:

    yarn nx build gamut-codemods
    mkdir -p /tmp/swap && cd /tmp/swap && git init -q
    printf "import { Box } from '@codecademy/gamut';\n// eslint-disable-next-line gamut/no-inline-style\nexport const A = () => <Box style={{}} />;\n" > a.tsx
    echo '{ "plugins": ["gamut"], "extends": ["plugin:gamut/recommended"], "rules": { "gamut/no-inline-style": "error" } }' > .eslintrc.json
    git add -A && git commit -qm init
    node <repo>/packages/gamut-codemods/dist/bin.js scope-swap .

    The directive and .eslintrc.json should both use @skillsoft/gamut.

  3. Flat config run: in a new throwaway repo with an eslint.config.js, the output starts with [eslint-comments] skipped: found flat ESLint config. Directives are left alone, and the next steps explain the plugins key.

PR Links and Envs

Repository PR Link
Mono N/A

🤖 Generated with Claude Code

dreamwasp and others added 3 commits October 20, 2026 10:07
…eset

Adds @skillsoft/gamut-codemods: the CLI (clean-tree guard, --dry, --only,
--no-report, --force), the runner for ast, splice, and file migrations,
the shared helpers (module-string finder, leftovers report, version-range
checks, flat ESLint config detection), the preset registry, and the
fixture harness.

The scope-swap preset has its package map but no migrations yet, so a run
only reports the lines that still name an old package. Each breaking
change lands its migration in its own PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…swap

scope-rename swaps @Codecademy/gamut* and eslint-plugin-gamut for their
@SkillSoft names in every module position and in comments. package-json,
mdx-imports, and yarnrc cover dependencies, MDX ESM blocks, and
.yarnrc.yml lists.

@codecademy/gamut-kit has no replacement, so package-json and mf-shared
expand it into the packages it bundled. In Module Federation config that
makes Gamut a real singleton, which the checklist calls out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eslint-comments rewrites gamut/ directives to @skillsoft/gamut/, and
eslint-config updates the plugin name, plugin: extends, and rule keys in
legacy .eslintrc files. Under a flat config the prefix is the plugins key,
so eslint-comments skips itself and the checklist explains why.

Also types eslint-plugin-gamut's recommended severities as literals, so the
plugin fits ESLint's Plugin type in a typed flat config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dreamwasp and others added 7 commits October 20, 2026 11:10
CodeQL read `migration.match(file)` in cli.ts as String.prototype.match
on a command-line argument and flagged js/regex-injection. Nothing builds
a regex from the path; the method just had the same name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…migrations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…migrations

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The package-json warning already names each range that's newer than the
fork point, so the extra next step only repeated it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	packages/gamut-codemods/src/presets/scope-swap/index.ts
@dreamwasp
dreamwasp marked this pull request as ready for review October 20, 2026 15:59
@dreamwasp
dreamwasp requested a review from a team as a code owner October 20, 2026 15:59

@LinKCoding LinKCoding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

checks look good!

with the flat directive, the next steps include:

1. ESLint directive comments were left as is because the repo uses a flat config, where the rule prefix is the key the plugin is registered under (for example `plugins: { gamut }`). Keep that key, or rename it and every 'gamut/' rule and directive together.
(and the other 3 usual steps)

repro for posterity:

mkdir -p /tmp/swap-flat && cd /tmp/swap-flat && git init -q \                                                                          
&& printf "import { Box } from '@codecademy/gamut';\n// eslint-disable-next-line gamut/no-inline-style\nexport const A = () => <Box style={{}} />;\n" > a.tsx \
&& printf "module.exports = [];\n" > eslint.config.js \
&& git add -A && git commit -qm init \
&& node  /Users/kenny.lin/Documents/eng/codecademy-eng/skillsoft-gamut/packages/gamut-codemods/dist/bin.js scope-swap .

Base automatically changed from cass-gmt-1790-scope-rename to main October 28, 2026 12:47
@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@skillsoft/eslint-plugin-gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/eslint-plugin-gamut@42.tgz

@skillsoft/gamut

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut@42.tgz

@skillsoft/gamut-agent-tools

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-agent-tools@42.tgz

@skillsoft/gamut-codemods

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-codemods@42.tgz

@skillsoft/gamut-icons

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-icons@42.tgz

@skillsoft/gamut-illustrations

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-illustrations@42.tgz

@skillsoft/gamut-patterns

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-patterns@42.tgz

@skillsoft/gamut-styles

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-styles@42.tgz

@skillsoft/gamut-tests

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/gamut-tests@42.tgz

@skillsoft/variance

npm i https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@42
yarn add https://pkg.pr.new/Codecademy/skillsoft-gamut/@skillsoft/variance@42.tgz

commit: fafc5a6

@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@1a63454). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #42   +/-   ##
=======================================
  Coverage        ?   99.15%           
=======================================
  Files           ?       23           
  Lines           ?      943           
  Branches        ?      289           
=======================================
  Hits            ?      935           
  Misses          ?        8           
  Partials        ?        0           
Flag Coverage Δ
pull-request 99.15% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dreamwasp
dreamwasp merged commit 128f5f2 into main Oct 28, 2026
14 checks passed
@dreamwasp
dreamwasp deleted the cass-gmt-1790-eslint branch October 28, 2026 14:57
dreamwasp added a commit that referenced this pull request Oct 28, 2026
Take main's #38-#42 scope-swap work, keep the next-config warning on
top: the nextConfig migration, its checklist item, the README row and
known-limits note, and its CLI test.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
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.

2 participants