Add initial implementation extracted from frontend-clients - #1
Open
diogoquintas wants to merge 1 commit into
Open
Add initial implementation extracted from frontend-clients#1diogoquintas wants to merge 1 commit into
diogoquintas wants to merge 1 commit into
Conversation
diogoquintas
force-pushed
the
feature/extract-from-frontend-clients
branch
from
September 3, 2026 17:46
d4327e9 to
9219c7e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness/operability issues in the release-it changelog command (can hang) and in the missingNewline autofix insertion point (can break indentation), plus README omissions around the export rule.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a standalone eslint-plugin-sort-declarations package extracted from the frontend-clients monorepo, including three sorting rules, shared utilities, tests, and CI/release automation to support independent versioning and publishing.
Changes:
- Added rule implementations for sorting module declarations, variable declarations, and export declarations (plus shared
lib/utils.js). - Added comprehensive RuleTester coverage for all three rules, including TypeScript parser regressions.
- Added repo scaffolding for publishing and maintenance (README, workflows, release-it config, eslint flat config, package metadata).
File summaries
| File | Description |
|---|---|
| tests/sort-variable-declarations.js | Adds extensive test suite for variable-declaration sorting (JS + TS cases). |
| tests/sort-module-declarations.js | Adds tests for module-level declaration grouping/sorting (CJS + ESM + TS). |
| tests/sort-export-declarations.js | Adds tests for ESM export sorting and blank-line rules. |
| README.md | Adds installation/configuration and rule documentation. |
| package.json | Defines package metadata, scripts, deps/peers, and export entrypoints. |
| LICENSE | Adds MIT license text. |
| lib/utils.js | Adds shared AST utilities (identifier collection, topo sort, comment helpers). |
| lib/rules/sort-variable-declarations.js | Implements variable declaration ordering, blank-line rules, and safe autofix. |
| lib/rules/sort-module-declarations.js | Implements module declaration ordering with dependency-aware topo sorting (incl. GraphQL mode). |
| lib/rules/sort-export-declarations.js | Implements export statement grouping/sorting and blank-line normalization. |
| lib/index.js | Exposes plugin meta and rule map. |
| eslint.config.js | Adds flat config for dogfooding lint + prettier integration. |
| CHANGELOG.md | Adds initial changelog placeholder. |
| .release-it.json | Adds release-it automation and changelog generation hook. |
| .gitignore | Adds basic Node/ESLint ignores. |
| .github/workflows/release.yaml | Adds manual release workflow (npm publish + GitHub release). |
| .github/workflows/ci.yml | Adds CI workflow for lint + tests on Node 20/22/24. |
| .editorconfig | Adds editor defaults (2-space, LF, final newline, trim). |
Review details
- Files reviewed: 17/19 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Extract the `@frontend-clients/eslint-plugin-sort-declarations` workspace package into this standalone repository, mirroring the structure of `uphold/eslint-plugin-sort-imports-requires`. The rule implementations are functionally unchanged. Prettier formatting and the plugin's own sort rules had never run in the monorepo because the package's `lint` script had no file pattern, so both are applied here. The resulting reordering is a pure move of existing lines. `peerDependencies` keeps `eslint >= 8` and the dev dependency stays on eslint 8.57.0 so `RuleTester` behaviour matches the consuming monorepo. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
diogoquintas
force-pushed
the
feature/extract-from-frontend-clients
branch
from
September 4, 2026 08:59
9219c7e to
af3355e
Compare
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.
Summary
Extracts
@frontend-clients/eslint-plugin-sort-declarationsfrom the frontend-clients monorepo into this standalone repository, so the plugin can be versioned and published independently. The structure mirrorsuphold/eslint-plugin-sort-imports-requires.The package takes the unscoped name
eslint-plugin-sort-declarations, which changes the rule prefix from@frontend-clients/sort-declarations/*tosort-declarations/*.What's here
sort-module-declarations,sort-variable-declarationsandsort-export-declarations— plus the sharedlib/utils.js, functionally unchanged.meta.namespace: 'sort-declarations'..github/workflows/ci.yml(node 20/22/24) andrelease.yaml, plus.release-it.jsonand.gitignore, taken from the reference repo.versionstarts at0.0.0so the release workflow produces the first published version.eslint.config.js.Deviations from the reference repo
peerDependencieseslint >=8eslint >=9eslint8.57.0^10.0.0RuleTesterbehaviour identical to the consumer@typescript-eslint/parserlib/utils.jshandlesTSTypeQuery, so the tests need itlib/index.d.tsThe flat config runs under eslint 8.57 via
ESLINT_USE_FLAT_CONFIG=true.Verification
npm ci→npm test(3/3 files pass) →npm run lint(clean), which is what CI runs.lintscript was a bareeslintwith no file pattern. Both are applied here, and the resulting reordering was confirmed to be a pure move of existing lines — every non-blank line is preserved exactly, with only position and blank lines changing.Follow-ups
lib/index.d.ts.@frontend-clients/eslint-plugin-sort-hook-depsthe same way.