@shayanthenerd/eslint-config 0.11.2 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,38 +5,40 @@ import path from "node:path";
5
5
  //#region src/rules/importX.ts
6
6
  function getImportXRules(options) {
7
7
  const { packageDir, configs: { importX, typescript } } = options;
8
+ const isTypeScriptEnabled = isEnabled(typescript);
8
9
  const { removeUnusedImports } = isEnabled(importX) ? importX : defaultOptions.configs.importX;
9
10
  return {
10
11
  "unused-imports/no-unused-imports": removeUnusedImports ? "warn" : "off",
11
- "import-x/no-amd": "error",
12
- "import-x/no-commonjs": "error",
13
- "import-x/exports-last": "warn",
12
+ "import-x/export": isTypeScriptEnabled ? "off" : "error",
14
13
  "import-x/no-deprecated": "warn",
15
- "import-x/group-exports": "warn",
16
- "import-x/no-self-import": "error",
17
- "import-x/no-absolute-path": "warn",
18
- "import-x/no-named-default": "error",
19
- "import-x/no-mutable-exports": "error",
20
14
  "import-x/no-empty-named-blocks": "error",
21
- "import-x/no-import-module-exports": "error",
22
- "import-x/no-useless-path-segments": "error",
15
+ "import-x/no-extraneous-dependencies": ["error", {
16
+ includeTypes: true,
17
+ packageDir: path.resolve(packageDir)
18
+ }],
19
+ "import-x/no-mutable-exports": "error",
20
+ "import-x/no-named-as-default": "error",
23
21
  "import-x/no-named-as-default-member": "off",
24
- "import-x/named": typescript ? "off" : "error",
25
- "import-x/export": typescript ? "off" : "error",
26
- "import-x/default": typescript ? "off" : "error",
27
- "import-x/consistent-type-specifier-style": "warn",
28
- "import-x/first": ["warn", "disable-absolute-first"],
29
- "import-x/no-unresolved": typescript ? "off" : "error",
22
+ "import-x/no-amd": "error",
23
+ "import-x/no-commonjs": "error",
24
+ "import-x/no-import-module-exports": "error",
25
+ "import-x/named": isTypeScriptEnabled ? "off" : "error",
26
+ "import-x/default": isTypeScriptEnabled ? "off" : "error",
30
27
  "import-x/namespace": ["error", { allowComputed: true }],
31
- "import-x/no-duplicates": ["error", { considerQueryString: true }],
28
+ "import-x/no-absolute-path": "warn",
32
29
  "import-x/no-cycle": ["error", {
33
30
  maxDepth: 1,
34
31
  ignoreExternal: true
35
32
  }],
36
- "import-x/no-extraneous-dependencies": ["error", {
37
- includeTypes: true,
38
- packageDir: path.resolve(packageDir)
39
- }]
33
+ "import-x/no-self-import": "error",
34
+ "import-x/no-unresolved": isTypeScriptEnabled ? "off" : "error",
35
+ "import-x/no-useless-path-segments": "error",
36
+ "import-x/consistent-type-specifier-style": "warn",
37
+ "import-x/exports-last": "warn",
38
+ "import-x/first": ["warn", "disable-absolute-first"],
39
+ "import-x/group-exports": "warn",
40
+ "import-x/no-duplicates": ["error", { considerQueryString: true }],
41
+ "import-x/no-named-default": "error"
40
42
  };
41
43
  }
42
44
 
@@ -2,130 +2,95 @@
2
2
  function getJavaScriptRules(options) {
3
3
  const { maxDepth, functionStyle, maxNestedCallbacks, preferNamedExports } = options.configs.base;
4
4
  return {
5
- "no-self-compare": "warn",
6
- "no-await-in-loop": "error",
7
- "no-unassigned-vars": "error",
8
- "no-unreachable-loop": "warn",
9
- "no-inner-declarations": "warn",
10
- "require-atomic-updates": "warn",
11
5
  "array-callback-return": "error",
12
- "no-useless-assignment": "error",
13
- "no-constructor-return": "error",
6
+ "constructor-super": "error",
7
+ "for-direction": "error",
8
+ "getter-return": "error",
14
9
  "no-async-promise-executor": "error",
10
+ "no-await-in-loop": "error",
11
+ "no-case-declarations": "error",
12
+ "no-class-assign": "error",
13
+ "no-compare-neg-zero": "error",
14
+ "no-cond-assign": "error",
15
+ "no-const-assign": "error",
16
+ "no-constant-binary-expression": "error",
17
+ "no-constant-condition": "error",
18
+ "no-constructor-return": "error",
19
+ "no-control-regex": "error",
20
+ "no-debugger": "error",
21
+ "no-delete-var": "error",
22
+ "no-dupe-args": "error",
23
+ "no-dupe-class-members": "error",
24
+ "no-dupe-else-if": "error",
25
+ "no-dupe-keys": "error",
26
+ "no-duplicate-case": "error",
27
+ "no-duplicate-imports": ["error", {
28
+ includeExports: true,
29
+ allowSeparateTypeImports: true
30
+ }],
31
+ "no-empty-character-class": "error",
32
+ "no-empty-pattern": "error",
33
+ "no-empty-static-block": "error",
34
+ "no-ex-assign": "error",
35
+ "no-fallthrough": "error",
36
+ "no-func-assign": "error",
37
+ "no-global-assign": "error",
38
+ "no-import-assign": "error",
39
+ "no-inner-declarations": "warn",
40
+ "no-invalid-regexp": "error",
41
+ "no-irregular-whitespace": "warn",
42
+ "no-loss-of-precision": "error",
43
+ "no-misleading-character-class": "error",
15
44
  "no-promise-executor-return": "error",
45
+ "no-self-compare": "warn",
16
46
  "no-template-curly-in-string": "error",
47
+ "no-unassigned-vars": "error",
17
48
  "no-unmodified-loop-condition": "error",
18
- "use-isnan": ["error", { enforceForIndexOf: true }],
19
- "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
49
+ "no-unreachable-loop": "warn",
20
50
  "no-unsafe-negation": ["error", { enforceForOrderingRelations: true }],
21
51
  "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
52
+ "no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
22
53
  "no-use-before-define": ["error", {
23
54
  functions: false,
24
55
  ignoreTypeReferences: false
25
56
  }],
26
- "no-duplicate-imports": ["error", {
27
- includeExports: true,
28
- allowSeparateTypeImports: true
57
+ "no-useless-assignment": "error",
58
+ "require-atomic-updates": "warn",
59
+ "use-isnan": ["error", { enforceForIndexOf: true }],
60
+ "valid-typeof": "error",
61
+ "accessor-pairs": "error",
62
+ "block-scoped-var": "warn",
63
+ "camelcase": ["warn", {
64
+ properties: "never",
65
+ ignoreImports: true,
66
+ ignoreDestructuring: true
29
67
  }],
30
- "yoda": "warn",
31
- "strict": "error",
32
- "no-var": "error",
33
- "eqeqeq": "error",
34
- "no-new": "error",
35
- "new-cap": "warn",
36
- "no-eval": "error",
37
- "no-void": "error",
38
- "no-proto": "warn",
39
- "no-empty": "warn",
40
- "no-caller": "error",
41
- "no-eq-null": "warn",
68
+ "class-methods-use-this": "error",
42
69
  "complexity": "warn",
43
- "sort-imports": "off",
44
- "no-redeclare": "off",
45
- "no-iterator": "warn",
46
- "no-continue": "warn",
47
- "no-new-func": "error",
48
- "guard-for-in": "warn",
49
- "no-loop-func": "warn",
50
- "default-case": "warn",
51
- "no-lonely-if": "error",
52
- "no-label-var": "error",
53
- "no-multi-str": "error",
54
- "prefer-const": "error",
55
- "require-await": "warn",
56
- "dot-notation": "error",
57
- "no-script-url": "error",
58
- "no-undef-init": "error",
59
- "no-extra-bind": "error",
60
- "prefer-spread": "error",
61
- "no-lone-blocks": "error",
62
- "no-extra-label": "error",
63
- "accessor-pairs": "error",
64
- "prefer-template": "warn",
65
- "no-invalid-this": "error",
66
- "no-useless-call": "error",
67
- "no-implied-eval": "error",
70
+ "consistent-return": "error",
68
71
  "consistent-this": "error",
69
- "no-octal-escape": "error",
70
- "no-new-wrappers": "error",
71
- "block-scoped-var": "warn",
72
- "object-shorthand": "warn",
73
- "no-throw-literal": "error",
74
- "no-extend-native": "error",
72
+ "curly": ["warn", "multi-line"],
73
+ "default-case": "warn",
75
74
  "default-case-last": "warn",
76
- "no-nested-ternary": "warn",
77
- "no-useless-return": "error",
78
- "init-declarations": "error",
79
- "consistent-return": "error",
80
- "no-useless-concat": "error",
81
- "no-param-reassign": "error",
82
- "no-useless-rename": "error",
83
75
  "default-param-last": "warn",
84
- "symbol-description": "warn",
76
+ "dot-notation": "warn",
77
+ "eqeqeq": "error",
85
78
  "func-name-matching": "warn",
86
- "prefer-rest-params": "error",
87
- "operator-assignment": "error",
88
- "no-unneeded-ternary": "error",
89
- "no-implicit-globals": "error",
90
- "prefer-destructuring": "warn",
91
- "no-implicit-coercion": "error",
92
- "no-array-constructor": "error",
93
- "prefer-object-spread": "error",
94
- "radix": ["error", "as-needed"],
95
- "curly": ["warn", "multi-line"],
96
- "max-depth": ["warn", maxDepth],
97
- "preserve-caught-error": "warn",
98
- "no-object-constructor": "error",
99
- "prefer-object-has-own": "error",
100
- "no-useless-constructor": "error",
101
- "class-methods-use-this": "error",
102
- "prefer-numeric-literals": "error",
103
- "no-useless-computed-key": "error",
104
- "prefer-named-capture-group": "warn",
105
- "no-return-assign": ["error", "always"],
106
- "prefer-exponentiation-operator": "error",
107
- "no-bitwise": ["error", { int32Hint: true }],
108
- "max-params": ["warn", { countVoidThis: true }],
109
- "logical-assignment-operators": ["error", "always"],
110
- "max-nested-callbacks": ["warn", maxNestedCallbacks],
111
- "no-sequences": ["error", { allowInParentheses: false }],
112
- "no-multi-assign": ["error", { ignoreNonDeclaration: true }],
113
- "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
114
- "prefer-arrow-callback": ["error", { allowUnboundThis: true }],
115
- "no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
116
79
  "func-style": [
117
80
  "warn",
118
81
  functionStyle,
119
82
  { allowTypeAnnotation: true }
120
83
  ],
121
- "prefer-promise-reject-errors": ["error", { allowEmptyReject: true }],
122
- "prefer-regex-literals": ["error", { disallowRedundantWrapping: true }],
123
- "no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
124
- "camelcase": ["warn", {
125
- properties: "never",
126
- ignoreImports: true,
127
- ignoreDestructuring: true
128
- }],
84
+ "guard-for-in": "warn",
85
+ "init-declarations": "error",
86
+ "logical-assignment-operators": ["error", "always"],
87
+ "max-depth": ["warn", maxDepth],
88
+ "max-nested-callbacks": ["warn", maxNestedCallbacks],
89
+ "max-params": ["warn", { countVoidThis: true }],
90
+ "new-cap": "warn",
91
+ "no-array-constructor": "error",
92
+ "no-bitwise": ["error", { int32Hint: true }],
93
+ "no-caller": "error",
129
94
  "no-console": ["warn", { allow: [
130
95
  "info",
131
96
  "warn",
@@ -135,6 +100,58 @@ function getJavaScriptRules(options) {
135
100
  "groupEnd",
136
101
  "groupCollapsed"
137
102
  ] }],
103
+ "no-continue": "warn",
104
+ "no-empty": "warn",
105
+ "no-empty-function": ["error", { allow: [
106
+ "overrideMethods",
107
+ "decoratedFunctions",
108
+ "privateConstructors",
109
+ "protectedConstructors"
110
+ ] }],
111
+ "no-eq-null": "warn",
112
+ "no-eval": "error",
113
+ "no-extend-native": "error",
114
+ "no-extra-bind": "error",
115
+ "no-extra-boolean-cast": ["error", { enforceForInnerExpressions: true }],
116
+ "no-extra-label": "error",
117
+ "no-implicit-coercion": "error",
118
+ "no-implicit-globals": "error",
119
+ "no-implied-eval": "error",
120
+ "no-invalid-this": "error",
121
+ "no-iterator": "warn",
122
+ "no-label-var": "error",
123
+ "no-lone-blocks": "error",
124
+ "no-lonely-if": "error",
125
+ "no-loop-func": "warn",
126
+ "no-multi-assign": ["error", { ignoreNonDeclaration: true }],
127
+ "no-multi-str": "error",
128
+ "no-nested-ternary": "warn",
129
+ "no-new": "error",
130
+ "no-new-func": "error",
131
+ "no-new-native-nonconstructor": "error",
132
+ "no-new-wrappers": "error",
133
+ "no-nonoctal-decimal-escape": "error",
134
+ "no-obj-calls": "error",
135
+ "no-object-constructor": "error",
136
+ "no-octal": "error",
137
+ "no-octal-escape": "error",
138
+ "no-param-reassign": "error",
139
+ "no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
140
+ "no-proto": "warn",
141
+ "no-prototype-builtins": "error",
142
+ "no-redeclare": "off",
143
+ "no-regex-spaces": "error",
144
+ "no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
145
+ named: true,
146
+ namedFrom: true,
147
+ defaultFrom: true,
148
+ namespaceFrom: true
149
+ } }],
150
+ "no-return-assign": ["error", "always"],
151
+ "no-script-url": "error",
152
+ "no-self-assign": "error",
153
+ "no-sequences": ["error", { allowInParentheses: false }],
154
+ "no-setter-return": "error",
138
155
  "no-shadow": ["error", {
139
156
  hoist: "all",
140
157
  allow: ["name"],
@@ -142,24 +159,59 @@ function getJavaScriptRules(options) {
142
159
  ignoreTypeValueShadow: false,
143
160
  ignoreFunctionTypeParameterNameValueShadow: false
144
161
  }],
145
- "no-restricted-exports": [preferNamedExports ? "error" : "off", { restrictDefaultExports: {
146
- named: true,
147
- namedFrom: true,
148
- defaultFrom: true,
149
- namespaceFrom: true
150
- } }],
151
- "no-empty-function": ["error", { allow: [
152
- "overrideMethods",
153
- "decoratedFunctions",
154
- "privateConstructors",
155
- "protectedConstructors"
156
- ] }],
162
+ "no-shadow-restricted-names": ["warn", { reportGlobalThis: true }],
163
+ "no-sparse-arrays": "error",
164
+ "no-this-before-super": "error",
165
+ "no-throw-literal": "error",
166
+ "no-undef": "error",
167
+ "no-undef-init": "error",
168
+ "no-unexpected-multiline": "error",
169
+ "no-unneeded-ternary": "error",
170
+ "no-unreachable": "error",
171
+ "no-unsafe-finally": "error",
157
172
  "no-unused-expressions": ["error", {
158
173
  allowTernary: true,
159
174
  enforceForJSX: true,
160
175
  allowShortCircuit: true,
161
176
  allowTaggedTemplates: true
162
- }]
177
+ }],
178
+ "no-unused-labels": "error",
179
+ "no-unused-private-class-members": "error",
180
+ "no-useless-backreference": "error",
181
+ "no-useless-call": "error",
182
+ "no-useless-catch": "error",
183
+ "no-useless-computed-key": "error",
184
+ "no-useless-concat": "error",
185
+ "no-useless-constructor": "error",
186
+ "no-useless-escape": "error",
187
+ "no-useless-rename": "error",
188
+ "no-useless-return": "error",
189
+ "no-var": "error",
190
+ "no-void": "error",
191
+ "no-with": "error",
192
+ "object-shorthand": "warn",
193
+ "operator-assignment": "error",
194
+ "prefer-arrow-callback": ["warn", { allowUnboundThis: true }],
195
+ "prefer-const": "error",
196
+ "prefer-destructuring": "warn",
197
+ "prefer-exponentiation-operator": "warn",
198
+ "prefer-named-capture-group": "warn",
199
+ "prefer-numeric-literals": "warn",
200
+ "prefer-object-has-own": "warn",
201
+ "prefer-object-spread": "warn",
202
+ "prefer-promise-reject-errors": ["warn", { allowEmptyReject: true }],
203
+ "prefer-regex-literals": ["warn", { disallowRedundantWrapping: true }],
204
+ "prefer-rest-params": "warn",
205
+ "prefer-spread": "warn",
206
+ "prefer-template": "warn",
207
+ "preserve-caught-error": "warn",
208
+ "radix": ["error", "as-needed"],
209
+ "require-await": "warn",
210
+ "require-yield": "error",
211
+ "sort-imports": "off",
212
+ "strict": "error",
213
+ "symbol-description": "warn",
214
+ "yoda": "warn"
163
215
  };
164
216
  }
165
217
 
@@ -2,23 +2,51 @@
2
2
  function getPlaywrightRules(options) {
3
3
  const { maxNestedDescribe } = options.configs.test;
4
4
  return {
5
- "playwright/max-expects": "off",
6
- "playwright/prefer-to-be": "warn",
7
- "playwright/no-get-by-title": "error",
8
- "playwright/prefer-to-contain": "warn",
9
- "playwright/no-wait-for-timeout": "off",
5
+ "playwright/expect-expect": "error",
6
+ "playwright/max-nested-describe": ["warn", { max: maxNestedDescribe }],
7
+ "playwright/missing-playwright-await": "error",
8
+ "playwright/no-commented-out-tests": "error",
9
+ "playwright/no-conditional-expect": "error",
10
+ "playwright/no-conditional-in-test": "error",
10
11
  "playwright/no-duplicate-hooks": "error",
11
- "playwright/prefer-strict-equal": "warn",
12
+ "playwright/no-element-handle": "warn",
13
+ "playwright/no-eval": "error",
14
+ "playwright/no-focused-test": "error",
15
+ "playwright/no-force-option": "warn",
16
+ "playwright/no-get-by-title": "warn",
17
+ "playwright/no-nested-step": "warn",
18
+ "playwright/no-networkidle": "error",
19
+ "playwright/no-page-pause": "error",
20
+ "playwright/no-raw-locators": "warn",
21
+ "playwright/no-skipped-test": "error",
22
+ "playwright/no-slowed-test": "warn",
23
+ "playwright/no-standalone-expect": "error",
24
+ "playwright/no-unsafe-references": "error",
25
+ "playwright/no-unused-locators": "warn",
26
+ "playwright/no-useless-await": "warn",
27
+ "playwright/no-useless-not": "warn",
28
+ "playwright/no-wait-for-selector": "warn",
29
+ "playwright/no-wait-for-timeout": "error",
30
+ "playwright/prefer-comparison-matcher": "warn",
31
+ "playwright/prefer-equality-matcher": "warn",
32
+ "playwright/prefer-hooks-in-order": "warn",
12
33
  "playwright/prefer-hooks-on-top": "warn",
34
+ "playwright/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }],
35
+ "playwright/prefer-native-locators": "warn",
36
+ "playwright/prefer-locator": "error",
37
+ "playwright/prefer-strict-equal": "warn",
38
+ "playwright/prefer-to-be": "warn",
39
+ "playwright/prefer-to-contain": "warn",
13
40
  "playwright/prefer-to-have-count": "warn",
14
- "playwright/prefer-hooks-in-order": "warn",
15
41
  "playwright/prefer-to-have-length": "warn",
16
- "playwright/no-commented-out-tests": "error",
17
- "playwright/prefer-equality-matcher": "warn",
42
+ "playwright/prefer-web-first-assertions": "warn",
43
+ "playwright/require-hook": "error",
18
44
  "playwright/require-to-throw-message": "error",
19
- "playwright/prefer-comparison-matcher": "warn",
20
- "playwright/max-nested-describe": ["warn", { max: maxNestedDescribe }],
21
- "playwright/prefer-lowercase-title": ["warn", { ignoreTopLevelDescribe: true }]
45
+ "playwright/valid-describe-callback": "error",
46
+ "playwright/valid-expect-in-promise": "error",
47
+ "playwright/valid-expect": "error",
48
+ "playwright/valid-title": "error",
49
+ "playwright/valid-test-tags": "error"
22
50
  };
23
51
  }
24
52
 
@@ -3,10 +3,21 @@ import path from "node:path";
3
3
  //#region src/rules/storybook.ts
4
4
  function getStorybookRules(options) {
5
5
  return {
6
+ "storybook/await-interactions": "error",
7
+ "storybook/context-in-play-function": "error",
6
8
  "storybook/csf-component": "error",
7
- "storybook/no-stories-of": "error",
9
+ "storybook/default-exports": "error",
10
+ "storybook/hierarchy-separator": "error",
11
+ "storybook/meta-inline-properties": "warn",
8
12
  "storybook/meta-satisfies-type": "warn",
9
- "storybook/no-uninstalled-addons": ["error", { packageJsonLocation: path.resolve(options.packageDir, "package.json") }]
13
+ "storybook/no-redundant-story-name": "warn",
14
+ "storybook/no-renderer-packages": "error",
15
+ "storybook/no-stories-of": "error",
16
+ "storybook/no-uninstalled-addons": ["error", { packageJsonLocation: path.resolve(options.packageDir, "package.json") }],
17
+ "storybook/prefer-pascal-case": "warn",
18
+ "storybook/story-exports": "error",
19
+ "storybook/use-storybook-expect": "error",
20
+ "storybook/use-storybook-testing-library": "error"
10
21
  };
11
22
  }
12
23