Undoubtedly, adhering to the same coding style helps developers work together. We suggest you take a few minutes to learn about the coding style used if you’d like to help us improve the code by submitting pull requests.
We use eslint to check the TypeScript and JavaScript formatting.
1npm run eslint
Stylelint is used to check the SCSS styles.
1npm run stylelint
Since Hugo parameters are case-insensitive, snake_case
is preferred.
Parameter | |
---|---|
FooBar | ❌ |
fooBar | ❌ |
foobar | ❌ |
foo-bar | ❌ |
foo_bar | ✅ |
Filenames are case-sensitive on some file systems, so we recommend always using kebab-case
.
Filename | |
---|---|
fooBar.html | ❌ |
foo-bar.html | ✅ |
PascalCase
for exported variables, as Go does.camelCase
for local variables.We recommend using Bootstrap CSS utilities as much as possible to reduce the size of CSS bundle.