This project includes:
Prettier & Stylelint are used for formatting & ESLint for linting.
We use stylelint instead of prettier for style formatting. This is because prettier doesn't work with scss files and stylelint gives us more control over the formatting.
Currently we are formatting astro, svelte & html style
tags, as well as css and scss files. It will reorder the properties in some groups and alphabetically within these groups.
For Tailwind, a prettier plugin is used. This plugin is reordering the classes automatically.
The extensions are needed to format the code automatically on save. If it doesn't work out of the box, you might have to configure it in VSCode settings.json:
CMD + SHIFT + P
-> Preferences: Open Settings (JSON)
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[astro]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[svelte]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.documentSelectors": ["**/*.astro", "**/*.svelte"]
"stylelint.validate": [
"css",
"scss",
"svelte",
"astro",
"html"
]
ESLint is set up for js, ts, svelte and astro files. There is also an additional package to help us with accessibility.
The extensions is needed to lint the code automatically on save. If it doesn't work out of the box, you might have to configure it in VSCode settings.json:
CMD + SHIFT + P
-> Preferences: Open Settings (JSON)
"eslint.validate": [
"javascript",
"astro",
"typescript",
"svelte",
"html",
],