Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP2universalStack: typescript
namingmodulesconsistency
Keep an exported symbol's name consistent with its module name
When a module is named after one concept (e.g. `checkUserId`) but exports a differently-named member (e.g. `getUserId`), rename one so the file and its export agree.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codets
| 1 | // file: middleware/checkUserId.ts |
| 2 | export const getUserId = async (req, res, next) => { /* ... */ }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // file: middleware/getUserId.ts |
| 2 | export const getUserId = async (req, res, next) => { /* ... */ }; |
Explanation (EN)
Objašnjenje (HR)