diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..372c0c6 --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..d894bc4 --- /dev/null +++ b/.eslintrc.json @@ -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" + } +} diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 0000000..c627fcd --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +pnpx lint-staged diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000..c228e11 --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,4 @@ +{ + "**/*.{md,mdx,html,astro,svelte,css}": ["pnpx prettier --write"], + "**/*.{js,ts,html,astro,svelte}": ["pnpx eslint --fix"] +} diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..631b858 --- /dev/null +++ b/.prettierrc.json @@ -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" + } + } + ] +} diff --git a/package.json b/package.json index cfc475a..37ea1a8 100644 --- a/package.json +++ b/package.json @@ -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", } -} \ No newline at end of file +}