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).
frontend ruleP2project specificStack: React
reactstylingstructure
Extract inline style objects into a dedicated styles file
Move large inline StyleSheet/style objects (e.g. for PDF rendering) into a ComponentName.styles file to keep the component readable.
PR: vinify-frontend · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetsx
| 1 | const PdfDocument = () => { |
| 2 | const styles = StyleSheet.create({ /* 100 lines */ }); |
| 3 | return <Document />; |
| 4 | }; |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | import { styles } from './PdfDocument.styles'; |
| 2 | const PdfDocument = () => <Document />; |
Explanation (EN)
Objašnjenje (HR)