Repository navigation
fix(muya): unbreak lint:css (stylelint 17 compatibility) - #4388
Conversation
`pnpm -C packages/muya lint:css` crashed on a clean checkout with `TypeError: Cannot read properties of undefined (reading 'unprefixed')`. Root cause: `.stylelintrc` extended `stylelint-config-rational-order/plugin`, whose v0.1.2 bundles its own `stylelint-order@2.2.1` built for `stylelint@^9`. That old rule reads a v9-shaped AST node and breaks on the `stylelint@17` AST the repo actually runs, aborting the whole lint run before it reached any file. Fix: drop the unmaintained `plugin/rational-order` plugin and instead drive the same property ordering through the maintained `stylelint-order@8` (already a devDep) via the native `order/properties-order` rule. The rule's group list is the exact rational-order expectation the old plugin generated for this repo's options (`border-in-box-model: false`, `empty-line-between-groups: true`), so the ordering intent is preserved with no change to any CSS behavior. Ordering stays `severity: warning`, matching the prior config. Removed the now-unused `stylelint-config-rational-order` devDep (prunes its old stylelint@9 / postcss@7 subtree from the lockfile). Also fixed one pre-existing genuine error the working tool finally surfaced: `font-family: 'danielbd'` -> `font-family: danielbd` in the vendored sequence-diagram `@font-face` (the standard `font-family-name-quotes` fix; identical rendering). `pnpm -C packages/muya lint:css` now completes with 0 errors. lint, lint:types, check-circular, test, and test:spec all still pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes packages/muya CSS linting on stylelint@17 by removing the incompatible stylelint-config-rational-order plugin (which pulled in an old stylelint-order@2 targeting stylelint@9) and replacing it with an explicit stylelint-order@8 order/properties-order configuration that preserves the intended property grouping/order. It also removes the now-unused dependency and trims the lockfile subtree that was only present to satisfy the old plugin, plus applies one stylelint --fix-equivalent correction in a vendored CSS file.
Changes:
- Replace
stylelint-config-rational-order/pluginusage with a directstylelint-orderorder/properties-ordergroup list compatible withstylelint@17. - Remove
stylelint-config-rational-orderfrompackages/muyadevDependencies and prune its lockfile subtree. - Fix a
font-family-name-quoteserror insequence-diagram.css(rendering-identical in@font-face).
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/muya/.stylelintrc |
Drops the incompatible rational-order plugin and defines explicit order/properties-order groups/options for stylelint-order v8. |
packages/muya/package.json |
Removes stylelint-config-rational-order devDependency (stylelint 9-era). |
pnpm-lock.yaml |
Removes the unused dependency subtree pulled in by stylelint-config-rational-order. |
packages/muya/src/utils/diagram/sequence/sequence-diagram.css |
Applies a stylelint auto-fix for font-family quoting in @font-face. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Website preview ready: https://pr-4388-marktext-website.ransixi.workers.dev Built from |
|
Build artifacts for PR #4388: Run: https://github.com/marktext/marktext/actions/runs/27116231267 |

Problem
On a clean
developcheckout,pnpm -C packages/muya lint:csscrashes:This blocks CSS linting entirely (the run aborts before reaching any file), which matters ahead of the upcoming theme-CSS migration.
Root cause
packages/muya/.stylelintrcextendedstylelint-config-rational-order/plugin.stylelint-config-rational-order@0.1.2bundles its ownstylelint-order@2.2.1, which targetsstylelint@^9. The repo actually runsstylelint@17, whose AST shape differs, so the oldproperties-orderrule reads an undefined node and throws — taking down the whole lint run.Note the repo already declared the maintained
stylelint-order@^8.1.1(stylelint-17-compatible) as a devDep; it just wasn't doing the property-ordering work — the broken bundled plugin was.Fix (chosen approach)
Replace the unmaintained
plugin/rational-orderwith a direct, maintainedstylelint-order@8setup, preserving the exact ordering intent:stylelint-config-rational-order/pluginfrompluginsand deleted theplugin/rational-orderrule.order/properties-orderrule with the exact group list the old plugin generated for this repo's options (border-in-box-model: false,empty-line-between-groups: true) — same property order, same 7 groups, same empty-line-between-groups behavior.severity: "warning"(matching the prior config, where both order rules were warnings) and addedunspecified: "bottomAlphabetical"so unlisted properties don't error.stylelint-config-rational-orderdevDep. This prunes its oldstylelint@9/postcss@7subtree from the lockfile (the largepnpm-lock.yamldeletion is entirely that dead subtree).This is config-only for ordering — no CSS rule behavior changes.
One trivial pre-existing fix
With the tool finally able to run end-to-end, it surfaced one genuine pre-existing error (from
stylelint-config-standard'sfont-family-name-quotes, unrelated to the ordering migration) in the vendoredsequence-diagram.css:This is exactly what
stylelint --fixproduces and is rendering-identical in@font-face.Verification
All run from the repo root against
packages/muya:lint:csslintlint:typescheck-circulartesttest:specThe 2 remaining
lint:csswarnings are pre-existing property-order nits (now visible because the rule actually runs); left as warnings to keep this PR about unbreaking the tool, not restyling CSS.🤖 Generated with Claude Code