@wongxy/eslint-config 2.0.0 → 2.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/chunk-CHLpw0oG.js +25 -0
- package/dist/index.cjs +132 -134
- package/dist/index.d.cts +124 -121
- package/dist/index.d.ts +123 -121
- package/dist/index.js +113 -132
- package/package.json +15 -12
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all) __defProp(target, name, {
|
|
8
|
+
get: all[name],
|
|
9
|
+
enumerable: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
+
key = keys[i];
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: ((k) => from[k]).bind(null, key),
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { __export, __reExport };
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
//#region rolldown:runtime
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,147 +7,144 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
9
|
var __export = (target, all) => {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
11
14
|
};
|
|
12
15
|
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
17
|
+
key = keys[i];
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
19
|
+
get: ((k) => from[k]).bind(null, key),
|
|
20
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
19
24
|
};
|
|
20
25
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
+
value: mod,
|
|
28
|
+
enumerable: true
|
|
29
|
+
}) : target, mod));
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
tailwindcss: () => tailwindcss
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(index_exports);
|
|
38
|
-
var import_eslint_config = require("@antfu/eslint-config");
|
|
39
|
-
var import_local_pkg = require("local-pkg");
|
|
31
|
+
//#endregion
|
|
32
|
+
const __antfu_eslint_config = __toESM(require("@antfu/eslint-config"));
|
|
33
|
+
const local_pkg = __toESM(require("local-pkg"));
|
|
34
|
+
const eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"));
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
|
|
36
|
+
//#region src/tailwindcss.ts
|
|
43
37
|
async function tailwindcss(options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"tw/classnames-order": "warn",
|
|
60
|
-
"tw/enforces-negative-arbitrary-values": "warn",
|
|
61
|
-
"tw/enforces-shorthand": "warn",
|
|
62
|
-
"tw/migration-from-tailwind-2": "warn",
|
|
63
|
-
"tw/no-arbitrary-value": "off",
|
|
64
|
-
// 'tw/no-custom-classname': 'warn',
|
|
65
|
-
"tw/no-contradicting-classname": "error",
|
|
66
|
-
// 'tw/no-unnecessary-arbitrary-value': 'warn',
|
|
67
|
-
...overrides
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
];
|
|
38
|
+
const { overrides = {} } = options ?? {};
|
|
39
|
+
return [{
|
|
40
|
+
name: "wongxy/tailwindcss",
|
|
41
|
+
plugins: { tw: eslint_plugin_tailwindcss.default },
|
|
42
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
43
|
+
rules: {
|
|
44
|
+
"tw/classnames-order": "warn",
|
|
45
|
+
"tw/enforces-negative-arbitrary-values": "warn",
|
|
46
|
+
"tw/enforces-shorthand": "warn",
|
|
47
|
+
"tw/migration-from-tailwind-2": "warn",
|
|
48
|
+
"tw/no-arbitrary-value": "off",
|
|
49
|
+
"tw/no-contradicting-classname": "error",
|
|
50
|
+
...overrides
|
|
51
|
+
}
|
|
52
|
+
}];
|
|
71
53
|
}
|
|
72
54
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region src/index.ts
|
|
57
|
+
var src_exports = {};
|
|
58
|
+
__export(src_exports, {
|
|
59
|
+
default: () => wongxy,
|
|
60
|
+
tailwindcss: () => tailwindcss
|
|
61
|
+
});
|
|
62
|
+
const VuePackages = [
|
|
63
|
+
"vue",
|
|
64
|
+
"nuxt",
|
|
65
|
+
"vitepress",
|
|
66
|
+
"@slidev/cli"
|
|
67
|
+
];
|
|
68
|
+
const ReactPackages = [
|
|
69
|
+
"react",
|
|
70
|
+
"react-native",
|
|
71
|
+
"react-dom",
|
|
72
|
+
"next"
|
|
73
|
+
];
|
|
81
74
|
function wongxy(options, ...userConfigs) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
75
|
+
options = options ?? {};
|
|
76
|
+
const finalOptions = {
|
|
77
|
+
...options,
|
|
78
|
+
vue: options.vue ?? VuePackages.some((i) => (0, local_pkg.isPackageExists)(i)),
|
|
79
|
+
typescript: options.typescript ?? (0, local_pkg.isPackageExists)("typescript"),
|
|
80
|
+
react: (options.react || options.reactnative) ?? ReactPackages.some((i) => (0, local_pkg.isPackageExists)(i)),
|
|
81
|
+
reactnative: options.reactnative ?? (0, local_pkg.isPackageExists)("react-native"),
|
|
82
|
+
tailwindcss: options.tailwindcss ?? (0, local_pkg.isPackageExists)("tailwindcss")
|
|
83
|
+
};
|
|
84
|
+
const rules = {
|
|
85
|
+
"no-console": "off",
|
|
86
|
+
"no-alert": "off",
|
|
87
|
+
"no-multiple-empty-lines": "warn",
|
|
88
|
+
"antfu/top-level-function": "off",
|
|
89
|
+
"antfu/if-newline": "off",
|
|
90
|
+
"style/brace-style": [
|
|
91
|
+
"error",
|
|
92
|
+
"1tbs",
|
|
93
|
+
{ allowSingleLine: true }
|
|
94
|
+
]
|
|
95
|
+
};
|
|
96
|
+
for (const key in finalOptions.rules) delete rules[key];
|
|
97
|
+
userConfigs.splice(0, 0, {
|
|
98
|
+
name: "wongxy/rules",
|
|
99
|
+
rules
|
|
100
|
+
});
|
|
101
|
+
if (finalOptions.vue) {
|
|
102
|
+
const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
|
|
103
|
+
finalOptions.vue = {
|
|
104
|
+
...vue,
|
|
105
|
+
overrides: {
|
|
106
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
107
|
+
"vue/valid-template-root": "off",
|
|
108
|
+
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
109
|
+
"vue/custom-event-name-casing": "off",
|
|
110
|
+
...vue.overrides
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (finalOptions.react) {
|
|
115
|
+
const react = typeof finalOptions.react === "object" ? finalOptions.react : {};
|
|
116
|
+
finalOptions.react = {
|
|
117
|
+
...react,
|
|
118
|
+
overrides: {
|
|
119
|
+
"react/prefer-destructuring-assignment": "off",
|
|
120
|
+
...react.overrides
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (finalOptions.typescript) {
|
|
125
|
+
const typescript = typeof finalOptions.typescript === "object" ? finalOptions.typescript : {};
|
|
126
|
+
finalOptions.typescript = {
|
|
127
|
+
...typescript,
|
|
128
|
+
overrides: {
|
|
129
|
+
"ts/consistent-type-imports": ["error", {
|
|
130
|
+
disallowTypeAnnotations: false,
|
|
131
|
+
fixStyle: "inline-type-imports",
|
|
132
|
+
prefer: "type-imports"
|
|
133
|
+
}],
|
|
134
|
+
...finalOptions.reactnative ? {
|
|
135
|
+
"ts/no-require-imports": "off",
|
|
136
|
+
"ts/no-use-before-define": "off"
|
|
137
|
+
} : void 0,
|
|
138
|
+
...typescript.overrides
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (finalOptions.tailwindcss) userConfigs.splice(0, 0, tailwindcss({ overrides: typeof finalOptions.tailwindcss === "object" ? finalOptions.tailwindcss.overrides : void 0 }));
|
|
143
|
+
delete finalOptions.reactnative;
|
|
144
|
+
delete finalOptions.tailwindcss;
|
|
145
|
+
return (0, __antfu_eslint_config.antfu)(finalOptions, ...userConfigs);
|
|
148
146
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
exports.default = wongxy;
|
|
150
|
+
exports.tailwindcss = tailwindcss;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,180 +1,183 @@
|
|
|
1
|
-
import { Linter } from
|
|
2
|
-
import { FlatConfigComposer } from
|
|
3
|
-
import {
|
|
4
|
-
export * from
|
|
5
|
-
|
|
6
|
-
/* eslint-disable */
|
|
7
|
-
/* prettier-ignore */
|
|
8
|
-
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
3
|
+
import { ConfigNames as ConfigNames$1, OptionsConfig as OptionsConfig$1, Rules, TypedFlatConfigItem as TypedFlatConfigItem$1 } from "@antfu/eslint-config";
|
|
4
|
+
export * from "@antfu/eslint-config";
|
|
9
5
|
|
|
6
|
+
//#region rolldown:runtime
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/typegen.d.ts
|
|
10
9
|
interface RuleOptions {
|
|
11
10
|
/**
|
|
12
11
|
* Enforce a consistent and logical order of the Tailwind CSS classnames
|
|
13
12
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md
|
|
14
13
|
*/
|
|
15
|
-
'tw/classnames-order'?: Linter.RuleEntry<TwClassnamesOrder
|
|
14
|
+
'tw/classnames-order'?: Linter.RuleEntry<TwClassnamesOrder>;
|
|
16
15
|
/**
|
|
17
16
|
* Warns about dash prefixed classnames using arbitrary values
|
|
18
17
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
19
18
|
*/
|
|
20
|
-
'tw/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TwEnforcesNegativeArbitraryValues
|
|
19
|
+
'tw/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TwEnforcesNegativeArbitraryValues>;
|
|
21
20
|
/**
|
|
22
21
|
* Enforces the usage of shorthand Tailwind CSS classnames
|
|
23
22
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md
|
|
24
23
|
*/
|
|
25
|
-
'tw/enforces-shorthand'?: Linter.RuleEntry<TwEnforcesShorthand
|
|
24
|
+
'tw/enforces-shorthand'?: Linter.RuleEntry<TwEnforcesShorthand>;
|
|
26
25
|
/**
|
|
27
26
|
* Detect obsolete classnames when upgrading to Tailwind CSS v3
|
|
28
27
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md
|
|
29
28
|
*/
|
|
30
|
-
'tw/migration-from-tailwind-2'?: Linter.RuleEntry<TwMigrationFromTailwind2
|
|
29
|
+
'tw/migration-from-tailwind-2'?: Linter.RuleEntry<TwMigrationFromTailwind2>;
|
|
31
30
|
/**
|
|
32
31
|
* Forbid using arbitrary values in classnames
|
|
33
32
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md
|
|
34
33
|
*/
|
|
35
|
-
'tw/no-arbitrary-value'?: Linter.RuleEntry<TwNoArbitraryValue
|
|
34
|
+
'tw/no-arbitrary-value'?: Linter.RuleEntry<TwNoArbitraryValue>;
|
|
36
35
|
/**
|
|
37
36
|
* Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5")
|
|
38
37
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md
|
|
39
38
|
*/
|
|
40
|
-
'tw/no-contradicting-classname'?: Linter.RuleEntry<TwNoContradictingClassname
|
|
39
|
+
'tw/no-contradicting-classname'?: Linter.RuleEntry<TwNoContradictingClassname>;
|
|
41
40
|
/**
|
|
42
41
|
* Detect classnames which do not belong to Tailwind CSS
|
|
43
42
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md
|
|
44
43
|
*/
|
|
45
|
-
'tw/no-custom-classname'?: Linter.RuleEntry<TwNoCustomClassname
|
|
44
|
+
'tw/no-custom-classname'?: Linter.RuleEntry<TwNoCustomClassname>;
|
|
46
45
|
/**
|
|
47
46
|
* Forbid using arbitrary values in classnames when an equivalent preset exists
|
|
48
47
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md
|
|
49
48
|
*/
|
|
50
|
-
'tw/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TwNoUnnecessaryArbitraryValue
|
|
49
|
+
'tw/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TwNoUnnecessaryArbitraryValue>;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
/* ======= Declarations ======= */
|
|
54
53
|
// ----- tw/classnames-order -----
|
|
55
|
-
type TwClassnamesOrder = []|[{
|
|
56
|
-
callees?: string[]
|
|
57
|
-
ignoredKeys?: string[]
|
|
54
|
+
type TwClassnamesOrder = [] | [{
|
|
55
|
+
callees?: string[];
|
|
56
|
+
ignoredKeys?: string[];
|
|
58
57
|
config?: (string | {
|
|
59
|
-
[k: string]: unknown | undefined
|
|
60
|
-
})
|
|
61
|
-
removeDuplicates?: boolean
|
|
62
|
-
tags?: string[]
|
|
63
|
-
[k: string]: unknown | undefined
|
|
64
|
-
}]
|
|
58
|
+
[k: string]: unknown | undefined;
|
|
59
|
+
});
|
|
60
|
+
removeDuplicates?: boolean;
|
|
61
|
+
tags?: string[];
|
|
62
|
+
[k: string]: unknown | undefined;
|
|
63
|
+
}];
|
|
65
64
|
// ----- tw/enforces-negative-arbitrary-values -----
|
|
66
|
-
type TwEnforcesNegativeArbitraryValues = []|[{
|
|
67
|
-
callees?: string[]
|
|
68
|
-
ignoredKeys?: string[]
|
|
65
|
+
type TwEnforcesNegativeArbitraryValues = [] | [{
|
|
66
|
+
callees?: string[];
|
|
67
|
+
ignoredKeys?: string[];
|
|
69
68
|
config?: (string | {
|
|
70
|
-
[k: string]: unknown | undefined
|
|
71
|
-
})
|
|
72
|
-
tags?: string[]
|
|
73
|
-
[k: string]: unknown | undefined
|
|
74
|
-
}]
|
|
69
|
+
[k: string]: unknown | undefined;
|
|
70
|
+
});
|
|
71
|
+
tags?: string[];
|
|
72
|
+
[k: string]: unknown | undefined;
|
|
73
|
+
}];
|
|
75
74
|
// ----- tw/enforces-shorthand -----
|
|
76
|
-
type TwEnforcesShorthand = []|[{
|
|
77
|
-
callees?: string[]
|
|
78
|
-
ignoredKeys?: string[]
|
|
75
|
+
type TwEnforcesShorthand = [] | [{
|
|
76
|
+
callees?: string[];
|
|
77
|
+
ignoredKeys?: string[];
|
|
79
78
|
config?: (string | {
|
|
80
|
-
[k: string]: unknown | undefined
|
|
81
|
-
})
|
|
82
|
-
tags?: string[]
|
|
83
|
-
[k: string]: unknown | undefined
|
|
84
|
-
}]
|
|
79
|
+
[k: string]: unknown | undefined;
|
|
80
|
+
});
|
|
81
|
+
tags?: string[];
|
|
82
|
+
[k: string]: unknown | undefined;
|
|
83
|
+
}];
|
|
85
84
|
// ----- tw/migration-from-tailwind-2 -----
|
|
86
|
-
type TwMigrationFromTailwind2 = []|[{
|
|
87
|
-
callees?: string[]
|
|
88
|
-
ignoredKeys?: string[]
|
|
85
|
+
type TwMigrationFromTailwind2 = [] | [{
|
|
86
|
+
callees?: string[];
|
|
87
|
+
ignoredKeys?: string[];
|
|
89
88
|
config?: (string | {
|
|
90
|
-
[k: string]: unknown | undefined
|
|
91
|
-
})
|
|
92
|
-
tags?: string[]
|
|
93
|
-
[k: string]: unknown | undefined
|
|
94
|
-
}]
|
|
89
|
+
[k: string]: unknown | undefined;
|
|
90
|
+
});
|
|
91
|
+
tags?: string[];
|
|
92
|
+
[k: string]: unknown | undefined;
|
|
93
|
+
}];
|
|
95
94
|
// ----- tw/no-arbitrary-value -----
|
|
96
|
-
type TwNoArbitraryValue = []|[{
|
|
97
|
-
callees?: string[]
|
|
98
|
-
ignoredKeys?: string[]
|
|
95
|
+
type TwNoArbitraryValue = [] | [{
|
|
96
|
+
callees?: string[];
|
|
97
|
+
ignoredKeys?: string[];
|
|
99
98
|
config?: (string | {
|
|
100
|
-
[k: string]: unknown | undefined
|
|
101
|
-
})
|
|
102
|
-
tags?: string[]
|
|
103
|
-
[k: string]: unknown | undefined
|
|
104
|
-
}]
|
|
99
|
+
[k: string]: unknown | undefined;
|
|
100
|
+
});
|
|
101
|
+
tags?: string[];
|
|
102
|
+
[k: string]: unknown | undefined;
|
|
103
|
+
}];
|
|
105
104
|
// ----- tw/no-contradicting-classname -----
|
|
106
|
-
type TwNoContradictingClassname = []|[{
|
|
107
|
-
callees?: string[]
|
|
108
|
-
ignoredKeys?: string[]
|
|
105
|
+
type TwNoContradictingClassname = [] | [{
|
|
106
|
+
callees?: string[];
|
|
107
|
+
ignoredKeys?: string[];
|
|
109
108
|
config?: (string | {
|
|
110
|
-
[k: string]: unknown | undefined
|
|
111
|
-
})
|
|
112
|
-
tags?: string[]
|
|
113
|
-
[k: string]: unknown | undefined
|
|
114
|
-
}]
|
|
109
|
+
[k: string]: unknown | undefined;
|
|
110
|
+
});
|
|
111
|
+
tags?: string[];
|
|
112
|
+
[k: string]: unknown | undefined;
|
|
113
|
+
}];
|
|
115
114
|
// ----- tw/no-custom-classname -----
|
|
116
|
-
type TwNoCustomClassname = []|[{
|
|
117
|
-
callees?: string[]
|
|
118
|
-
ignoredKeys?: string[]
|
|
115
|
+
type TwNoCustomClassname = [] | [{
|
|
116
|
+
callees?: string[];
|
|
117
|
+
ignoredKeys?: string[];
|
|
119
118
|
config?: (string | {
|
|
120
|
-
[k: string]: unknown | undefined
|
|
121
|
-
})
|
|
122
|
-
cssFiles?: string[]
|
|
123
|
-
cssFilesRefreshRate?: number
|
|
124
|
-
tags?: string[]
|
|
125
|
-
whitelist?: string[]
|
|
126
|
-
[k: string]: unknown | undefined
|
|
127
|
-
}]
|
|
119
|
+
[k: string]: unknown | undefined;
|
|
120
|
+
});
|
|
121
|
+
cssFiles?: string[];
|
|
122
|
+
cssFilesRefreshRate?: number;
|
|
123
|
+
tags?: string[];
|
|
124
|
+
whitelist?: string[];
|
|
125
|
+
[k: string]: unknown | undefined;
|
|
126
|
+
}];
|
|
128
127
|
// ----- tw/no-unnecessary-arbitrary-value -----
|
|
129
|
-
type TwNoUnnecessaryArbitraryValue = []|[{
|
|
130
|
-
callees?: string[]
|
|
131
|
-
ignoredKeys?: string[]
|
|
128
|
+
type TwNoUnnecessaryArbitraryValue = [] | [{
|
|
129
|
+
callees?: string[];
|
|
130
|
+
ignoredKeys?: string[];
|
|
132
131
|
config?: (string | {
|
|
133
|
-
[k: string]: unknown | undefined
|
|
134
|
-
})
|
|
135
|
-
tags?: string[]
|
|
136
|
-
[k: string]: unknown | undefined
|
|
137
|
-
}]
|
|
132
|
+
[k: string]: unknown | undefined;
|
|
133
|
+
});
|
|
134
|
+
tags?: string[];
|
|
135
|
+
[k: string]: unknown | undefined;
|
|
136
|
+
}];
|
|
138
137
|
// Names of all the configs
|
|
139
|
-
type ConfigNames$
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
overrides?: TypedFlatConfigItem['rules'];
|
|
143
|
-
}
|
|
144
|
-
type ConfigNames = ConfigNames$2 & ConfigNames$1;
|
|
145
|
-
type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
|
|
146
|
-
interface MyRules extends RuleOptions {
|
|
138
|
+
type ConfigNames$2 = 'wongxy/tailwindcss';
|
|
139
|
+
declare namespace types_d_exports {
|
|
140
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem };
|
|
147
141
|
}
|
|
148
|
-
|
|
142
|
+
import * as import___antfu_eslint_config from "@antfu/eslint-config";
|
|
143
|
+
interface OptionsOverrides$1 {
|
|
144
|
+
overrides?: TypedFlatConfigItem['rules'];
|
|
149
145
|
}
|
|
150
|
-
type
|
|
151
|
-
|
|
146
|
+
type ConfigNames = ConfigNames$1 & ConfigNames$2;
|
|
147
|
+
type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
|
|
148
|
+
interface MyRules extends RuleOptions {}
|
|
149
|
+
interface Rules$1 extends MyRules, Rules {}
|
|
150
|
+
type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules$1>, 'plugins'> & {
|
|
151
|
+
plugins?: Record<string, any>;
|
|
152
152
|
};
|
|
153
153
|
interface OptionsConfig extends OptionsConfig$1 {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
154
|
+
/**
|
|
155
|
+
* Enable Tailwind rules.
|
|
156
|
+
*
|
|
157
|
+
* @default auto-detect based on the dependencies
|
|
158
|
+
*/
|
|
159
|
+
tailwindcss?: boolean | OptionsOverrides$1;
|
|
160
|
+
/**
|
|
161
|
+
* Enable React Native support.
|
|
162
|
+
*
|
|
163
|
+
* Will enable `react` support automatically.
|
|
164
|
+
*
|
|
165
|
+
* @default auto-detect based on the dependencies
|
|
166
|
+
*/
|
|
167
|
+
reactnative?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Enable react rules.
|
|
170
|
+
*
|
|
171
|
+
* @default auto-detect based on the dependencies
|
|
172
|
+
*/
|
|
173
|
+
react?: boolean | OptionsOverrides$1;
|
|
174
174
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
declare
|
|
179
|
-
|
|
180
|
-
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region src/tailwindcss.d.ts
|
|
177
|
+
declare function tailwindcss(options?: types_d_exports.OptionsOverrides): Promise<TypedFlatConfigItem$1[]>;
|
|
178
|
+
declare namespace index_d_exports {
|
|
179
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem, wongxy as default, tailwindcss };
|
|
180
|
+
}
|
|
181
|
+
declare function wongxy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: types_d_exports.Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
182
|
+
//#endregion
|
|
183
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem, wongxy as default, tailwindcss };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,180 +1,182 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/* eslint-disable */
|
|
7
|
-
/* prettier-ignore */
|
|
8
|
-
|
|
1
|
+
import { __export, __reExport } from "./chunk-CHLpw0oG.js";
|
|
2
|
+
import { ConfigNames as ConfigNames$1, OptionsConfig as OptionsConfig$1, Rules, TypedFlatConfigItem as TypedFlatConfigItem$1 } from "@antfu/eslint-config";
|
|
3
|
+
import { Linter } from "eslint";
|
|
4
|
+
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
5
|
+
export * from "@antfu/eslint-config";
|
|
9
6
|
|
|
7
|
+
//#region src/typegen.d.ts
|
|
10
8
|
interface RuleOptions {
|
|
11
9
|
/**
|
|
12
10
|
* Enforce a consistent and logical order of the Tailwind CSS classnames
|
|
13
11
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/classnames-order.md
|
|
14
12
|
*/
|
|
15
|
-
'tw/classnames-order'?: Linter.RuleEntry<TwClassnamesOrder
|
|
13
|
+
'tw/classnames-order'?: Linter.RuleEntry<TwClassnamesOrder>;
|
|
16
14
|
/**
|
|
17
15
|
* Warns about dash prefixed classnames using arbitrary values
|
|
18
16
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-negative-arbitrary-values.md
|
|
19
17
|
*/
|
|
20
|
-
'tw/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TwEnforcesNegativeArbitraryValues
|
|
18
|
+
'tw/enforces-negative-arbitrary-values'?: Linter.RuleEntry<TwEnforcesNegativeArbitraryValues>;
|
|
21
19
|
/**
|
|
22
20
|
* Enforces the usage of shorthand Tailwind CSS classnames
|
|
23
21
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/enforces-shorthand.md
|
|
24
22
|
*/
|
|
25
|
-
'tw/enforces-shorthand'?: Linter.RuleEntry<TwEnforcesShorthand
|
|
23
|
+
'tw/enforces-shorthand'?: Linter.RuleEntry<TwEnforcesShorthand>;
|
|
26
24
|
/**
|
|
27
25
|
* Detect obsolete classnames when upgrading to Tailwind CSS v3
|
|
28
26
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/migration-from-tailwind-2.md
|
|
29
27
|
*/
|
|
30
|
-
'tw/migration-from-tailwind-2'?: Linter.RuleEntry<TwMigrationFromTailwind2
|
|
28
|
+
'tw/migration-from-tailwind-2'?: Linter.RuleEntry<TwMigrationFromTailwind2>;
|
|
31
29
|
/**
|
|
32
30
|
* Forbid using arbitrary values in classnames
|
|
33
31
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-arbitrary-value.md
|
|
34
32
|
*/
|
|
35
|
-
'tw/no-arbitrary-value'?: Linter.RuleEntry<TwNoArbitraryValue
|
|
33
|
+
'tw/no-arbitrary-value'?: Linter.RuleEntry<TwNoArbitraryValue>;
|
|
36
34
|
/**
|
|
37
35
|
* Avoid contradicting Tailwind CSS classnames (e.g. "w-3 w-5")
|
|
38
36
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-contradicting-classname.md
|
|
39
37
|
*/
|
|
40
|
-
'tw/no-contradicting-classname'?: Linter.RuleEntry<TwNoContradictingClassname
|
|
38
|
+
'tw/no-contradicting-classname'?: Linter.RuleEntry<TwNoContradictingClassname>;
|
|
41
39
|
/**
|
|
42
40
|
* Detect classnames which do not belong to Tailwind CSS
|
|
43
41
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-custom-classname.md
|
|
44
42
|
*/
|
|
45
|
-
'tw/no-custom-classname'?: Linter.RuleEntry<TwNoCustomClassname
|
|
43
|
+
'tw/no-custom-classname'?: Linter.RuleEntry<TwNoCustomClassname>;
|
|
46
44
|
/**
|
|
47
45
|
* Forbid using arbitrary values in classnames when an equivalent preset exists
|
|
48
46
|
* @see https://github.com/francoismassart/eslint-plugin-tailwindcss/tree/master/docs/rules/no-unnecessary-arbitrary-value.md
|
|
49
47
|
*/
|
|
50
|
-
'tw/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TwNoUnnecessaryArbitraryValue
|
|
48
|
+
'tw/no-unnecessary-arbitrary-value'?: Linter.RuleEntry<TwNoUnnecessaryArbitraryValue>;
|
|
51
49
|
}
|
|
52
50
|
|
|
53
51
|
/* ======= Declarations ======= */
|
|
54
52
|
// ----- tw/classnames-order -----
|
|
55
|
-
type TwClassnamesOrder = []|[{
|
|
56
|
-
callees?: string[]
|
|
57
|
-
ignoredKeys?: string[]
|
|
53
|
+
type TwClassnamesOrder = [] | [{
|
|
54
|
+
callees?: string[];
|
|
55
|
+
ignoredKeys?: string[];
|
|
58
56
|
config?: (string | {
|
|
59
|
-
[k: string]: unknown | undefined
|
|
60
|
-
})
|
|
61
|
-
removeDuplicates?: boolean
|
|
62
|
-
tags?: string[]
|
|
63
|
-
[k: string]: unknown | undefined
|
|
64
|
-
}]
|
|
57
|
+
[k: string]: unknown | undefined;
|
|
58
|
+
});
|
|
59
|
+
removeDuplicates?: boolean;
|
|
60
|
+
tags?: string[];
|
|
61
|
+
[k: string]: unknown | undefined;
|
|
62
|
+
}];
|
|
65
63
|
// ----- tw/enforces-negative-arbitrary-values -----
|
|
66
|
-
type TwEnforcesNegativeArbitraryValues = []|[{
|
|
67
|
-
callees?: string[]
|
|
68
|
-
ignoredKeys?: string[]
|
|
64
|
+
type TwEnforcesNegativeArbitraryValues = [] | [{
|
|
65
|
+
callees?: string[];
|
|
66
|
+
ignoredKeys?: string[];
|
|
69
67
|
config?: (string | {
|
|
70
|
-
[k: string]: unknown | undefined
|
|
71
|
-
})
|
|
72
|
-
tags?: string[]
|
|
73
|
-
[k: string]: unknown | undefined
|
|
74
|
-
}]
|
|
68
|
+
[k: string]: unknown | undefined;
|
|
69
|
+
});
|
|
70
|
+
tags?: string[];
|
|
71
|
+
[k: string]: unknown | undefined;
|
|
72
|
+
}];
|
|
75
73
|
// ----- tw/enforces-shorthand -----
|
|
76
|
-
type TwEnforcesShorthand = []|[{
|
|
77
|
-
callees?: string[]
|
|
78
|
-
ignoredKeys?: string[]
|
|
74
|
+
type TwEnforcesShorthand = [] | [{
|
|
75
|
+
callees?: string[];
|
|
76
|
+
ignoredKeys?: string[];
|
|
79
77
|
config?: (string | {
|
|
80
|
-
[k: string]: unknown | undefined
|
|
81
|
-
})
|
|
82
|
-
tags?: string[]
|
|
83
|
-
[k: string]: unknown | undefined
|
|
84
|
-
}]
|
|
78
|
+
[k: string]: unknown | undefined;
|
|
79
|
+
});
|
|
80
|
+
tags?: string[];
|
|
81
|
+
[k: string]: unknown | undefined;
|
|
82
|
+
}];
|
|
85
83
|
// ----- tw/migration-from-tailwind-2 -----
|
|
86
|
-
type TwMigrationFromTailwind2 = []|[{
|
|
87
|
-
callees?: string[]
|
|
88
|
-
ignoredKeys?: string[]
|
|
84
|
+
type TwMigrationFromTailwind2 = [] | [{
|
|
85
|
+
callees?: string[];
|
|
86
|
+
ignoredKeys?: string[];
|
|
89
87
|
config?: (string | {
|
|
90
|
-
[k: string]: unknown | undefined
|
|
91
|
-
})
|
|
92
|
-
tags?: string[]
|
|
93
|
-
[k: string]: unknown | undefined
|
|
94
|
-
}]
|
|
88
|
+
[k: string]: unknown | undefined;
|
|
89
|
+
});
|
|
90
|
+
tags?: string[];
|
|
91
|
+
[k: string]: unknown | undefined;
|
|
92
|
+
}];
|
|
95
93
|
// ----- tw/no-arbitrary-value -----
|
|
96
|
-
type TwNoArbitraryValue = []|[{
|
|
97
|
-
callees?: string[]
|
|
98
|
-
ignoredKeys?: string[]
|
|
94
|
+
type TwNoArbitraryValue = [] | [{
|
|
95
|
+
callees?: string[];
|
|
96
|
+
ignoredKeys?: string[];
|
|
99
97
|
config?: (string | {
|
|
100
|
-
[k: string]: unknown | undefined
|
|
101
|
-
})
|
|
102
|
-
tags?: string[]
|
|
103
|
-
[k: string]: unknown | undefined
|
|
104
|
-
}]
|
|
98
|
+
[k: string]: unknown | undefined;
|
|
99
|
+
});
|
|
100
|
+
tags?: string[];
|
|
101
|
+
[k: string]: unknown | undefined;
|
|
102
|
+
}];
|
|
105
103
|
// ----- tw/no-contradicting-classname -----
|
|
106
|
-
type TwNoContradictingClassname = []|[{
|
|
107
|
-
callees?: string[]
|
|
108
|
-
ignoredKeys?: string[]
|
|
104
|
+
type TwNoContradictingClassname = [] | [{
|
|
105
|
+
callees?: string[];
|
|
106
|
+
ignoredKeys?: string[];
|
|
109
107
|
config?: (string | {
|
|
110
|
-
[k: string]: unknown | undefined
|
|
111
|
-
})
|
|
112
|
-
tags?: string[]
|
|
113
|
-
[k: string]: unknown | undefined
|
|
114
|
-
}]
|
|
108
|
+
[k: string]: unknown | undefined;
|
|
109
|
+
});
|
|
110
|
+
tags?: string[];
|
|
111
|
+
[k: string]: unknown | undefined;
|
|
112
|
+
}];
|
|
115
113
|
// ----- tw/no-custom-classname -----
|
|
116
|
-
type TwNoCustomClassname = []|[{
|
|
117
|
-
callees?: string[]
|
|
118
|
-
ignoredKeys?: string[]
|
|
114
|
+
type TwNoCustomClassname = [] | [{
|
|
115
|
+
callees?: string[];
|
|
116
|
+
ignoredKeys?: string[];
|
|
119
117
|
config?: (string | {
|
|
120
|
-
[k: string]: unknown | undefined
|
|
121
|
-
})
|
|
122
|
-
cssFiles?: string[]
|
|
123
|
-
cssFilesRefreshRate?: number
|
|
124
|
-
tags?: string[]
|
|
125
|
-
whitelist?: string[]
|
|
126
|
-
[k: string]: unknown | undefined
|
|
127
|
-
}]
|
|
118
|
+
[k: string]: unknown | undefined;
|
|
119
|
+
});
|
|
120
|
+
cssFiles?: string[];
|
|
121
|
+
cssFilesRefreshRate?: number;
|
|
122
|
+
tags?: string[];
|
|
123
|
+
whitelist?: string[];
|
|
124
|
+
[k: string]: unknown | undefined;
|
|
125
|
+
}];
|
|
128
126
|
// ----- tw/no-unnecessary-arbitrary-value -----
|
|
129
|
-
type TwNoUnnecessaryArbitraryValue = []|[{
|
|
130
|
-
callees?: string[]
|
|
131
|
-
ignoredKeys?: string[]
|
|
127
|
+
type TwNoUnnecessaryArbitraryValue = [] | [{
|
|
128
|
+
callees?: string[];
|
|
129
|
+
ignoredKeys?: string[];
|
|
132
130
|
config?: (string | {
|
|
133
|
-
[k: string]: unknown | undefined
|
|
134
|
-
})
|
|
135
|
-
tags?: string[]
|
|
136
|
-
[k: string]: unknown | undefined
|
|
137
|
-
}]
|
|
131
|
+
[k: string]: unknown | undefined;
|
|
132
|
+
});
|
|
133
|
+
tags?: string[];
|
|
134
|
+
[k: string]: unknown | undefined;
|
|
135
|
+
}];
|
|
138
136
|
// Names of all the configs
|
|
139
|
-
type ConfigNames$
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
overrides?: TypedFlatConfigItem['rules'];
|
|
143
|
-
}
|
|
144
|
-
type ConfigNames = ConfigNames$2 & ConfigNames$1;
|
|
145
|
-
type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
|
|
146
|
-
interface MyRules extends RuleOptions {
|
|
137
|
+
type ConfigNames$2 = 'wongxy/tailwindcss';
|
|
138
|
+
declare namespace types_d_exports {
|
|
139
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem };
|
|
147
140
|
}
|
|
148
|
-
|
|
141
|
+
import * as import___antfu_eslint_config from "@antfu/eslint-config";
|
|
142
|
+
interface OptionsOverrides$1 {
|
|
143
|
+
overrides?: TypedFlatConfigItem['rules'];
|
|
149
144
|
}
|
|
150
|
-
type
|
|
151
|
-
|
|
145
|
+
type ConfigNames = ConfigNames$1 & ConfigNames$2;
|
|
146
|
+
type TypedFlatConfigItem = TypedFlatConfigItem$1 & MyTypedFlatConfigItem;
|
|
147
|
+
interface MyRules extends RuleOptions {}
|
|
148
|
+
interface Rules$1 extends MyRules, Rules {}
|
|
149
|
+
type MyTypedFlatConfigItem = Omit<Linter.Config<Linter.RulesRecord & Rules$1>, 'plugins'> & {
|
|
150
|
+
plugins?: Record<string, any>;
|
|
152
151
|
};
|
|
153
152
|
interface OptionsConfig extends OptionsConfig$1 {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Enable Tailwind rules.
|
|
155
|
+
*
|
|
156
|
+
* @default auto-detect based on the dependencies
|
|
157
|
+
*/
|
|
158
|
+
tailwindcss?: boolean | OptionsOverrides$1;
|
|
159
|
+
/**
|
|
160
|
+
* Enable React Native support.
|
|
161
|
+
*
|
|
162
|
+
* Will enable `react` support automatically.
|
|
163
|
+
*
|
|
164
|
+
* @default auto-detect based on the dependencies
|
|
165
|
+
*/
|
|
166
|
+
reactnative?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Enable react rules.
|
|
169
|
+
*
|
|
170
|
+
* @default auto-detect based on the dependencies
|
|
171
|
+
*/
|
|
172
|
+
react?: boolean | OptionsOverrides$1;
|
|
174
173
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
declare
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
//#endregion
|
|
175
|
+
//#region src/tailwindcss.d.ts
|
|
176
|
+
declare function tailwindcss(options?: types_d_exports.OptionsOverrides): Promise<TypedFlatConfigItem$1[]>;
|
|
177
|
+
declare namespace index_d_exports {
|
|
178
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem, wongxy as default, tailwindcss };
|
|
179
|
+
}
|
|
180
|
+
declare function wongxy(options?: OptionsConfig & Omit<TypedFlatConfigItem, 'files'>, ...userConfigs: types_d_exports.Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[]): FlatConfigComposer<TypedFlatConfigItem, ConfigNames>;
|
|
181
|
+
//#endregion
|
|
182
|
+
export { ConfigNames, MyTypedFlatConfigItem, OptionsConfig, TypedFlatConfigItem, wongxy as default, tailwindcss };
|
package/dist/index.js
CHANGED
|
@@ -1,140 +1,121 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
-
|
|
19
|
-
// src/index.ts
|
|
20
|
-
var index_exports = {};
|
|
21
|
-
__export(index_exports, {
|
|
22
|
-
default: () => wongxy,
|
|
23
|
-
tailwindcss: () => tailwindcss
|
|
24
|
-
});
|
|
1
|
+
import { __export, __reExport } from "./chunk-CHLpw0oG.js";
|
|
25
2
|
import { antfu } from "@antfu/eslint-config";
|
|
26
3
|
import { isPackageExists } from "local-pkg";
|
|
27
|
-
|
|
28
|
-
// src/tailwindcss.ts
|
|
29
4
|
import pluginTailwind from "eslint-plugin-tailwindcss";
|
|
5
|
+
|
|
6
|
+
export * from "@antfu/eslint-config"
|
|
7
|
+
|
|
8
|
+
//#region src/tailwindcss.ts
|
|
30
9
|
async function tailwindcss(options) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"tw/classnames-order": "warn",
|
|
47
|
-
"tw/enforces-negative-arbitrary-values": "warn",
|
|
48
|
-
"tw/enforces-shorthand": "warn",
|
|
49
|
-
"tw/migration-from-tailwind-2": "warn",
|
|
50
|
-
"tw/no-arbitrary-value": "off",
|
|
51
|
-
// 'tw/no-custom-classname': 'warn',
|
|
52
|
-
"tw/no-contradicting-classname": "error",
|
|
53
|
-
// 'tw/no-unnecessary-arbitrary-value': 'warn',
|
|
54
|
-
...overrides
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
];
|
|
10
|
+
const { overrides = {} } = options ?? {};
|
|
11
|
+
return [{
|
|
12
|
+
name: "wongxy/tailwindcss",
|
|
13
|
+
plugins: { tw: pluginTailwind },
|
|
14
|
+
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
|
|
15
|
+
rules: {
|
|
16
|
+
"tw/classnames-order": "warn",
|
|
17
|
+
"tw/enforces-negative-arbitrary-values": "warn",
|
|
18
|
+
"tw/enforces-shorthand": "warn",
|
|
19
|
+
"tw/migration-from-tailwind-2": "warn",
|
|
20
|
+
"tw/no-arbitrary-value": "off",
|
|
21
|
+
"tw/no-contradicting-classname": "error",
|
|
22
|
+
...overrides
|
|
23
|
+
}
|
|
24
|
+
}];
|
|
58
25
|
}
|
|
59
26
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/index.ts
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => wongxy,
|
|
32
|
+
tailwindcss: () => tailwindcss
|
|
33
|
+
});
|
|
34
|
+
const VuePackages = [
|
|
35
|
+
"vue",
|
|
36
|
+
"nuxt",
|
|
37
|
+
"vitepress",
|
|
38
|
+
"@slidev/cli"
|
|
39
|
+
];
|
|
40
|
+
const ReactPackages = [
|
|
41
|
+
"react",
|
|
42
|
+
"react-native",
|
|
43
|
+
"react-dom",
|
|
44
|
+
"next"
|
|
45
|
+
];
|
|
69
46
|
function wongxy(options, ...userConfigs) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
47
|
+
options = options ?? {};
|
|
48
|
+
const finalOptions = {
|
|
49
|
+
...options,
|
|
50
|
+
vue: options.vue ?? VuePackages.some((i) => isPackageExists(i)),
|
|
51
|
+
typescript: options.typescript ?? isPackageExists("typescript"),
|
|
52
|
+
react: (options.react || options.reactnative) ?? ReactPackages.some((i) => isPackageExists(i)),
|
|
53
|
+
reactnative: options.reactnative ?? isPackageExists("react-native"),
|
|
54
|
+
tailwindcss: options.tailwindcss ?? isPackageExists("tailwindcss")
|
|
55
|
+
};
|
|
56
|
+
const rules = {
|
|
57
|
+
"no-console": "off",
|
|
58
|
+
"no-alert": "off",
|
|
59
|
+
"no-multiple-empty-lines": "warn",
|
|
60
|
+
"antfu/top-level-function": "off",
|
|
61
|
+
"antfu/if-newline": "off",
|
|
62
|
+
"style/brace-style": [
|
|
63
|
+
"error",
|
|
64
|
+
"1tbs",
|
|
65
|
+
{ allowSingleLine: true }
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
for (const key in finalOptions.rules) delete rules[key];
|
|
69
|
+
userConfigs.splice(0, 0, {
|
|
70
|
+
name: "wongxy/rules",
|
|
71
|
+
rules
|
|
72
|
+
});
|
|
73
|
+
if (finalOptions.vue) {
|
|
74
|
+
const vue = typeof finalOptions.vue === "object" ? finalOptions.vue : {};
|
|
75
|
+
finalOptions.vue = {
|
|
76
|
+
...vue,
|
|
77
|
+
overrides: {
|
|
78
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
79
|
+
"vue/valid-template-root": "off",
|
|
80
|
+
"vue/block-order": ["warn", { order: [["script", "template"], "style"] }],
|
|
81
|
+
"vue/custom-event-name-casing": "off",
|
|
82
|
+
...vue.overrides
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (finalOptions.react) {
|
|
87
|
+
const react = typeof finalOptions.react === "object" ? finalOptions.react : {};
|
|
88
|
+
finalOptions.react = {
|
|
89
|
+
...react,
|
|
90
|
+
overrides: {
|
|
91
|
+
"react/prefer-destructuring-assignment": "off",
|
|
92
|
+
...react.overrides
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (finalOptions.typescript) {
|
|
97
|
+
const typescript = typeof finalOptions.typescript === "object" ? finalOptions.typescript : {};
|
|
98
|
+
finalOptions.typescript = {
|
|
99
|
+
...typescript,
|
|
100
|
+
overrides: {
|
|
101
|
+
"ts/consistent-type-imports": ["error", {
|
|
102
|
+
disallowTypeAnnotations: false,
|
|
103
|
+
fixStyle: "inline-type-imports",
|
|
104
|
+
prefer: "type-imports"
|
|
105
|
+
}],
|
|
106
|
+
...finalOptions.reactnative ? {
|
|
107
|
+
"ts/no-require-imports": "off",
|
|
108
|
+
"ts/no-use-before-define": "off"
|
|
109
|
+
} : void 0,
|
|
110
|
+
...typescript.overrides
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
if (finalOptions.tailwindcss) userConfigs.splice(0, 0, tailwindcss({ overrides: typeof finalOptions.tailwindcss === "object" ? finalOptions.tailwindcss.overrides : void 0 }));
|
|
115
|
+
delete finalOptions.reactnative;
|
|
116
|
+
delete finalOptions.tailwindcss;
|
|
117
|
+
return antfu(finalOptions, ...userConfigs);
|
|
136
118
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
};
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
export { wongxy as default, tailwindcss };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wongxy/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"description": "xiyaowong's eslint config",
|
|
6
6
|
"author": "xiyaowong (https://github.com/xiyaowong)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@eslint-react/eslint-plugin": "^1.49.0",
|
|
20
|
+
"@next/eslint-plugin-next": "^15.5.2",
|
|
20
21
|
"@unocss/eslint-plugin": "^66.1.2",
|
|
21
22
|
"eslint": "^9.27.0",
|
|
22
23
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
@@ -24,25 +25,27 @@
|
|
|
24
25
|
"eslint-plugin-tailwindcss": ">=3.18.0"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@antfu/eslint-config": "^
|
|
28
|
-
"
|
|
28
|
+
"@antfu/eslint-config": "^5.2.1",
|
|
29
|
+
"eslint-flat-config-utils": "^2.1.1",
|
|
30
|
+
"local-pkg": "^1.1.2"
|
|
29
31
|
},
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@types/eslint": "^9.6.1",
|
|
32
34
|
"@types/eslint-plugin-tailwindcss": "3.17.0",
|
|
33
|
-
"@types/node": "^
|
|
34
|
-
"bumpp": "^10.
|
|
35
|
-
"eslint": "^9.
|
|
36
|
-
"eslint-typegen": "^2.
|
|
35
|
+
"@types/node": "^24.3.0",
|
|
36
|
+
"bumpp": "^10.2.3",
|
|
37
|
+
"eslint": "^9.34.0",
|
|
38
|
+
"eslint-typegen": "^2.3.0",
|
|
37
39
|
"esno": "^4.8.0",
|
|
38
|
-
"
|
|
39
|
-
"typescript": "5.
|
|
40
|
+
"tsdown": "^0.14.2",
|
|
41
|
+
"typescript": "5.9.2"
|
|
40
42
|
},
|
|
41
43
|
"scripts": {
|
|
42
|
-
"build": "nr typegen &&
|
|
43
|
-
"stub": "
|
|
44
|
-
"
|
|
44
|
+
"build": "nr typegen && tsdown --clean --dts",
|
|
45
|
+
"stub": "tsdown --format esm",
|
|
46
|
+
"watch": "tsdown --watch",
|
|
45
47
|
"lint": "pnpm run stub && eslint .",
|
|
48
|
+
"dev": "tsdown --watch & eslint-flat-config-viewer",
|
|
46
49
|
"lint:fix": "pnpm run stub && eslint . --fix",
|
|
47
50
|
"release": "bumpp && pnpm publish",
|
|
48
51
|
"inspect": "pnpm build && npx @eslint/config-inspector",
|