-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
106 lines (105 loc) · 2.97 KB
/
eslint.config.js
File metadata and controls
106 lines (105 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import eslint from "@eslint/js";
import vitest from "@vitest/eslint-plugin";
import eslintPluginAstro from "eslint-plugin-astro";
import eslintPluginBetterTailwindcss from "eslint-plugin-better-tailwindcss";
import perfectionist from "eslint-plugin-perfectionist";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import eslintPluginSeparateTypeImports from "eslint-plugin-separate-type-imports";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import { defineConfig } from "eslint/config";
import tsEslint from "typescript-eslint";
export default defineConfig(
{
ignores: ["dist/", ".astro/", "coverage/", "content/", "public/"],
},
eslint.configs.recommended,
eslintPluginUnicorn.configs.recommended,
eslintPluginSeparateTypeImports.configs.recommended,
reactHooks.configs.flat.recommended,
perfectionist.configs["recommended-natural"],
tsEslint.configs.recommendedTypeChecked,
eslintPluginAstro.configs.recommended,
{
rules: {
"@typescript-eslint/array-type": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/consistent-type-imports": "off", // Turned off in favor of our custom rule
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["../*"],
message: "no relative imports outside current folder",
},
],
},
],
"unicorn/filename-case": "off",
"unicorn/no-array-reverse": "off",
"unicorn/no-nested-ternary": "off",
"unicorn/prevent-abbreviations": "off",
},
},
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
warnOnUnsupportedTypeScriptVersion: false,
},
},
},
{
files: ["**/*.{astro,tsx}"],
plugins: {
"better-tailwindcss": eslintPluginBetterTailwindcss,
},
rules: {
...eslintPluginBetterTailwindcss.configs["recommended-error"].rules,
"better-tailwindcss/no-conflicting-classes": "error",
"better-tailwindcss/no-unknown-classes": [
"error",
{ detectComponentClasses: true },
],
},
settings: {
"better-tailwindcss": {
entryPoint: "src/css/tailwind.css",
},
},
},
{
files: ["**/*.tsx"],
plugins: {
react,
},
rules: {
...react.configs.recommended.rules,
"@typescript-eslint/explicit-function-return-type": "error",
"react/boolean-prop-naming": "error",
"react/button-has-type": "error",
"react/react-in-jsx-scope": "off",
},
settings: {
react: {
version: "detect",
},
},
},
{
extends: [tsEslint.configs.disableTypeChecked],
...tsEslint.configs.eslintRecommended,
files: ["**/*.astro"],
},
{
files: ["src/**/?(*.)+(spec|test).[jt]s?(x)"],
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
},
);