Add lint rule to discourage Flash usage - #630
Open
llastflowers wants to merge 3 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70736adb-aaef-4999-bbdd-c76914f5f8aa
🦋 Changeset detectedLatest commit: b6fab6d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 70736adb-aaef-4999-bbdd-c76914f5f8aa
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new ESLint rule to the eslint-plugin-primer-react plugin to discourage use of the deprecated Flash component by flagging Flash named imports (including aliased imports) from @primer/react and @primer/react/deprecated, and guiding developers toward Banner and the Flash migration guide.
Changes:
- Added a new rule (
primer-react/no-deprecated-flash) that reportsFlashnamed imports from Primer React entrypoints. - Added RuleTester coverage for valid/invalid import patterns (including aliased imports).
- Documented the rule, linked it from the README, and enabled it as a warning in the recommended config (with a changeset for release notes/versioning).
Show a summary per file
| File | Description |
|---|---|
| src/rules/no-deprecated-flash.js | Implements the new rule by reporting Flash named imports from supported Primer React entrypoints. |
| src/rules/tests/no-deprecated-flash.test.js | Adds tests validating both non-triggering imports and triggering Flash imports (including aliasing/mixed imports). |
| src/index.js | Exports the new rule from the plugin entrypoint. |
| src/configs/recommended.js | Enables the new rule as warn in the recommended preset. |
| README.md | Adds the new rule to the documented rules list. |
| docs/rules/no-deprecated-flash.md | Adds rule documentation with correct/incorrect examples and a migration link. |
| .changeset/curly-horses-fold.md | Declares a minor version bump for the new rule addition. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 7/7 changed files
- Comments generated: 0
- Review effort level: Lite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
primer-react/no-deprecated-flashruleFlashimports from@primer/reactand@primer/react/deprecatedBannerand the Flash migration guidePart of github/primer#5437.
Validation
npm testnpm run lintnpm run lint:mdnpm run format:check