@averay/codeformat 0.1.14 → 0.2.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.
@@ -1,753 +0,0 @@
1
- export { default as globals } from 'globals';
2
- import typescriptPlugin from '@typescript-eslint/eslint-plugin';
3
- import typescriptParser from '@typescript-eslint/parser';
4
- import prettierConfig from 'eslint-config-prettier';
5
- import eslintCommentsPlugin from 'eslint-plugin-eslint-comments';
6
- import importPlugin from 'eslint-plugin-import';
7
- import jsdocPlugin from 'eslint-plugin-jsdoc';
8
- import promisePlugin from 'eslint-plugin-promise';
9
- import regexpPlugin from 'eslint-plugin-regexp';
10
- import sonarjsPlugin from 'eslint-plugin-sonarjs';
11
- import unicornPlugin from 'eslint-plugin-unicorn';
12
- import js from '@eslint/js';
13
- import postcssScss from 'postcss-scss';
14
- import orderPlugin from 'stylelint-order';
15
- import scssPlugin from 'stylelint-scss';
16
- import recommended from 'stylelint-config-recommended';
17
- import standard from 'stylelint-config-standard';
18
- import recommended$1 from 'stylelint-config-recommended-scss';
19
- import standard$1 from 'stylelint-config-standard-scss';
20
-
21
- var extensions = {
22
- js: ['js', 'jsx', 'cjs', 'cjs', 'mjs', 'mjsx'],
23
- ts: ['ts', 'tsx', 'cts', 'cts', 'mts', 'mtsx'],
24
- css: ['css'],
25
- scss: ['scss']
26
- };
27
-
28
- function _extends() {
29
- _extends = Object.assign ? Object.assign.bind() : function (target) {
30
- for (var i = 1; i < arguments.length; i++) {
31
- var source = arguments[i];
32
- for (var key in source) {
33
- if (Object.prototype.hasOwnProperty.call(source, key)) {
34
- target[key] = source[key];
35
- }
36
- }
37
- }
38
- return target;
39
- };
40
- return _extends.apply(this, arguments);
41
- }
42
-
43
- function convertWarnsToErrors(ruleset) {
44
- const rulesetProcessed = {};
45
- for (const [key, value] of Object.entries(ruleset)) {
46
- const processedValue = Array.isArray(value) ? [...value] : [value];
47
- if (processedValue[0] === 'warn' || processedValue[0] === 1) {
48
- processedValue[0] = 'error';
49
- }
50
- rulesetProcessed[key] = processedValue;
51
- }
52
- return rulesetProcessed;
53
- }
54
-
55
- var rulesetEslintShared = _extends({}, {
56
- 'accessor-pairs': ['error', {
57
- setWithoutGet: true
58
- }],
59
- 'array-callback-return': 'error',
60
- 'block-scoped-var': 'error',
61
- 'capitalized-comments': ['error', 'always', {
62
- ignoreConsecutiveComments: true
63
- }],
64
- 'consistent-return': 'error',
65
- 'consistent-this': ['error', '_this'],
66
- 'constructor-super': 'error',
67
- 'default-case': 'error',
68
- 'default-case-last': 'error',
69
- 'default-param-last': 'error',
70
- 'dot-notation': 'error',
71
- eqeqeq: ['error', 'always', {
72
- null: 'ignore'
73
- }],
74
- 'for-direction': 'error',
75
- 'func-names': ['error', 'as-needed'],
76
- 'func-style': ['error', 'declaration', {
77
- allowArrowFunctions: true
78
- }],
79
- 'getter-return': 'error',
80
- 'global-require': 'error',
81
- 'grouped-accessor-pairs': ['error', 'getBeforeSet'],
82
- 'guard-for-in': 'error',
83
- 'id-denylist': ['error', 'cb', 'e', 'enc', 'err', 'evt'],
84
- 'lines-between-class-members': 'error',
85
- 'logical-assignment-operators': ['error', 'always'],
86
- 'max-classes-per-file': ['error', 1],
87
- 'max-statements-per-line': 'error',
88
- 'multiline-comment-style': 'error',
89
- 'new-cap': ['error', {
90
- properties: true
91
- }],
92
- 'no-alert': 'error',
93
- 'no-array-constructor': 'error',
94
- 'no-async-promise-executor': 'error',
95
- 'no-await-in-loop': 'error',
96
- 'no-bitwise': 'error',
97
- 'no-buffer-constructor': 'error',
98
- 'no-caller': 'error',
99
- 'no-case-declarations': 'error',
100
- 'no-class-assign': 'error',
101
- 'no-compare-neg-zero': 'error',
102
- 'no-cond-assign': 'error',
103
- 'no-const-assign': 'error',
104
- 'no-constant-binary-expression': 'error',
105
- 'no-constant-condition': 'error',
106
- 'no-constructor-return': 'error',
107
- 'no-control-regex': 'error',
108
- 'no-debugger': 'error',
109
- 'no-delete-var': 'error',
110
- 'no-div-regex': 'error',
111
- 'no-dupe-args': 'error',
112
- 'no-dupe-class-members': 'error',
113
- 'no-dupe-else-if': 'error',
114
- 'no-dupe-keys': 'error',
115
- 'no-duplicate-case': 'error',
116
- 'no-duplicate-imports': 'error',
117
- 'no-empty': 'error',
118
- 'no-empty-character-class': 'error',
119
- 'no-empty-function': 'error',
120
- 'no-empty-pattern': 'error',
121
- 'no-empty-static-block': 'error',
122
- 'no-eval': 'error',
123
- 'no-ex-assign': 'error',
124
- 'no-extend-native': 'error',
125
- 'no-extra-bind': 'error',
126
- 'no-extra-boolean-cast': 'error',
127
- 'no-extra-label': 'error',
128
- 'no-fallthrough': 'error',
129
- 'no-func-assign': 'error',
130
- 'no-global-assign': 'error',
131
- 'no-implicit-coercion': 'error',
132
- 'no-implicit-globals': 'error',
133
- 'no-implied-eval': 'error',
134
- 'no-import-assign': 'error',
135
- 'no-inner-declarations': 'error',
136
- 'no-invalid-regexp': 'error',
137
- 'no-invalid-this': 'error',
138
- 'no-irregular-whitespace': 'error',
139
- 'no-iterator': 'error',
140
- 'no-label-var': 'error',
141
- 'no-labels': ['error', {
142
- allowLoop: true
143
- }],
144
- 'no-lone-blocks': 'error',
145
- 'no-loop-func': 'error',
146
- 'no-loss-of-precision': 'error',
147
- 'no-magic-numbers': ['error', {
148
- detectObjects: true,
149
- enforceConst: true,
150
- ignore: [-1, 0, 1],
151
- ignoreArrayIndexes: true,
152
- ignoreClassFieldInitialValues: true,
153
- ignoreDefaultValues: true
154
- }],
155
- 'no-misleading-character-class': 'error',
156
- 'no-mixed-requires': 'error',
157
- 'no-multi-assign': 'error',
158
- 'no-multi-str': 'error',
159
- 'no-nested-ternary': 'error',
160
- 'no-new': 'error',
161
- 'no-new-func': 'error',
162
- 'no-new-native-nonconstructor': 'error',
163
- 'no-new-object': 'error',
164
- 'no-new-require': 'error',
165
- 'no-new-symbol': 'error',
166
- 'no-new-wrappers': 'error',
167
- 'no-nonoctal-decimal-escape': 'error',
168
- 'no-obj-calls': 'error',
169
- 'no-octal': 'error',
170
- 'no-octal-escape': 'error',
171
- 'no-path-concat': 'error',
172
- 'no-plusplus': 'error',
173
- 'no-process-env': 'error',
174
- 'no-process-exit': 'error',
175
- 'no-promise-executor-return': 'error',
176
- 'no-proto': 'error',
177
- 'no-prototype-builtins': 'error',
178
- 'no-redeclare': 'error',
179
- 'no-regex-spaces': 'error',
180
- 'no-restricted-globals': ['error', 'event'],
181
- 'no-restricted-syntax': ['error', 'WithStatement', "BinaryExpression[operator='in']"],
182
- 'no-return-assign': 'error',
183
- 'no-return-await': 'error',
184
- 'no-script-url': 'error',
185
- 'no-self-assign': 'error',
186
- 'no-self-compare': 'error',
187
- 'no-sequences': 'error',
188
- 'no-setter-return': 'error',
189
- 'no-shadow': ['error', {
190
- hoist: 'all'
191
- }],
192
- 'no-shadow-restricted-names': 'error',
193
- 'no-sparse-arrays': 'error',
194
- 'no-template-curly-in-string': 'error',
195
- 'no-this-before-super': 'error',
196
- 'no-throw-literal': 'error',
197
- 'no-undef': 'error',
198
- 'no-undef-init': 'error',
199
- 'no-underscore-dangle': ['error', {
200
- allow: ['_', '_this', '_1', '_2', '_3', '_4', '_5', '_6', '_7', '_8', '_9'],
201
- allowAfterSuper: true,
202
- allowAfterThis: true,
203
- allowAfterThisConstructor: true,
204
- allowFunctionParams: false,
205
- allowInArrayDestructuring: false,
206
- enforceInClassFields: true,
207
- enforceInMethodNames: true
208
- }],
209
- 'no-unmodified-loop-condition': 'error',
210
- 'no-unneeded-ternary': 'error',
211
- 'no-unreachable': 'error',
212
- 'no-unreachable-loop': 'error',
213
- 'no-unsafe-finally': 'error',
214
- 'no-unsafe-negation': 'error',
215
- 'no-unsafe-optional-chaining': 'error',
216
- 'no-unused-expressions': 'error',
217
- 'no-unused-labels': 'error',
218
- 'no-unused-private-class-members': 'error',
219
- 'no-unused-vars': ['error', {
220
- argsIgnorePattern: '^_\\w*$',
221
- caughtErrorsIgnorePattern: '^_\\w*$',
222
- varsIgnorePattern: '^(_\\d*|React)$'
223
- }],
224
- 'no-use-before-define': 'error',
225
- 'no-useless-backreference': 'error',
226
- 'no-useless-call': 'error',
227
- 'no-useless-catch': 'error',
228
- 'no-useless-computed-key': ['error', {
229
- enforceForClassMembers: true
230
- }],
231
- 'no-useless-concat': 'error',
232
- 'no-useless-constructor': 'error',
233
- 'no-useless-escape': 'error',
234
- 'no-useless-rename': 'error',
235
- 'no-useless-return': 'error',
236
- 'no-var': 'error',
237
- 'no-void': 'error',
238
- 'no-with': 'error',
239
- 'object-shorthand': ['error', 'always', {
240
- avoidExplicitReturnArrows: true,
241
- avoidQuotes: true
242
- }],
243
- 'one-var': ['error', 'never'],
244
- 'operator-assignment': 'error',
245
- 'padding-line-between-statements': ['error', /* eslint-disable sort-keys -- Logically ordered */
246
- {
247
- blankLine: 'always',
248
- prev: 'directive',
249
- next: '*'
250
- }, {
251
- blankLine: 'always',
252
- prev: 'function',
253
- next: 'function'
254
- }
255
- /* eslint-enable sort-keys -- Restore */],
256
-
257
- 'prefer-arrow-callback': 'error',
258
- 'prefer-const': 'error',
259
- 'prefer-destructuring': 'error',
260
- 'prefer-exponentiation-operator': 'error',
261
- 'prefer-numeric-literals': 'error',
262
- 'prefer-object-spread': 'error',
263
- 'prefer-promise-reject-errors': 'error',
264
- 'prefer-regex-literals': ['error', {
265
- disallowRedundantWrapping: true
266
- }],
267
- 'prefer-rest-params': 'error',
268
- 'prefer-spread': 'error',
269
- 'prefer-template': 'error',
270
- radix: 'error',
271
- 'require-atomic-updates': 'error',
272
- 'require-unicode-regexp': 'error',
273
- 'require-yield': 'error',
274
- 'spaced-comment': 'error',
275
- 'symbol-description': 'error',
276
- 'use-isnan': 'error',
277
- 'valid-typeof': 'error',
278
- 'vars-on-top': 'error',
279
- yoda: 'error'
280
- }, eslintCommentsPlugin.configs.recommended.rules, {
281
- 'eslint-comments/no-unused-disable': 'error',
282
- 'eslint-comments/require-description': 'error'
283
- }, importPlugin.configs.recommended.rules, {
284
- 'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
285
- 'import/first': ['error', 'absolute-first'],
286
- 'import/newline-after-import': 'error',
287
- 'import/no-absolute-path': 'error',
288
- 'import/no-amd': 'error',
289
- 'import/no-anonymous-default-export': ['error', {
290
- allowArray: true,
291
- allowCallExpression: true,
292
- allowLiteral: true,
293
- allowNew: true,
294
- allowObject: true
295
- }],
296
- 'import/no-commonjs': 'error',
297
- 'import/no-cycle': ['error', {
298
- ignoreExternal: true
299
- }],
300
- 'import/no-duplicates': ['error', {
301
- 'prefer-inline': true
302
- }],
303
- 'import/no-dynamic-require': 'error',
304
- 'import/no-empty-named-blocks': 'error',
305
- 'import/no-extraneous-dependencies': 'error',
306
- 'import/no-mutable-exports': 'error',
307
- 'import/no-named-as-default-member': 'error',
308
- 'import/no-named-default': 'error',
309
- 'import/no-self-import': 'error',
310
- 'import/no-unresolved': ['error', {
311
- caseSensitiveStrict: true
312
- }],
313
- 'import/no-unused-modules': 'error',
314
- 'import/no-useless-path-segments': 'error',
315
- 'import/no-webpack-loader-syntax': 'error',
316
- 'import/order': ['error', {
317
- alphabetize: {
318
- order: 'asc'
319
- },
320
- groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
321
- 'newlines-between': 'always',
322
- warnOnUnassignedImports: true
323
- }],
324
- 'import/prefer-default-export': 'error'
325
- }, jsdocPlugin.configs.recommended.rules, {
326
- 'jsdoc/check-indentation': 'error',
327
- 'jsdoc/check-syntax': 'error',
328
- 'jsdoc/match-description': ['error', {
329
- matchDescription: '[A-Z]',
330
- tags: {
331
- param: true,
332
- returns: true
333
- }
334
- }],
335
- 'jsdoc/no-bad-blocks': 'error',
336
- 'jsdoc/no-defaults': 'error',
337
- 'jsdoc/require-asterisk-prefix': 'error',
338
- 'jsdoc/require-jsdoc': 'off',
339
- 'jsdoc/require-returns': 'off',
340
- 'jsdoc/sort-tags': 'error'
341
- }, promisePlugin.configs.recommended.rules, {
342
- 'promise/no-multiple-resolved': 'error'
343
- }, regexpPlugin.configs.recommended.rules, {
344
- 'regexp/hexadecimal-escape': ['error', 'never'],
345
- 'regexp/letter-case': 'error',
346
- 'regexp/no-empty-character-class': 'error',
347
- 'regexp/no-extra-lookaround-assertions': 'error',
348
- 'regexp/no-misleading-capturing-group': 'error',
349
- 'regexp/no-misleading-unicode-character': 'error',
350
- 'regexp/no-missing-g-flag': 'error',
351
- 'regexp/no-octal': 'error',
352
- 'regexp/no-standalone-backslash': 'error',
353
- 'regexp/prefer-escape-replacement-dollar-char': 'error',
354
- 'regexp/prefer-named-backreference': 'error',
355
- 'regexp/prefer-named-replacement': 'error',
356
- 'regexp/prefer-quantifier': 'error',
357
- 'regexp/prefer-result-array-groups': 'error',
358
- 'regexp/unicode-escape': 'error',
359
- 'regexp/use-ignore-case': 'error'
360
- }, sonarjsPlugin.configs.recommended.rules, {
361
- 'sonarjs/cognitive-complexity': 'off',
362
- 'sonarjs/max-switch-cases': 'off',
363
- 'sonarjs/no-inverted-boolean-check': 'error',
364
- 'sonarjs/no-nested-template-literals': 'off',
365
- 'sonarjs/no-small-switch': 'off',
366
- 'sonarjs/prefer-immediate-return': 'off',
367
- 'sonarjs/prefer-single-boolean-return': 'off'
368
- }, unicornPlugin.configs.recommended.rules, {
369
- 'unicorn/filename-case': 'off',
370
- 'unicorn/no-null': 'off',
371
- 'unicorn/no-unsafe-regex': 'error',
372
- 'unicorn/prefer-event-target': 'error',
373
- 'unicorn/prevent-abbreviations': 'off',
374
- 'unicorn/require-post-message-target-origin': 'error'
375
- });
376
-
377
- var rulesetEslintTypescript = _extends({}, js.configs.recommended.rules, importPlugin.configs.typescript.rules, typescriptPlugin.configs['eslint-recommended'].rules, typescriptPlugin.configs.recommended.rules, typescriptPlugin.configs['recommended-requiring-type-checking'].rules, typescriptPlugin.configs.strict.rules, {
378
- 'default-param-last': 'off',
379
- 'dot-notation': 'off',
380
- 'lines-between-class-members': 'off',
381
- 'no-array-constructor': 'off',
382
- 'no-dupe-class-members': 'off',
383
- 'no-empty-function': 'off',
384
- 'no-implied-eval': 'off',
385
- 'no-invalid-this': 'off',
386
- 'no-loop-func': 'off',
387
- 'no-loss-of-precision': 'off',
388
- 'no-magic-numbers': 'off',
389
- 'no-redeclare': 'off',
390
- 'no-restricted-imports': 'off',
391
- 'no-return-await': 'off',
392
- 'no-shadow': 'off',
393
- 'no-throw-literal': 'off',
394
- 'no-unused-expressions': 'off',
395
- 'no-unused-vars': 'off',
396
- 'no-use-before-define': 'off',
397
- 'no-useless-constructor': 'off',
398
- 'padding-line-between-statements': 'off'
399
- }, {
400
- '@typescript-eslint/adjacent-overload-signatures': 'error',
401
- '@typescript-eslint/array-type': 'error',
402
- '@typescript-eslint/await-thenable': 'error',
403
- '@typescript-eslint/ban-ts-comment': 'error',
404
- '@typescript-eslint/ban-types': 'error',
405
- '@typescript-eslint/class-literal-property-style': 'off',
406
- // Breaks subclassed getters
407
- '@typescript-eslint/consistent-indexed-object-style': 'error',
408
- '@typescript-eslint/consistent-type-assertions': ['error', {
409
- assertionStyle: 'as',
410
- objectLiteralTypeAssertions: 'allow'
411
- }],
412
- '@typescript-eslint/consistent-type-definitions': ['error', 'interface'],
413
- '@typescript-eslint/consistent-type-exports': ['error', {
414
- fixMixedExportsWithInlineTypeSpecifier: true
415
- }],
416
- '@typescript-eslint/consistent-type-imports': 'error',
417
- '@typescript-eslint/default-param-last': 'error',
418
- '@typescript-eslint/dot-notation': 'error',
419
- '@typescript-eslint/explicit-function-return-type': ['error', {
420
- allowExpressions: true
421
- }],
422
- '@typescript-eslint/explicit-member-accessibility': ['error', {
423
- overrides: {
424
- constructors: 'no-public'
425
- }
426
- }],
427
- '@typescript-eslint/explicit-module-boundary-types': ['error', {
428
- allowArgumentsExplicitlyTypedAsAny: true
429
- }],
430
- '@typescript-eslint/member-ordering': 'off',
431
- '@typescript-eslint/method-signature-style': 'error',
432
- '@typescript-eslint/naming-convention': ['error', /* eslint-disable sort-keys -- Logically ordered */
433
- {
434
- selector: 'default',
435
- format: ['camelCase']
436
- }, {
437
- selector: 'variable',
438
- modifiers: ['const'],
439
- format: ['camelCase', 'PascalCase', 'UPPER_CASE']
440
- }, {
441
- selector: 'variable',
442
- modifiers: ['const'],
443
- filter: {
444
- regex: '^_(static|\\d+)?$',
445
- match: true
446
- },
447
- format: ['camelCase'],
448
- leadingUnderscore: 'allow'
449
- }, {
450
- selector: 'parameter',
451
- format: ['camelCase'],
452
- leadingUnderscore: 'allow'
453
- }, {
454
- selector: 'property',
455
- format: ['camelCase', 'UPPER_CASE']
456
- }, {
457
- selector: 'classProperty',
458
- modifiers: ['static'],
459
- format: ['camelCase', 'PascalCase', 'UPPER_CASE']
460
- }, {
461
- selector: 'enumMember',
462
- format: ['camelCase', 'PascalCase', 'UPPER_CASE']
463
- }, {
464
- selector: 'function',
465
- format: ['camelCase', 'PascalCase']
466
- }, {
467
- selector: 'typeLike',
468
- format: ['PascalCase']
469
- }, {
470
- selector: ['objectLiteralProperty'],
471
- format: []
472
- }, {
473
- selector: ['classProperty', 'objectLiteralMethod'],
474
- format: ['camelCase', 'UPPER_CASE']
475
- }, {
476
- selector: 'typeParameter',
477
- format: ['PascalCase'],
478
- custom: {
479
- regex: '^([A-Z]|T[A-Z][a-zA-Z]+|key)$',
480
- match: true
481
- }
482
- }
483
- /* eslint-enable sort-keys -- Logically ordered */],
484
-
485
- '@typescript-eslint/no-array-constructor': 'error',
486
- '@typescript-eslint/no-base-to-string': 'error',
487
- '@typescript-eslint/no-confusing-non-null-assertion': 'error',
488
- '@typescript-eslint/no-confusing-void-expression': 'error',
489
- '@typescript-eslint/no-dupe-class-members': 'error',
490
- '@typescript-eslint/no-duplicate-imports': 'error',
491
- '@typescript-eslint/no-empty-function': 'error',
492
- '@typescript-eslint/no-empty-interface': ['error', {
493
- allowSingleExtends: true
494
- }],
495
- '@typescript-eslint/no-explicit-any': 'off',
496
- '@typescript-eslint/no-extra-non-null-assertion': 'error',
497
- '@typescript-eslint/no-extraneous-class': 'error',
498
- '@typescript-eslint/no-floating-promises': 'error',
499
- '@typescript-eslint/no-for-in-array': 'error',
500
- '@typescript-eslint/no-implied-eval': 'error',
501
- '@typescript-eslint/no-inferrable-types': ['error', {
502
- ignoreParameters: true
503
- }],
504
- '@typescript-eslint/no-invalid-this': 'error',
505
- '@typescript-eslint/no-invalid-void-type': 'error',
506
- '@typescript-eslint/no-loop-func': 'error',
507
- '@typescript-eslint/no-loss-of-precision': 'error',
508
- '@typescript-eslint/no-magic-numbers': ['error', {
509
- detectObjects: true,
510
- enforceConst: true,
511
- ignore: [-1, 0, 1],
512
- ignoreArrayIndexes: true,
513
- ignoreClassFieldInitialValues: true,
514
- ignoreDefaultValues: true
515
- }],
516
- '@typescript-eslint/no-meaningless-void-operator': 'error',
517
- '@typescript-eslint/no-misused-new': 'error',
518
- '@typescript-eslint/no-misused-promises': 'error',
519
- '@typescript-eslint/no-namespace': 'error',
520
- '@typescript-eslint/no-non-null-asserted-nullish-coalescing': 'error',
521
- '@typescript-eslint/no-non-null-asserted-optional-chain': 'error',
522
- '@typescript-eslint/no-non-null-assertion': 'error',
523
- '@typescript-eslint/no-redeclare': 'error',
524
- '@typescript-eslint/no-require-imports': 'error',
525
- '@typescript-eslint/no-restricted-imports': 'error',
526
- '@typescript-eslint/no-shadow': ['error', {
527
- hoist: 'all'
528
- }],
529
- '@typescript-eslint/no-this-alias': 'error',
530
- '@typescript-eslint/no-throw-literal': 'error',
531
- '@typescript-eslint/no-unnecessary-boolean-literal-compare': 'error',
532
- '@typescript-eslint/no-unnecessary-condition': ['error', {
533
- allowConstantLoopConditions: true
534
- }],
535
- '@typescript-eslint/no-unnecessary-qualifier': 'error',
536
- '@typescript-eslint/no-unnecessary-type-arguments': 'error',
537
- '@typescript-eslint/no-unnecessary-type-assertion': 'error',
538
- '@typescript-eslint/no-unnecessary-type-constraint': 'error',
539
- '@typescript-eslint/no-unused-expressions': 'error',
540
- '@typescript-eslint/no-unused-vars': ['error', {
541
- argsIgnorePattern: '^_\\w*$',
542
- caughtErrorsIgnorePattern: '^_\\w*$',
543
- varsIgnorePattern: '^(_\\d*|React)$'
544
- }],
545
- '@typescript-eslint/no-use-before-define': 'error',
546
- '@typescript-eslint/no-useless-constructor': 'error',
547
- '@typescript-eslint/no-useless-empty-export': 'error',
548
- '@typescript-eslint/no-var-requires': 'error',
549
- '@typescript-eslint/non-nullable-type-assertion-style': 'error',
550
- '@typescript-eslint/padding-line-between-statements': ['error', /* eslint-disable sort-keys -- Logically ordered */
551
- {
552
- blankLine: 'always',
553
- prev: 'directive',
554
- next: '*'
555
- }, {
556
- blankLine: 'always',
557
- prev: 'function',
558
- next: 'function'
559
- }, {
560
- blankLine: 'never',
561
- prev: 'interface',
562
- next: 'class'
563
- }
564
- /* eslint-enable sort-keys -- Logically ordered */],
565
-
566
- '@typescript-eslint/prefer-as-const': 'error',
567
- '@typescript-eslint/prefer-enum-initializers': 'error',
568
- '@typescript-eslint/prefer-for-of': 'error',
569
- '@typescript-eslint/prefer-function-type': 'error',
570
- '@typescript-eslint/prefer-includes': 'error',
571
- '@typescript-eslint/prefer-literal-enum-member': 'error',
572
- '@typescript-eslint/prefer-namespace-keyword': 'error',
573
- '@typescript-eslint/prefer-nullish-coalescing': ['error', {
574
- ignoreConditionalTests: false,
575
- ignoreMixedLogicalExpressions: false
576
- }],
577
- '@typescript-eslint/prefer-optional-chain': 'error',
578
- '@typescript-eslint/prefer-readonly': 'error',
579
- '@typescript-eslint/prefer-reduce-type-parameter': 'error',
580
- '@typescript-eslint/prefer-return-this-type': 'error',
581
- '@typescript-eslint/prefer-string-starts-ends-with': 'error',
582
- '@typescript-eslint/prefer-ts-expect-error': 'error',
583
- '@typescript-eslint/promise-function-async': 'error',
584
- '@typescript-eslint/require-array-sort-compare': 'error',
585
- '@typescript-eslint/restrict-plus-operands': 'error',
586
- '@typescript-eslint/restrict-template-expressions': 'error',
587
- '@typescript-eslint/return-await': 'error',
588
- '@typescript-eslint/strict-boolean-expressions': ['error', {
589
- allowNullableObject: false,
590
- allowNullableString: false,
591
- allowNumber: false,
592
- allowString: false
593
- }],
594
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
595
- '@typescript-eslint/triple-slash-reference': 'error',
596
- '@typescript-eslint/unbound-method': 'off',
597
- // Does not support @autobind nor recognise binding in constructors
598
- '@typescript-eslint/unified-signatures': 'error',
599
- 'jsdoc/no-types': 'error',
600
- 'jsdoc/require-param-type': 'off',
601
- 'jsdoc/require-returns-type': 'off'
602
- });
603
-
604
- /**
605
- * @param {{ tsconfigPath?: string }} options Project-specific customisations
606
- * @returns {object[]} The complete ESLint config
607
- */
608
- function makeEslintConfig(options = {}) {
609
- return [
610
- // JavaScript & TypeScript
611
- {
612
- files: [`**/*.{${[...extensions.js, ...extensions.ts].join(',')}}`],
613
- languageOptions: {
614
- parserOptions: {
615
- ecmaVersion: 'latest',
616
- sourceType: 'module'
617
- }
618
- },
619
- linterOptions: {
620
- reportUnusedDisableDirectives: true
621
- },
622
- plugins: {
623
- 'eslint-comments': eslintCommentsPlugin,
624
- import: importPlugin,
625
- jsdoc: jsdocPlugin,
626
- promise: promisePlugin,
627
- regexp: regexpPlugin,
628
- sonarjs: sonarjsPlugin,
629
- unicorn: unicornPlugin
630
- },
631
- rules: convertWarnsToErrors(rulesetEslintShared),
632
- settings: {
633
- 'import/parsers': {
634
- espree: extensions.js.map(extension => `.${extension}`)
635
- }
636
- }
637
- },
638
- // TypeScript
639
- {
640
- files: [`**/*.{${extensions.ts.join(',')}}`],
641
- languageOptions: {
642
- parser: typescriptParser,
643
- parserOptions: options.tsconfigPath == null ? {} : {
644
- project: options.tsconfigPath
645
- }
646
- },
647
- plugins: {
648
- '@typescript-eslint': typescriptPlugin
649
- },
650
- rules: convertWarnsToErrors(rulesetEslintTypescript),
651
- settings: _extends({}, importPlugin.configs.typescript.settings, {
652
- 'import/parsers': {
653
- '@typescript-eslint/parser': extensions.ts.map(extension => `.${extension}`)
654
- }
655
- })
656
- }, prettierConfig];
657
- }
658
-
659
- // Based off https://github.com/cahamilton/css-property-sort-order-smacss/blob/master/index.js & https://github.com/cahamilton/css-property-sort-order-smacss/pull/6/files
660
-
661
- var propertiesOrderingGroups = {
662
- heading: ['content', 'quotes'],
663
- box: ['display', 'visibility', 'position', 'z-index', 'inset', 'top', 'right', 'bottom', 'left', 'inset-block', 'inset-inline', 'inset-block-start', 'inset-block-end', 'inset-inline-start', 'inset-inline-end', 'box-sizing', 'grid', 'grid-after', 'grid-area', 'grid-auto-columns', 'grid-auto-flow', 'grid-auto-rows', 'grid-before', 'grid-column', 'grid-column-end', 'grid-column-gap', 'grid-column-start', 'grid-columns', 'grid-end', 'grid-gap', 'grid-row', 'grid-row-end', 'grid-row-gap', 'grid-row-start', 'grid-rows', 'grid-start', 'grid-template', 'grid-template-areas', 'grid-template-columns', 'grid-template-rows', 'flex', 'flex-basis', 'flex-direction', 'flex-flow', 'flex-grow', 'flex-shrink', 'flex-wrap', 'align-content', 'align-items', 'align-self', 'justify-content', 'order', 'width', 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'block-size', 'min-block-size', 'max-block-size', 'inline-size', 'min-inline-size', 'max-inline-size', 'margin', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'margin-block', 'margin-block-start', 'margin-block-end', 'margin-inline', 'margin-inline-start', 'margin-inline-end', 'padding', 'padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'padding-block', 'padding-block-start', 'padding-block-end', 'padding-inline', 'padding-inline-start', 'padding-inline-end', 'float', 'clear', 'overflow', 'overflow-x', 'overflow-y', 'overflow-block', 'overflow-inline', 'clip', 'zoom', 'columns', 'column-gap', 'column-fill', 'column-rule', 'column-span', 'column-count', 'column-width', 'table-layout', 'empty-cells', 'caption-side', 'border-spacing', 'border-collapse', 'list-style', 'list-style-position', 'list-style-type', 'list-style-image'],
664
- animation: ['transform', 'transform-box', 'transform-origin', 'transform-style', 'backface-visibility', 'perspective', 'perspective-origin', 'transition', 'transition-property', 'transition-duration', 'transition-timing-function', 'transition-delay', 'animation', 'animation-name', 'animation-duration', 'animation-play-state', 'animation-timing-function', 'animation-delay', 'animation-iteration-count', 'animation-direction'],
665
- border: ['border', 'border-top', 'border-right', 'border-bottom', 'border-left', 'border-block', 'border-inline', 'border-block-start', 'border-block-end', 'border-inline-start', 'border-inline-end', 'border-width', 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width', 'border-block-width', 'border-inline-width', 'border-block-start-width', 'border-block-end-width', 'border-inline-start-width', 'border-inline-end-width', 'border-style', 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style', 'border-block-style', 'border-inline-style', 'border-block-start-style', 'border-block-end-style', 'border-inline-start-style', 'border-inline-end-style', 'border-radius', 'border-top-left-radius', 'border-top-right-radius', 'border-bottom-right-radius', 'border-bottom-left-radius', 'border-start-start-radius', 'border-start-end-radius', 'border-end-start-radius', 'border-end-end-radius', 'border-color', 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color', 'border-block-color', 'border-inline-color', 'border-block-start-color', 'border-block-end-color', 'border-inline-start-color', 'border-inline-end-color', 'outline', 'outline-color', 'outline-offset', 'outline-style', 'outline-width', 'stroke-width', 'stroke-linecap', 'stroke-dasharray', 'stroke-dashoffset', 'stroke'],
666
- background: ['opacity', 'background', 'background-attachment', 'background-clip', 'background-color', 'background-image', 'background-repeat', 'background-position', 'background-size', 'box-shadow', 'fill'],
667
- text: ['color', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-smoothing', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'font-emphasize', 'font-emphasize-position', 'font-emphasize-style', 'letter-spacing', 'line-height', 'list-style', 'text-align', 'text-align-last', 'text-decoration', 'text-decoration-color', 'text-decoration-line', 'text-decoration-style', 'text-indent', 'text-justify', 'text-overflow', 'text-overflow-ellipsis', 'text-overflow-mode', 'text-rendering', 'text-outline', 'text-shadow', 'text-transform', 'text-wrap', 'word-wrap', 'word-break', 'text-emphasis', 'text-emphasis-color', 'text-emphasis-style', 'text-emphasis-position', 'vertical-align', 'white-space', 'word-spacing', 'hyphens', 'src'],
668
- other: ['tab-size', 'counter-reset', 'counter-increment', 'resize', 'cursor', 'pointer-events', 'speak', 'user-select', 'nav-index', 'nav-up', 'nav-right', 'nav-down', 'nav-left']
669
- };
670
-
671
- var rulesetStylelintCss = _extends({}, recommended.rules, standard.rules, {
672
- 'at-rule-empty-line-before': null,
673
- 'color-named': 'never',
674
- 'comment-empty-line-before': null,
675
- 'function-url-no-scheme-relative': true,
676
- 'rule-empty-line-before': null
677
- }, {
678
- 'order/order': ['custom-properties', 'declarations'],
679
- 'order/properties-order': [Object.values(propertiesOrderingGroups).flat(), {
680
- unspecified: 'bottomAlphabetical'
681
- }]
682
- });
683
-
684
- const serialiseRegex = pattern => String(pattern).replace(/^\/((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)\/[a-z]*$/, '$1');
685
- const CUSTOM_KEYWORD_PATTERN = /^_?[a-z][0-9a-z]*((\x2D|\x2D\x2D|__)[0-9a-z]+)*$/; // eslint-disable-line unicorn/no-unsafe-regex -- Complex syntax
686
-
687
- var rulesetStylelintScss = _extends({}, recommended$1.rules, standard$1.rules, {
688
- 'order/order': [/* eslint-disable sort-keys -- Improves legibility */
689
- {
690
- type: 'at-rule',
691
- name: 'function'
692
- }, {
693
- type: 'at-rule',
694
- name: 'mixin'
695
- }, 'dollar-variables', {
696
- type: 'at-rule',
697
- name: 'extend'
698
- }, {
699
- type: 'at-rule',
700
- name: 'include'
701
- }, {
702
- type: 'at-rule',
703
- name: 'import'
704
- }, 'custom-properties', 'declarations'
705
- /* eslint-enable sort-keys -- Improves legibility */]
706
- }, {
707
- 'scss/at-else-closing-brace-newline-after': null,
708
- 'scss/at-else-closing-brace-space-after': null,
709
- 'scss/at-else-empty-line-before': null,
710
- 'scss/at-else-if-parentheses-space-before': null,
711
- 'scss/at-function-parentheses-space-before': null,
712
- 'scss/at-if-closing-brace-newline-after': null,
713
- 'scss/at-if-closing-brace-space-after': null,
714
- 'scss/at-mixin-parentheses-space-before': null,
715
- 'scss/dollar-variable-colon-newline-after': null,
716
- 'scss/dollar-variable-colon-space-after': null,
717
- 'scss/dollar-variable-colon-space-before': null,
718
- 'scss/operator-no-newline-after': null,
719
- 'scss/operator-no-newline-before': null,
720
- 'scss/operator-no-unspaced': null
721
- }, {
722
- 'scss/at-function-pattern': serialiseRegex(CUSTOM_KEYWORD_PATTERN),
723
- 'scss/at-mixin-pattern': serialiseRegex(CUSTOM_KEYWORD_PATTERN),
724
- 'scss/dollar-variable-pattern': serialiseRegex(CUSTOM_KEYWORD_PATTERN)
725
- });
726
-
727
- /* eslint sort-keys: "error" -- Organise rules */
728
-
729
- /**
730
- * @returns {object} The complete Stylelint config
731
- */
732
- function makeStylelintConfig() {
733
- return {
734
- defaultSeverity: 'error',
735
- ignoreFiles: ['**/*.min.*'],
736
- plugins: [orderPlugin],
737
- reportDescriptionlessDisables: true,
738
- reportInvalidScopeDisables: true,
739
- reportNeedlessDisables: true,
740
- rules: rulesetStylelintCss,
741
- // eslint-disable-next-line sort-keys -- Logically positioned
742
- overrides: [{
743
- customSyntax: postcssScss,
744
- files: extensions.scss.map(ext => `**/*.${ext}`),
745
- // Does not support glob braces
746
- plugins: [scssPlugin],
747
- rules: rulesetStylelintScss
748
- }]
749
- };
750
- }
751
-
752
- export { extensions, makeEslintConfig, makeStylelintConfig };
753
- //# sourceMappingURL=codeformat.mjs.map