@will-stone/eslint-config 7.2.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -54
- package/dist/index.js +22 -53
- package/package.json +17 -20
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
|
},
|
|
@@ -517,6 +523,7 @@ function jest() {
|
|
|
517
523
|
},
|
|
518
524
|
{
|
|
519
525
|
files: ["**/*.{spec,test}.{ts,tsx}"],
|
|
526
|
+
name: "will-stone/jest/typescript",
|
|
520
527
|
rules: {
|
|
521
528
|
"jest/no-untyped-mock-factory": "warn"
|
|
522
529
|
}
|
|
@@ -533,6 +540,7 @@ function node() {
|
|
|
533
540
|
languageOptions: {
|
|
534
541
|
globals: _globals2.default.node
|
|
535
542
|
},
|
|
543
|
+
name: "will-stone/node",
|
|
536
544
|
plugins: {
|
|
537
545
|
n: _eslintpluginn2.default
|
|
538
546
|
},
|
|
@@ -540,6 +548,9 @@ function node() {
|
|
|
540
548
|
"n/callback-return": "error",
|
|
541
549
|
"n/global-require": "error",
|
|
542
550
|
"n/handle-callback-err": "error",
|
|
551
|
+
// Not sure I need this...?
|
|
552
|
+
// TODO check others' configs to see how they use this.
|
|
553
|
+
"n/hashbang": "off",
|
|
543
554
|
"n/no-mixed-requires": "error",
|
|
544
555
|
"n/no-new-require": "error",
|
|
545
556
|
"n/no-path-concat": "error",
|
|
@@ -549,9 +560,6 @@ function node() {
|
|
|
549
560
|
"n/no-restricted-require": "off",
|
|
550
561
|
// I like synchronous functions
|
|
551
562
|
"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
563
|
// Turn these off until I work out if I need them
|
|
556
564
|
"n/exports-style": "off",
|
|
557
565
|
"n/file-extension-in-import": "off",
|
|
@@ -576,6 +584,7 @@ function node() {
|
|
|
576
584
|
"n/prefer-global/text-encoder": "off",
|
|
577
585
|
"n/prefer-global/url": "off",
|
|
578
586
|
"n/prefer-global/url-search-params": "off",
|
|
587
|
+
"n/prefer-node-protocol": "warn",
|
|
579
588
|
"n/prefer-promises/dns": "off",
|
|
580
589
|
"n/prefer-promises/fs": "off",
|
|
581
590
|
"n/process-exit-as-throw": "off"
|
|
@@ -584,21 +593,6 @@ function node() {
|
|
|
584
593
|
];
|
|
585
594
|
}
|
|
586
595
|
|
|
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
596
|
// src/configs/react.ts
|
|
603
597
|
var _eslintpluginjsxa11y = require('eslint-plugin-jsx-a11y'); var _eslintpluginjsxa11y2 = _interopRequireDefault(_eslintpluginjsxa11y);
|
|
604
598
|
var _eslintpluginreact = require('eslint-plugin-react'); var _eslintpluginreact2 = _interopRequireDefault(_eslintpluginreact);
|
|
@@ -616,6 +610,7 @@ function react() {
|
|
|
616
610
|
}
|
|
617
611
|
}
|
|
618
612
|
},
|
|
613
|
+
name: "will-stone/react",
|
|
619
614
|
plugins: {
|
|
620
615
|
"jsx-a11y": _eslintpluginjsxa11y2.default,
|
|
621
616
|
"react": _eslintpluginreact2.default,
|
|
@@ -898,32 +893,13 @@ function react() {
|
|
|
898
893
|
];
|
|
899
894
|
}
|
|
900
895
|
|
|
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
896
|
// src/configs/tailwind.ts
|
|
922
897
|
var _eslintplugintailwindcss = require('eslint-plugin-tailwindcss'); var _eslintplugintailwindcss2 = _interopRequireDefault(_eslintplugintailwindcss);
|
|
923
898
|
function tailwind() {
|
|
924
899
|
return [
|
|
925
900
|
{
|
|
926
901
|
files: ["**/*.{jsx,tsx,astro}"],
|
|
902
|
+
name: "will-stone/tailwind",
|
|
927
903
|
plugins: { tailwindcss: _eslintplugintailwindcss2.default },
|
|
928
904
|
rules: {
|
|
929
905
|
"tailwindcss/classnames-order": "warn",
|
|
@@ -955,6 +931,7 @@ function typescript(options) {
|
|
|
955
931
|
} : {}
|
|
956
932
|
}
|
|
957
933
|
},
|
|
934
|
+
name: "will-stone/typescript",
|
|
958
935
|
plugins: {
|
|
959
936
|
// @ts-expect-error -- does not confirm to type
|
|
960
937
|
"@typescript-eslint": _eslintplugin2.default
|
|
@@ -1048,7 +1025,6 @@ function typescript(options) {
|
|
|
1048
1025
|
"@typescript-eslint/no-misused-promises": "off",
|
|
1049
1026
|
"@typescript-eslint/no-mixed-enums": "off",
|
|
1050
1027
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
1051
|
-
"@typescript-eslint/no-throw-literal": "off",
|
|
1052
1028
|
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
|
1053
1029
|
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
1054
1030
|
"@typescript-eslint/no-unnecessary-qualifier": "off",
|
|
@@ -1181,6 +1157,7 @@ var _eslintpluginunicorn = require('eslint-plugin-unicorn'); var _eslintpluginun
|
|
|
1181
1157
|
function unicorn() {
|
|
1182
1158
|
return [
|
|
1183
1159
|
{
|
|
1160
|
+
name: "will-stone/unicorn",
|
|
1184
1161
|
plugins: {
|
|
1185
1162
|
unicorn: _eslintpluginunicorn2.default
|
|
1186
1163
|
},
|
|
@@ -1206,12 +1183,14 @@ function unicorn() {
|
|
|
1206
1183
|
"unicorn/import-style": "off",
|
|
1207
1184
|
"unicorn/new-for-builtins": "warn",
|
|
1208
1185
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1186
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1209
1187
|
"unicorn/no-array-callback-reference": "off",
|
|
1210
1188
|
"unicorn/no-array-for-each": "warn",
|
|
1211
1189
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1212
1190
|
"unicorn/no-array-push-push": "warn",
|
|
1213
1191
|
"unicorn/no-array-reduce": "error",
|
|
1214
1192
|
"unicorn/no-await-expression-member": "warn",
|
|
1193
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1215
1194
|
"unicorn/no-console-spaces": "warn",
|
|
1216
1195
|
"unicorn/no-document-cookie": "error",
|
|
1217
1196
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1238,6 +1217,7 @@ function unicorn() {
|
|
|
1238
1217
|
"unicorn/no-null": "off",
|
|
1239
1218
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1240
1219
|
"unicorn/no-process-exit": "error",
|
|
1220
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1241
1221
|
"unicorn/no-static-only-class": "error",
|
|
1242
1222
|
"unicorn/no-thenable": "error",
|
|
1243
1223
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1332,7 +1312,6 @@ var _glob = require('glob');
|
|
|
1332
1312
|
function checkEnvironment() {
|
|
1333
1313
|
const isGitIgnore = _fs.existsSync.call(void 0, ".gitignore");
|
|
1334
1314
|
let isNodeEngine = false;
|
|
1335
|
-
let isPrettier = false;
|
|
1336
1315
|
let isTailwind = false;
|
|
1337
1316
|
let testingFramework = null;
|
|
1338
1317
|
const allPackageJsonPaths = _glob.globSync.call(void 0, "**/package.json", {
|
|
@@ -1350,13 +1329,8 @@ function checkEnvironment() {
|
|
|
1350
1329
|
if (!isNodeEngine && Boolean(_optionalChain([packageJson, 'access', _6 => _6.engines, 'optionalAccess', _7 => _7.node]))) {
|
|
1351
1330
|
isNodeEngine = true;
|
|
1352
1331
|
}
|
|
1353
|
-
if (!isPrettier && Boolean(
|
|
1354
|
-
_optionalChain([packageJson, 'access', _8 => _8.dependencies, 'optionalAccess', _9 => _9.prettier]) || _optionalChain([packageJson, 'access', _10 => _10.devDependencies, 'optionalAccess', _11 => _11.prettier])
|
|
1355
|
-
)) {
|
|
1356
|
-
isPrettier = true;
|
|
1357
|
-
}
|
|
1358
1332
|
if (!isTailwind && Boolean(
|
|
1359
|
-
_optionalChain([packageJson, 'access',
|
|
1333
|
+
_optionalChain([packageJson, 'access', _8 => _8.dependencies, 'optionalAccess', _9 => _9.tailwindcss]) || _optionalChain([packageJson, 'access', _10 => _10.devDependencies, 'optionalAccess', _11 => _11.tailwindcss])
|
|
1360
1334
|
)) {
|
|
1361
1335
|
isTailwind = true;
|
|
1362
1336
|
}
|
|
@@ -1365,7 +1339,6 @@ function checkEnvironment() {
|
|
|
1365
1339
|
return {
|
|
1366
1340
|
isGitIgnore,
|
|
1367
1341
|
isNode,
|
|
1368
|
-
isPrettier,
|
|
1369
1342
|
isTailwind,
|
|
1370
1343
|
testingFramework
|
|
1371
1344
|
};
|
|
@@ -1373,7 +1346,7 @@ function checkEnvironment() {
|
|
|
1373
1346
|
|
|
1374
1347
|
// src/factory.ts
|
|
1375
1348
|
function factory(options) {
|
|
1376
|
-
const { isGitIgnore, isNode,
|
|
1349
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1377
1350
|
const configs = [];
|
|
1378
1351
|
if (isGitIgnore) {
|
|
1379
1352
|
configs.push([_eslintconfigflatgitignore2.default.call(void 0, )]);
|
|
@@ -1382,7 +1355,6 @@ function factory(options) {
|
|
|
1382
1355
|
ignores(),
|
|
1383
1356
|
base(),
|
|
1384
1357
|
imports(),
|
|
1385
|
-
switchCase(),
|
|
1386
1358
|
unicorn(),
|
|
1387
1359
|
typescript(options),
|
|
1388
1360
|
astro(),
|
|
@@ -1397,9 +1369,6 @@ function factory(options) {
|
|
|
1397
1369
|
if (testingFramework === "jest") {
|
|
1398
1370
|
configs.push(jest());
|
|
1399
1371
|
}
|
|
1400
|
-
if (isPrettier) {
|
|
1401
|
-
configs.push(prettier());
|
|
1402
|
-
}
|
|
1403
1372
|
const merged = configs.flat();
|
|
1404
1373
|
return merged;
|
|
1405
1374
|
}
|
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
|
},
|
|
@@ -517,6 +523,7 @@ function jest() {
|
|
|
517
523
|
},
|
|
518
524
|
{
|
|
519
525
|
files: ["**/*.{spec,test}.{ts,tsx}"],
|
|
526
|
+
name: "will-stone/jest/typescript",
|
|
520
527
|
rules: {
|
|
521
528
|
"jest/no-untyped-mock-factory": "warn"
|
|
522
529
|
}
|
|
@@ -533,6 +540,7 @@ function node() {
|
|
|
533
540
|
languageOptions: {
|
|
534
541
|
globals: globals3.node
|
|
535
542
|
},
|
|
543
|
+
name: "will-stone/node",
|
|
536
544
|
plugins: {
|
|
537
545
|
n: pluginNode
|
|
538
546
|
},
|
|
@@ -540,6 +548,9 @@ function node() {
|
|
|
540
548
|
"n/callback-return": "error",
|
|
541
549
|
"n/global-require": "error",
|
|
542
550
|
"n/handle-callback-err": "error",
|
|
551
|
+
// Not sure I need this...?
|
|
552
|
+
// TODO check others' configs to see how they use this.
|
|
553
|
+
"n/hashbang": "off",
|
|
543
554
|
"n/no-mixed-requires": "error",
|
|
544
555
|
"n/no-new-require": "error",
|
|
545
556
|
"n/no-path-concat": "error",
|
|
@@ -549,9 +560,6 @@ function node() {
|
|
|
549
560
|
"n/no-restricted-require": "off",
|
|
550
561
|
// I like synchronous functions
|
|
551
562
|
"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
563
|
// Turn these off until I work out if I need them
|
|
556
564
|
"n/exports-style": "off",
|
|
557
565
|
"n/file-extension-in-import": "off",
|
|
@@ -576,6 +584,7 @@ function node() {
|
|
|
576
584
|
"n/prefer-global/text-encoder": "off",
|
|
577
585
|
"n/prefer-global/url": "off",
|
|
578
586
|
"n/prefer-global/url-search-params": "off",
|
|
587
|
+
"n/prefer-node-protocol": "warn",
|
|
579
588
|
"n/prefer-promises/dns": "off",
|
|
580
589
|
"n/prefer-promises/fs": "off",
|
|
581
590
|
"n/process-exit-as-throw": "off"
|
|
@@ -584,21 +593,6 @@ function node() {
|
|
|
584
593
|
];
|
|
585
594
|
}
|
|
586
595
|
|
|
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
596
|
// src/configs/react.ts
|
|
603
597
|
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
|
|
604
598
|
import pluginReact from "eslint-plugin-react";
|
|
@@ -616,6 +610,7 @@ function react() {
|
|
|
616
610
|
}
|
|
617
611
|
}
|
|
618
612
|
},
|
|
613
|
+
name: "will-stone/react",
|
|
619
614
|
plugins: {
|
|
620
615
|
"jsx-a11y": pluginJsxA11y,
|
|
621
616
|
"react": pluginReact,
|
|
@@ -898,32 +893,13 @@ function react() {
|
|
|
898
893
|
];
|
|
899
894
|
}
|
|
900
895
|
|
|
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
896
|
// src/configs/tailwind.ts
|
|
922
897
|
import pluginTailwind from "eslint-plugin-tailwindcss";
|
|
923
898
|
function tailwind() {
|
|
924
899
|
return [
|
|
925
900
|
{
|
|
926
901
|
files: ["**/*.{jsx,tsx,astro}"],
|
|
902
|
+
name: "will-stone/tailwind",
|
|
927
903
|
plugins: { tailwindcss: pluginTailwind },
|
|
928
904
|
rules: {
|
|
929
905
|
"tailwindcss/classnames-order": "warn",
|
|
@@ -955,6 +931,7 @@ function typescript(options) {
|
|
|
955
931
|
} : {}
|
|
956
932
|
}
|
|
957
933
|
},
|
|
934
|
+
name: "will-stone/typescript",
|
|
958
935
|
plugins: {
|
|
959
936
|
// @ts-expect-error -- does not confirm to type
|
|
960
937
|
"@typescript-eslint": pluginTypescript
|
|
@@ -1048,7 +1025,6 @@ function typescript(options) {
|
|
|
1048
1025
|
"@typescript-eslint/no-misused-promises": "off",
|
|
1049
1026
|
"@typescript-eslint/no-mixed-enums": "off",
|
|
1050
1027
|
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
1051
|
-
"@typescript-eslint/no-throw-literal": "off",
|
|
1052
1028
|
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
|
|
1053
1029
|
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
1054
1030
|
"@typescript-eslint/no-unnecessary-qualifier": "off",
|
|
@@ -1181,6 +1157,7 @@ import pluginUnicorn from "eslint-plugin-unicorn";
|
|
|
1181
1157
|
function unicorn() {
|
|
1182
1158
|
return [
|
|
1183
1159
|
{
|
|
1160
|
+
name: "will-stone/unicorn",
|
|
1184
1161
|
plugins: {
|
|
1185
1162
|
unicorn: pluginUnicorn
|
|
1186
1163
|
},
|
|
@@ -1206,12 +1183,14 @@ function unicorn() {
|
|
|
1206
1183
|
"unicorn/import-style": "off",
|
|
1207
1184
|
"unicorn/new-for-builtins": "warn",
|
|
1208
1185
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1186
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1209
1187
|
"unicorn/no-array-callback-reference": "off",
|
|
1210
1188
|
"unicorn/no-array-for-each": "warn",
|
|
1211
1189
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1212
1190
|
"unicorn/no-array-push-push": "warn",
|
|
1213
1191
|
"unicorn/no-array-reduce": "error",
|
|
1214
1192
|
"unicorn/no-await-expression-member": "warn",
|
|
1193
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1215
1194
|
"unicorn/no-console-spaces": "warn",
|
|
1216
1195
|
"unicorn/no-document-cookie": "error",
|
|
1217
1196
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1238,6 +1217,7 @@ function unicorn() {
|
|
|
1238
1217
|
"unicorn/no-null": "off",
|
|
1239
1218
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1240
1219
|
"unicorn/no-process-exit": "error",
|
|
1220
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1241
1221
|
"unicorn/no-static-only-class": "error",
|
|
1242
1222
|
"unicorn/no-thenable": "error",
|
|
1243
1223
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1332,7 +1312,6 @@ import { globSync } from "glob";
|
|
|
1332
1312
|
function checkEnvironment() {
|
|
1333
1313
|
const isGitIgnore = existsSync(".gitignore");
|
|
1334
1314
|
let isNodeEngine = false;
|
|
1335
|
-
let isPrettier = false;
|
|
1336
1315
|
let isTailwind = false;
|
|
1337
1316
|
let testingFramework = null;
|
|
1338
1317
|
const allPackageJsonPaths = globSync("**/package.json", {
|
|
@@ -1350,11 +1329,6 @@ function checkEnvironment() {
|
|
|
1350
1329
|
if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
|
|
1351
1330
|
isNodeEngine = true;
|
|
1352
1331
|
}
|
|
1353
|
-
if (!isPrettier && Boolean(
|
|
1354
|
-
packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
|
|
1355
|
-
)) {
|
|
1356
|
-
isPrettier = true;
|
|
1357
|
-
}
|
|
1358
1332
|
if (!isTailwind && Boolean(
|
|
1359
1333
|
packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
|
|
1360
1334
|
)) {
|
|
@@ -1365,7 +1339,6 @@ function checkEnvironment() {
|
|
|
1365
1339
|
return {
|
|
1366
1340
|
isGitIgnore,
|
|
1367
1341
|
isNode,
|
|
1368
|
-
isPrettier,
|
|
1369
1342
|
isTailwind,
|
|
1370
1343
|
testingFramework
|
|
1371
1344
|
};
|
|
@@ -1373,7 +1346,7 @@ function checkEnvironment() {
|
|
|
1373
1346
|
|
|
1374
1347
|
// src/factory.ts
|
|
1375
1348
|
function factory(options) {
|
|
1376
|
-
const { isGitIgnore, isNode,
|
|
1349
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1377
1350
|
const configs = [];
|
|
1378
1351
|
if (isGitIgnore) {
|
|
1379
1352
|
configs.push([gitignore()]);
|
|
@@ -1382,7 +1355,6 @@ function factory(options) {
|
|
|
1382
1355
|
ignores(),
|
|
1383
1356
|
base(),
|
|
1384
1357
|
imports(),
|
|
1385
|
-
switchCase(),
|
|
1386
1358
|
unicorn(),
|
|
1387
1359
|
typescript(options),
|
|
1388
1360
|
astro(),
|
|
@@ -1397,9 +1369,6 @@ function factory(options) {
|
|
|
1397
1369
|
if (testingFramework === "jest") {
|
|
1398
1370
|
configs.push(jest());
|
|
1399
1371
|
}
|
|
1400
|
-
if (isPrettier) {
|
|
1401
|
-
configs.push(prettier());
|
|
1402
|
-
}
|
|
1403
1372
|
const merged = configs.flat();
|
|
1404
1373
|
return merged;
|
|
1405
1374
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@will-stone/eslint-config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Will Stone's ESLint config",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint-config"
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsup src/index.ts --format esm,cjs --clean --dts --cjsInterop --splitting",
|
|
29
|
-
"dev": "tsup src/index.ts --format esm,cjs --watch &
|
|
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",
|
|
68
|
+
"@eslint/config-inspector": "^0.4.1",
|
|
70
69
|
"@types/confusing-browser-globals": "^1.0.3",
|
|
71
|
-
"@types/eslint": "^8.56.
|
|
72
|
-
"@types/node": "^20.
|
|
70
|
+
"@types/eslint": "^8.56.7",
|
|
71
|
+
"@types/node": "^20.12.5",
|
|
73
72
|
"@will-stone/prettier-config": "^7.0.3",
|
|
74
|
-
"eslint": "^8.57.0",
|
|
75
|
-
"eslint-flat-config-viewer": "^0.1.14",
|
|
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"
|