@will-stone/eslint-config 7.2.1 → 8.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.
- package/dist/index.cjs +23 -54
- package/dist/index.js +22 -53
- package/package.json +16 -19
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,7 @@ function astro() {
|
|
|
16
16
|
parser: parserTypescript2.default
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
name: "will-stone/astro",
|
|
19
20
|
plugins: {
|
|
20
21
|
// @ts-expect-error -- does not confirm to type
|
|
21
22
|
astro: _eslintpluginastro2.default
|
|
@@ -95,6 +96,7 @@ function base() {
|
|
|
95
96
|
// as "warn".
|
|
96
97
|
reportUnusedDisableDirectives: true
|
|
97
98
|
},
|
|
99
|
+
name: "will-stone/base",
|
|
98
100
|
rules: {
|
|
99
101
|
/**
|
|
100
102
|
* Built-in rules
|
|
@@ -374,7 +376,8 @@ var GLOB_EXCLUDE = [
|
|
|
374
376
|
function ignores() {
|
|
375
377
|
return [
|
|
376
378
|
{
|
|
377
|
-
ignores: GLOB_EXCLUDE
|
|
379
|
+
ignores: GLOB_EXCLUDE,
|
|
380
|
+
name: "will-stone/ignores"
|
|
378
381
|
}
|
|
379
382
|
];
|
|
380
383
|
}
|
|
@@ -385,6 +388,7 @@ var _eslintpluginsimpleimportsort = require('eslint-plugin-simple-import-sort');
|
|
|
385
388
|
function imports() {
|
|
386
389
|
return [
|
|
387
390
|
{
|
|
391
|
+
name: "will-stone/imports",
|
|
388
392
|
plugins: {
|
|
389
393
|
"import": pluginImport,
|
|
390
394
|
"simple-import-sort": _eslintpluginsimpleimportsort2.default
|
|
@@ -451,10 +455,12 @@ function jest() {
|
|
|
451
455
|
files: ["**/__mocks__/**/*", "**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
|
|
452
456
|
languageOptions: {
|
|
453
457
|
globals: _globals2.default.jest
|
|
454
|
-
}
|
|
458
|
+
},
|
|
459
|
+
name: "will-stone/jest/globals"
|
|
455
460
|
},
|
|
456
461
|
{
|
|
457
462
|
files: ["**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
|
|
463
|
+
name: "will-stone/jest/base",
|
|
458
464
|
plugins: {
|
|
459
465
|
jest: _eslintpluginjest2.default
|
|
460
466
|
},
|
|
@@ -478,7 +484,6 @@ function jest() {
|
|
|
478
484
|
"jest/no-focused-tests": "error",
|
|
479
485
|
"jest/no-hooks": "off",
|
|
480
486
|
"jest/no-identical-title": "error",
|
|
481
|
-
"jest/no-if": "error",
|
|
482
487
|
"jest/no-interpolation-in-snapshots": "error",
|
|
483
488
|
"jest/no-jasmine-globals": "warn",
|
|
484
489
|
"jest/no-large-snapshots": "off",
|
|
@@ -517,6 +522,7 @@ function jest() {
|
|
|
517
522
|
},
|
|
518
523
|
{
|
|
519
524
|
files: ["**/*.{spec,test}.{ts,tsx}"],
|
|
525
|
+
name: "will-stone/jest/typescript",
|
|
520
526
|
rules: {
|
|
521
527
|
"jest/no-untyped-mock-factory": "warn"
|
|
522
528
|
}
|
|
@@ -533,6 +539,7 @@ function node() {
|
|
|
533
539
|
languageOptions: {
|
|
534
540
|
globals: _globals2.default.node
|
|
535
541
|
},
|
|
542
|
+
name: "will-stone/node",
|
|
536
543
|
plugins: {
|
|
537
544
|
n: _eslintpluginn2.default
|
|
538
545
|
},
|
|
@@ -540,6 +547,9 @@ function node() {
|
|
|
540
547
|
"n/callback-return": "error",
|
|
541
548
|
"n/global-require": "error",
|
|
542
549
|
"n/handle-callback-err": "error",
|
|
550
|
+
// Not sure I need this...?
|
|
551
|
+
// TODO check others' configs to see how they use this.
|
|
552
|
+
"n/hashbang": "off",
|
|
543
553
|
"n/no-mixed-requires": "error",
|
|
544
554
|
"n/no-new-require": "error",
|
|
545
555
|
"n/no-path-concat": "error",
|
|
@@ -549,9 +559,6 @@ function node() {
|
|
|
549
559
|
"n/no-restricted-require": "off",
|
|
550
560
|
// I like synchronous functions
|
|
551
561
|
"n/no-sync": "off",
|
|
552
|
-
// Not sure I need this...?
|
|
553
|
-
// TODO check others' configs to see how they use this.
|
|
554
|
-
"n/shebang": "off",
|
|
555
562
|
// Turn these off until I work out if I need them
|
|
556
563
|
"n/exports-style": "off",
|
|
557
564
|
"n/file-extension-in-import": "off",
|
|
@@ -576,6 +583,7 @@ function node() {
|
|
|
576
583
|
"n/prefer-global/text-encoder": "off",
|
|
577
584
|
"n/prefer-global/url": "off",
|
|
578
585
|
"n/prefer-global/url-search-params": "off",
|
|
586
|
+
"n/prefer-node-protocol": "warn",
|
|
579
587
|
"n/prefer-promises/dns": "off",
|
|
580
588
|
"n/prefer-promises/fs": "off",
|
|
581
589
|
"n/process-exit-as-throw": "off"
|
|
@@ -584,21 +592,6 @@ function node() {
|
|
|
584
592
|
];
|
|
585
593
|
}
|
|
586
594
|
|
|
587
|
-
// src/configs/prettier.ts
|
|
588
|
-
var _eslintpluginprettier = require('eslint-plugin-prettier'); var _eslintpluginprettier2 = _interopRequireDefault(_eslintpluginprettier);
|
|
589
|
-
function prettier() {
|
|
590
|
-
return [
|
|
591
|
-
{
|
|
592
|
-
plugins: {
|
|
593
|
-
prettier: _eslintpluginprettier2.default
|
|
594
|
-
},
|
|
595
|
-
rules: {
|
|
596
|
-
"prettier/prettier": "warn"
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
];
|
|
600
|
-
}
|
|
601
|
-
|
|
602
595
|
// src/configs/react.ts
|
|
603
596
|
var _eslintpluginjsxa11y = require('eslint-plugin-jsx-a11y'); var _eslintpluginjsxa11y2 = _interopRequireDefault(_eslintpluginjsxa11y);
|
|
604
597
|
var _eslintpluginreact = require('eslint-plugin-react'); var _eslintpluginreact2 = _interopRequireDefault(_eslintpluginreact);
|
|
@@ -616,6 +609,7 @@ function react() {
|
|
|
616
609
|
}
|
|
617
610
|
}
|
|
618
611
|
},
|
|
612
|
+
name: "will-stone/react",
|
|
619
613
|
plugins: {
|
|
620
614
|
"jsx-a11y": _eslintpluginjsxa11y2.default,
|
|
621
615
|
"react": _eslintpluginreact2.default,
|
|
@@ -898,32 +892,13 @@ function react() {
|
|
|
898
892
|
];
|
|
899
893
|
}
|
|
900
894
|
|
|
901
|
-
// src/configs/switch-case.ts
|
|
902
|
-
var _eslintpluginswitchcase = require('eslint-plugin-switch-case'); var _eslintpluginswitchcase2 = _interopRequireDefault(_eslintpluginswitchcase);
|
|
903
|
-
function switchCase() {
|
|
904
|
-
return [
|
|
905
|
-
{
|
|
906
|
-
plugins: {
|
|
907
|
-
"switch-case": _eslintpluginswitchcase2.default
|
|
908
|
-
},
|
|
909
|
-
rules: {
|
|
910
|
-
"switch-case/newline-between-switch-case": [
|
|
911
|
-
"warn",
|
|
912
|
-
"always",
|
|
913
|
-
{ fallthrough: "never" }
|
|
914
|
-
],
|
|
915
|
-
"switch-case/no-case-curly": "off"
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
];
|
|
919
|
-
}
|
|
920
|
-
|
|
921
895
|
// src/configs/tailwind.ts
|
|
922
896
|
var _eslintplugintailwindcss = require('eslint-plugin-tailwindcss'); var _eslintplugintailwindcss2 = _interopRequireDefault(_eslintplugintailwindcss);
|
|
923
897
|
function tailwind() {
|
|
924
898
|
return [
|
|
925
899
|
{
|
|
926
900
|
files: ["**/*.{jsx,tsx,astro}"],
|
|
901
|
+
name: "will-stone/tailwind",
|
|
927
902
|
plugins: { tailwindcss: _eslintplugintailwindcss2.default },
|
|
928
903
|
rules: {
|
|
929
904
|
"tailwindcss/classnames-order": "warn",
|
|
@@ -955,6 +930,7 @@ function typescript(options) {
|
|
|
955
930
|
} : {}
|
|
956
931
|
}
|
|
957
932
|
},
|
|
933
|
+
name: "will-stone/typescript",
|
|
958
934
|
plugins: {
|
|
959
935
|
// @ts-expect-error -- does not confirm to type
|
|
960
936
|
"@typescript-eslint": _eslintplugin2.default
|
|
@@ -1180,6 +1156,7 @@ var _eslintpluginunicorn = require('eslint-plugin-unicorn'); var _eslintpluginun
|
|
|
1180
1156
|
function unicorn() {
|
|
1181
1157
|
return [
|
|
1182
1158
|
{
|
|
1159
|
+
name: "will-stone/unicorn",
|
|
1183
1160
|
plugins: {
|
|
1184
1161
|
unicorn: _eslintpluginunicorn2.default
|
|
1185
1162
|
},
|
|
@@ -1205,12 +1182,14 @@ function unicorn() {
|
|
|
1205
1182
|
"unicorn/import-style": "off",
|
|
1206
1183
|
"unicorn/new-for-builtins": "warn",
|
|
1207
1184
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1185
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1208
1186
|
"unicorn/no-array-callback-reference": "off",
|
|
1209
1187
|
"unicorn/no-array-for-each": "warn",
|
|
1210
1188
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1211
1189
|
"unicorn/no-array-push-push": "warn",
|
|
1212
1190
|
"unicorn/no-array-reduce": "error",
|
|
1213
1191
|
"unicorn/no-await-expression-member": "warn",
|
|
1192
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1214
1193
|
"unicorn/no-console-spaces": "warn",
|
|
1215
1194
|
"unicorn/no-document-cookie": "error",
|
|
1216
1195
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1237,6 +1216,7 @@ function unicorn() {
|
|
|
1237
1216
|
"unicorn/no-null": "off",
|
|
1238
1217
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1239
1218
|
"unicorn/no-process-exit": "error",
|
|
1219
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1240
1220
|
"unicorn/no-static-only-class": "error",
|
|
1241
1221
|
"unicorn/no-thenable": "error",
|
|
1242
1222
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1331,7 +1311,6 @@ var _glob = require('glob');
|
|
|
1331
1311
|
function checkEnvironment() {
|
|
1332
1312
|
const isGitIgnore = _fs.existsSync.call(void 0, ".gitignore");
|
|
1333
1313
|
let isNodeEngine = false;
|
|
1334
|
-
let isPrettier = false;
|
|
1335
1314
|
let isTailwind = false;
|
|
1336
1315
|
let testingFramework = null;
|
|
1337
1316
|
const allPackageJsonPaths = _glob.globSync.call(void 0, "**/package.json", {
|
|
@@ -1349,13 +1328,8 @@ function checkEnvironment() {
|
|
|
1349
1328
|
if (!isNodeEngine && Boolean(_optionalChain([packageJson, 'access', _6 => _6.engines, 'optionalAccess', _7 => _7.node]))) {
|
|
1350
1329
|
isNodeEngine = true;
|
|
1351
1330
|
}
|
|
1352
|
-
if (!isPrettier && Boolean(
|
|
1353
|
-
_optionalChain([packageJson, 'access', _8 => _8.dependencies, 'optionalAccess', _9 => _9.prettier]) || _optionalChain([packageJson, 'access', _10 => _10.devDependencies, 'optionalAccess', _11 => _11.prettier])
|
|
1354
|
-
)) {
|
|
1355
|
-
isPrettier = true;
|
|
1356
|
-
}
|
|
1357
1331
|
if (!isTailwind && Boolean(
|
|
1358
|
-
_optionalChain([packageJson, 'access',
|
|
1332
|
+
_optionalChain([packageJson, 'access', _8 => _8.dependencies, 'optionalAccess', _9 => _9.tailwindcss]) || _optionalChain([packageJson, 'access', _10 => _10.devDependencies, 'optionalAccess', _11 => _11.tailwindcss])
|
|
1359
1333
|
)) {
|
|
1360
1334
|
isTailwind = true;
|
|
1361
1335
|
}
|
|
@@ -1364,7 +1338,6 @@ function checkEnvironment() {
|
|
|
1364
1338
|
return {
|
|
1365
1339
|
isGitIgnore,
|
|
1366
1340
|
isNode,
|
|
1367
|
-
isPrettier,
|
|
1368
1341
|
isTailwind,
|
|
1369
1342
|
testingFramework
|
|
1370
1343
|
};
|
|
@@ -1372,7 +1345,7 @@ function checkEnvironment() {
|
|
|
1372
1345
|
|
|
1373
1346
|
// src/factory.ts
|
|
1374
1347
|
function factory(options) {
|
|
1375
|
-
const { isGitIgnore, isNode,
|
|
1348
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1376
1349
|
const configs = [];
|
|
1377
1350
|
if (isGitIgnore) {
|
|
1378
1351
|
configs.push([_eslintconfigflatgitignore2.default.call(void 0, )]);
|
|
@@ -1381,7 +1354,6 @@ function factory(options) {
|
|
|
1381
1354
|
ignores(),
|
|
1382
1355
|
base(),
|
|
1383
1356
|
imports(),
|
|
1384
|
-
switchCase(),
|
|
1385
1357
|
unicorn(),
|
|
1386
1358
|
typescript(options),
|
|
1387
1359
|
astro(),
|
|
@@ -1396,9 +1368,6 @@ function factory(options) {
|
|
|
1396
1368
|
if (testingFramework === "jest") {
|
|
1397
1369
|
configs.push(jest());
|
|
1398
1370
|
}
|
|
1399
|
-
if (isPrettier) {
|
|
1400
|
-
configs.push(prettier());
|
|
1401
|
-
}
|
|
1402
1371
|
const merged = configs.flat();
|
|
1403
1372
|
return merged;
|
|
1404
1373
|
}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ function astro() {
|
|
|
16
16
|
parser: parserTypescript
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
name: "will-stone/astro",
|
|
19
20
|
plugins: {
|
|
20
21
|
// @ts-expect-error -- does not confirm to type
|
|
21
22
|
astro: pluginAstro
|
|
@@ -95,6 +96,7 @@ function base() {
|
|
|
95
96
|
// as "warn".
|
|
96
97
|
reportUnusedDisableDirectives: true
|
|
97
98
|
},
|
|
99
|
+
name: "will-stone/base",
|
|
98
100
|
rules: {
|
|
99
101
|
/**
|
|
100
102
|
* Built-in rules
|
|
@@ -374,7 +376,8 @@ var GLOB_EXCLUDE = [
|
|
|
374
376
|
function ignores() {
|
|
375
377
|
return [
|
|
376
378
|
{
|
|
377
|
-
ignores: GLOB_EXCLUDE
|
|
379
|
+
ignores: GLOB_EXCLUDE,
|
|
380
|
+
name: "will-stone/ignores"
|
|
378
381
|
}
|
|
379
382
|
];
|
|
380
383
|
}
|
|
@@ -385,6 +388,7 @@ import pluginSimpleImport from "eslint-plugin-simple-import-sort";
|
|
|
385
388
|
function imports() {
|
|
386
389
|
return [
|
|
387
390
|
{
|
|
391
|
+
name: "will-stone/imports",
|
|
388
392
|
plugins: {
|
|
389
393
|
"import": pluginImport,
|
|
390
394
|
"simple-import-sort": pluginSimpleImport
|
|
@@ -451,10 +455,12 @@ function jest() {
|
|
|
451
455
|
files: ["**/__mocks__/**/*", "**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
|
|
452
456
|
languageOptions: {
|
|
453
457
|
globals: globals2.jest
|
|
454
|
-
}
|
|
458
|
+
},
|
|
459
|
+
name: "will-stone/jest/globals"
|
|
455
460
|
},
|
|
456
461
|
{
|
|
457
462
|
files: ["**/*.{spec,test}.{js,cjs,mjs,jsx,ts,tsx}"],
|
|
463
|
+
name: "will-stone/jest/base",
|
|
458
464
|
plugins: {
|
|
459
465
|
jest: pluginJest
|
|
460
466
|
},
|
|
@@ -478,7 +484,6 @@ function jest() {
|
|
|
478
484
|
"jest/no-focused-tests": "error",
|
|
479
485
|
"jest/no-hooks": "off",
|
|
480
486
|
"jest/no-identical-title": "error",
|
|
481
|
-
"jest/no-if": "error",
|
|
482
487
|
"jest/no-interpolation-in-snapshots": "error",
|
|
483
488
|
"jest/no-jasmine-globals": "warn",
|
|
484
489
|
"jest/no-large-snapshots": "off",
|
|
@@ -517,6 +522,7 @@ function jest() {
|
|
|
517
522
|
},
|
|
518
523
|
{
|
|
519
524
|
files: ["**/*.{spec,test}.{ts,tsx}"],
|
|
525
|
+
name: "will-stone/jest/typescript",
|
|
520
526
|
rules: {
|
|
521
527
|
"jest/no-untyped-mock-factory": "warn"
|
|
522
528
|
}
|
|
@@ -533,6 +539,7 @@ function node() {
|
|
|
533
539
|
languageOptions: {
|
|
534
540
|
globals: globals3.node
|
|
535
541
|
},
|
|
542
|
+
name: "will-stone/node",
|
|
536
543
|
plugins: {
|
|
537
544
|
n: pluginNode
|
|
538
545
|
},
|
|
@@ -540,6 +547,9 @@ function node() {
|
|
|
540
547
|
"n/callback-return": "error",
|
|
541
548
|
"n/global-require": "error",
|
|
542
549
|
"n/handle-callback-err": "error",
|
|
550
|
+
// Not sure I need this...?
|
|
551
|
+
// TODO check others' configs to see how they use this.
|
|
552
|
+
"n/hashbang": "off",
|
|
543
553
|
"n/no-mixed-requires": "error",
|
|
544
554
|
"n/no-new-require": "error",
|
|
545
555
|
"n/no-path-concat": "error",
|
|
@@ -549,9 +559,6 @@ function node() {
|
|
|
549
559
|
"n/no-restricted-require": "off",
|
|
550
560
|
// I like synchronous functions
|
|
551
561
|
"n/no-sync": "off",
|
|
552
|
-
// Not sure I need this...?
|
|
553
|
-
// TODO check others' configs to see how they use this.
|
|
554
|
-
"n/shebang": "off",
|
|
555
562
|
// Turn these off until I work out if I need them
|
|
556
563
|
"n/exports-style": "off",
|
|
557
564
|
"n/file-extension-in-import": "off",
|
|
@@ -576,6 +583,7 @@ function node() {
|
|
|
576
583
|
"n/prefer-global/text-encoder": "off",
|
|
577
584
|
"n/prefer-global/url": "off",
|
|
578
585
|
"n/prefer-global/url-search-params": "off",
|
|
586
|
+
"n/prefer-node-protocol": "warn",
|
|
579
587
|
"n/prefer-promises/dns": "off",
|
|
580
588
|
"n/prefer-promises/fs": "off",
|
|
581
589
|
"n/process-exit-as-throw": "off"
|
|
@@ -584,21 +592,6 @@ function node() {
|
|
|
584
592
|
];
|
|
585
593
|
}
|
|
586
594
|
|
|
587
|
-
// src/configs/prettier.ts
|
|
588
|
-
import pluginPrettier from "eslint-plugin-prettier";
|
|
589
|
-
function prettier() {
|
|
590
|
-
return [
|
|
591
|
-
{
|
|
592
|
-
plugins: {
|
|
593
|
-
prettier: pluginPrettier
|
|
594
|
-
},
|
|
595
|
-
rules: {
|
|
596
|
-
"prettier/prettier": "warn"
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
];
|
|
600
|
-
}
|
|
601
|
-
|
|
602
595
|
// src/configs/react.ts
|
|
603
596
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
604
597
|
import pluginReact from "eslint-plugin-react";
|
|
@@ -616,6 +609,7 @@ function react() {
|
|
|
616
609
|
}
|
|
617
610
|
}
|
|
618
611
|
},
|
|
612
|
+
name: "will-stone/react",
|
|
619
613
|
plugins: {
|
|
620
614
|
"jsx-a11y": pluginJsxA11y,
|
|
621
615
|
"react": pluginReact,
|
|
@@ -898,32 +892,13 @@ function react() {
|
|
|
898
892
|
];
|
|
899
893
|
}
|
|
900
894
|
|
|
901
|
-
// src/configs/switch-case.ts
|
|
902
|
-
import pluginSwitchCase from "eslint-plugin-switch-case";
|
|
903
|
-
function switchCase() {
|
|
904
|
-
return [
|
|
905
|
-
{
|
|
906
|
-
plugins: {
|
|
907
|
-
"switch-case": pluginSwitchCase
|
|
908
|
-
},
|
|
909
|
-
rules: {
|
|
910
|
-
"switch-case/newline-between-switch-case": [
|
|
911
|
-
"warn",
|
|
912
|
-
"always",
|
|
913
|
-
{ fallthrough: "never" }
|
|
914
|
-
],
|
|
915
|
-
"switch-case/no-case-curly": "off"
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
];
|
|
919
|
-
}
|
|
920
|
-
|
|
921
895
|
// src/configs/tailwind.ts
|
|
922
896
|
import pluginTailwind from "eslint-plugin-tailwindcss";
|
|
923
897
|
function tailwind() {
|
|
924
898
|
return [
|
|
925
899
|
{
|
|
926
900
|
files: ["**/*.{jsx,tsx,astro}"],
|
|
901
|
+
name: "will-stone/tailwind",
|
|
927
902
|
plugins: { tailwindcss: pluginTailwind },
|
|
928
903
|
rules: {
|
|
929
904
|
"tailwindcss/classnames-order": "warn",
|
|
@@ -955,6 +930,7 @@ function typescript(options) {
|
|
|
955
930
|
} : {}
|
|
956
931
|
}
|
|
957
932
|
},
|
|
933
|
+
name: "will-stone/typescript",
|
|
958
934
|
plugins: {
|
|
959
935
|
// @ts-expect-error -- does not confirm to type
|
|
960
936
|
"@typescript-eslint": pluginTypescript
|
|
@@ -1180,6 +1156,7 @@ import pluginUnicorn from "eslint-plugin-unicorn";
|
|
|
1180
1156
|
function unicorn() {
|
|
1181
1157
|
return [
|
|
1182
1158
|
{
|
|
1159
|
+
name: "will-stone/unicorn",
|
|
1183
1160
|
plugins: {
|
|
1184
1161
|
unicorn: pluginUnicorn
|
|
1185
1162
|
},
|
|
@@ -1205,12 +1182,14 @@ function unicorn() {
|
|
|
1205
1182
|
"unicorn/import-style": "off",
|
|
1206
1183
|
"unicorn/new-for-builtins": "warn",
|
|
1207
1184
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1185
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1208
1186
|
"unicorn/no-array-callback-reference": "off",
|
|
1209
1187
|
"unicorn/no-array-for-each": "warn",
|
|
1210
1188
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1211
1189
|
"unicorn/no-array-push-push": "warn",
|
|
1212
1190
|
"unicorn/no-array-reduce": "error",
|
|
1213
1191
|
"unicorn/no-await-expression-member": "warn",
|
|
1192
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1214
1193
|
"unicorn/no-console-spaces": "warn",
|
|
1215
1194
|
"unicorn/no-document-cookie": "error",
|
|
1216
1195
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1237,6 +1216,7 @@ function unicorn() {
|
|
|
1237
1216
|
"unicorn/no-null": "off",
|
|
1238
1217
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1239
1218
|
"unicorn/no-process-exit": "error",
|
|
1219
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1240
1220
|
"unicorn/no-static-only-class": "error",
|
|
1241
1221
|
"unicorn/no-thenable": "error",
|
|
1242
1222
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1331,7 +1311,6 @@ import { globSync } from "glob";
|
|
|
1331
1311
|
function checkEnvironment() {
|
|
1332
1312
|
const isGitIgnore = existsSync(".gitignore");
|
|
1333
1313
|
let isNodeEngine = false;
|
|
1334
|
-
let isPrettier = false;
|
|
1335
1314
|
let isTailwind = false;
|
|
1336
1315
|
let testingFramework = null;
|
|
1337
1316
|
const allPackageJsonPaths = globSync("**/package.json", {
|
|
@@ -1349,11 +1328,6 @@ function checkEnvironment() {
|
|
|
1349
1328
|
if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
|
|
1350
1329
|
isNodeEngine = true;
|
|
1351
1330
|
}
|
|
1352
|
-
if (!isPrettier && Boolean(
|
|
1353
|
-
packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
|
|
1354
|
-
)) {
|
|
1355
|
-
isPrettier = true;
|
|
1356
|
-
}
|
|
1357
1331
|
if (!isTailwind && Boolean(
|
|
1358
1332
|
packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
|
|
1359
1333
|
)) {
|
|
@@ -1364,7 +1338,6 @@ function checkEnvironment() {
|
|
|
1364
1338
|
return {
|
|
1365
1339
|
isGitIgnore,
|
|
1366
1340
|
isNode,
|
|
1367
|
-
isPrettier,
|
|
1368
1341
|
isTailwind,
|
|
1369
1342
|
testingFramework
|
|
1370
1343
|
};
|
|
@@ -1372,7 +1345,7 @@ function checkEnvironment() {
|
|
|
1372
1345
|
|
|
1373
1346
|
// src/factory.ts
|
|
1374
1347
|
function factory(options) {
|
|
1375
|
-
const { isGitIgnore, isNode,
|
|
1348
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1376
1349
|
const configs = [];
|
|
1377
1350
|
if (isGitIgnore) {
|
|
1378
1351
|
configs.push([gitignore()]);
|
|
@@ -1381,7 +1354,6 @@ function factory(options) {
|
|
|
1381
1354
|
ignores(),
|
|
1382
1355
|
base(),
|
|
1383
1356
|
imports(),
|
|
1384
|
-
switchCase(),
|
|
1385
1357
|
unicorn(),
|
|
1386
1358
|
typescript(options),
|
|
1387
1359
|
astro(),
|
|
@@ -1396,9 +1368,6 @@ function factory(options) {
|
|
|
1396
1368
|
if (testingFramework === "jest") {
|
|
1397
1369
|
configs.push(jest());
|
|
1398
1370
|
}
|
|
1399
|
-
if (isPrettier) {
|
|
1400
|
-
configs.push(prettier());
|
|
1401
|
-
}
|
|
1402
1371
|
const merged = configs.flat();
|
|
1403
1372
|
return merged;
|
|
1404
1373
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"description": "Will Stone's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build": "tsup src/index.ts --format esm,cjs --clean --dts --cjsInterop --splitting",
|
|
29
29
|
"dev": "tsup src/index.ts --format esm,cjs --watch & config-inspector",
|
|
30
30
|
"lint": "npm run stub && eslint .",
|
|
31
|
-
"prepare": "husky
|
|
31
|
+
"prepare": "husky",
|
|
32
32
|
"prepublishOnly": "npm run build",
|
|
33
33
|
"stub": "tsup src/index.ts --format esm",
|
|
34
34
|
"typecheck": "tsc --noEmit"
|
|
@@ -43,42 +43,39 @@
|
|
|
43
43
|
},
|
|
44
44
|
"prettier": "@will-stone/prettier-config",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
47
|
-
"@typescript-eslint/parser": "^7.
|
|
48
|
-
"astro-eslint-parser": "^0.
|
|
46
|
+
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
47
|
+
"@typescript-eslint/parser": "^7.6.0",
|
|
48
|
+
"astro-eslint-parser": "^0.17.0",
|
|
49
49
|
"confusing-browser-globals": "^1.0.11",
|
|
50
|
-
"eslint-config-flat-gitignore": "^0.1.
|
|
51
|
-
"eslint-plugin-astro": "^0.
|
|
50
|
+
"eslint-config-flat-gitignore": "^0.1.5",
|
|
51
|
+
"eslint-plugin-astro": "^0.34.0",
|
|
52
52
|
"eslint-plugin-i": "^2.29.1",
|
|
53
|
-
"eslint-plugin-jest": "^
|
|
53
|
+
"eslint-plugin-jest": "^28.2.0",
|
|
54
54
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
55
|
-
"eslint-plugin-n": "^
|
|
56
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
55
|
+
"eslint-plugin-n": "^17.0.0",
|
|
57
56
|
"eslint-plugin-react": "^7.34.1",
|
|
58
57
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
59
58
|
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
60
|
-
"eslint-plugin-switch-case": "^1.1.2",
|
|
61
59
|
"eslint-plugin-tailwindcss": "^3.15.1",
|
|
62
|
-
"eslint-plugin-unicorn": "^
|
|
63
|
-
"glob": "^10.3.
|
|
60
|
+
"eslint-plugin-unicorn": "^52.0.0",
|
|
61
|
+
"glob": "^10.3.12",
|
|
64
62
|
"globals": "^15.0.0",
|
|
65
63
|
"globby": "^14.0.1",
|
|
66
64
|
"load-json-file": "^7.0.1"
|
|
67
65
|
},
|
|
68
66
|
"devDependencies": {
|
|
69
67
|
"@changesets/cli": "^2.27.1",
|
|
70
|
-
"@eslint/config-inspector": "^0.1
|
|
68
|
+
"@eslint/config-inspector": "^0.4.1",
|
|
71
69
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
72
|
-
"@types/eslint": "^8.56.
|
|
73
|
-
"@types/node": "^20.
|
|
70
|
+
"@types/eslint": "^8.56.7",
|
|
71
|
+
"@types/node": "^20.12.5",
|
|
74
72
|
"@will-stone/prettier-config": "^7.0.3",
|
|
75
|
-
"eslint": "^8.57.0",
|
|
76
73
|
"husky": "^9.0.11",
|
|
77
74
|
"lint-staged": "^15.2.2",
|
|
78
75
|
"prettier": "^3.2.5",
|
|
79
76
|
"tsup": "^8.0.2",
|
|
80
|
-
"type-fest": "^4.
|
|
81
|
-
"typescript": "^5.4.
|
|
77
|
+
"type-fest": "^4.15.0",
|
|
78
|
+
"typescript": "^5.4.4"
|
|
82
79
|
},
|
|
83
80
|
"peerDependencies": {
|
|
84
81
|
"eslint": ">=8.57.0"
|