-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
121 lines (107 loc) · 3.04 KB
/
index.js
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
import reactPlugin from "eslint-plugin-react";
import torusTypescriptConfig from "@toruslabs/eslint-config-typescript";
import tailwind from "eslint-plugin-tailwindcss";
import reactHooks from "eslint-plugin-react-hooks";
import jsxA11Y from "eslint-plugin-jsx-a11y";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
// TODO: Add back eslint-config-airbnb when it's ready
/** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigFile} */
export default [
...fixupConfigRules(compat.extends("plugin:react-hooks/recommended")),
reactPlugin.configs.flat.recommended,
reactPlugin.configs.flat["jsx-runtime"],
jsxA11Y.flatConfigs.recommended,
...tailwind.configs["flat/recommended"],
...torusTypescriptConfig,
{
plugins: {
"react-hooks": fixupPluginRules(reactHooks),
},
languageOptions: {
...reactPlugin.configs.flat.recommended.languageOptions,
...jsxA11Y.flatConfigs.recommended.languageOptions,
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
ecmaVersion: 2024,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: "detect",
},
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx", ".json"],
},
},
},
rules: {
"no-restricted-exports": 0,
"react/require-default-props": 0,
"@typescript-eslint/naming-convention": [
"error",
{
selector: "typeLike",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
},
],
"@typescript-eslint/member-ordering": 1,
"import/prefer-default-export": 0,
"simple-import-sort/imports": 2,
"simple-import-sort/exports": 2,
"no-dupe-class-members": 0,
"@typescript-eslint/no-dupe-class-members": 2,
"no-useless-constructor": 0,
"@typescript-eslint/no-useless-constructor": 2,
"no-unused-vars": 0,
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "after-used",
argsIgnorePattern: "_",
},
],
"import/extensions": [
"error",
"ignorePackages",
{
js: "never",
ts: "never",
jsx: "never",
tsx: "never",
},
],
"no-console": 2,
"prettier/prettier": [
2,
{
singleQuote: false,
printWidth: 150,
semi: true,
trailingComma: "es5",
},
],
},
},
];