@mimica/eslint-config 2.8.0 → 3.0.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.
Files changed (3) hide show
  1. package/index.mjs +334 -0
  2. package/package.json +4 -3
  3. package/index.js +0 -294
package/index.mjs ADDED
@@ -0,0 +1,334 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+
4
+ import js from "@eslint/js";
5
+ import { FlatCompat } from "@eslint/eslintrc";
6
+
7
+ import babelParser from "@babel/eslint-parser";
8
+ import eslintComments from "eslint-plugin-eslint-comments";
9
+ import unicorn from "eslint-plugin-unicorn";
10
+ import sonarjs from "eslint-plugin-sonarjs";
11
+ import promise from "eslint-plugin-promise";
12
+ import youDontNeedLodashUnderscore from "eslint-plugin-you-dont-need-lodash-underscore";
13
+ import inker from "eslint-plugin-inker";
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const compat = new FlatCompat({
18
+ baseDirectory: __dirname,
19
+ recommendedConfig: js.configs.recommended,
20
+ allConfig: js.configs.all,
21
+ });
22
+
23
+ export default [
24
+ ...compat.extends("airbnb-base"),
25
+ unicorn.configs["flat/recommended"],
26
+ {
27
+ plugins: {
28
+ sonarjs,
29
+ unicorn,
30
+ inker,
31
+ promise,
32
+ "you-dont-need-lodash-underscore": youDontNeedLodashUnderscore,
33
+ "eslint-comments": eslintComments,
34
+ },
35
+
36
+ languageOptions: {
37
+ globals: {},
38
+ parser: babelParser,
39
+ ecmaVersion: 5,
40
+ sourceType: "script",
41
+
42
+ parserOptions: {
43
+ requireConfigFile: false,
44
+ },
45
+ },
46
+
47
+ rules: {
48
+ "arrow-parens": 0,
49
+
50
+ camelcase: [
51
+ 1,
52
+ {
53
+ allow: [],
54
+ },
55
+ ],
56
+
57
+ "consistent-return": 0,
58
+ curly: [2, "all"],
59
+ "function-paren-newline": [0, "never"],
60
+ "guard-for-in": 1,
61
+ "implicit-arrow-linebreak": 0,
62
+ indent: 0,
63
+
64
+ "lines-between-class-members": [
65
+ 2,
66
+ "always",
67
+ {
68
+ exceptAfterSingleLine: true,
69
+ },
70
+ ],
71
+
72
+ "max-params": 2,
73
+ "no-confusing-arrow": 0,
74
+ "no-console": 2,
75
+ "no-continue": 0,
76
+ "no-loop-func": 1,
77
+
78
+ "no-param-reassign": [
79
+ 2,
80
+ {
81
+ props: false,
82
+ },
83
+ ],
84
+
85
+ "no-plusplus": 0,
86
+
87
+ "no-restricted-syntax": [
88
+ 2,
89
+ "ForInStatement",
90
+ "LabeledStatement",
91
+ "WithStatement",
92
+ {
93
+ selector:
94
+ ':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
95
+ message: "Use #private instead.",
96
+ },
97
+ ],
98
+
99
+ "no-underscore-dangle": 0,
100
+ "no-unused-private-class-members": 2,
101
+
102
+ "no-unused-vars": [
103
+ 2,
104
+ {
105
+ args: "none",
106
+ },
107
+ ],
108
+
109
+ "no-useless-escape": 2,
110
+ "object-curly-newline": 0,
111
+ "operator-linebreak": 0,
112
+
113
+ "padding-line-between-statements": [
114
+ 2,
115
+ {
116
+ blankLine: "always",
117
+ prev: "*",
118
+ next: "function",
119
+ },
120
+ {
121
+ blankLine: "always",
122
+ prev: "function",
123
+ next: "*",
124
+ },
125
+ {
126
+ blankLine: "always",
127
+ prev: "*",
128
+ next: "class",
129
+ },
130
+ {
131
+ blankLine: "always",
132
+ prev: "class",
133
+ next: "*",
134
+ },
135
+ {
136
+ blankLine: "always",
137
+ prev: "cjs-export",
138
+ next: "*",
139
+ },
140
+ {
141
+ blankLine: "always",
142
+ prev: "*",
143
+ next: "cjs-export",
144
+ },
145
+ ],
146
+
147
+ "prefer-destructuring": [
148
+ 2,
149
+ {
150
+ array: false,
151
+ object: true,
152
+ },
153
+ ],
154
+
155
+ quotes: [0, "double"],
156
+ semi: [2, "always"],
157
+ "sonarjs/no-inverted-boolean-check": 2,
158
+ "sonarjs/prefer-immediate-return": 2,
159
+ "sonarjs/prefer-while": 2,
160
+ "unicorn/better-regex": 2,
161
+
162
+ "unicorn/catch-error-name": [
163
+ 2,
164
+ {
165
+ name: "err",
166
+ ignore: ["error"],
167
+ },
168
+ ],
169
+
170
+ "unicorn/consistent-destructuring": 2,
171
+ "unicorn/consistent-existence-index-check": 0,
172
+ "unicorn/consistent-function-scoping": 0,
173
+ "unicorn/custom-error-definition": 2,
174
+ "unicorn/empty-brace-spaces": 0,
175
+ "unicorn/explicit-length-check": 0,
176
+ "unicorn/filename-case": 0,
177
+ "unicorn/import-style": 0,
178
+ "unicorn/no-anonymous-default-export": 0,
179
+ "unicorn/no-array-callback-reference": 0,
180
+
181
+ "unicorn/no-array-reduce": [
182
+ 2,
183
+ {
184
+ allowSimpleOperations: false,
185
+ },
186
+ ],
187
+
188
+ "unicorn/no-nested-ternary": 0,
189
+ "unicorn/no-null": 0,
190
+ "unicorn/no-process-exit": 0,
191
+ "unicorn/no-useless-undefined": 0,
192
+ "unicorn/numeric-separators-style": 0,
193
+ "unicorn/prefer-add-event-listener": 0,
194
+ "unicorn/prefer-module": 0,
195
+ "unicorn/prefer-query-selector": 0,
196
+ "unicorn/prefer-set-has": 0,
197
+ "unicorn/prefer-spread": 0,
198
+ "unicorn/prefer-switch": 0,
199
+ "unicorn/prefer-ternary": 0,
200
+ "unicorn/prefer-top-level-await": 0,
201
+ "unicorn/prevent-abbreviations": 0,
202
+ "unicorn/switch-case-braces": 0,
203
+
204
+ "inker/enforce-import-name": [
205
+ 2,
206
+ {
207
+ paths: [
208
+ {
209
+ name: "path",
210
+
211
+ importNames: [
212
+ {
213
+ imported: "namespace",
214
+ local: "Path",
215
+ },
216
+ {
217
+ imported: "default",
218
+ local: "Path",
219
+ },
220
+ ],
221
+ },
222
+ {
223
+ name: "date-fns",
224
+
225
+ importNames: [
226
+ {
227
+ imported: "format",
228
+ local: "formatDate",
229
+ },
230
+ {
231
+ imported: "isValid",
232
+ local: "isDateValid",
233
+ },
234
+ ],
235
+ },
236
+ {
237
+ name: "joi",
238
+
239
+ importNames: [
240
+ {
241
+ imported: "default",
242
+ local: "Joi",
243
+ },
244
+ ],
245
+ },
246
+ {
247
+ name: "lodash",
248
+
249
+ importNames: [
250
+ {
251
+ imported: "namespace",
252
+ local: "_",
253
+ },
254
+ {
255
+ imported: "default",
256
+ local: "_",
257
+ },
258
+ ],
259
+ },
260
+ ],
261
+ },
262
+ ],
263
+
264
+ "inker/no-true-as-default": 2,
265
+
266
+ "import/order": [
267
+ 2,
268
+ {
269
+ groups: [
270
+ "builtin",
271
+ "external",
272
+ "internal",
273
+ "parent",
274
+ "sibling",
275
+ "index",
276
+ ],
277
+ "newlines-between": "always",
278
+ distinctGroup: false,
279
+ warnOnUnassignedImports: true,
280
+ },
281
+ ],
282
+
283
+ "promise/no-new-statics": 2,
284
+ "promise/no-return-wrap": 2,
285
+ "promise/param-names": 2,
286
+ "promise/prefer-await-to-then": 2,
287
+ "promise/valid-params": 2,
288
+ "you-dont-need-lodash-underscore/concat": 2,
289
+ "you-dont-need-lodash-underscore/drop": 2,
290
+ "you-dont-need-lodash-underscore/drop-right": 2,
291
+ "you-dont-need-lodash-underscore/fill": 2,
292
+ "you-dont-need-lodash-underscore/find": 2,
293
+ "you-dont-need-lodash-underscore/find-index": 2,
294
+ "you-dont-need-lodash-underscore/index-of": 2,
295
+ "you-dont-need-lodash-underscore/is-array": 2,
296
+ "you-dont-need-lodash-underscore/join": 2,
297
+ "you-dont-need-lodash-underscore/last-index-of": 2,
298
+ "you-dont-need-lodash-underscore/slice": 2,
299
+ "you-dont-need-lodash-underscore/each": 2,
300
+ "you-dont-need-lodash-underscore/every": 2,
301
+ "you-dont-need-lodash-underscore/filter": 2,
302
+ "you-dont-need-lodash-underscore/includes": 2,
303
+ "you-dont-need-lodash-underscore/is-nil": 2,
304
+ "you-dont-need-lodash-underscore/map": 2,
305
+ "you-dont-need-lodash-underscore/reduce": 2,
306
+ "you-dont-need-lodash-underscore/reduce-right": 2,
307
+ "you-dont-need-lodash-underscore/size": 2,
308
+ "you-dont-need-lodash-underscore/some": 2,
309
+ "you-dont-need-lodash-underscore/bind": 2,
310
+ "you-dont-need-lodash-underscore/is-finite": 2,
311
+ "you-dont-need-lodash-underscore/is-integer": 2,
312
+ "you-dont-need-lodash-underscore/is-nan": 2,
313
+ "you-dont-need-lodash-underscore/assign": 2,
314
+ "you-dont-need-lodash-underscore/keys": 2,
315
+ "you-dont-need-lodash-underscore/to-pairs": 2,
316
+ "you-dont-need-lodash-underscore/values": 2,
317
+ "you-dont-need-lodash-underscore/ends-with": 2,
318
+ "you-dont-need-lodash-underscore/pad-start": 2,
319
+ "you-dont-need-lodash-underscore/pad-end": 2,
320
+ "you-dont-need-lodash-underscore/repeat": 2,
321
+ "you-dont-need-lodash-underscore/replace": 2,
322
+ "you-dont-need-lodash-underscore/split": 2,
323
+ "you-dont-need-lodash-underscore/starts-with": 2,
324
+ "eslint-comments/no-unused-disable": 2,
325
+
326
+ "eslint-comments/no-use": [
327
+ 2,
328
+ {
329
+ allow: ["eslint-disable", "eslint-disable-next-line"],
330
+ },
331
+ ],
332
+ },
333
+ },
334
+ ];
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@mimica/eslint-config",
3
- "version": "2.8.0",
3
+ "version": "3.0.1",
4
4
  "description": "Mimica eslint config",
5
- "main": "index.js",
5
+ "main": "index.mjs",
6
+ "module": "index.mjs",
6
7
  "scripts": {
7
8
  "test": "exit 0",
8
9
  "prepublishOnly": "npm run lint-prettier",
@@ -30,7 +31,7 @@
30
31
  "eslint-plugin-import": "^2.26.0",
31
32
  "eslint-plugin-inker": "^2.2.2",
32
33
  "eslint-plugin-promise": "^7.1.0",
33
- "eslint-plugin-sonarjs": "^2.0.1",
34
+ "eslint-plugin-sonarjs": "^3.0.1",
34
35
  "eslint-plugin-unicorn": "^56.0.0",
35
36
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0"
36
37
  },
package/index.js DELETED
@@ -1,294 +0,0 @@
1
- module.exports = {
2
- extends: ["airbnb-base", "plugin:unicorn/recommended"],
3
- env: {
4
- es6: true,
5
- },
6
- plugins: [
7
- "sonarjs",
8
- "unicorn",
9
- "inker",
10
- "promise",
11
- "you-dont-need-lodash-underscore",
12
- "eslint-comments",
13
- ],
14
- parser: "@babel/eslint-parser",
15
- parserOptions: {
16
- requireConfigFile: false,
17
- },
18
- rules: {
19
- "arrow-parens": 0, // TODO: do not disable "arrow-parens" rule
20
- camelcase: [
21
- 1,
22
- {
23
- allow: [],
24
- },
25
- ],
26
- "consistent-return": 0,
27
- curly: [2, "all"],
28
- "function-paren-newline": [0, "never"],
29
- "guard-for-in": 1,
30
- "implicit-arrow-linebreak": 0,
31
- indent: 0,
32
- "lines-between-class-members": [
33
- 2,
34
- "always",
35
- {
36
- exceptAfterSingleLine: true,
37
- },
38
- ],
39
- "max-params": 2,
40
- "no-confusing-arrow": 0,
41
- "no-console": 2,
42
- "no-continue": 0,
43
- "no-loop-func": 1,
44
- "no-param-reassign": [
45
- 2,
46
- {
47
- props: false,
48
- },
49
- ],
50
- "no-plusplus": 0,
51
- "no-restricted-syntax": [
52
- 2,
53
- "ForInStatement",
54
- "LabeledStatement",
55
- "WithStatement",
56
- {
57
- selector:
58
- ':matches(PropertyDefinition, MethodDefinition)[accessibility="private"]',
59
- message: "Use #private instead.",
60
- },
61
- ],
62
- "no-underscore-dangle": 0,
63
- "no-unused-private-class-members": 2,
64
- "no-unused-vars": [2, { args: "none" }],
65
- "no-useless-escape": 2,
66
- "object-curly-newline": 0,
67
- "operator-linebreak": 0,
68
- "padding-line-between-statements": [
69
- 2,
70
- {
71
- blankLine: "always",
72
- prev: "*",
73
- next: "function",
74
- },
75
- {
76
- blankLine: "always",
77
- prev: "function",
78
- next: "*",
79
- },
80
- {
81
- blankLine: "always",
82
- prev: "*",
83
- next: "class",
84
- },
85
- {
86
- blankLine: "always",
87
- prev: "class",
88
- next: "*",
89
- },
90
- {
91
- blankLine: "always",
92
- prev: "cjs-export",
93
- next: "*",
94
- },
95
- {
96
- blankLine: "always",
97
- prev: "*",
98
- next: "cjs-export",
99
- },
100
- ],
101
- "prefer-destructuring": [
102
- 2,
103
- {
104
- array: false,
105
- object: true,
106
- },
107
- ],
108
- quotes: [0, "double"],
109
- semi: [2, "always"],
110
-
111
- "sonarjs/no-inverted-boolean-check": 2,
112
- "sonarjs/prefer-immediate-return": 2,
113
- "sonarjs/prefer-while": 2,
114
-
115
- "unicorn/better-regex": 2,
116
- "unicorn/catch-error-name": [
117
- 2,
118
- {
119
- name: "err",
120
- ignore: ["error"],
121
- },
122
- ],
123
- "unicorn/consistent-destructuring": 2,
124
- "unicorn/consistent-existence-index-check": 0,
125
- "unicorn/consistent-function-scoping": 0,
126
- "unicorn/custom-error-definition": 2,
127
- "unicorn/empty-brace-spaces": 0,
128
- "unicorn/explicit-length-check": 0,
129
- "unicorn/filename-case": 0,
130
- "unicorn/import-style": 0,
131
- "unicorn/no-anonymous-default-export": 0,
132
- "unicorn/no-array-callback-reference": 0,
133
- "unicorn/no-array-reduce": [
134
- 2,
135
- {
136
- allowSimpleOperations: false,
137
- },
138
- ],
139
- "unicorn/no-nested-ternary": 0,
140
- "unicorn/no-null": 0,
141
- "unicorn/no-process-exit": 0,
142
- "unicorn/no-useless-undefined": 0, // TODO: enable
143
- "unicorn/numeric-separators-style": 0,
144
- "unicorn/prefer-add-event-listener": 0, // TODO: enable
145
- "unicorn/prefer-module": 0,
146
- "unicorn/prefer-query-selector": 0,
147
- "unicorn/prefer-set-has": 0, // TODO: enable
148
- "unicorn/prefer-spread": 0, // TODO: enable
149
- "unicorn/prefer-switch": 0,
150
- "unicorn/prefer-ternary": 0, // TODO: enable
151
- "unicorn/prefer-top-level-await": 0,
152
- "unicorn/prevent-abbreviations": 0,
153
- "unicorn/switch-case-braces": 0,
154
- // "unicorn/template-indent": [
155
- // 2,
156
- // {
157
- // selectors: ["TemplateLiteral"],
158
- // comments: ["sql"],
159
- // },
160
- // ],
161
-
162
- "inker/enforce-import-name": [
163
- 2,
164
- {
165
- paths: [
166
- {
167
- name: "path",
168
- importNames: [
169
- {
170
- imported: "namespace",
171
- local: "Path",
172
- },
173
- {
174
- imported: "default",
175
- local: "Path",
176
- },
177
- ],
178
- },
179
- {
180
- name: "date-fns",
181
- importNames: [
182
- {
183
- imported: "format",
184
- local: "formatDate",
185
- },
186
- {
187
- imported: "isValid",
188
- local: "isDateValid",
189
- },
190
- ],
191
- },
192
- {
193
- name: "joi",
194
- importNames: [
195
- {
196
- imported: "default",
197
- local: "Joi",
198
- },
199
- ],
200
- },
201
- {
202
- name: "lodash",
203
- importNames: [
204
- {
205
- imported: "namespace",
206
- local: "_",
207
- },
208
- {
209
- imported: "default",
210
- local: "_",
211
- },
212
- ],
213
- },
214
- ],
215
- },
216
- ],
217
- "inker/no-true-as-default": 2,
218
-
219
- "import/order": [
220
- 2,
221
- {
222
- groups: [
223
- "builtin",
224
- "external",
225
- "internal",
226
- "parent",
227
- "sibling",
228
- "index",
229
- ],
230
- "newlines-between": "always",
231
- distinctGroup: false,
232
- warnOnUnassignedImports: true,
233
- },
234
- ],
235
-
236
- // "promise/catch-or-return": 2,
237
- "promise/no-new-statics": 2,
238
- "promise/no-return-wrap": 2,
239
- "promise/param-names": 2,
240
- "promise/prefer-await-to-then": 2,
241
- "promise/valid-params": 2,
242
-
243
- "you-dont-need-lodash-underscore/concat": 2,
244
- "you-dont-need-lodash-underscore/drop": 2,
245
- "you-dont-need-lodash-underscore/drop-right": 2,
246
- "you-dont-need-lodash-underscore/fill": 2,
247
- "you-dont-need-lodash-underscore/find": 2,
248
- "you-dont-need-lodash-underscore/find-index": 2,
249
- // "you-dont-need-lodash-underscore/from-pairs": 2,
250
- "you-dont-need-lodash-underscore/index-of": 2,
251
- "you-dont-need-lodash-underscore/is-array": 2,
252
- // "you-dont-need-lodash-underscore/is-array-buffer": 2,
253
- "you-dont-need-lodash-underscore/join": 2,
254
- "you-dont-need-lodash-underscore/last-index-of": 2,
255
- "you-dont-need-lodash-underscore/slice": 2,
256
- "you-dont-need-lodash-underscore/each": 2,
257
- "you-dont-need-lodash-underscore/every": 2,
258
- "you-dont-need-lodash-underscore/filter": 2,
259
- "you-dont-need-lodash-underscore/includes": 2,
260
- "you-dont-need-lodash-underscore/is-nil": 2,
261
- "you-dont-need-lodash-underscore/map": 2,
262
- // "you-dont-need-lodash-underscore/pluck": 2,
263
- "you-dont-need-lodash-underscore/reduce": 2,
264
- "you-dont-need-lodash-underscore/reduce-right": 2,
265
- "you-dont-need-lodash-underscore/size": 2,
266
- "you-dont-need-lodash-underscore/some": 2,
267
- "you-dont-need-lodash-underscore/bind": 2,
268
- // "you-dont-need-lodash-underscore/partial": 2,
269
- "you-dont-need-lodash-underscore/is-finite": 2,
270
- "you-dont-need-lodash-underscore/is-integer": 2,
271
- "you-dont-need-lodash-underscore/is-nan": 2,
272
- "you-dont-need-lodash-underscore/assign": 2,
273
- // "you-dont-need-lodash-underscore/extend": 2,
274
- "you-dont-need-lodash-underscore/keys": 2,
275
- "you-dont-need-lodash-underscore/to-pairs": 2,
276
- "you-dont-need-lodash-underscore/values": 2,
277
- "you-dont-need-lodash-underscore/ends-with": 2,
278
- "you-dont-need-lodash-underscore/pad-start": 2,
279
- "you-dont-need-lodash-underscore/pad-end": 2,
280
- "you-dont-need-lodash-underscore/repeat": 2,
281
- "you-dont-need-lodash-underscore/replace": 2,
282
- "you-dont-need-lodash-underscore/split": 2,
283
- "you-dont-need-lodash-underscore/starts-with": 2,
284
- // "you-dont-need-lodash-underscore/template": 2,
285
-
286
- "eslint-comments/no-unused-disable": 2,
287
- "eslint-comments/no-use": [
288
- 2,
289
- {
290
- allow: ["eslint-disable", "eslint-disable-next-line"],
291
- },
292
- ],
293
- },
294
- };