@coderwyd/eslint-config 2.5.0 → 2.5.2
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/cli.cjs +2 -1
- package/dist/cli.js +2 -1
- package/dist/index.cjs +63 -28
- package/dist/index.js +63 -28
- package/package.json +6 -2
package/dist/cli.cjs
CHANGED
|
@@ -46,7 +46,7 @@ var import_parse_gitignore = __toESM(require("parse-gitignore"), 1);
|
|
|
46
46
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
47
47
|
|
|
48
48
|
// package.json
|
|
49
|
-
var version = "2.5.
|
|
49
|
+
var version = "2.5.2";
|
|
50
50
|
var devDependencies = {
|
|
51
51
|
"@antfu/ni": "^0.21.12",
|
|
52
52
|
"@eslint-react/eslint-plugin": "^1.5.12",
|
|
@@ -64,6 +64,7 @@ var devDependencies = {
|
|
|
64
64
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
65
65
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
66
66
|
"eslint-plugin-svelte": "2.39.0",
|
|
67
|
+
"eslint-plugin-tailwindcss": "^3.16.0",
|
|
67
68
|
execa: "^9.1.0",
|
|
68
69
|
"fast-glob": "^3.3.2",
|
|
69
70
|
"fs-extra": "^11.2.0",
|
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,7 @@ import parse from "parse-gitignore";
|
|
|
17
17
|
import c from "picocolors";
|
|
18
18
|
|
|
19
19
|
// package.json
|
|
20
|
-
var version = "2.5.
|
|
20
|
+
var version = "2.5.2";
|
|
21
21
|
var devDependencies = {
|
|
22
22
|
"@antfu/ni": "^0.21.12",
|
|
23
23
|
"@eslint-react/eslint-plugin": "^1.5.12",
|
|
@@ -35,6 +35,7 @@ var devDependencies = {
|
|
|
35
35
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
36
36
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
37
37
|
"eslint-plugin-svelte": "2.39.0",
|
|
38
|
+
"eslint-plugin-tailwindcss": "^3.16.0",
|
|
38
39
|
execa: "^9.1.0",
|
|
39
40
|
"fast-glob": "^3.3.2",
|
|
40
41
|
"fs-extra": "^11.2.0",
|
package/dist/index.cjs
CHANGED
|
@@ -288,9 +288,9 @@ async function javascript(options = {}) {
|
|
|
288
288
|
"no-new": "error",
|
|
289
289
|
"no-new-func": "error",
|
|
290
290
|
"no-new-native-nonconstructor": "error",
|
|
291
|
-
"no-new-object": "error",
|
|
292
291
|
"no-new-wrappers": "error",
|
|
293
292
|
"no-obj-calls": "error",
|
|
293
|
+
"no-object-constructor": "error",
|
|
294
294
|
"no-octal": "error",
|
|
295
295
|
"no-octal-escape": "error",
|
|
296
296
|
"no-proto": "error",
|
|
@@ -1283,9 +1283,13 @@ async function vue(options = {}) {
|
|
|
1283
1283
|
order: isVue3 ? ["script", "template", "style"] : ["template", "script", "style"]
|
|
1284
1284
|
}
|
|
1285
1285
|
],
|
|
1286
|
+
// 'vue/component-api-style': ['warn', ['script-setup', 'composition']],
|
|
1286
1287
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1287
1288
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1289
|
+
// this is deprecated
|
|
1290
|
+
"vue/component-tags-order": "off",
|
|
1288
1291
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1292
|
+
// 'vue/define-emits-declaration': ['warn', 'type-based'],
|
|
1289
1293
|
"vue/define-macros-order": [
|
|
1290
1294
|
"error",
|
|
1291
1295
|
{
|
|
@@ -1297,31 +1301,35 @@ async function vue(options = {}) {
|
|
|
1297
1301
|
]
|
|
1298
1302
|
}
|
|
1299
1303
|
],
|
|
1304
|
+
// 'vue/define-props-declaration': ['warn', 'type-based'],
|
|
1300
1305
|
"vue/dot-location": ["error", "property"],
|
|
1301
1306
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1302
1307
|
"vue/eqeqeq": ["error", "smart"],
|
|
1303
1308
|
"vue/html-indent": ["error", indent],
|
|
1309
|
+
// 'vue/html-self-closing': [
|
|
1310
|
+
// 'error',
|
|
1311
|
+
// {
|
|
1312
|
+
// html: {
|
|
1313
|
+
// component: 'always',
|
|
1314
|
+
// normal: 'always',
|
|
1315
|
+
// void: 'any',
|
|
1316
|
+
// },
|
|
1317
|
+
// math: 'always',
|
|
1318
|
+
// svg: 'always',
|
|
1319
|
+
// },
|
|
1304
1320
|
"vue/html-quotes": ["error", "double"],
|
|
1305
|
-
|
|
1306
|
-
"error",
|
|
1307
|
-
{
|
|
1308
|
-
html: {
|
|
1309
|
-
component: "always",
|
|
1310
|
-
normal: "always",
|
|
1311
|
-
void: "any"
|
|
1312
|
-
},
|
|
1313
|
-
math: "always",
|
|
1314
|
-
svg: "always"
|
|
1315
|
-
}
|
|
1316
|
-
],
|
|
1321
|
+
// ],
|
|
1317
1322
|
"vue/max-attributes-per-line": "off",
|
|
1318
1323
|
"vue/multi-word-component-names": "off",
|
|
1324
|
+
// 'vue/next-tick-style': ['warn', 'promise'],
|
|
1319
1325
|
"vue/no-constant-condition": "warn",
|
|
1320
1326
|
"vue/no-dupe-keys": "off",
|
|
1327
|
+
"vue/no-duplicate-attr-inheritance": "warn",
|
|
1321
1328
|
"vue/no-empty-pattern": "error",
|
|
1322
1329
|
"vue/no-extra-parens": ["error", "functions"],
|
|
1323
1330
|
"vue/no-irregular-whitespace": "error",
|
|
1324
1331
|
"vue/no-loss-of-precision": "error",
|
|
1332
|
+
"vue/no-required-prop-with-default": "warn",
|
|
1325
1333
|
"vue/no-restricted-syntax": [
|
|
1326
1334
|
"error",
|
|
1327
1335
|
"DebuggerStatement",
|
|
@@ -1331,9 +1339,14 @@ async function vue(options = {}) {
|
|
|
1331
1339
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1332
1340
|
"vue/no-setup-props-reactivity-loss": "off",
|
|
1333
1341
|
"vue/no-sparse-arrays": "error",
|
|
1342
|
+
"vue/no-unsupported-features": "warn",
|
|
1343
|
+
"vue/no-unused-emit-declarations": "warn",
|
|
1334
1344
|
"vue/no-unused-refs": "error",
|
|
1345
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
1346
|
+
"vue/no-useless-mustaches": "warn",
|
|
1335
1347
|
"vue/no-useless-v-bind": "error",
|
|
1336
1348
|
"vue/no-v-html": "off",
|
|
1349
|
+
"vue/no-v-text": "warn",
|
|
1337
1350
|
"vue/object-shorthand": [
|
|
1338
1351
|
"error",
|
|
1339
1352
|
"always",
|
|
@@ -1342,10 +1355,21 @@ async function vue(options = {}) {
|
|
|
1342
1355
|
ignoreConstructors: false
|
|
1343
1356
|
}
|
|
1344
1357
|
],
|
|
1358
|
+
"vue/prefer-define-options": "warn",
|
|
1345
1359
|
"vue/prefer-separate-static-class": "error",
|
|
1346
1360
|
"vue/prefer-template": "error",
|
|
1347
1361
|
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1348
1362
|
"vue/require-default-prop": "off",
|
|
1363
|
+
"vue/require-macro-variable-name": [
|
|
1364
|
+
"warn",
|
|
1365
|
+
{
|
|
1366
|
+
defineEmits: "emit",
|
|
1367
|
+
defineProps: "props",
|
|
1368
|
+
defineSlots: "slots",
|
|
1369
|
+
useAttrs: "attrs",
|
|
1370
|
+
useSlots: "slots"
|
|
1371
|
+
}
|
|
1372
|
+
],
|
|
1349
1373
|
"vue/require-prop-types": "off",
|
|
1350
1374
|
"vue/space-infix-ops": "error",
|
|
1351
1375
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
@@ -1369,6 +1393,7 @@ async function vue(options = {}) {
|
|
|
1369
1393
|
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1370
1394
|
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1371
1395
|
"vue/comma-style": ["error", "last"],
|
|
1396
|
+
"vue/html-comment-content-newline": "warn",
|
|
1372
1397
|
"vue/html-comment-content-spacing": [
|
|
1373
1398
|
"error",
|
|
1374
1399
|
"always",
|
|
@@ -1456,8 +1481,20 @@ async function perfectionist() {
|
|
|
1456
1481
|
}
|
|
1457
1482
|
|
|
1458
1483
|
// src/configs/react.ts
|
|
1484
|
+
var import_local_pkg3 = require("local-pkg");
|
|
1485
|
+
|
|
1486
|
+
// src/env.ts
|
|
1487
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
1459
1488
|
var import_local_pkg2 = require("local-pkg");
|
|
1460
|
-
var
|
|
1489
|
+
var isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI);
|
|
1490
|
+
var hasTypeScript = (0, import_local_pkg2.isPackageExists)("typescript");
|
|
1491
|
+
var VueJsPackages = [
|
|
1492
|
+
"vue",
|
|
1493
|
+
"nuxt",
|
|
1494
|
+
"vitepress",
|
|
1495
|
+
"@slidev/cli"
|
|
1496
|
+
];
|
|
1497
|
+
var hasVue = hasPackages(VueJsPackages);
|
|
1461
1498
|
var RemixPackages = [
|
|
1462
1499
|
"@remix-run/node",
|
|
1463
1500
|
"@remix-run/react",
|
|
@@ -1465,6 +1502,14 @@ var RemixPackages = [
|
|
|
1465
1502
|
"@remix-run/dev"
|
|
1466
1503
|
];
|
|
1467
1504
|
var NextJsPackages = ["next"];
|
|
1505
|
+
var isUsingRemix = hasPackages(RemixPackages);
|
|
1506
|
+
var isUsingNext = hasPackages(NextJsPackages);
|
|
1507
|
+
function hasPackages(packages) {
|
|
1508
|
+
return packages.some((name) => (0, import_local_pkg2.isPackageExists)(name));
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
// src/configs/react.ts
|
|
1512
|
+
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
1468
1513
|
async function react(options = {}) {
|
|
1469
1514
|
const { files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX], overrides = {} } = options;
|
|
1470
1515
|
await ensurePackages([
|
|
@@ -1481,10 +1526,8 @@ async function react(options = {}) {
|
|
|
1481
1526
|
interopDefault(import("@typescript-eslint/parser"))
|
|
1482
1527
|
]);
|
|
1483
1528
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1484
|
-
(i) => (0,
|
|
1529
|
+
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1485
1530
|
);
|
|
1486
|
-
const isUsingRemix = RemixPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
|
|
1487
|
-
const isUsingNext = NextJsPackages.some((i) => (0, import_local_pkg2.isPackageExists)(i));
|
|
1488
1531
|
const plugins = pluginReact.configs.all.plugins;
|
|
1489
1532
|
return [
|
|
1490
1533
|
{
|
|
@@ -1818,6 +1861,7 @@ async function svelte(options = {}) {
|
|
|
1818
1861
|
// src/configs/tailwindcss.ts
|
|
1819
1862
|
async function tailwindcss(options = {}) {
|
|
1820
1863
|
const { overrides } = options;
|
|
1864
|
+
await ensurePackages(["eslint-plugin-tailwindcss"]);
|
|
1821
1865
|
const pluginTailwindcss = await interopDefault(
|
|
1822
1866
|
import("eslint-plugin-tailwindcss")
|
|
1823
1867
|
);
|
|
@@ -1833,7 +1877,7 @@ async function tailwindcss(options = {}) {
|
|
|
1833
1877
|
"tailwindcss/enforces-shorthand": "warn",
|
|
1834
1878
|
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1835
1879
|
"tailwindcss/no-arbitrary-value": "off",
|
|
1836
|
-
"tailwindcss/no-contradicting-classname": "
|
|
1880
|
+
"tailwindcss/no-contradicting-classname": "warn",
|
|
1837
1881
|
"tailwindcss/no-custom-classname": "off",
|
|
1838
1882
|
"tailwindcss/no-unnecessary-arbitrary-value": "warn",
|
|
1839
1883
|
...overrides
|
|
@@ -1878,15 +1922,6 @@ async function regexp(options = {}) {
|
|
|
1878
1922
|
];
|
|
1879
1923
|
}
|
|
1880
1924
|
|
|
1881
|
-
// src/env.ts
|
|
1882
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
1883
|
-
var import_local_pkg3 = require("local-pkg");
|
|
1884
|
-
var isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI);
|
|
1885
|
-
var hasTypeScript = (0, import_local_pkg3.isPackageExists)("typescript");
|
|
1886
|
-
var hasVue = (0, import_local_pkg3.isPackageExists)("vue") || (0, import_local_pkg3.isPackageExists)("nuxt") || (0, import_local_pkg3.isPackageExists)("vitepress") || (0, import_local_pkg3.isPackageExists)("@slidev/cli");
|
|
1887
|
-
var hasUnocss = (0, import_local_pkg3.isPackageExists)("unocss") || (0, import_local_pkg3.isPackageExists)("@unocss/webpack") || (0, import_local_pkg3.isPackageExists)("@unocss/nuxt");
|
|
1888
|
-
var hasTailwindCSS = (0, import_local_pkg3.isPackageExists)("tailwindcss") && !hasUnocss;
|
|
1889
|
-
|
|
1890
1925
|
// src/index.ts
|
|
1891
1926
|
var flatConfigProps = [
|
|
1892
1927
|
"name",
|
|
@@ -1924,7 +1959,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1924
1959
|
react: enableReact = false,
|
|
1925
1960
|
regexp: enableRegexp = true,
|
|
1926
1961
|
svelte: enableSvelte = false,
|
|
1927
|
-
tailwindcss: enableTailwindCSS =
|
|
1962
|
+
tailwindcss: enableTailwindCSS = false,
|
|
1928
1963
|
typescript: enableTypeScript = hasTypeScript,
|
|
1929
1964
|
unocss: enableUnoCSS = false,
|
|
1930
1965
|
vue: enableVue = hasVue
|
package/dist/index.js
CHANGED
|
@@ -243,9 +243,9 @@ async function javascript(options = {}) {
|
|
|
243
243
|
"no-new": "error",
|
|
244
244
|
"no-new-func": "error",
|
|
245
245
|
"no-new-native-nonconstructor": "error",
|
|
246
|
-
"no-new-object": "error",
|
|
247
246
|
"no-new-wrappers": "error",
|
|
248
247
|
"no-obj-calls": "error",
|
|
248
|
+
"no-object-constructor": "error",
|
|
249
249
|
"no-octal": "error",
|
|
250
250
|
"no-octal-escape": "error",
|
|
251
251
|
"no-proto": "error",
|
|
@@ -1238,9 +1238,13 @@ async function vue(options = {}) {
|
|
|
1238
1238
|
order: isVue3 ? ["script", "template", "style"] : ["template", "script", "style"]
|
|
1239
1239
|
}
|
|
1240
1240
|
],
|
|
1241
|
+
// 'vue/component-api-style': ['warn', ['script-setup', 'composition']],
|
|
1241
1242
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1242
1243
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1244
|
+
// this is deprecated
|
|
1245
|
+
"vue/component-tags-order": "off",
|
|
1243
1246
|
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1247
|
+
// 'vue/define-emits-declaration': ['warn', 'type-based'],
|
|
1244
1248
|
"vue/define-macros-order": [
|
|
1245
1249
|
"error",
|
|
1246
1250
|
{
|
|
@@ -1252,31 +1256,35 @@ async function vue(options = {}) {
|
|
|
1252
1256
|
]
|
|
1253
1257
|
}
|
|
1254
1258
|
],
|
|
1259
|
+
// 'vue/define-props-declaration': ['warn', 'type-based'],
|
|
1255
1260
|
"vue/dot-location": ["error", "property"],
|
|
1256
1261
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1257
1262
|
"vue/eqeqeq": ["error", "smart"],
|
|
1258
1263
|
"vue/html-indent": ["error", indent],
|
|
1264
|
+
// 'vue/html-self-closing': [
|
|
1265
|
+
// 'error',
|
|
1266
|
+
// {
|
|
1267
|
+
// html: {
|
|
1268
|
+
// component: 'always',
|
|
1269
|
+
// normal: 'always',
|
|
1270
|
+
// void: 'any',
|
|
1271
|
+
// },
|
|
1272
|
+
// math: 'always',
|
|
1273
|
+
// svg: 'always',
|
|
1274
|
+
// },
|
|
1259
1275
|
"vue/html-quotes": ["error", "double"],
|
|
1260
|
-
|
|
1261
|
-
"error",
|
|
1262
|
-
{
|
|
1263
|
-
html: {
|
|
1264
|
-
component: "always",
|
|
1265
|
-
normal: "always",
|
|
1266
|
-
void: "any"
|
|
1267
|
-
},
|
|
1268
|
-
math: "always",
|
|
1269
|
-
svg: "always"
|
|
1270
|
-
}
|
|
1271
|
-
],
|
|
1276
|
+
// ],
|
|
1272
1277
|
"vue/max-attributes-per-line": "off",
|
|
1273
1278
|
"vue/multi-word-component-names": "off",
|
|
1279
|
+
// 'vue/next-tick-style': ['warn', 'promise'],
|
|
1274
1280
|
"vue/no-constant-condition": "warn",
|
|
1275
1281
|
"vue/no-dupe-keys": "off",
|
|
1282
|
+
"vue/no-duplicate-attr-inheritance": "warn",
|
|
1276
1283
|
"vue/no-empty-pattern": "error",
|
|
1277
1284
|
"vue/no-extra-parens": ["error", "functions"],
|
|
1278
1285
|
"vue/no-irregular-whitespace": "error",
|
|
1279
1286
|
"vue/no-loss-of-precision": "error",
|
|
1287
|
+
"vue/no-required-prop-with-default": "warn",
|
|
1280
1288
|
"vue/no-restricted-syntax": [
|
|
1281
1289
|
"error",
|
|
1282
1290
|
"DebuggerStatement",
|
|
@@ -1286,9 +1294,14 @@ async function vue(options = {}) {
|
|
|
1286
1294
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1287
1295
|
"vue/no-setup-props-reactivity-loss": "off",
|
|
1288
1296
|
"vue/no-sparse-arrays": "error",
|
|
1297
|
+
"vue/no-unsupported-features": "warn",
|
|
1298
|
+
"vue/no-unused-emit-declarations": "warn",
|
|
1289
1299
|
"vue/no-unused-refs": "error",
|
|
1300
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
1301
|
+
"vue/no-useless-mustaches": "warn",
|
|
1290
1302
|
"vue/no-useless-v-bind": "error",
|
|
1291
1303
|
"vue/no-v-html": "off",
|
|
1304
|
+
"vue/no-v-text": "warn",
|
|
1292
1305
|
"vue/object-shorthand": [
|
|
1293
1306
|
"error",
|
|
1294
1307
|
"always",
|
|
@@ -1297,10 +1310,21 @@ async function vue(options = {}) {
|
|
|
1297
1310
|
ignoreConstructors: false
|
|
1298
1311
|
}
|
|
1299
1312
|
],
|
|
1313
|
+
"vue/prefer-define-options": "warn",
|
|
1300
1314
|
"vue/prefer-separate-static-class": "error",
|
|
1301
1315
|
"vue/prefer-template": "error",
|
|
1302
1316
|
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1303
1317
|
"vue/require-default-prop": "off",
|
|
1318
|
+
"vue/require-macro-variable-name": [
|
|
1319
|
+
"warn",
|
|
1320
|
+
{
|
|
1321
|
+
defineEmits: "emit",
|
|
1322
|
+
defineProps: "props",
|
|
1323
|
+
defineSlots: "slots",
|
|
1324
|
+
useAttrs: "attrs",
|
|
1325
|
+
useSlots: "slots"
|
|
1326
|
+
}
|
|
1327
|
+
],
|
|
1304
1328
|
"vue/require-prop-types": "off",
|
|
1305
1329
|
"vue/space-infix-ops": "error",
|
|
1306
1330
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
@@ -1324,6 +1348,7 @@ async function vue(options = {}) {
|
|
|
1324
1348
|
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1325
1349
|
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1326
1350
|
"vue/comma-style": ["error", "last"],
|
|
1351
|
+
"vue/html-comment-content-newline": "warn",
|
|
1327
1352
|
"vue/html-comment-content-spacing": [
|
|
1328
1353
|
"error",
|
|
1329
1354
|
"always",
|
|
@@ -1411,8 +1436,20 @@ async function perfectionist() {
|
|
|
1411
1436
|
}
|
|
1412
1437
|
|
|
1413
1438
|
// src/configs/react.ts
|
|
1439
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
1440
|
+
|
|
1441
|
+
// src/env.ts
|
|
1442
|
+
import process3 from "node:process";
|
|
1414
1443
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1415
|
-
var
|
|
1444
|
+
var isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI);
|
|
1445
|
+
var hasTypeScript = isPackageExists2("typescript");
|
|
1446
|
+
var VueJsPackages = [
|
|
1447
|
+
"vue",
|
|
1448
|
+
"nuxt",
|
|
1449
|
+
"vitepress",
|
|
1450
|
+
"@slidev/cli"
|
|
1451
|
+
];
|
|
1452
|
+
var hasVue = hasPackages(VueJsPackages);
|
|
1416
1453
|
var RemixPackages = [
|
|
1417
1454
|
"@remix-run/node",
|
|
1418
1455
|
"@remix-run/react",
|
|
@@ -1420,6 +1457,14 @@ var RemixPackages = [
|
|
|
1420
1457
|
"@remix-run/dev"
|
|
1421
1458
|
];
|
|
1422
1459
|
var NextJsPackages = ["next"];
|
|
1460
|
+
var isUsingRemix = hasPackages(RemixPackages);
|
|
1461
|
+
var isUsingNext = hasPackages(NextJsPackages);
|
|
1462
|
+
function hasPackages(packages) {
|
|
1463
|
+
return packages.some((name) => isPackageExists2(name));
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
// src/configs/react.ts
|
|
1467
|
+
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
1423
1468
|
async function react(options = {}) {
|
|
1424
1469
|
const { files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX], overrides = {} } = options;
|
|
1425
1470
|
await ensurePackages([
|
|
@@ -1436,10 +1481,8 @@ async function react(options = {}) {
|
|
|
1436
1481
|
interopDefault(import("@typescript-eslint/parser"))
|
|
1437
1482
|
]);
|
|
1438
1483
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1439
|
-
(i) =>
|
|
1484
|
+
(i) => isPackageExists3(i)
|
|
1440
1485
|
);
|
|
1441
|
-
const isUsingRemix = RemixPackages.some((i) => isPackageExists2(i));
|
|
1442
|
-
const isUsingNext = NextJsPackages.some((i) => isPackageExists2(i));
|
|
1443
1486
|
const plugins = pluginReact.configs.all.plugins;
|
|
1444
1487
|
return [
|
|
1445
1488
|
{
|
|
@@ -1773,6 +1816,7 @@ async function svelte(options = {}) {
|
|
|
1773
1816
|
// src/configs/tailwindcss.ts
|
|
1774
1817
|
async function tailwindcss(options = {}) {
|
|
1775
1818
|
const { overrides } = options;
|
|
1819
|
+
await ensurePackages(["eslint-plugin-tailwindcss"]);
|
|
1776
1820
|
const pluginTailwindcss = await interopDefault(
|
|
1777
1821
|
import("eslint-plugin-tailwindcss")
|
|
1778
1822
|
);
|
|
@@ -1788,7 +1832,7 @@ async function tailwindcss(options = {}) {
|
|
|
1788
1832
|
"tailwindcss/enforces-shorthand": "warn",
|
|
1789
1833
|
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1790
1834
|
"tailwindcss/no-arbitrary-value": "off",
|
|
1791
|
-
"tailwindcss/no-contradicting-classname": "
|
|
1835
|
+
"tailwindcss/no-contradicting-classname": "warn",
|
|
1792
1836
|
"tailwindcss/no-custom-classname": "off",
|
|
1793
1837
|
"tailwindcss/no-unnecessary-arbitrary-value": "warn",
|
|
1794
1838
|
...overrides
|
|
@@ -1833,15 +1877,6 @@ async function regexp(options = {}) {
|
|
|
1833
1877
|
];
|
|
1834
1878
|
}
|
|
1835
1879
|
|
|
1836
|
-
// src/env.ts
|
|
1837
|
-
import process3 from "node:process";
|
|
1838
|
-
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
1839
|
-
var isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI);
|
|
1840
|
-
var hasTypeScript = isPackageExists3("typescript");
|
|
1841
|
-
var hasVue = isPackageExists3("vue") || isPackageExists3("nuxt") || isPackageExists3("vitepress") || isPackageExists3("@slidev/cli");
|
|
1842
|
-
var hasUnocss = isPackageExists3("unocss") || isPackageExists3("@unocss/webpack") || isPackageExists3("@unocss/nuxt");
|
|
1843
|
-
var hasTailwindCSS = isPackageExists3("tailwindcss") && !hasUnocss;
|
|
1844
|
-
|
|
1845
1880
|
// src/index.ts
|
|
1846
1881
|
var flatConfigProps = [
|
|
1847
1882
|
"name",
|
|
@@ -1879,7 +1914,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1879
1914
|
react: enableReact = false,
|
|
1880
1915
|
regexp: enableRegexp = true,
|
|
1881
1916
|
svelte: enableSvelte = false,
|
|
1882
|
-
tailwindcss: enableTailwindCSS =
|
|
1917
|
+
tailwindcss: enableTailwindCSS = false,
|
|
1883
1918
|
typescript: enableTypeScript = hasTypeScript,
|
|
1884
1919
|
unocss: enableUnoCSS = false,
|
|
1885
1920
|
vue: enableVue = hasVue
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coderwyd/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.5.
|
|
4
|
+
"version": "2.5.2",
|
|
5
5
|
"description": "Donny's ESLint config",
|
|
6
6
|
"author": "Donny Wang <donny526@outlook.com> (https://github.com/coderwyd/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
42
42
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
43
43
|
"eslint-plugin-svelte": "^2.34.1",
|
|
44
|
+
"eslint-plugin-tailwindcss": "^3.16.0",
|
|
44
45
|
"svelte-eslint-parser": "^0.33.1"
|
|
45
46
|
},
|
|
46
47
|
"peerDependenciesMeta": {
|
|
@@ -59,6 +60,9 @@
|
|
|
59
60
|
"eslint-plugin-svelte": {
|
|
60
61
|
"optional": true
|
|
61
62
|
},
|
|
63
|
+
"eslint-plugin-tailwindcss": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
62
66
|
"svelte-eslint-parser": {
|
|
63
67
|
"optional": true
|
|
64
68
|
}
|
|
@@ -82,7 +86,6 @@
|
|
|
82
86
|
"eslint-plugin-no-only-tests": "^3.1.0",
|
|
83
87
|
"eslint-plugin-perfectionist": "^2.10.0",
|
|
84
88
|
"eslint-plugin-regexp": "^2.6.0",
|
|
85
|
-
"eslint-plugin-tailwindcss": "^3.15.2",
|
|
86
89
|
"eslint-plugin-unicorn": "^53.0.0",
|
|
87
90
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
88
91
|
"eslint-plugin-vitest": "^0.5.4",
|
|
@@ -116,6 +119,7 @@
|
|
|
116
119
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
117
120
|
"eslint-plugin-react-refresh": "^0.4.7",
|
|
118
121
|
"eslint-plugin-svelte": "2.39.0",
|
|
122
|
+
"eslint-plugin-tailwindcss": "^3.16.0",
|
|
119
123
|
"execa": "^9.1.0",
|
|
120
124
|
"fast-glob": "^3.3.2",
|
|
121
125
|
"fs-extra": "^11.2.0",
|