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).
Do not use require-style imports in TypeScript
Avoid import x = require('...'); use ES module syntax instead.
Bad example
| 1 | import x = require('mydep'); |
Explanation (EN)
require-style imports are less compatible with modern module tooling and can complicate interoperability.
Objašnjenje (HR)
require-style importi su lošije kompatibilni s modernim module toolingom i kompliciraju interoperabilnost.
Good example
| 1 | import {something} from 'mydep'; |
Explanation (EN)
ES module imports are the standard and behave consistently across TS, bundlers, and Node ESM.
Objašnjenje (HR)
ES module import je standard i radi konzistentno kroz TS, bundlere i Node ESM.
Exceptions / Tradeoffs (EN)
Only in legacy interop edge cases that you cannot avoid (prefer wrapping such code).
Iznimke / Tradeoffi (HR)
Samo u legacy interop edge slučajevima koje ne možeš izbjeći (radije wrapaj takav kod).