| name | upgrading-shared-stylelint-config |
| description | Upgrades a Stylelint configuration to a new Stylelint major release |
| license | MIT |
| metadata | {"audience":"maintainers","internal":true,"disable-model-invocation":true} |
Overview
Comprehensive project and dependencies review to identify needed changes to upgrade this project to a new Stylelint version, and potential opt-in improvements based on any changes in the release.
Methodology
Goals
- Upgrade the project to the target Stylelint release, including any needed dependencies upgrades.
- Baseline QA that the upgrade works correctly - linting passes, test suite passes, all with no deprecation warnings if possible.
- A thorough upgrade report for the user (upgrade methodology, what changed, what further tests to do, links to relevant information), ideally with guidance on opt-in changes to consider.
Guardrails
- Prefer minimal, reviewable changes. Avoid introducing technical debt.
- Make dependency updates explicit and reproducible (lockfile updates included).
- No fixes unrelated to the upgrade (like linting/formatting), unless required for the QA checks to pass.
- If a change is ambiguous, choose the option with the least technical debt. Ask for further input if needed.
- When there are issues that seem like bugs in the dependencies, encourage the user to report back with feedback for maintainers.
Input
To detect from the context or request from the user if unclear:
- Agent mode: whether we want to provide an audit of the needed work for an upgrade, or actually directly do the upgrade. Default: assume "direct update on current code".
- Current versions of Node, Stylelint. Default: read from project configuration (
node --version, npm info . peerDependencies)
- Target version for Stylelint. Default: assume "latest", fetch the CHANGELOG and check which version is latest based on the current date.
Reference data sources
Always fetch latest information from the official Stylelint docs if possible.
Combine it with project-specific information:
- Guidance for contributors in
CONTRIBUTING.md.
- Upgrade considerations / test plans / documentation on customizations.
Reporting
Upgrades are sensitive tasks, it’s critical to provide clear information to the user throughout the upgrade tasks, with clear requests for any extra input. And as a comprehensive report at the end.
- Use text formatting if supported (tables, lists, Markdown links)
- Link directly to release notes and other documentation pages where relevant.
- When sharing docs references in reporting, make sure to link to the HTML pages.
- Report on both the methodology, and the outcome.
- Use artifacts in addition to messages if supported.
Commit and pull request strategy
If the current task mode is to work directly on the project code, commit regularly on a new branch unless otherwise noted by project instructions.
Commit for:
- Version upgrades of dependencies
- Fixes in the code
- Fixes / additions in test suites
- Documentation updates
Push if allowed from current permissions or after user confirmation, when:
- We want to see results from Continuous Integration tools.
- We want human review.
- We think the work is done.
Quality Assurance
Options to check that the upgrade works correctly, to use as needed through upgrade steps:
- Linting passes:
npm run lint
- Test suite passes:
npm run test
- Rules tests passes:
npm run test:rules
- Docs updates work:
npm run build:docs
- Any other automated or manual checks documented for the project (test plans? upgrade considerations?)
Look for any deprecation warnings coming from Stylelint in particular.
Definition of done
- Dependency files + lockfiles updated and consistent (
package.json and package-lock.json)
- Test suite / QA tools / CI all passing
- No new deprecation warnings introduced (or explicitly documented)
- CHANGELOG updated
- Any relevant project doc is updated
- Upgrade report created
Steps
Confirm upgrade path
At this stage, if there are multiple Stylelint versions on the upgrade path, make sure that all subsequent work is done in sequence for every one of those versions. For example, upgrading from Stylelint v14 to v16 should involve running through all the steps in this file with v15 as the target; then asking the user to confirm the successful v15 upgrade; then restarting this all from v15 to v16.
Baseline setup and QA
Dependencies audit and upgrades
This may need to be done in a different order depending on whether dependency compatibility issues are reported when upgrading to the new Stylelint version.
Note any warnings or errors from npm or from the project’s QA tools. Those might indicate further actions needed for the upgrades to be successful. Those might require moving on to the subsequent steps to resolve.
Apply official upgrade guidance
Rules updates
This is crucial for the success of the upgrade, and we have bespoke tools to facilitate this.
Update the CHANGELOG
Add a new entry in the CHANGELOG, following this set template, with examples replaced with the rules updates relevant for this release:
### Features
- Update stylelint to v<version> and up.
- If relevant: Update all config dependencies to their latest releases, compatible with stylelint v<version>.
- If relevant: Change enforced rules from Stylelint and `stylelint-config-standard-scss` (see list below).
### BREAKING CHANGES
The configuration now mandates stylelint v<version>. {Add commentary about the major highlights of the release if relevant}. See Stylelint’s official [Migrating to <version>](https://stylelint.io/migration-guide/to-<version>) documentation.
#### New rules configuration
| Rule | Purpose | Set to | Was set to |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------- |
| [`at-rule-no-deprecated`](https://stylelint.io/user-guide/rules/at-rule-no-deprecated/) | Disallow deprecated at-rules | `true` | New rule |
| [`scss/load-no-partial-leading-underscore`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/load-no-partial-leading-underscore/README.md) | Replaces `scss/at-import-no-partial-leading-underscore` Disallow leading underscore in partial names in `@import`, `@use`, `@forward`, and [`meta.load-css`](https://sass-lang.com/documentation/modules/meta/#load-css) `$url` parameter | `true` | New rule |
| [`scss/dollar-variable-colon-space-after`](https://github.com/stylelint-scss/stylelint-scss/blob/master/src/rules/dollar-variable-colon-space-after/README.md) | Require or disallow whitespace after the colon in `$`-variable declarations. | `always-single-line` | `always` |
#### New unused rules
- [`unit-allowed-list`](https://stylelint.io/user-guide/rules/unit-allowed-list/)
- [`unit-disallowed-list`](https://stylelint.io/user-guide/rules/unit-disallowed-list/)
For the key rules sections,
Update documentation
Produce the upgrade report