My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Základní formátování zdrojovéh kódu na front-endu

Jaroslav Vrána (cebreus)'s photo
Jaroslav Vrána (cebreus)
·Jul 5, 2019

Jednotné formátování zdrojového kódu. Co by nemělo v každém front-end projektu chybět.

Konfigurace editoru kódu

Soubor .editorconfig definuje pravidla formátování, která provádí přímo editor kódu.

# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
quote_type = single

[*.js]
max_line_length = 80

[*.json]
indent_style = tab

# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
[{*.yml,*.yaml,package.json}]
indent_style = space
indent_size = 2
insert_final_newline = ignore

[*.md]
insert_final_newline = ignore
trim_trailing_whitespace = false

[Makefile]
indent_style = tab

[{*.min.css,*.min.js}]
indent_style = ignore
insert_final_newline = ignore

Prettier