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