-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.mjs
More file actions
122 lines (111 loc) · 3.98 KB
/
Copy patheslint.config.mjs
File metadata and controls
122 lines (111 loc) · 3.98 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import path from "node:path"
import tseslint from "typescript-eslint"
import url from "node:url"
import unusedImports from "eslint-plugin-unused-imports"
import unicornPlugin from "eslint-plugin-unicorn"
import functional from "eslint-plugin-functional"
import suggestMembersPlugin from "@ton-ai-core/eslint-plugin-suggest-members"
import react from "eslint-plugin-react"
import reactHooks from "eslint-plugin-react-hooks"
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
export default tseslint.config(
// register plugins
{
plugins: {
["@typescript-eslint"]: tseslint.plugin,
["@unused-imports"]: unusedImports,
["suggest-members"]: suggestMembersPlugin,
functional: functional,
react: react,
"react-hooks": reactHooks,
},
},
// add files and folders to be ignored
{
ignores: [
"**/*.js",
"eslint.config.mjs",
".github/*",
".yarn/*",
".vscode-test/*",
"dist/*",
"node_modules/*",
],
},
tseslint.configs.recommended,
unicornPlugin.configs["flat/recommended"],
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
ecmaVersion: "latest",
sourceType: "module"
},
},
rules: {
"suggest-members/suggest-members": "error",
"suggest-members/suggest-imports": "error",
// React rules
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
// TypeScript rules
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/typedef": [
"error",
{parameter: true, memberVariableDeclaration: true},
],
"@typescript-eslint/consistent-generic-constructors": ["error", "type-annotation"],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
varsIgnorePattern: "^_",
},
],
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
},
],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/prefer-optional-chain": "off",
"@typescript-eslint/no-extraneous-class": "off",
"@typescript-eslint/no-magic-numbers": "off",
// Unused imports
"@unused-imports/no-unused-imports": "error",
"no-duplicate-imports": "error",
// Functional programming rules
"functional/type-declaration-immutability": [
"error",
{
rules: [
{
identifiers: ".+",
immutability: "ReadonlyShallow",
comparator: "AtLeast",
},
],
},
],
"functional/readonly-type": ["error", "keyword"],
// Unicorn rules
"unicorn/no-null": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/no-array-for-each": "off",
"unicorn/import-style": "off",
"unicorn/filename-case": "off",
"unicorn/consistent-function-scoping": "off",
"unicorn/no-nested-ternary": "off"
},
},
)