chore: add eslint, prettier, lint-staged, husky, eslint, and editorconfig

This commit is contained in:
Stefan Imhoff
2023-02-12 12:23:14 +01:00
parent 99a3bdab56
commit 9bd0f772b0
6 changed files with 86 additions and 2 deletions

10
.editorconfig Normal file
View File

@@ -0,0 +1,10 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
charset = utf-8
indent_style = tab
end_of_line = lf
insert_final_newline = true

15
.eslintrc.json Normal file
View File

@@ -0,0 +1,15 @@
{
"env": {
"es6": true,
"node": true,
"browser": true
},
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error"
}
}

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
pnpx lint-staged

4
.lintstagedrc.json Normal file
View File

@@ -0,0 +1,4 @@
{
"**/*.{md,mdx,html,astro,svelte,css}": ["pnpx prettier --write"],
"**/*.{js,ts,html,astro,svelte}": ["pnpx eslint --fix"]
}

36
.prettierrc.json Normal file
View File

@@ -0,0 +1,36 @@
{
"plugins": [
"prettier-plugin-astro",
"prettier-plugin-svelte",
"prettier-plugin-organize-imports",
"prettier-plugin-tailwindcss"
],
"endOfLine": "lf",
"semi": true,
"singleQuote": true,
"useTabs": true,
"tabWidth": 4,
"printWidth": 100,
"trailingComma": "es5",
"overrides": [
{
"files": "*.md",
"options": {
"singleQuote": false,
"tabWidth": 2
}
},
{
"files": "*.astro",
"options": {
"parser": "astro"
}
},
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}

View File

@@ -7,7 +7,8 @@
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
"astro": "astro",
"prepare": "husky install"
},
"dependencies": {
"@astrojs/mdx": "^0.16.0",
@@ -16,5 +17,19 @@
"astro": "^2.0.10",
"svelte": "^3.54.0",
"tailwindcss": "^3.0.24"
},
"devDependencies": {
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.0",
"lint-staged": "^13.1.1",
"prettier": "^2.8.4",
"prettier-plugin-astro": "^0.8.0",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-svelte": "^2.9.0",
"prettier-plugin-tailwindcss": "^0.2.2",
"rollup": "^3.15.0",
"typescript": "^4.9.5",
}
}