chore: set up prettier

This commit is contained in:
Ayo Ayco 2024-12-26 01:00:32 +01:00
parent 2c7a153aa5
commit 5bc7712731
4 changed files with 29 additions and 25 deletions

7
.prettierignore Normal file
View file

@ -0,0 +1,7 @@
# someday let's think about formatting html
**/*.html
**/*.md
**/*.css
**/*.yml
**/*.yaml

View file

@ -1,24 +0,0 @@
/** @type {import("@types/prettier").Options} */
module.exports = {
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: true,
plugins: ['./node_modules/prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
{
files: ['.*', '*.json', '*.md', '*.toml', '*.yml'],
options: {
useTabs: false,
},
},
],
};

View file

@ -25,7 +25,7 @@
"scripts": {
"start": "npm run dev -w demo",
"dev": "npm run dev -w demo",
"format": "prettier -w .",
"format": "prettier . --write",
"lint": "eslint . --config eslint.config.mjs",
"build": "tsc",
"demo": "npm run dev -w demo",

21
prettier.config.mjs Normal file
View file

@ -0,0 +1,21 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
trailingComma: 'es5',
tabWidth: 2,
semi: false,
singleQuote: true,
plugins: ['prettier-plugin-astro'],
overrides: [
{
files: '*.astro',
options: {
parser: 'astro',
},
},
],
}
export default config