Skip to content

Commit 37c2229

Browse files
chore: add eslint and prettier support
1 parent 39ef8e6 commit 37c2229

File tree

4 files changed

+3666
-132
lines changed

4 files changed

+3666
-132
lines changed

.prettierrc.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"plugins": ["prettier-plugin-astro"],
3+
"overrides": [
4+
{
5+
"files": "*.astro",
6+
"options": {
7+
"parser": "astro"
8+
}
9+
}
10+
],
11+
"semi": false
12+
}

eslint.config.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import js from "@eslint/js"
2+
import globals from "globals"
3+
import tseslint from "typescript-eslint"
4+
import { defineConfig } from "eslint/config"
5+
import eslintPluginAstro from "eslint-plugin-astro"
6+
7+
// can't use @eslint/css with the astro eslint plugin - see this gh issue for
8+
// details: https://github.com/ota-meshi/eslint-plugin-astro/issues/485
9+
export default defineConfig([
10+
{
11+
files: ["**/*.{js,mjs,cjs,ts}"],
12+
plugins: { js },
13+
extends: ["js/recommended"],
14+
},
15+
{
16+
files: ["**/*.{js,mjs,cjs,ts}"],
17+
languageOptions: { globals: { ...globals.browser, ...globals.node } },
18+
},
19+
...tseslint.configs.recommended,
20+
...eslintPluginAstro.configs.recommended,
21+
...eslintPluginAstro.configs["jsx-a11y-strict"],
22+
{
23+
rules: {
24+
"default-case-last": "error",
25+
eqeqeq: "error",
26+
"no-await-in-loop": "warn",
27+
"no-duplicate-imports": "error",
28+
"no-implicit-coercion": "error",
29+
"no-label-var": "error",
30+
"no-self-compare": "error",
31+
"no-template-curly-in-string": "error",
32+
"no-unmodified-loop-condition": "error",
33+
"no-unreachable-loop": "error",
34+
"no-useless-assignment": "error",
35+
"prefer-promise-reject-errors": "error",
36+
yoda: "warn",
37+
},
38+
},
39+
])

0 commit comments

Comments
 (0)