@coderwyd/eslint-config 2.5.0 → 2.5.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/cli.cjs +2 -1
- package/dist/cli.js +2 -1
- package/dist/index.cjs +25 -15
- package/dist/index.js +25 -15
- 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.1";
|
|
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.1";
|
|
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
|
@@ -1456,8 +1456,20 @@ async function perfectionist() {
|
|
|
1456
1456
|
}
|
|
1457
1457
|
|
|
1458
1458
|
// src/configs/react.ts
|
|
1459
|
+
var import_local_pkg3 = require("local-pkg");
|
|
1460
|
+
|
|
1461
|
+
// src/env.ts
|
|
1462
|
+
var import_node_process3 = __toESM(require("process"), 1);
|
|
1459
1463
|
var import_local_pkg2 = require("local-pkg");
|
|
1460
|
-
var
|
|
1464
|
+
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);
|
|
1465
|
+
var hasTypeScript = (0, import_local_pkg2.isPackageExists)("typescript");
|
|
1466
|
+
var VueJsPackages = [
|
|
1467
|
+
"vue",
|
|
1468
|
+
"nuxt",
|
|
1469
|
+
"vitepress",
|
|
1470
|
+
"@slidev/cli"
|
|
1471
|
+
];
|
|
1472
|
+
var hasVue = hasPackages(VueJsPackages);
|
|
1461
1473
|
var RemixPackages = [
|
|
1462
1474
|
"@remix-run/node",
|
|
1463
1475
|
"@remix-run/react",
|
|
@@ -1465,6 +1477,14 @@ var RemixPackages = [
|
|
|
1465
1477
|
"@remix-run/dev"
|
|
1466
1478
|
];
|
|
1467
1479
|
var NextJsPackages = ["next"];
|
|
1480
|
+
var isUsingRemix = hasPackages(RemixPackages);
|
|
1481
|
+
var isUsingNext = hasPackages(NextJsPackages);
|
|
1482
|
+
function hasPackages(packages) {
|
|
1483
|
+
return packages.some((name) => (0, import_local_pkg2.isPackageExists)(name));
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
// src/configs/react.ts
|
|
1487
|
+
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
1468
1488
|
async function react(options = {}) {
|
|
1469
1489
|
const { files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX], overrides = {} } = options;
|
|
1470
1490
|
await ensurePackages([
|
|
@@ -1481,10 +1501,8 @@ async function react(options = {}) {
|
|
|
1481
1501
|
interopDefault(import("@typescript-eslint/parser"))
|
|
1482
1502
|
]);
|
|
1483
1503
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1484
|
-
(i) => (0,
|
|
1504
|
+
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1485
1505
|
);
|
|
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
1506
|
const plugins = pluginReact.configs.all.plugins;
|
|
1489
1507
|
return [
|
|
1490
1508
|
{
|
|
@@ -1818,6 +1836,7 @@ async function svelte(options = {}) {
|
|
|
1818
1836
|
// src/configs/tailwindcss.ts
|
|
1819
1837
|
async function tailwindcss(options = {}) {
|
|
1820
1838
|
const { overrides } = options;
|
|
1839
|
+
await ensurePackages(["eslint-plugin-tailwindcss"]);
|
|
1821
1840
|
const pluginTailwindcss = await interopDefault(
|
|
1822
1841
|
import("eslint-plugin-tailwindcss")
|
|
1823
1842
|
);
|
|
@@ -1833,7 +1852,7 @@ async function tailwindcss(options = {}) {
|
|
|
1833
1852
|
"tailwindcss/enforces-shorthand": "warn",
|
|
1834
1853
|
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1835
1854
|
"tailwindcss/no-arbitrary-value": "off",
|
|
1836
|
-
"tailwindcss/no-contradicting-classname": "
|
|
1855
|
+
"tailwindcss/no-contradicting-classname": "warn",
|
|
1837
1856
|
"tailwindcss/no-custom-classname": "off",
|
|
1838
1857
|
"tailwindcss/no-unnecessary-arbitrary-value": "warn",
|
|
1839
1858
|
...overrides
|
|
@@ -1878,15 +1897,6 @@ async function regexp(options = {}) {
|
|
|
1878
1897
|
];
|
|
1879
1898
|
}
|
|
1880
1899
|
|
|
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
1900
|
// src/index.ts
|
|
1891
1901
|
var flatConfigProps = [
|
|
1892
1902
|
"name",
|
|
@@ -1924,7 +1934,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1924
1934
|
react: enableReact = false,
|
|
1925
1935
|
regexp: enableRegexp = true,
|
|
1926
1936
|
svelte: enableSvelte = false,
|
|
1927
|
-
tailwindcss: enableTailwindCSS =
|
|
1937
|
+
tailwindcss: enableTailwindCSS = false,
|
|
1928
1938
|
typescript: enableTypeScript = hasTypeScript,
|
|
1929
1939
|
unocss: enableUnoCSS = false,
|
|
1930
1940
|
vue: enableVue = hasVue
|
package/dist/index.js
CHANGED
|
@@ -1411,8 +1411,20 @@ async function perfectionist() {
|
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
1413
1413
|
// src/configs/react.ts
|
|
1414
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
1415
|
+
|
|
1416
|
+
// src/env.ts
|
|
1417
|
+
import process3 from "node:process";
|
|
1414
1418
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1415
|
-
var
|
|
1419
|
+
var isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI);
|
|
1420
|
+
var hasTypeScript = isPackageExists2("typescript");
|
|
1421
|
+
var VueJsPackages = [
|
|
1422
|
+
"vue",
|
|
1423
|
+
"nuxt",
|
|
1424
|
+
"vitepress",
|
|
1425
|
+
"@slidev/cli"
|
|
1426
|
+
];
|
|
1427
|
+
var hasVue = hasPackages(VueJsPackages);
|
|
1416
1428
|
var RemixPackages = [
|
|
1417
1429
|
"@remix-run/node",
|
|
1418
1430
|
"@remix-run/react",
|
|
@@ -1420,6 +1432,14 @@ var RemixPackages = [
|
|
|
1420
1432
|
"@remix-run/dev"
|
|
1421
1433
|
];
|
|
1422
1434
|
var NextJsPackages = ["next"];
|
|
1435
|
+
var isUsingRemix = hasPackages(RemixPackages);
|
|
1436
|
+
var isUsingNext = hasPackages(NextJsPackages);
|
|
1437
|
+
function hasPackages(packages) {
|
|
1438
|
+
return packages.some((name) => isPackageExists2(name));
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
// src/configs/react.ts
|
|
1442
|
+
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
1423
1443
|
async function react(options = {}) {
|
|
1424
1444
|
const { files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX], overrides = {} } = options;
|
|
1425
1445
|
await ensurePackages([
|
|
@@ -1436,10 +1456,8 @@ async function react(options = {}) {
|
|
|
1436
1456
|
interopDefault(import("@typescript-eslint/parser"))
|
|
1437
1457
|
]);
|
|
1438
1458
|
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1439
|
-
(i) =>
|
|
1459
|
+
(i) => isPackageExists3(i)
|
|
1440
1460
|
);
|
|
1441
|
-
const isUsingRemix = RemixPackages.some((i) => isPackageExists2(i));
|
|
1442
|
-
const isUsingNext = NextJsPackages.some((i) => isPackageExists2(i));
|
|
1443
1461
|
const plugins = pluginReact.configs.all.plugins;
|
|
1444
1462
|
return [
|
|
1445
1463
|
{
|
|
@@ -1773,6 +1791,7 @@ async function svelte(options = {}) {
|
|
|
1773
1791
|
// src/configs/tailwindcss.ts
|
|
1774
1792
|
async function tailwindcss(options = {}) {
|
|
1775
1793
|
const { overrides } = options;
|
|
1794
|
+
await ensurePackages(["eslint-plugin-tailwindcss"]);
|
|
1776
1795
|
const pluginTailwindcss = await interopDefault(
|
|
1777
1796
|
import("eslint-plugin-tailwindcss")
|
|
1778
1797
|
);
|
|
@@ -1788,7 +1807,7 @@ async function tailwindcss(options = {}) {
|
|
|
1788
1807
|
"tailwindcss/enforces-shorthand": "warn",
|
|
1789
1808
|
"tailwindcss/migration-from-tailwind-2": "warn",
|
|
1790
1809
|
"tailwindcss/no-arbitrary-value": "off",
|
|
1791
|
-
"tailwindcss/no-contradicting-classname": "
|
|
1810
|
+
"tailwindcss/no-contradicting-classname": "warn",
|
|
1792
1811
|
"tailwindcss/no-custom-classname": "off",
|
|
1793
1812
|
"tailwindcss/no-unnecessary-arbitrary-value": "warn",
|
|
1794
1813
|
...overrides
|
|
@@ -1833,15 +1852,6 @@ async function regexp(options = {}) {
|
|
|
1833
1852
|
];
|
|
1834
1853
|
}
|
|
1835
1854
|
|
|
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
1855
|
// src/index.ts
|
|
1846
1856
|
var flatConfigProps = [
|
|
1847
1857
|
"name",
|
|
@@ -1879,7 +1889,7 @@ async function defineConfig(options = {}, ...userConfigs) {
|
|
|
1879
1889
|
react: enableReact = false,
|
|
1880
1890
|
regexp: enableRegexp = true,
|
|
1881
1891
|
svelte: enableSvelte = false,
|
|
1882
|
-
tailwindcss: enableTailwindCSS =
|
|
1892
|
+
tailwindcss: enableTailwindCSS = false,
|
|
1883
1893
|
typescript: enableTypeScript = hasTypeScript,
|
|
1884
1894
|
unocss: enableUnoCSS = false,
|
|
1885
1895
|
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.1",
|
|
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",
|