Rules Hub
Coding Rules Library
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
Distinct named imports must resolve to their intended distinct modules
Watch for copy-paste import bugs where several differently-named imports all point at the same file. Each alias should resolve to the module it claims to load.
Bad example
| 1 | // All three load the SAME module despite different names |
| 2 | import baseConfig from './config/configuration.config'; |
| 3 | import apiConfig from './config/configuration.config'; |
| 4 | import dbConfig from './config/configuration.config'; |
Explanation (EN)
This compiles fine but silently loads the same module three times, so apiConfig and dbConfig are not the configs the author intended — a runtime bug the type system won't catch.
Objašnjenje (HR)
Ovo se uredno kompajlira ali tiho ucitava isti modul tri puta, pa apiConfig i dbConfig nisu konfiguracije koje je autor namjeravao — runtime bug koji tipski sustav nece uhvatiti.
Good example
| 1 | import baseConfig from './config/configuration.config'; |
| 2 | import apiConfig from './config/api.config'; |
| 3 | import dbConfig from './config/db.config'; |
Explanation (EN)
Each import path matches the module it is named after, so every config object is the one the code actually expects.
Objašnjenje (HR)
Svaki import path odgovara modulu po kojem je nazvan, pa je svaki konfiguracijski objekt onaj koji kod stvarno ocekuje.