@prowise/eslint-config-linting-rules 2.4.7 → 3.0.0

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.
@@ -13,22 +13,11 @@ export default {
13
13
 
14
14
  rules: {
15
15
  /**
16
- * Enforce or ban the use of inline type-only markers for named imports.
16
+ * Enforce or ban the use of inline type-only markers for named imports. 🔧
17
17
  * https://github.com/un-ts/eslint-plugin-import-x/blob/v4.5.0/docs/rules/consistent-type-specifier-style.md
18
+ * Rule turned off: already caught by "typescript/no-import-type-side-effects"
18
19
  */
19
- "import/consistent-type-specifier-style": ["warn", "prefer-inline"],
20
-
21
- /**
22
- * Ensure default import coupled with default export
23
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/default.md.
24
- */
25
- // "import/default": "off",
26
-
27
- /**
28
- * Dynamic imports require a leading comment with a webpackChunkName
29
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/dynamic-import-chunkname.md.
30
- */
31
- // "import/dynamic-import-chunkname": ["off", { importFunctions: [], webpackChunknameFormat: "[0-9a-zA-Z-_/.]+" }],
20
+ "import/consistent-type-specifier-style": ["off", "prefer-top-level"],
32
21
 
33
22
  /**
34
23
  * Disallow invalid exports, e.g. Multiple defaults
@@ -36,12 +25,6 @@ export default {
36
25
  */
37
26
  "import/export": "error",
38
27
 
39
- /**
40
- * This rule enforces that all exports are declared at the bottom of the file.
41
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md.
42
- */
43
- // "import/exports-last": "off",
44
-
45
28
  /**
46
29
  * Ensure consistent use of file extension within the import path
47
30
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/extensions.md.
@@ -51,37 +34,17 @@ export default {
51
34
  "import/extensions": ["off", "always", { ignorePackages: true }],
52
35
 
53
36
  /**
54
- * Disallow non-import statements appearing before import statements
37
+ * Disallow non-import statements appearing before import statements. 🔧
55
38
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md.
56
39
  */
57
40
  "import/first": "error",
58
41
 
59
- /**
60
- * Reports when named exports are not grouped together in a single export declaration
61
- * or when multiple assignments to CommonJS module.exports or exports object are present
62
- * in a single file.
63
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/group-exports.md.
64
- */
65
- // "import/group-exports": "off",
66
-
67
- /**
68
- * Forbid modules to have too many dependencies
69
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/group-exports.md.
70
- */
71
- // "import/max-dependencies": ["off", { max: 10 }],
72
-
73
42
  /**
74
43
  * Ensure named imports coupled with named exports
75
44
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/named.md#.
76
45
  */
77
46
  "import/named": "error",
78
47
 
79
- /**
80
- * Enforces names exist at the time they are dereferenced, when imported as a full namespace
81
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/namespace.md.
82
- */
83
- // "import/namespace": "off",
84
-
85
48
  /**
86
49
  * Require a newline after the last import/require in a group
87
50
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md.
@@ -89,7 +52,7 @@ export default {
89
52
  "import/newline-after-import": "error",
90
53
 
91
54
  /**
92
- * Forbid import of modules using absolute paths
55
+ * Forbid import of modules using absolute paths. 🔧
93
56
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-absolute-path.md.
94
57
  */
95
58
  "import/no-absolute-path": "error",
@@ -100,28 +63,6 @@ export default {
100
63
  */
101
64
  "import/no-amd": "error",
102
65
 
103
- /**
104
- * Reports if a module"s default export is unnamed
105
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-anonymous-default-export.md.
106
- */
107
- // "import/no-anonymous-default-export": [
108
- // "off",
109
- // {
110
- // allowArray: false,
111
- // allowArrowFunction: false,
112
- // allowAnonymousClass: false,
113
- // allowAnonymousFunction: false,
114
- // allowLiteral: false,
115
- // allowObject: false,
116
- // },
117
- // ],
118
-
119
- /**
120
- * Disallow require()
121
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-commonjs.md.
122
- */
123
- // "import/no-commonjs": "off",
124
-
125
66
  /**
126
67
  * Forbid cyclical dependencies between modules
127
68
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-cycle.md.
@@ -129,22 +70,10 @@ export default {
129
70
  "import/no-cycle": ["error", { ignoreExternal: true }],
130
71
 
131
72
  /**
132
- * Forbid default exports. This is a terrible rule, do not use it.
133
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-default-export.md.
134
- */
135
- // "import/no-default-export": "off",
136
-
137
- /**
138
- * Disallow use of jsdoc-marked-deprecated imports
139
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-deprecated.md.
140
- */
141
- // "import/no-deprecated": "off",
142
-
143
- /**
144
- * Disallow duplicate imports
73
+ * Disallow duplicate imports. 🔧
145
74
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-duplicates.md.
146
75
  */
147
- "import/no-duplicates": "error",
76
+ "import/no-duplicates": ["error", { "prefer-inline": false }],
148
77
 
149
78
  /**
150
79
  * Forbid require() calls with expressions
@@ -153,53 +82,11 @@ export default {
153
82
  "import/no-dynamic-require": "error",
154
83
 
155
84
  /**
156
- * Forbid the use of extraneous packages
157
- * paths are treated both as absolute paths, and relative to process.cwd()
158
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-extraneous-dependencies.md.
159
- */
160
- // "import/no-extraneous-dependencies": [
161
- // "off",
162
- // {
163
- // devDependencies: [
164
- // "test/**", // tape, common npm pattern
165
- // "tests/**", // also common npm pattern
166
- // "spec/**", // mocha, rspec-like pattern
167
- // "**/__tests__/**", // jest pattern
168
- // "**/__mocks__/**", // jest pattern
169
- // "test.{js,jsx}", // repos with a single test file
170
- // "test-*.{js,jsx}", // repos with multiple top-level test files
171
- // "**/*{.,_}{test,spec}.{js,jsx}", // tests where the extension or filename suffix denotes that it is a test
172
- // "**/jest.config.js", // jest config
173
- // "**/jest.setup.js", // jest setup
174
- // "**/vue.config.js", // vue-cli config
175
- // "**/webpack.config.js", // webpack config
176
- // "**/webpack.config.*.js", // webpack config
177
- // "**/rollup.config.js", // rollup config
178
- // "**/rollup.config.*.js", // rollup config
179
- // "**/gulpfile.js", // gulp config
180
- // "**/gulpfile.*.js", // gulp config
181
- // "**/Gruntfile{,.js}", // grunt config
182
- // "**/protractor.conf.js", // protractor config
183
- // "**/protractor.conf.*.js", // protractor config
184
- // "**/karma.conf.js", // karma config
185
- // "**/.eslintrc.js", // eslint config
186
- // ],
187
- // optionalDependencies: false,
188
- // },
189
- // ],
190
-
191
- /**
192
- * Reports the use of import declarations with CommonJS exports in any module except for the main module.
193
- * Https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md.
85
+ * Reports the use of import declarations with CommonJS exports in any module except for the main module. ✅ 🔧
86
+ * Https://github.com/benmosher/eslint-plugin-import/blob/main/docs/rules/no-import-module-exports.md.
194
87
  */
195
88
  "import/no-import-module-exports": ["error", { exceptions: [] }],
196
89
 
197
- /**
198
- * Prevent importing the submodules of other modules
199
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-internal-modules.md.
200
- */
201
- // "import/no-internal-modules": ["off", { allow: [] }],
202
-
203
90
  /**
204
91
  * Forbid mutable exports
205
92
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-mutable-exports.md.
@@ -225,74 +112,23 @@ export default {
225
112
  "import/no-named-default": "error",
226
113
 
227
114
  /**
228
- * Prohibit named exports. This is a terrible rule, do not use it.
229
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-export.md.
230
- */
231
- // "import/no-named-export": "off",
232
-
233
- /**
234
- * Disallow namespace imports
235
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-namespace.md.
236
- */
237
- // "import/no-namespace": "off",
238
-
239
- /**
240
- * No Node.js builtin modules
241
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-nodejs-modules.md.
242
- */
243
- // "import/no-nodejs-modules": "off",
244
-
245
- /**
246
- * Use this rule to prevent importing packages through relative paths.
115
+ * Use this rule to prevent importing packages through relative paths. 🔧
247
116
  * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md.
248
117
  */
249
118
  "import/no-relative-packages": "error",
250
119
 
251
120
  /**
252
- * Use this rule to prevent imports to folders in relative parent paths.
253
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-parent-imports.md.
254
- */
255
- // "import/no-relative-parent-imports": "off",
256
-
257
- /**
258
- * Restrict which files can be imported in a given folder
259
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-restricted-paths.md.
260
- */
261
- // "import/no-restricted-paths": "off",
262
-
263
- /**
264
- * Forbid a module from importing itself
121
+ * Forbid a module from importing itself ✅
265
122
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-self-import.md.
266
123
  */
267
124
  "import/no-self-import": "error",
268
125
 
269
- /**
270
- * Prevent unassigned imports
271
- * importing for side effects is perfectly acceptable, if you need side effects.
272
- * Https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unassigned-import.md.
273
- */
274
- // "import/no-unassigned-import": "off",
275
-
276
126
  /**
277
127
  * Ensure imports point to files/modules that can be resolved
278
128
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unresolved.md.
279
129
  */
280
130
  "import/no-unresolved": ["error", { commonjs: true, caseSensitive: true }],
281
131
 
282
- /**
283
- * Reports modules without any exports, or with unused exports
284
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-unused-modules.md
285
- * TODO: enable once it supports CJS.
286
- */
287
- // "import/no-unused-modules": [
288
- // "off",
289
- // {
290
- // ignoreExports: [],
291
- // missingExports: true,
292
- // unusedExports: true,
293
- // },
294
- // ],
295
-
296
132
  /**
297
133
  * Ensures that there are no useless path segments
298
134
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md.
@@ -306,13 +142,13 @@ export default {
306
142
  "import/no-webpack-loader-syntax": "error",
307
143
 
308
144
  /**
309
- * Ensure absolute imports are above relative imports and that unassigned imports are ignored
145
+ * Ensure absolute imports are above relative imports and that unassigned imports are ignored. 🔧
310
146
  * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md.
311
147
  */
312
148
  "import/order": [
313
149
  "error",
314
150
  {
315
- groups: [["builtin", "external", "internal"]],
151
+ groups: [["builtin", "external", "internal"], ["sibling", "parent", "index"]],
316
152
  pathGroups: [
317
153
  {
318
154
  pattern: "react",
@@ -323,20 +159,5 @@ export default {
323
159
  alphabetize: { order: "asc", caseInsensitive: true },
324
160
  },
325
161
  ],
326
-
327
- /**
328
- * Require modules with a single export to use a default export
329
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/prefer-default-export.md.
330
- */
331
- // "import/prefer-default-export": "off",
332
-
333
- /**
334
- * Warn if a module could be mistakenly parsed as a script by a consumer
335
- * leveraging Unambiguous JavaScript Grammar
336
- * https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/unambiguous.md
337
- * this should not be enabled until this proposal has at least been *presented* to TC39.
338
- * At the moment, it"s not a thing.
339
- */
340
- // "import/unambiguous": "off",
341
162
  },
342
163
  };