-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
102 lines (102 loc) · 3.17 KB
/
.eslintrc.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
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
jquery: true,
},
globals: {
JSX: "readonly",
},
extends: ["plugin:react/recommended", "airbnb", "airbnb/hooks", "prettier"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["react", "@typescript-eslint"],
ignorePatterns: ["dist"],
rules: {
camelcase: "off",
"max-len": ["error", { code: 120, ignorePattern: "^import .*" }],
// indent: ["error", 2], --> conflicts with prettier
"lines-between-class-members": "off",
"no-use-before-define": "off", // https://stackoverflow.com/a/64024916
"@typescript-eslint/no-use-before-define": ["error", { functions: false }],
"no-unused-vars": "off",
"class-methods-use-this": "off",
"react/jsx-no-constructed-context-values": "warn",
"@typescript-eslint/no-unused-vars": ["error"],
"no-shadow": "off", // https://stackoverflow.com/a/63961972
"@typescript-eslint/no-shadow": ["error"],
"react/prop-types": "error", // works with typescript too
"react/jsx-props-no-spreading": "off",
"react/require-default-props": "off",
"react/jsx-filename-extension": "off",
"react-hooks/exhaustive-deps": "warn",
"import/no-extraneous-dependencies": ["error", { packageDir: "." }],
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/extensions": "off",
"react/jsx-no-bind": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-no-target-blank": "warn",
"react/jsx-fragments": "off",
"react/function-component-definition": [
"error",
{
namedComponents: "arrow-function",
unnamedComponents: "arrow-function",
},
],
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/no-noninteractive-element-interactions": "warn",
"jsx-a11y/no-static-element-interactions": "warn",
"no-restricted-imports": [
"error",
{
patterns: [
{
group: ["react-icons/*", "@react-icons/*", "@mdi/react", "@mdi/svg", "@mdi/font"],
message: "Please use @/common/icons/MdIcon and @mdi/js for icons.",
},
{
group: ["moment", "luxon", "date-fns", "date-fns-jalali", "@date-io", "jalaali-js", "dayjs", "@js-joda"],
message: "Please use Temporal for working with date and time.",
},
],
paths: [
{
name: "@chakra-ui/react",
importNames: ["Image"],
message: "Due to SSR problems, please use 'Img' component instead.",
},
{
name: "@/common/utils/string",
importNames: ["humanizePersianDigits", "persianFloat"],
message: 'Deprecated. Use number.toLocaleString("fa-IR", options) instead.',
},
],
},
],
"jsx-a11y/label-has-associated-control": [
"error",
{
required: {
some: ["nesting", "id"],
},
},
],
"jsx-a11y/label-has-for": [
"error",
{
required: {
some: ["nesting", "id"],
},
},
],
},
};