Skip to content

Feature branch pull-request from feature/eslint-plugin-wb to main#3005

Merged
beaesguerra merged 7 commits intomainfrom
feature/eslint-plugin-wb
Apr 15, 2026
Merged

Feature branch pull-request from feature/eslint-plugin-wb to main#3005
beaesguerra merged 7 commits intomainfrom
feature/eslint-plugin-wb

Conversation

@beaesguerra
Copy link
Copy Markdown
Member

@beaesguerra beaesguerra commented Apr 10, 2026

Summary:

This PR includes the following commits:

Issue: WB-2207

Test plan:

beaesguerra and others added 4 commits April 1, 2026 15:35
## Summary:

Setting up the `@khanacademy/eslint-plugin-wonder-blocks` package. Used the set up from WB packages and the `@khanacademy/eslint-plugin` package from [wonder-stuff](https://github.com/Khan/wonder-stuff/tree/main/packages/eslint-plugin-khan) as a reference.

Prior to creating this package, I used the [wonder-stuff-tool-new-pkg](https://github.com/Khan/wonder-stuff/tree/main/packages/wonder-stuff-tool-new-pkg) to publish the initial version of the package: https://www.npmjs.com/package/@khanacademy/eslint-plugin-wonder-blocks

In this PR, the package is set up with the basics to verify that we can release the package to npm. 

Issue: WB-2207

## Test plan:

- Review the changes in the PR. 
- Confirm a npm snapshot package is created for the PR 

## Implementation plan:
1. (done) Publish a new package to npm
2. (this PR) Set up the package in the wonder-blocks repo 
3. Set up dependencies and infra for creating lint rules 
4. Set up a custom lint rule (WB-2272)

Author: beaesguerra

Reviewers: claude[bot], jandrade

Required Reviewers:

Approved By: jandrade

Checks: ⏭️  3 checks have been skipped, ✅ 14 checks were successful, ⚪️ 1 check is neutral

Pull Request URL: #2994
…-tab-role`) (#3000)

## Summary:

Set up the `eslint-plugin-wonder-blocks` package to support the creation of custom rules:
- Set up the first custom lint rule to verify the project set up: `no-custom-tab-role`
  - This rule will detect if `role="tab"` is used so that the WB ResponsiveTabs component can be suggested instead. The goal of this rule is to prevent custom implementations of this pattern since ResponsiveTabs handles many things out of the box like responsiveness, keyboard navigation, accessibility attributes and semantics, etc.
- Unit tests
  - The tests in the eslint-plugin package run in a `jest-environment-node` environment instead of `jest-environment-jsdom`
  - RuleTester from `@typescript-eslint/rule-tester` is set up to work with jest
  - Unit test was set up for the `no-custom-tab-role` rule
- Demo project was created so we can test out consuming the eslint-plugin package
  - We can import WB packages into the demo project so we can confirm that the lint rules work on WB components too 

Notes:
- Most of these changes were based on how `@khanacademy/eslint-plugin` is set up in [wonder-stuff](https://github.com/Khan/wonder-stuff). Some changes were different to accommodate the wb repo set up (see PR annotations for more details)
- We'll be moving to oxlint at some point. For now, we can set up eslint custom rules since it'll be compatible with oxlint. Then, we can decide later if we want to port our custom rules over!

Issue: WB-2207, WB-2272

## Test plan:

1. Tests and checks pass
2. Confirm that lint errors are caught in the `demo/` package
```
cd packages/eslint-plugin-wonder-blocks/demo/
pnpm lint
```
(Note: To see the lint errors in your IDE, temporarily remove the demo directory from `.eslintignore`. The demo directory needed to be added so that the expected lint errors don't fail when `khan-linter` runs)

<img width="1007" height="257" alt="Screenshot 2026-04-08 at 10 03 03 AM" src="https://github.com/user-attachments/assets/51473fd8-be34-4ae4-b58e-5c612067b593" />

3. Test the npm snapshot release in `frontend` to verify it detects custom tab implementations when the `no-custom-tab-role` rule is enabled (see Khan/frontend#10086)

Author: beaesguerra

Reviewers: beaesguerra, claude[bot], jandrade

Required Reviewers:

Approved By: jandrade

Checks: ✅ 13 checks were successful, ⏭️  3 checks have been skipped

Pull Request URL: #3000
## Summary:

- Add docs for the eslint-plugin-wonder-blocks package
- Include the docs for the custom WB lint rule `no-custom-tag-role` in Storybook
  - We create a separate mdx for each lint rule so that the rule name shows up in the side navigation and can be found via the search bar 
- Specify order of root categories

Issue: WB-2304

## Test plan:

1. Review the docs for the eslint-plugin-wonder-blocks package

<img width="1718" height="884" alt="image" src="https://github.com/user-attachments/assets/0013b463-35f9-41ce-9fd7-bbf4316755ac" />

<img width="1723" height="930" alt="image" src="https://github.com/user-attachments/assets/79471d44-b269-49d3-ae13-6245a1f4e5b7" />

Author: beaesguerra

Reviewers: beaesguerra, claude[bot], jandrade

Required Reviewers:

Approved By: jandrade

Checks: ✅ 13 checks were successful, ⏭️  3 checks have been skipped

Pull Request URL: #3003
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: abe52a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@khanacademy/eslint-plugin-wonder-blocks Minor
eslint-plugin-wonder-blocks-demo Minor

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

npm Snapshot: Published

🎉 Good news!! We've packaged up the latest commit from this PR (1f16457) and published all packages with changesets to npm.

You can install the packages in frontend by running:

./dev/tools/deploy_wonder_blocks.js --tag="PR3005"

Packages can also be installed manually by running:

pnpm add @khanacademy/wonder-blocks-<package-name>@PR3005

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Size Change: 0 B

Total Size: 122 kB

ℹ️ View Unchanged
Filename Size
packages/eslint-plugin-wonder-blocks/dist/es/index.js 622 B
packages/wonder-blocks-accordion/dist/es/index.js 3 kB
packages/wonder-blocks-announcer/dist/es/index.js 2.43 kB
packages/wonder-blocks-badge/dist/es/index.js 2.02 kB
packages/wonder-blocks-banner/dist/es/index.js 2.01 kB
packages/wonder-blocks-birthday-picker/dist/es/index.js 1.91 kB
packages/wonder-blocks-breadcrumbs/dist/es/index.js 755 B
packages/wonder-blocks-button/dist/es/index.js 4.28 kB
packages/wonder-blocks-card/dist/es/index.js 1.08 kB
packages/wonder-blocks-cell/dist/es/index.js 2.18 kB
packages/wonder-blocks-clickable/dist/es/index.js 2.6 kB
packages/wonder-blocks-core/dist/es/index.js 2.59 kB
packages/wonder-blocks-data/dist/es/index.js 5.48 kB
packages/wonder-blocks-date-picker/dist/es/index.js 8.06 kB
packages/wonder-blocks-dropdown/dist/es/index.js 19.7 kB
packages/wonder-blocks-form/dist/es/index.js 6.3 kB
packages/wonder-blocks-grid/dist/es/index.js 1.24 kB
packages/wonder-blocks-icon-button/dist/es/index.js 4.01 kB
packages/wonder-blocks-icon/dist/es/index.js 1.91 kB
packages/wonder-blocks-labeled-field/dist/es/index.js 3.47 kB
packages/wonder-blocks-layout/dist/es/index.js 1.63 kB
packages/wonder-blocks-link/dist/es/index.js 1.53 kB
packages/wonder-blocks-modal/dist/es/index.js 7.36 kB
packages/wonder-blocks-pill/dist/es/index.js 1.31 kB
packages/wonder-blocks-popover/dist/es/index.js 4.36 kB
packages/wonder-blocks-progress-spinner/dist/es/index.js 1.48 kB
packages/wonder-blocks-search-field/dist/es/index.js 1.1 kB
packages/wonder-blocks-styles/dist/es/index.js 464 B
packages/wonder-blocks-switch/dist/es/index.js 1.55 kB
packages/wonder-blocks-tabs/dist/es/index.js 5.57 kB
packages/wonder-blocks-testing-core/dist/es/index.js 3.25 kB
packages/wonder-blocks-testing/dist/es/index.js 978 B
packages/wonder-blocks-theming/dist/es/index.js 384 B
packages/wonder-blocks-timing/dist/es/index.js 1.37 kB
packages/wonder-blocks-tokens/dist/es/index.js 5.18 kB
packages/wonder-blocks-toolbar/dist/es/index.js 906 B
packages/wonder-blocks-tooltip/dist/es/index.js 6.02 kB
packages/wonder-blocks-typography/dist/es/index.js 1.57 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

A new build was pushed to Chromatic! 🚀

https://5e1bf4b385e3fb0020b7073c-zhbyxeecuh.chromatic.com/

Chromatic results:

Metric Total
Captured snapshots 462
Tests with visual changes 0
Total stories 835
Inherited (not captured) snapshots [TurboSnap] 0
Tests on the build 462

@beaesguerra beaesguerra marked this pull request as ready for review April 10, 2026 19:01
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@khan-actions-bot khan-actions-bot requested a review from a team April 10, 2026 19:01
@khan-actions-bot
Copy link
Copy Markdown
Contributor

khan-actions-bot commented Apr 10, 2026

Gerald

Required Reviewers
  • @Khan/wonder-blocks for changes to .eslintignore, .npmpackagejsonlintrc.json, package.json, pnpm-lock.yaml, pnpm-workspace.yaml, tsconfig-build.json, .changeset/ninety-singers-invent.md, .changeset/shaggy-dogs-fry.md, .changeset/tender-dogs-sneeze.md, .storybook/preview.tsx, build-settings/check-type-definitions.ts, config/jest/rule-tester-setup.js, config/jest/test.config.js, packages/eslint-plugin-wonder-blocks/.npmignore, packages/eslint-plugin-wonder-blocks/CHANGELOG.md, packages/eslint-plugin-wonder-blocks/CONTRIBUTING.md, packages/eslint-plugin-wonder-blocks/README.md, packages/eslint-plugin-wonder-blocks/package.json, packages/eslint-plugin-wonder-blocks/tsconfig-build.json, static/sb-styles/preview.css, __docs__/tools/eslint-plugin-wonder-blocks/eslint-plugin-wonder-blocks.mdx, __docs__/tools/eslint-plugin-wonder-blocks/no-custom-tab-role.mdx, packages/eslint-plugin-wonder-blocks/demo/.eslintrc.js, packages/eslint-plugin-wonder-blocks/demo/README.md, packages/eslint-plugin-wonder-blocks/demo/package.json, packages/eslint-plugin-wonder-blocks/demo/tsconfig.json, packages/eslint-plugin-wonder-blocks/docs/no-custom-tab-role.md, packages/eslint-plugin-wonder-blocks/src/index.ts, packages/eslint-plugin-wonder-blocks/src/types.ts, packages/eslint-plugin-wonder-blocks/demo/src/no-custom-tab-role-example.tsx, packages/eslint-plugin-wonder-blocks/src/configs/index.ts, packages/eslint-plugin-wonder-blocks/src/configs/recommended.ts, packages/eslint-plugin-wonder-blocks/src/configs/strict.ts, packages/eslint-plugin-wonder-blocks/src/rules/index.ts, packages/eslint-plugin-wonder-blocks/src/rules/no-custom-tab-role.ts, packages/eslint-plugin-wonder-blocks/src/rules/__tests__/no-custom-tab-role.test.ts

Don't want to be involved in this pull request? Comment #removeme and we won't notify you of further changes.

Copy link
Copy Markdown
Member

@jandrade jandrade left a comment

Choose a reason for hiding this comment

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

🚀

beaesguerra and others added 3 commits April 13, 2026 16:58
## Summary:

Set up `strict` and `recommended` eslint configs. The `recommended` config will enable the base lint rules for WB usage, and the `strict` config includes the recommended rules + more specific rules intended for modern projects without legacy wb patterns.

We set up the `strict` config with the first wb lint rule `no-custom-tab-role`. As we add more lint rules, we can decide if it should only be enabled in recommended or strict cases. 


As part of this PR, I also updated the `eslint-plugin-wonder-blocks` README with information about the configs. This README is re-used for the SB docs. 

The demo project is also updated to use the `strict` config from the plugin. 

Issue: WB-2307

## Test plan:

1. Confirm that linting still works in the `demo` project
```sh
pnpm build
cd packages/eslint-plugin-wonder-blocks/demo
pnpm lint
```
You should see errors for the `no-custom-tab-role`. (To see this lint rules in the IDE, you can temporarily remove the `demo` dir from `.eslintignore` and restart the eslint server)

<img width="934" height="194" alt="Screenshot 2026-04-13 at 3 11 13 PM" src="https://github.com/user-attachments/assets/a45688a9-c851-44ba-95d4-85c00ee6b787" />

2. Confirm that the shared configs can be used in `frontend`. Here is the draft PR where I tested using the `strict` config for modern apps and the `recommended` config for the legacy app Khan/frontend#10285

3. Review the docs in SB around installation steps and the configs `?path=/docs/tools-eslint-plugin-wonder-blocks--docs`

Author: beaesguerra

Reviewers: beaesguerra, claude[bot], marcysutton

Required Reviewers:

Approved By: marcysutton

Checks: ✅ 12 checks were successful, ⏭️  3 checks have been skipped

Pull Request URL: #3009
@beaesguerra beaesguerra merged commit a6f35eb into main Apr 15, 2026
30 checks passed
@beaesguerra beaesguerra deleted the feature/eslint-plugin-wb branch April 15, 2026 20:48
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (ec0c216) to head (abe52a8).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@     Coverage Diff      @@
##   main   #3005   +/-   ##
============================
============================

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ec0c216...abe52a8. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants