feat(linters): add eslint-plugin-spectrum-wc to the monorepo#6361
Draft
Rajdeepc wants to merge 4 commits into
Draft
feat(linters): add eslint-plugin-spectrum-wc to the monorepo#6361Rajdeepc wants to merge 4 commits into
Rajdeepc wants to merge 4 commits into
Conversation
- integrate the consumer-facing ESLint plugin that catches accessibility gaps, deprecated APIs, invalid attribute values, and slot misuse at lint time for both Lit html`` templates and JSX/TSX - the plugin is data-driven: six rules are generated from a central component descriptor map so adding a new component requires zero rule code - placed in linters/eslint-plugin-spectrum-wc following the existing linters/* workspace convention alongside the internal eslint-plugin - published as the unscoped eslint-plugin-spectrum-wc package with independent versioning (outside the @spectrum-web-components fixed group) - 187 tests across 13 files cover Lit and JSX adapters plus all rules Rules included: swc/accessible-component swc/no-deprecated swc/required-attributes swc/valid-attribute-values swc/valid-slot-names swc/valid-slot-children Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 7972e5d 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 |
Contributor
📚 Branch Preview Links🔍 First Generation Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
…elease Co-authored-by: Cursor <cursoragent@cursor.com>
…/tools - relocate from linters/ to 2nd-gen/packages/tools/ to co-locate with other 2nd-gen tooling packages (postcss-token, swc-tokens, etc.) - update repository.directory and rule doc URLs to reflect the new path - build and all 187 tests pass in the new location Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Description
Integrates the consumer-facing
eslint-plugin-spectrum-wcESLint plugin into the monorepo so it can be versioned, tested, and released alongside the component library. The plugin catches accessibility gaps, deprecated APIs, invalid attribute values, and slot misuse at lint time for both Lit `html`` tagged templates and JSX/TSX — shifting left what `window.__swc.warn()` and axe catch at runtime.Previously maintained as a standalone repo at Rajdeepc/eslint-plugin-spectrum-wc, this PR brings the plugin home so that component descriptor updates and rule improvements ship in lockstep with the components themselves.
Motivation and context
SWC consumers currently discover accessibility gaps, deprecated APIs (e.g. `variant="cta"` on ``), and invalid slot usage only at runtime through browser warnings or axe audits. An ESLint plugin shifts these checks to the editor and CI, providing immediate feedback during development. Hosting it in the monorepo ensures:
Architecture
The plugin is data-driven. Six rules are generated from a central component descriptor map (`src/descriptors/components.ts`), so adding a new component requires zero rule code:
```
linters/eslint-plugin-spectrum-wc/
├── src/
│ ├── adapters/ # Lit html`` + JSX/TSX template parsers
│ ├── core/ # Types + rule factory (generates rules from descriptors)
│ ├── descriptors/ # Component a11y, deprecation, slot, and attribute metadata
│ ├── rules/ # 6 thin wrappers: factory(descriptors)
│ └── index.ts # Plugin entry with recommended + strict configs
└── tests/ # 13 test files, 187 tests (Lit + JSX coverage)
```
Rules included
Integration decisions
Related issue(s)
Author's checklist
Reviewer's checklist
Manual review test cases
Verify build passes
Verify all 187 tests pass
Verify workspace registration
Verify the plugin loads in an ESLint flat config
Device review
Accessibility testing checklist
Keyboard — N/A: this is a developer tooling package (ESLint plugin), not a UI component. It has no interactive elements or focus management. The plugin enforces keyboard accessibility in consumer code via the `swc/accessible-component` rule.
Screen reader — N/A: same rationale as above. The plugin enforces screen reader accessibility by requiring `label`, `aria-label`, or `aria-labelledby` attributes on SWC elements.