Undoubtedly, the same coding style helps developers to cooperate with each other. We suggest taking a few minutes to learn about the coding style used, if you’re going to help us improve the code.
We use eslint to check the TypeScript and JavaScript styles.
1npm run eslint
We use stylelint to check the SCSS styles.
1npm run stylelint
Since Hugo parameters are case-insensitive, snake_case are preferred.
| Parameter | |
|---|---|
FooBar | ❌ |
fooBar | ❌ |
foobar | ❌ |
foo-bar | ❌ |
foo_bar | ✅ |
The filenames are case-sensitive on most 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.