@wongxy/eslint-config 3.0.1 → 4.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.d.mts +3079 -0
- package/dist/{index.js → index.mjs} +16 -10
- package/package.json +17 -16
- package/dist/index.cjs +0 -146
- package/dist/index.d.cts +0 -678
- package/dist/index.d.ts +0 -679
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GLOB_SRC, GLOB_TS, GLOB_TSX, GLOB_VUE, antfu, getOverrides } from "@antfu/eslint-config";
|
|
2
2
|
import { isPackageExists } from "local-pkg";
|
|
3
3
|
import pluginTailwind from "eslint-plugin-better-tailwindcss";
|
|
4
|
-
|
|
5
4
|
//#region src/tailwindcss.ts
|
|
6
5
|
async function tailwindcss(options = {}) {
|
|
7
6
|
const { overrides = {}, settings } = options;
|
|
@@ -11,7 +10,7 @@ async function tailwindcss(options = {}) {
|
|
|
11
10
|
"tw/no-duplicate-classes": "warn",
|
|
12
11
|
"tw/no-unnecessary-whitespace": "warn",
|
|
13
12
|
"tw/no-conflicting-classes": "warn",
|
|
14
|
-
"tw/no-
|
|
13
|
+
"tw/no-unknown-classes": "warn"
|
|
15
14
|
};
|
|
16
15
|
return [{
|
|
17
16
|
name: "wongxy/tailwindcss/setup",
|
|
@@ -26,7 +25,6 @@ async function tailwindcss(options = {}) {
|
|
|
26
25
|
}
|
|
27
26
|
}];
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
//#endregion
|
|
31
29
|
//#region src/index.ts
|
|
32
30
|
const VuePackages = [
|
|
@@ -69,11 +67,20 @@ function wongxy(options = {}, ...userConfigs) {
|
|
|
69
67
|
"unknown",
|
|
70
68
|
"reserved-last"
|
|
71
69
|
],
|
|
72
|
-
customGroups:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
customGroups: [
|
|
71
|
+
{
|
|
72
|
+
groupName: "reserved-first",
|
|
73
|
+
elementNamePattern: ["key", "ref"]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
groupName: "reserved-second",
|
|
77
|
+
elementNamePattern: ["id", "name"]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
groupName: "reserved-last",
|
|
81
|
+
elementNamePattern: ["asChild"]
|
|
82
|
+
}
|
|
83
|
+
]
|
|
77
84
|
}]
|
|
78
85
|
})
|
|
79
86
|
});
|
|
@@ -115,6 +122,5 @@ function wongxy(options = {}, ...userConfigs) {
|
|
|
115
122
|
}
|
|
116
123
|
return antfu(options, ...configs, ...userConfigs);
|
|
117
124
|
}
|
|
118
|
-
|
|
119
125
|
//#endregion
|
|
120
|
-
export { wongxy as default };
|
|
126
|
+
export { wongxy as default };
|
package/package.json
CHANGED
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wongxy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "4.0.1",
|
|
5
5
|
"description": "xiyaowong's eslint config",
|
|
6
6
|
"author": "xiyaowong (https://github.com/xiyaowong)",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"exports": {
|
|
9
|
-
".": "./dist/index.
|
|
9
|
+
".": "./dist/index.mjs",
|
|
10
|
+
"./package.json": "./package.json"
|
|
10
11
|
},
|
|
11
|
-
"
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@eslint-react/eslint-plugin": "^
|
|
17
|
+
"@eslint-react/eslint-plugin": "^5.18.6",
|
|
18
18
|
"@next/eslint-plugin-next": "^16.0.1",
|
|
19
19
|
"@unocss/eslint-plugin": "^66.5.4",
|
|
20
|
-
"eslint": "^9.
|
|
21
|
-
"eslint-plugin-
|
|
20
|
+
"eslint": "^10.9.1",
|
|
21
|
+
"eslint-plugin-astro": "^3.1.0",
|
|
22
|
+
"eslint-plugin-better-tailwindcss": "^4.7.0",
|
|
22
23
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
23
|
-
"eslint-plugin-react-refresh": "^0.
|
|
24
|
+
"eslint-plugin-react-refresh": "^0.5.5"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@antfu/eslint-config": "^
|
|
27
|
-
"eslint-flat-config-utils": "^2.
|
|
28
|
-
"local-pkg": "^1.1
|
|
27
|
+
"@antfu/eslint-config": "^9.3.0",
|
|
28
|
+
"eslint-flat-config-utils": "^3.2.0",
|
|
29
|
+
"local-pkg": "^1.2.1"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@antfu/ni": "^
|
|
32
|
+
"@antfu/ni": "^30.5.0",
|
|
32
33
|
"@types/eslint": "^9.6.1",
|
|
33
34
|
"@types/node": "^24.10.0",
|
|
34
|
-
"bumpp": "^
|
|
35
|
-
"eslint": "^9.
|
|
36
|
-
"eslint-typegen": "^2.3.
|
|
35
|
+
"bumpp": "^12.2.2",
|
|
36
|
+
"eslint": "^10.9.1",
|
|
37
|
+
"eslint-typegen": "^2.3.1",
|
|
37
38
|
"esno": "^4.8.0",
|
|
38
|
-
"tsdown": "^0.
|
|
39
|
+
"tsdown": "^0.22.14",
|
|
39
40
|
"typescript": "^5.9.3"
|
|
40
41
|
},
|
|
41
42
|
"scripts": {
|
package/dist/index.cjs
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
//#region rolldown:runtime
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
-
key = keys[i];
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
-
get: ((k) => from[k]).bind(null, key),
|
|
13
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
-
value: mod,
|
|
20
|
-
enumerable: true
|
|
21
|
-
}) : target, mod));
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
let __antfu_eslint_config = require("@antfu/eslint-config");
|
|
25
|
-
__antfu_eslint_config = __toESM(__antfu_eslint_config);
|
|
26
|
-
let local_pkg = require("local-pkg");
|
|
27
|
-
local_pkg = __toESM(local_pkg);
|
|
28
|
-
let eslint_plugin_better_tailwindcss = require("eslint-plugin-better-tailwindcss");
|
|
29
|
-
eslint_plugin_better_tailwindcss = __toESM(eslint_plugin_better_tailwindcss);
|
|
30
|
-
|
|
31
|
-
//#region src/tailwindcss.ts
|
|
32
|
-
async function tailwindcss(options = {}) {
|
|
33
|
-
const { overrides = {}, settings } = options;
|
|
34
|
-
const rules = {
|
|
35
|
-
"tw/enforce-consistent-class-order": "warn",
|
|
36
|
-
"tw/enforce-consistent-line-wrapping": ["warn", { printWidth: 100 }],
|
|
37
|
-
"tw/no-duplicate-classes": "warn",
|
|
38
|
-
"tw/no-unnecessary-whitespace": "warn",
|
|
39
|
-
"tw/no-conflicting-classes": "warn",
|
|
40
|
-
"tw/no-unregistered-classes": "warn"
|
|
41
|
-
};
|
|
42
|
-
return [{
|
|
43
|
-
name: "wongxy/tailwindcss/setup",
|
|
44
|
-
plugins: { tw: eslint_plugin_better_tailwindcss.default },
|
|
45
|
-
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
46
|
-
...!!settings && { settings: { "better-tailwindcss": settings } }
|
|
47
|
-
}, {
|
|
48
|
-
name: "wongxy/tailwindcss/rules",
|
|
49
|
-
rules: {
|
|
50
|
-
...rules,
|
|
51
|
-
...overrides
|
|
52
|
-
}
|
|
53
|
-
}];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/index.ts
|
|
58
|
-
const VuePackages = [
|
|
59
|
-
"vue",
|
|
60
|
-
"nuxt",
|
|
61
|
-
"vitepress",
|
|
62
|
-
"@slidev/cli"
|
|
63
|
-
];
|
|
64
|
-
const ReactPackages = [
|
|
65
|
-
"react",
|
|
66
|
-
"react-native",
|
|
67
|
-
"react-dom",
|
|
68
|
-
"next"
|
|
69
|
-
];
|
|
70
|
-
function resolveRules(overrides, rules) {
|
|
71
|
-
return Object.fromEntries(Object.entries(rules).filter(([k]) => !overrides[k]));
|
|
72
|
-
}
|
|
73
|
-
function wongxy(options = {}, ...userConfigs) {
|
|
74
|
-
const { react: enableReact = ReactPackages.some((i) => (0, local_pkg.isPackageExists)(i)), typescript: enableTypeScript = (0, local_pkg.isPackageExists)("typescript"), vue: enableVue = VuePackages.some((i) => (0, local_pkg.isPackageExists)(i)), tailwindcss: enableTailwind = (0, local_pkg.isPackageExists)("tailwindcss"), reactnative: enableReactNative = (0, local_pkg.isPackageExists)("react-native") } = options;
|
|
75
|
-
const configs = [];
|
|
76
|
-
configs.push({
|
|
77
|
-
name: "wongxy/common",
|
|
78
|
-
rules: resolveRules(options.rules ?? {}, {
|
|
79
|
-
"no-console": "off",
|
|
80
|
-
"no-alert": "off",
|
|
81
|
-
"no-multiple-empty-lines": "warn",
|
|
82
|
-
"antfu/top-level-function": "off",
|
|
83
|
-
"antfu/if-newline": "off",
|
|
84
|
-
"style/brace-style": [
|
|
85
|
-
"error",
|
|
86
|
-
"1tbs",
|
|
87
|
-
{ allowSingleLine: true }
|
|
88
|
-
],
|
|
89
|
-
"perfectionist/sort-jsx-props": ["warn", {
|
|
90
|
-
order: "asc",
|
|
91
|
-
type: "natural",
|
|
92
|
-
groups: [
|
|
93
|
-
"reserved-first",
|
|
94
|
-
"reserved-second",
|
|
95
|
-
"unknown",
|
|
96
|
-
"reserved-last"
|
|
97
|
-
],
|
|
98
|
-
customGroups: {
|
|
99
|
-
"reserved-first": ["key", "ref"],
|
|
100
|
-
"reserved-second": ["id", "name"],
|
|
101
|
-
"reserved-last": ["asChild"]
|
|
102
|
-
}
|
|
103
|
-
}]
|
|
104
|
-
})
|
|
105
|
-
});
|
|
106
|
-
if (enableVue) configs.push({
|
|
107
|
-
name: "wongxy/vue",
|
|
108
|
-
files: [__antfu_eslint_config.GLOB_VUE],
|
|
109
|
-
rules: resolveRules((0, __antfu_eslint_config.getOverrides)(options, "vue"), {
|
|
110
|
-
"vue/singleline-html-element-content-newline": "off",
|
|
111
|
-
"vue/valid-template-root": "off",
|
|
112
|
-
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
113
|
-
"vue/custom-event-name-casing": "off"
|
|
114
|
-
})
|
|
115
|
-
});
|
|
116
|
-
if (enableReact) configs.push({
|
|
117
|
-
name: "wongxy/react",
|
|
118
|
-
files: [__antfu_eslint_config.GLOB_SRC],
|
|
119
|
-
rules: resolveRules((0, __antfu_eslint_config.getOverrides)(options, "react"), { "react/prefer-destructuring-assignment": "off" })
|
|
120
|
-
});
|
|
121
|
-
if (enableTypeScript) configs.push({
|
|
122
|
-
name: "wongxy/typescript",
|
|
123
|
-
files: [__antfu_eslint_config.GLOB_TS, __antfu_eslint_config.GLOB_TSX],
|
|
124
|
-
rules: resolveRules((0, __antfu_eslint_config.getOverrides)(options, "typescript"), { "ts/consistent-type-imports": ["error", {
|
|
125
|
-
disallowTypeAnnotations: false,
|
|
126
|
-
fixStyle: "inline-type-imports",
|
|
127
|
-
prefer: "type-imports"
|
|
128
|
-
}] })
|
|
129
|
-
});
|
|
130
|
-
if (enableReactNative) configs.push({
|
|
131
|
-
name: "wongxy/reactnative",
|
|
132
|
-
files: [__antfu_eslint_config.GLOB_TS, __antfu_eslint_config.GLOB_TSX],
|
|
133
|
-
rules: resolveRules((0, __antfu_eslint_config.getOverrides)(options, "typescript"), {
|
|
134
|
-
"ts/no-require-imports": "off",
|
|
135
|
-
"ts/no-use-before-define": "off"
|
|
136
|
-
})
|
|
137
|
-
});
|
|
138
|
-
if (enableTailwind) {
|
|
139
|
-
const tw = typeof options.tailwindcss === "object" ? options.tailwindcss : void 0;
|
|
140
|
-
configs.push(tailwindcss(tw));
|
|
141
|
-
}
|
|
142
|
-
return (0, __antfu_eslint_config.antfu)(options, ...configs, ...userConfigs);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
//#endregion
|
|
146
|
-
module.exports = wongxy;
|