Define and implement import
ordering rules for ESLint/Prettier
As a developer,
I would like consistent import ordering rules enforced through ESLint and Prettier
to maintain a standard code structure and reduce manual formatting efforts.
Background
Currently, npm run prettier-fix
and npm run lint-fix
commands do not apply automatic fixes to the import order and general formatting. The team needs a defined standard for import ordering (e.g., grouping by built-in, third-party, and relative imports) and an ESLint configuration that enforces these rules ideally without adding new npm packages. Additionally, this configuration should integrate with pre-commit hooks to ensure compliance before code is committed.
Acceptance Criteria
-
Define a clear rule for import ordering, at developer discretion - preferring out-of-the-box rules from existing tools if available -
Configure ESLint and Prettier integration to enforce import ordering according to the defined rules. -
Verify that ESLint configuration works with existing packages without introducing new npm dependencies. -
Ensure npm run prettier-fix
andnpm run lint-fix
commands apply import ordering fixes as per the defined rules. -
Implement a pre-commit hook to check for and enforce import ordering compliance.
Edited by Mike Knee