@will-stone/eslint-config 7.2.1 → 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 -53
- package/dist/index.js +22 -52
- 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
|
},
|
|
@@ -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
|
|
@@ -1180,6 +1157,7 @@ var _eslintpluginunicorn = require('eslint-plugin-unicorn'); var _eslintpluginun
|
|
|
1180
1157
|
function unicorn() {
|
|
1181
1158
|
return [
|
|
1182
1159
|
{
|
|
1160
|
+
name: "will-stone/unicorn",
|
|
1183
1161
|
plugins: {
|
|
1184
1162
|
unicorn: _eslintpluginunicorn2.default
|
|
1185
1163
|
},
|
|
@@ -1205,12 +1183,14 @@ function unicorn() {
|
|
|
1205
1183
|
"unicorn/import-style": "off",
|
|
1206
1184
|
"unicorn/new-for-builtins": "warn",
|
|
1207
1185
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1186
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1208
1187
|
"unicorn/no-array-callback-reference": "off",
|
|
1209
1188
|
"unicorn/no-array-for-each": "warn",
|
|
1210
1189
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1211
1190
|
"unicorn/no-array-push-push": "warn",
|
|
1212
1191
|
"unicorn/no-array-reduce": "error",
|
|
1213
1192
|
"unicorn/no-await-expression-member": "warn",
|
|
1193
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1214
1194
|
"unicorn/no-console-spaces": "warn",
|
|
1215
1195
|
"unicorn/no-document-cookie": "error",
|
|
1216
1196
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1237,6 +1217,7 @@ function unicorn() {
|
|
|
1237
1217
|
"unicorn/no-null": "off",
|
|
1238
1218
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1239
1219
|
"unicorn/no-process-exit": "error",
|
|
1220
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1240
1221
|
"unicorn/no-static-only-class": "error",
|
|
1241
1222
|
"unicorn/no-thenable": "error",
|
|
1242
1223
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1331,7 +1312,6 @@ var _glob = require('glob');
|
|
|
1331
1312
|
function checkEnvironment() {
|
|
1332
1313
|
const isGitIgnore = _fs.existsSync.call(void 0, ".gitignore");
|
|
1333
1314
|
let isNodeEngine = false;
|
|
1334
|
-
let isPrettier = false;
|
|
1335
1315
|
let isTailwind = false;
|
|
1336
1316
|
let testingFramework = null;
|
|
1337
1317
|
const allPackageJsonPaths = _glob.globSync.call(void 0, "**/package.json", {
|
|
@@ -1349,13 +1329,8 @@ function checkEnvironment() {
|
|
|
1349
1329
|
if (!isNodeEngine && Boolean(_optionalChain([packageJson, 'access', _6 => _6.engines, 'optionalAccess', _7 => _7.node]))) {
|
|
1350
1330
|
isNodeEngine = true;
|
|
1351
1331
|
}
|
|
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
1332
|
if (!isTailwind && Boolean(
|
|
1358
|
-
_optionalChain([packageJson, 'access',
|
|
1333
|
+
_optionalChain([packageJson, 'access', _8 => _8.dependencies, 'optionalAccess', _9 => _9.tailwindcss]) || _optionalChain([packageJson, 'access', _10 => _10.devDependencies, 'optionalAccess', _11 => _11.tailwindcss])
|
|
1359
1334
|
)) {
|
|
1360
1335
|
isTailwind = true;
|
|
1361
1336
|
}
|
|
@@ -1364,7 +1339,6 @@ function checkEnvironment() {
|
|
|
1364
1339
|
return {
|
|
1365
1340
|
isGitIgnore,
|
|
1366
1341
|
isNode,
|
|
1367
|
-
isPrettier,
|
|
1368
1342
|
isTailwind,
|
|
1369
1343
|
testingFramework
|
|
1370
1344
|
};
|
|
@@ -1372,7 +1346,7 @@ function checkEnvironment() {
|
|
|
1372
1346
|
|
|
1373
1347
|
// src/factory.ts
|
|
1374
1348
|
function factory(options) {
|
|
1375
|
-
const { isGitIgnore, isNode,
|
|
1349
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1376
1350
|
const configs = [];
|
|
1377
1351
|
if (isGitIgnore) {
|
|
1378
1352
|
configs.push([_eslintconfigflatgitignore2.default.call(void 0, )]);
|
|
@@ -1381,7 +1355,6 @@ function factory(options) {
|
|
|
1381
1355
|
ignores(),
|
|
1382
1356
|
base(),
|
|
1383
1357
|
imports(),
|
|
1384
|
-
switchCase(),
|
|
1385
1358
|
unicorn(),
|
|
1386
1359
|
typescript(options),
|
|
1387
1360
|
astro(),
|
|
@@ -1396,9 +1369,6 @@ function factory(options) {
|
|
|
1396
1369
|
if (testingFramework === "jest") {
|
|
1397
1370
|
configs.push(jest());
|
|
1398
1371
|
}
|
|
1399
|
-
if (isPrettier) {
|
|
1400
|
-
configs.push(prettier());
|
|
1401
|
-
}
|
|
1402
1372
|
const merged = configs.flat();
|
|
1403
1373
|
return merged;
|
|
1404
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
|
|
@@ -1180,6 +1157,7 @@ import pluginUnicorn from "eslint-plugin-unicorn";
|
|
|
1180
1157
|
function unicorn() {
|
|
1181
1158
|
return [
|
|
1182
1159
|
{
|
|
1160
|
+
name: "will-stone/unicorn",
|
|
1183
1161
|
plugins: {
|
|
1184
1162
|
unicorn: pluginUnicorn
|
|
1185
1163
|
},
|
|
@@ -1205,12 +1183,14 @@ function unicorn() {
|
|
|
1205
1183
|
"unicorn/import-style": "off",
|
|
1206
1184
|
"unicorn/new-for-builtins": "warn",
|
|
1207
1185
|
"unicorn/no-abusive-eslint-disable": "error",
|
|
1186
|
+
"unicorn/no-anonymous-default-export": "error",
|
|
1208
1187
|
"unicorn/no-array-callback-reference": "off",
|
|
1209
1188
|
"unicorn/no-array-for-each": "warn",
|
|
1210
1189
|
"unicorn/no-array-method-this-argument": "warn",
|
|
1211
1190
|
"unicorn/no-array-push-push": "warn",
|
|
1212
1191
|
"unicorn/no-array-reduce": "error",
|
|
1213
1192
|
"unicorn/no-await-expression-member": "warn",
|
|
1193
|
+
"unicorn/no-await-in-promise-methods": "error",
|
|
1214
1194
|
"unicorn/no-console-spaces": "warn",
|
|
1215
1195
|
"unicorn/no-document-cookie": "error",
|
|
1216
1196
|
// TODO turn back on when it can exclude files. As this warns about the
|
|
@@ -1237,6 +1217,7 @@ function unicorn() {
|
|
|
1237
1217
|
"unicorn/no-null": "off",
|
|
1238
1218
|
"unicorn/no-object-as-default-parameter": "error",
|
|
1239
1219
|
"unicorn/no-process-exit": "error",
|
|
1220
|
+
"unicorn/no-single-promise-in-promise-methods": "warn",
|
|
1240
1221
|
"unicorn/no-static-only-class": "error",
|
|
1241
1222
|
"unicorn/no-thenable": "error",
|
|
1242
1223
|
"unicorn/no-this-assignment": "error",
|
|
@@ -1331,7 +1312,6 @@ import { globSync } from "glob";
|
|
|
1331
1312
|
function checkEnvironment() {
|
|
1332
1313
|
const isGitIgnore = existsSync(".gitignore");
|
|
1333
1314
|
let isNodeEngine = false;
|
|
1334
|
-
let isPrettier = false;
|
|
1335
1315
|
let isTailwind = false;
|
|
1336
1316
|
let testingFramework = null;
|
|
1337
1317
|
const allPackageJsonPaths = globSync("**/package.json", {
|
|
@@ -1349,11 +1329,6 @@ function checkEnvironment() {
|
|
|
1349
1329
|
if (!isNodeEngine && Boolean(packageJson.engines?.node)) {
|
|
1350
1330
|
isNodeEngine = true;
|
|
1351
1331
|
}
|
|
1352
|
-
if (!isPrettier && Boolean(
|
|
1353
|
-
packageJson.dependencies?.prettier || packageJson.devDependencies?.prettier
|
|
1354
|
-
)) {
|
|
1355
|
-
isPrettier = true;
|
|
1356
|
-
}
|
|
1357
1332
|
if (!isTailwind && Boolean(
|
|
1358
1333
|
packageJson.dependencies?.tailwindcss || packageJson.devDependencies?.tailwindcss
|
|
1359
1334
|
)) {
|
|
@@ -1364,7 +1339,6 @@ function checkEnvironment() {
|
|
|
1364
1339
|
return {
|
|
1365
1340
|
isGitIgnore,
|
|
1366
1341
|
isNode,
|
|
1367
|
-
isPrettier,
|
|
1368
1342
|
isTailwind,
|
|
1369
1343
|
testingFramework
|
|
1370
1344
|
};
|
|
@@ -1372,7 +1346,7 @@ function checkEnvironment() {
|
|
|
1372
1346
|
|
|
1373
1347
|
// src/factory.ts
|
|
1374
1348
|
function factory(options) {
|
|
1375
|
-
const { isGitIgnore, isNode,
|
|
1349
|
+
const { isGitIgnore, isNode, isTailwind, testingFramework } = checkEnvironment();
|
|
1376
1350
|
const configs = [];
|
|
1377
1351
|
if (isGitIgnore) {
|
|
1378
1352
|
configs.push([gitignore()]);
|
|
@@ -1381,7 +1355,6 @@ function factory(options) {
|
|
|
1381
1355
|
ignores(),
|
|
1382
1356
|
base(),
|
|
1383
1357
|
imports(),
|
|
1384
|
-
switchCase(),
|
|
1385
1358
|
unicorn(),
|
|
1386
1359
|
typescript(options),
|
|
1387
1360
|
astro(),
|
|
@@ -1396,9 +1369,6 @@ function factory(options) {
|
|
|
1396
1369
|
if (testingFramework === "jest") {
|
|
1397
1370
|
configs.push(jest());
|
|
1398
1371
|
}
|
|
1399
|
-
if (isPrettier) {
|
|
1400
|
-
configs.push(prettier());
|
|
1401
|
-
}
|
|
1402
1372
|
const merged = configs.flat();
|
|
1403
1373
|
return merged;
|
|
1404
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"
|
|
@@ -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"
|