refactor: move sort-lit-get-properties from Prettier to ESLint#1699
Open
refactor: move sort-lit-get-properties from Prettier to ESLint#1699
Conversation
6ebc6a4 to
201c7c7
Compare
Contributor
|
🔎 A preview has been automatically published : https://clever-components-preview.cellar-c2.services.clever-cloud.com/eslint/move-prettier-plugin-to-eslint/index.html. This preview will be deleted once this PR is closed. |
201c7c7 to
05ba9af
Compare
Migrate the sort-lit-get-properties logic from Prettier plugin to ESLint custom rule, as property ordering is a structural concern, not formatting.
The property sorting logic has been migrated to an ESLint rule. Remove the Prettier plugin, its test, and simplify the config.
05ba9af to
7faa1d4
Compare
florian-sanders-cc
requested changes
Mar 19, 2026
Contributor
There was a problem hiding this comment.
All good, mostly nitpicks and I think the last commit should be a refactor, it shouldn't be part of the changelog since there's no impact on the consumers of this project 👍 (EDIT: same for the first commit as well)
I really like the change, you've convinced me it's fine / better to do this with ESLint and I like that you also added tests 🙌
Comment on lines
+1
to
+2
| /** @import { Rule } from 'eslint' */ | ||
| /** @import { Identifier } from 'estree' */ |
Contributor
There was a problem hiding this comment.
nitpick: merge these comments
| } | ||
| } | ||
|
|
||
| const sorted = [...properties].sort((pA, pB) => { |
Contributor
There was a problem hiding this comment.
nitpick: use toSorted instead
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.
Context
The
sort-lit-get-propertiesrule sorts properties insidestatic get properties()in Lit components.This is a structural/organizational concern (ordering class members), not a formatting concern — it doesn't belong in Prettier.
Having it as a Prettier plugin also required a parser merge hack to avoid conflicts between plugins sharing the same Babel parser. Moving it to ESLint removes that complexity entirely.
What does this PR do?
lit-cc/sort-get-properties) that does the same sorting: spreads first, then alphabetical, then_-prefixed last,lit-ccESLint plugin to host lit-specific custom rules,prettier.config.js(plugins as strings, no more import/wrapper).How to review?
npm run test:mocha -- --grep "eslint lit"— 5 tests pass,