@truenine/eslint9-config 1.0.14 → 1.0.15
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/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/defaults/index.cjs +181 -181
- package/dist/defaults/index.cjs.map +1 -0
- package/dist/defaults/index.js +181 -190
- package/dist/defaults/index.js.map +1 -0
- package/dist/index.cjs +35 -48
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +19 -15
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -49
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.cts +46 -0
- package/dist/types/index.d.cts.map +1 -0
- package/dist/types/index.d.ts +45 -39
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +5 -14
- package/dist/defaults/index.d.ts +0 -35
package/dist/defaults/index.js
CHANGED
|
@@ -1,200 +1,191 @@
|
|
|
1
|
+
//#region src/defaults/index.ts
|
|
1
2
|
const defaultUnocssConfig = {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
attributify: true,
|
|
4
|
+
strict: true
|
|
4
5
|
};
|
|
5
6
|
const defaultVueConfig = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
"prefer-const": [
|
|
85
|
-
"error",
|
|
86
|
-
{
|
|
87
|
-
destructuring: "any",
|
|
88
|
-
ignoreReadBeforeAssign: false
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
const defaultTsConfig = {
|
|
94
|
-
overrides: {
|
|
95
|
-
"ts/no-unsafe-assignment": "off",
|
|
96
|
-
"ts/no-unsafe-call": "off",
|
|
97
|
-
"ts/no-unsafe-argument": "off",
|
|
98
|
-
"ts/no-unsafe-return": "off",
|
|
99
|
-
"ts/member-ordering": ["error"],
|
|
100
|
-
"ts/no-extra-non-null-assertion": "error",
|
|
101
|
-
"ts/no-non-null-assertion": "error",
|
|
102
|
-
"ts/no-explicit-any": ["error", {
|
|
103
|
-
fixToUnknown: true,
|
|
104
|
-
ignoreRestArgs: true
|
|
105
|
-
}],
|
|
106
|
-
"ts/no-namespace": "error",
|
|
107
|
-
"ts/no-unused-vars": [
|
|
108
|
-
"error",
|
|
109
|
-
{
|
|
110
|
-
vars: "all",
|
|
111
|
-
args: "after-used",
|
|
112
|
-
ignoreRestSiblings: false
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
7
|
+
vueVersion: 3,
|
|
8
|
+
overrides: {
|
|
9
|
+
"vue/html-self-closing": ["error", { html: {
|
|
10
|
+
void: "always",
|
|
11
|
+
normal: "always",
|
|
12
|
+
component: "always"
|
|
13
|
+
} }],
|
|
14
|
+
"vue/html-comment-content-spacing": [
|
|
15
|
+
"error",
|
|
16
|
+
"always",
|
|
17
|
+
{ exceptions: [] }
|
|
18
|
+
],
|
|
19
|
+
"vue/html-comment-indent": ["error", 2],
|
|
20
|
+
"vue/html-indent": [
|
|
21
|
+
"error",
|
|
22
|
+
2,
|
|
23
|
+
{
|
|
24
|
+
baseIndent: 0,
|
|
25
|
+
alignAttributesVertically: true
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"vue/define-emits-declaration": ["error", "type-literal"],
|
|
29
|
+
"vue/define-props-declaration": ["error", "type-based"],
|
|
30
|
+
"vue/define-macros-order": ["error", {
|
|
31
|
+
order: [
|
|
32
|
+
"defineProps",
|
|
33
|
+
"defineEmits",
|
|
34
|
+
"defineModel",
|
|
35
|
+
"defineSlots"
|
|
36
|
+
],
|
|
37
|
+
defineExposeLast: true
|
|
38
|
+
}],
|
|
39
|
+
"vue/block-order": ["error", { order: [
|
|
40
|
+
"script",
|
|
41
|
+
"template",
|
|
42
|
+
"style"
|
|
43
|
+
] }],
|
|
44
|
+
"vue/attributes-order": ["error", { order: [
|
|
45
|
+
"DEFINITION",
|
|
46
|
+
"LIST_RENDERING",
|
|
47
|
+
"CONDITIONALS",
|
|
48
|
+
"RENDER_MODIFIERS",
|
|
49
|
+
"GLOBAL",
|
|
50
|
+
"UNIQUE",
|
|
51
|
+
"TWO_WAY_BINDING",
|
|
52
|
+
"OTHER_DIRECTIVES",
|
|
53
|
+
"OTHER_ATTR",
|
|
54
|
+
"EVENTS",
|
|
55
|
+
"CONTENT"
|
|
56
|
+
] }],
|
|
57
|
+
"vue/v-on-event-hyphenation": [
|
|
58
|
+
"error",
|
|
59
|
+
"never",
|
|
60
|
+
{ autofix: true }
|
|
61
|
+
],
|
|
62
|
+
"vue/attribute-hyphenation": [
|
|
63
|
+
"error",
|
|
64
|
+
"never",
|
|
65
|
+
{ ignoreTags: [
|
|
66
|
+
"i-",
|
|
67
|
+
"v-",
|
|
68
|
+
"v-bind"
|
|
69
|
+
] }
|
|
70
|
+
],
|
|
71
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
72
|
+
"vue/component-name-in-template-casing": [
|
|
73
|
+
"error",
|
|
74
|
+
"PascalCase",
|
|
75
|
+
{
|
|
76
|
+
ignores: [
|
|
77
|
+
"router-view",
|
|
78
|
+
"router-link",
|
|
79
|
+
"scroll-view"
|
|
80
|
+
],
|
|
81
|
+
registeredComponentsOnly: false
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
}
|
|
116
85
|
};
|
|
86
|
+
const defaultJsConfig = { overrides: {
|
|
87
|
+
"no-inline-comments": "error",
|
|
88
|
+
"unicorn/no-useless-spread": "error",
|
|
89
|
+
"curly": ["error", "all"],
|
|
90
|
+
"no-undefined": "error",
|
|
91
|
+
"no-cond-assign": ["error", "always"],
|
|
92
|
+
"no-constant-condition": "error",
|
|
93
|
+
"no-restricted-syntax": "error",
|
|
94
|
+
"no-global-assign": "error",
|
|
95
|
+
"no-unused-vars": "error",
|
|
96
|
+
"no-var": "error",
|
|
97
|
+
"prefer-const": ["error", {
|
|
98
|
+
destructuring: "any",
|
|
99
|
+
ignoreReadBeforeAssign: false
|
|
100
|
+
}]
|
|
101
|
+
} };
|
|
102
|
+
const defaultTsConfig = { overrides: {
|
|
103
|
+
"ts/no-unsafe-assignment": "off",
|
|
104
|
+
"ts/no-unsafe-call": "off",
|
|
105
|
+
"ts/no-unsafe-argument": "off",
|
|
106
|
+
"ts/no-unsafe-return": "off",
|
|
107
|
+
"ts/member-ordering": ["error"],
|
|
108
|
+
"ts/no-extra-non-null-assertion": "error",
|
|
109
|
+
"ts/no-non-null-assertion": "error",
|
|
110
|
+
"ts/no-explicit-any": ["error", {
|
|
111
|
+
fixToUnknown: true,
|
|
112
|
+
ignoreRestArgs: true
|
|
113
|
+
}],
|
|
114
|
+
"ts/no-namespace": "error",
|
|
115
|
+
"ts/no-unused-vars": ["error", {
|
|
116
|
+
vars: "all",
|
|
117
|
+
args: "after-used",
|
|
118
|
+
ignoreRestSiblings: false
|
|
119
|
+
}]
|
|
120
|
+
} };
|
|
117
121
|
const defaultFormatterConfig = {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
132
|
-
const defaultStrictTsConfig = {
|
|
133
|
-
overrides: {
|
|
134
|
-
"ts/no-unsafe-assignment": "off",
|
|
135
|
-
"ts/no-unsafe-call": "off",
|
|
136
|
-
"ts/no-unsafe-argument": "off",
|
|
137
|
-
"ts/no-unsafe-return": "off",
|
|
138
|
-
"ts/no-floating-promises": "error"
|
|
139
|
-
}
|
|
122
|
+
css: "prettier",
|
|
123
|
+
html: "prettier",
|
|
124
|
+
prettierOptions: {
|
|
125
|
+
printWidth: 160,
|
|
126
|
+
tabWidth: 2,
|
|
127
|
+
arrowParens: "always",
|
|
128
|
+
vueIndentScriptAndStyle: true,
|
|
129
|
+
useTabs: false,
|
|
130
|
+
singleQuote: true,
|
|
131
|
+
jsxSingleQuote: true,
|
|
132
|
+
trailingComma: "all",
|
|
133
|
+
bracketSpacing: true
|
|
134
|
+
}
|
|
140
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* 严格 ts 模式 的默认配置
|
|
138
|
+
*
|
|
139
|
+
* 这些配置需要 配置 parserOptions 和 tsconfigPath 等
|
|
140
|
+
* @see https://typescript-eslint.io/getting-started/typed-linting
|
|
141
|
+
*/
|
|
142
|
+
const defaultStrictTsConfig = { overrides: {
|
|
143
|
+
"ts/no-unsafe-assignment": "off",
|
|
144
|
+
"ts/no-unsafe-call": "off",
|
|
145
|
+
"ts/no-unsafe-argument": "off",
|
|
146
|
+
"ts/no-unsafe-return": "off",
|
|
147
|
+
"ts/no-floating-promises": "error"
|
|
148
|
+
} };
|
|
141
149
|
const defaultStylisticConfig = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"ts/unbound-method": "off",
|
|
156
|
-
"ts/no-unsafe-argument": "off",
|
|
157
|
-
"ts/no-unsafe-assignment": "off",
|
|
158
|
-
"ts/no-unsafe-member-access": "off",
|
|
159
|
-
"ts/no-unsafe-call": "off",
|
|
160
|
-
"ts/no-unsafe-return": "off"
|
|
161
|
-
}
|
|
150
|
+
jsx: true,
|
|
151
|
+
indent: 2,
|
|
152
|
+
quotes: "single",
|
|
153
|
+
semi: false,
|
|
154
|
+
overrides: {
|
|
155
|
+
"style/no-multiple-empty-lines": ["error", {
|
|
156
|
+
max: 1,
|
|
157
|
+
maxBOF: 0,
|
|
158
|
+
maxEOF: 0
|
|
159
|
+
}],
|
|
160
|
+
"style/brace-style": ["error", "1tbs"],
|
|
161
|
+
"style/arrow-parens": ["error", "always"]
|
|
162
|
+
}
|
|
162
163
|
};
|
|
164
|
+
const defaultTestConfig = { overrides: {
|
|
165
|
+
"no-console": "off",
|
|
166
|
+
"ts/unbound-method": "off",
|
|
167
|
+
"ts/no-unsafe-argument": "off",
|
|
168
|
+
"ts/no-unsafe-assignment": "off",
|
|
169
|
+
"ts/no-unsafe-member-access": "off",
|
|
170
|
+
"ts/no-unsafe-call": "off",
|
|
171
|
+
"ts/no-unsafe-return": "off"
|
|
172
|
+
} };
|
|
163
173
|
function mergeWithDefaults(value, defaults) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
if (value === true) {
|
|
180
|
-
return defaults;
|
|
181
|
-
}
|
|
182
|
-
if (typeof value === "object" && typeof defaults === "object") {
|
|
183
|
-
return {
|
|
184
|
-
...defaults,
|
|
185
|
-
...value
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
return value;
|
|
174
|
+
if (defaults === false || defaults === null || defaults === void 0) {
|
|
175
|
+
if (value === true) return true;
|
|
176
|
+
if (value === false || value === null) return false;
|
|
177
|
+
return value;
|
|
178
|
+
}
|
|
179
|
+
if (value === void 0) return defaults;
|
|
180
|
+
if (value === false || value === null) return false;
|
|
181
|
+
if (value === true) return defaults;
|
|
182
|
+
if (typeof value === "object" && typeof defaults === "object") return {
|
|
183
|
+
...defaults,
|
|
184
|
+
...value
|
|
185
|
+
};
|
|
186
|
+
return value;
|
|
189
187
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
defaultStylisticConfig,
|
|
195
|
-
defaultTestConfig,
|
|
196
|
-
defaultTsConfig,
|
|
197
|
-
defaultUnocssConfig,
|
|
198
|
-
defaultVueConfig,
|
|
199
|
-
mergeWithDefaults
|
|
200
|
-
};
|
|
188
|
+
|
|
189
|
+
//#endregion
|
|
190
|
+
export { defaultFormatterConfig, defaultJsConfig, defaultStrictTsConfig, defaultStylisticConfig, defaultTestConfig, defaultTsConfig, defaultUnocssConfig, defaultVueConfig, mergeWithDefaults };
|
|
191
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaultUnocssConfig: AntFuUnocssConfig","defaultVueConfig: AntFuVueConfig","defaultJsConfig: AntFuJsConfig","defaultTsConfig: AntFuTsConfig","defaultFormatterConfig: AntFuFormatterConfig","defaultStrictTsConfig: AntFuTsConfig","defaultStylisticConfig: AntFuStylisticConfig","defaultTestConfig: AntFuTestConfig","value?: boolean | T | null","defaults?: boolean | T | null"],"sources":["../../src/defaults/index.ts"],"sourcesContent":["import type { AntFuFormatterConfig, AntFuJsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from '../types'\n\nexport const defaultUnocssConfig: AntFuUnocssConfig = {\n attributify: true,\n strict: true,\n}\n\nexport const defaultVueConfig: AntFuVueConfig = {\n vueVersion: 3,\n overrides: {\n 'vue/html-self-closing': ['error', {\n html: {\n void: 'always',\n normal: 'always',\n component: 'always',\n },\n }],\n 'vue/html-comment-content-spacing': ['error', 'always', { exceptions: [] }],\n 'vue/html-comment-indent': ['error', 2],\n 'vue/html-indent': ['error', 2, {\n baseIndent: 0,\n alignAttributesVertically: true,\n }],\n 'vue/define-emits-declaration': ['error', 'type-literal'],\n 'vue/define-props-declaration': ['error', 'type-based'],\n 'vue/define-macros-order': [\n 'error',\n {\n order: [\n 'defineProps',\n 'defineEmits',\n 'defineModel',\n 'defineSlots',\n ],\n defineExposeLast: true,\n },\n ],\n 'vue/block-order': [\n 'error',\n {\n order: ['script', 'template', 'style'],\n },\n ],\n 'vue/attributes-order': [\n 'error',\n {\n order: ['DEFINITION', 'LIST_RENDERING', 'CONDITIONALS', 'RENDER_MODIFIERS', 'GLOBAL', 'UNIQUE', 'TWO_WAY_BINDING', 'OTHER_DIRECTIVES', 'OTHER_ATTR', 'EVENTS', 'CONTENT'],\n },\n ],\n 'vue/v-on-event-hyphenation': [\n 'error',\n 'never',\n {\n autofix: true,\n },\n ],\n 'vue/attribute-hyphenation': [\n 'error',\n 'never',\n {\n ignoreTags: ['i-', 'v-', 'v-bind'],\n },\n ],\n 'vue/prop-name-casing': ['error', 'camelCase'],\n 'vue/component-name-in-template-casing': [\n 'error',\n 'PascalCase',\n {\n ignores: ['router-view', 'router-link', 'scroll-view'],\n registeredComponentsOnly: false,\n },\n ],\n },\n}\n\nexport const defaultJsConfig: AntFuJsConfig = {\n overrides: {\n 'no-inline-comments': 'error',\n 'unicorn/no-useless-spread': 'error',\n\n 'curly': ['error', 'all'],\n 'no-undefined': 'error',\n 'no-cond-assign': ['error', 'always'],\n 'no-constant-condition': 'error',\n 'no-restricted-syntax': 'error',\n 'no-global-assign': 'error',\n 'no-unused-vars': 'error',\n 'no-var': 'error',\n 'prefer-const': [\n 'error',\n {\n destructuring: 'any',\n ignoreReadBeforeAssign: false,\n },\n ],\n },\n}\n\nexport const defaultTsConfig: AntFuTsConfig = {\n overrides: {\n 'ts/no-unsafe-assignment': 'off',\n 'ts/no-unsafe-call': 'off',\n 'ts/no-unsafe-argument': 'off',\n 'ts/no-unsafe-return': 'off',\n 'ts/member-ordering': ['error'],\n 'ts/no-extra-non-null-assertion': 'error',\n 'ts/no-non-null-assertion': 'error',\n 'ts/no-explicit-any': ['error', {\n fixToUnknown: true,\n ignoreRestArgs: true,\n }],\n 'ts/no-namespace': 'error',\n 'ts/no-unused-vars': [\n 'error',\n {\n vars: 'all',\n args: 'after-used',\n ignoreRestSiblings: false,\n },\n ],\n },\n}\n\nexport const defaultFormatterConfig: AntFuFormatterConfig = {\n css: 'prettier',\n html: 'prettier',\n prettierOptions: {\n printWidth: 160,\n tabWidth: 2,\n arrowParens: 'always',\n vueIndentScriptAndStyle: true,\n useTabs: false,\n singleQuote: true,\n jsxSingleQuote: true,\n trailingComma: 'all',\n bracketSpacing: true,\n },\n}\n\n/**\n * 严格 ts 模式 的默认配置\n *\n * 这些配置需要 配置 parserOptions 和 tsconfigPath 等\n * @see https://typescript-eslint.io/getting-started/typed-linting\n */\nexport const defaultStrictTsConfig: AntFuTsConfig = {\n overrides: {\n 'ts/no-unsafe-assignment': 'off',\n 'ts/no-unsafe-call': 'off',\n 'ts/no-unsafe-argument': 'off',\n 'ts/no-unsafe-return': 'off',\n 'ts/no-floating-promises': 'error',\n },\n}\n\nexport const defaultStylisticConfig: AntFuStylisticConfig = {\n jsx: true,\n indent: 2,\n quotes: 'single',\n semi: false,\n overrides: {\n 'style/no-multiple-empty-lines': ['error', { max: 1, maxBOF: 0, maxEOF: 0 }],\n 'style/brace-style': ['error', '1tbs'],\n 'style/arrow-parens': ['error', 'always'],\n },\n}\n\nexport const defaultTestConfig: AntFuTestConfig = {\n overrides: {\n 'no-console': 'off',\n 'ts/unbound-method': 'off',\n 'ts/no-unsafe-argument': 'off',\n 'ts/no-unsafe-assignment': 'off',\n 'ts/no-unsafe-member-access': 'off',\n 'ts/no-unsafe-call': 'off',\n 'ts/no-unsafe-return': 'off',\n },\n}\n\n/**\n * 合并配置项,支持以下场景:\n * 1. 布尔值与对象配置的混合\n * 2. 使用 vite 的 mergeConfig 进行对象合并\n * 3. 处理 undefined 和 null 的默认值\n *\n * @example\n * ```ts\n * // 场景1: 布尔值转换为默认对象\n * mergeWithDefaults(true, { foo: 'bar' }) // => { foo: 'bar' }\n *\n * // 场景2: vite配置合并\n * mergeWithDefaults({ plugins: [vue()] }, { plugins: [unocss()] })\n *\n * // 场景3: undefined/null/false 处理\n * mergeWithDefaults(false, true) // => false\n * ```\n */\nexport function mergeWithDefaults<T extends object>(\n value?: boolean | T | null,\n defaults?: T\n): T\nexport function mergeWithDefaults<T extends object>(\n value?: boolean | T | null,\n defaults?: boolean\n): boolean | T\nexport function mergeWithDefaults<T extends object>(\n value?: boolean | T | null,\n defaults?: boolean | T | null,\n): boolean | T {\n // 处理无默认值的情况\n if (defaults === false || defaults === null || defaults === void 0) {\n if (value === true) {\n return true\n }\n if (value === false || value === null) {\n return false\n }\n return value as T\n }\n\n // 处理 value 为 undefined 的情况\n if (value === void 0) {\n return defaults\n }\n\n // 处理 value 为 false/null 的情况\n if (value === false || value === null) {\n return false\n }\n\n // 处理 value 为 true 的情况\n if (value === true) {\n return defaults\n }\n\n // 如果都是对象,使用 vite 的 mergeConfig 进行合并\n if (typeof value === 'object' && typeof defaults === 'object') {\n return {\n ...defaults,\n ...value,\n }\n }\n\n // 其他情况返回 value\n return value\n}\n"],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,51 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_index = require('./defaults/index.cjs');
|
|
3
|
+
const __antfu_eslint_config = require_rolldown_runtime.__toESM(require("@antfu/eslint-config"));
|
|
4
|
+
|
|
5
|
+
//#region src/index.ts
|
|
4
6
|
async function eslint9(options = {}) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_typescript.parserOptions = {
|
|
33
|
-
projectService: true
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return eslintConfig.antfu({
|
|
38
|
-
type,
|
|
39
|
-
ignores,
|
|
40
|
-
pnpm: _pnpm,
|
|
41
|
-
test: _test,
|
|
42
|
-
unocss: _unocss,
|
|
43
|
-
vue: _vue,
|
|
44
|
-
jsx,
|
|
45
|
-
typescript: _typescript,
|
|
46
|
-
javascript: _javascript,
|
|
47
|
-
stylistic: _stylistic,
|
|
48
|
-
formatters: _formatters
|
|
49
|
-
});
|
|
7
|
+
const { type = "lib", ignores = [], test = true, unocss = false, vue = false, jsx = false, pnpm = false, stylistic = true, javascript = require_index.defaultJsConfig, typescript = require_index.defaultTsConfig, formatters = false } = options;
|
|
8
|
+
const _test = require_index.mergeWithDefaults(test, require_index.defaultTestConfig);
|
|
9
|
+
const _unocss = require_index.mergeWithDefaults(unocss, require_index.defaultUnocssConfig);
|
|
10
|
+
const _vue = require_index.mergeWithDefaults(vue, require_index.defaultVueConfig);
|
|
11
|
+
const _javascript = require_index.mergeWithDefaults(javascript, require_index.defaultJsConfig);
|
|
12
|
+
const _stylistic = require_index.mergeWithDefaults(stylistic, require_index.defaultStylisticConfig);
|
|
13
|
+
const _formatters = require_index.mergeWithDefaults(formatters, require_index.defaultFormatterConfig);
|
|
14
|
+
let _typescript = typescript;
|
|
15
|
+
let _pnpm = pnpm;
|
|
16
|
+
if (type === "app") _pnpm = false;
|
|
17
|
+
if (_typescript !== null && typeof _typescript === "object" && "strictTypescriptEslint" in _typescript && _typescript.strictTypescriptEslint === true) {
|
|
18
|
+
_typescript = require_index.mergeWithDefaults(typescript, require_index.defaultStrictTsConfig);
|
|
19
|
+
if (typeof _typescript === "object" && "tsconfigPath" in _typescript) _typescript.parserOptions = { projectService: true };
|
|
20
|
+
}
|
|
21
|
+
return (0, __antfu_eslint_config.antfu)({
|
|
22
|
+
type,
|
|
23
|
+
ignores,
|
|
24
|
+
pnpm: _pnpm,
|
|
25
|
+
test: _test,
|
|
26
|
+
unocss: _unocss,
|
|
27
|
+
vue: _vue,
|
|
28
|
+
jsx,
|
|
29
|
+
typescript: _typescript,
|
|
30
|
+
javascript: _javascript,
|
|
31
|
+
stylistic: _stylistic,
|
|
32
|
+
formatters: _formatters
|
|
33
|
+
});
|
|
50
34
|
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
51
37
|
module.exports = eslint9;
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["options: ConfigOptions","defaultJsConfig","defaultTsConfig","mergeWithDefaults","defaultTestConfig","defaultUnocssConfig","defaultVueConfig","defaultStylisticConfig","defaultFormatterConfig","defaultStrictTsConfig"],"sources":["../src/index.ts"],"sourcesContent":["import type { OptionsTypeScriptParserOptions } from '@antfu/eslint-config'\nimport type { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from './types'\nimport { antfu } from '@antfu/eslint-config'\nimport { defaultFormatterConfig, defaultJsConfig, defaultStrictTsConfig, defaultStylisticConfig, defaultTestConfig, defaultTsConfig, defaultUnocssConfig, defaultVueConfig, mergeWithDefaults } from './defaults'\n\ninterface ConfigOptions {\n type?: 'app' | 'lib'\n pnpm?: boolean\n test?: boolean | AntFuTestConfig\n ignores?: string[]\n jsx?: boolean\n vue?: boolean | AntFuVueConfig\n formatters?: boolean | AntFuFormatterConfig\n javascript?: AntFuJsConfig\n typescript?: boolean | AntFuStrictTsConfig | AntFuTsConfig\n unocss?: boolean | AntFuUnocssConfig\n stylistic?: boolean | AntFuStylisticConfig\n}\n\nexport default async function eslint9(options: ConfigOptions = {}): Promise<ReturnType<typeof antfu>> {\n const {\n type = 'lib',\n ignores = [],\n test = true,\n unocss = false,\n vue = false,\n jsx = false,\n pnpm = false,\n stylistic = true,\n javascript = defaultJsConfig,\n typescript = defaultTsConfig,\n formatters = false,\n } = options\n\n const _test = mergeWithDefaults(test, defaultTestConfig)\n const _unocss = mergeWithDefaults(unocss, defaultUnocssConfig)\n const _vue = mergeWithDefaults(vue, defaultVueConfig)\n const _javascript = mergeWithDefaults(javascript, defaultJsConfig)\n const _stylistic = mergeWithDefaults(stylistic, defaultStylisticConfig)\n const _formatters = mergeWithDefaults(formatters, defaultFormatterConfig)\n let _typescript = typescript\n\n // 如果 type 为 'app',强制 pnpm 为 false\n let _pnpm = pnpm\n if (type === 'app') {\n _pnpm = false\n }\n\n // 严格 ts 模式\n if (\n _typescript !== null\n && typeof _typescript === 'object'\n && 'strictTypescriptEslint' in _typescript\n && _typescript.strictTypescriptEslint === true\n ) {\n _typescript = mergeWithDefaults(typescript, defaultStrictTsConfig)\n if (typeof _typescript === 'object' && 'tsconfigPath' in _typescript) {\n (_typescript as OptionsTypeScriptParserOptions).parserOptions = {\n projectService: true,\n }\n }\n }\n\n return antfu({\n type,\n ignores,\n pnpm: _pnpm,\n test: _test,\n unocss: _unocss,\n vue: _vue,\n jsx,\n typescript: _typescript,\n javascript: _javascript,\n stylistic: _stylistic,\n formatters: _formatters,\n })\n}\n"],"mappings":";;;;;AAmBA,eAA8B,QAAQA,UAAyB,CAAE,GAAqC;CACpG,MAAM,EACJ,OAAO,OACP,UAAU,CAAE,GACZ,OAAO,MACP,SAAS,OACT,MAAM,OACN,MAAM,OACN,OAAO,OACP,YAAY,MACZ,aAAaC,+BACb,aAAaC,+BACb,aAAa,OACd,GAAG;CAEJ,MAAM,QAAQC,gCAAkB,MAAMC,gCAAkB;CACxD,MAAM,UAAUD,gCAAkB,QAAQE,kCAAoB;CAC9D,MAAM,OAAOF,gCAAkB,KAAKG,+BAAiB;CACrD,MAAM,cAAcH,gCAAkB,YAAYF,8BAAgB;CAClE,MAAM,aAAaE,gCAAkB,WAAWI,qCAAuB;CACvE,MAAM,cAAcJ,gCAAkB,YAAYK,qCAAuB;CACzE,IAAI,cAAc;CAGlB,IAAI,QAAQ;AACZ,KAAI,SAAS,OACX,QAAQ;AAIV,KACE,gBAAgB,QACb,OAAO,gBAAgB,YACvB,4BAA4B,eAC5B,YAAY,2BAA2B,MAC1C;EACA,cAAcL,gCAAkB,YAAYM,oCAAsB;AAClE,MAAI,OAAO,gBAAgB,YAAY,kBAAkB,aACtD,YAA+C,gBAAgB,EAC9D,gBAAgB,KACjB;CAEJ;AAED,yCAAa;EACX;EACA;EACA,MAAM;EACN,MAAM;EACN,QAAQ;EACR,KAAK;EACL;EACA,YAAY;EACZ,YAAY;EACZ,WAAW;EACX,YAAY;CACb,EAAC;AACH"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from "./types/index.cjs";
|
|
2
|
+
import { antfu } from "@antfu/eslint-config";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
5
|
+
interface ConfigOptions {
|
|
6
|
+
type?: "app" | "lib";
|
|
7
|
+
pnpm?: boolean;
|
|
8
|
+
test?: boolean | AntFuTestConfig;
|
|
9
|
+
ignores?: string[];
|
|
10
|
+
jsx?: boolean;
|
|
11
|
+
vue?: boolean | AntFuVueConfig;
|
|
12
|
+
formatters?: boolean | AntFuFormatterConfig;
|
|
13
|
+
javascript?: AntFuJsConfig;
|
|
14
|
+
typescript?: boolean | AntFuStrictTsConfig | AntFuTsConfig;
|
|
15
|
+
unocss?: boolean | AntFuUnocssConfig;
|
|
16
|
+
stylistic?: boolean | AntFuStylisticConfig;
|
|
17
|
+
}
|
|
18
|
+
declare function eslint9(options?: ConfigOptions): Promise<ReturnType<typeof antfu>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { eslint9 as default };
|
|
21
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["options: ConfigOptions"],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;UAKU,aAAA;;EAHkC,IAGlC,CAAA,EAAA,OAAA;EAAA,IAAA,CAAA,EAAA,OAAA,GAGS,eAHT;EAAA,OAGS,CAAA,EAAA,MAAA,EAAA;EAAA,GAAA,CAAA,EAGD,OAAA;EAAA,GAAA,CAAA,EACO,OAAA,GADP,cACO;EAAA,UACV,CAAA,EAAA,OAAA,GADU,oBACV;EAAA,UACU,CAAA,EADV,aACU;EAAA,UAAsB,CAAA,EAAA,OAAA,GAAtB,mBAAsB,GAAA,aAAA;EAAA,MAC1B,CAAA,EAAA,OAAA,GAAA,iBAAA;EAAA,SACG,CAAA,EAAA,OAAA,GAAA,oBAAA;AAAA;AAGM,iBAAA,OAAA,CAAA,OAAA,CAAA,EAAiB,aAAjB,CAAA,EAAsC,OAAtC,CAA8C,UAA9C,CAAA,OAAgE,KAAhE,CAAA,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from
|
|
2
|
-
import { antfu } from
|
|
1
|
+
import { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from "./types/index.js";
|
|
2
|
+
import { antfu } from "@antfu/eslint-config";
|
|
3
|
+
|
|
4
|
+
//#region src/index.d.ts
|
|
3
5
|
interface ConfigOptions {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
type?: "app" | "lib";
|
|
7
|
+
pnpm?: boolean;
|
|
8
|
+
test?: boolean | AntFuTestConfig;
|
|
9
|
+
ignores?: string[];
|
|
10
|
+
jsx?: boolean;
|
|
11
|
+
vue?: boolean | AntFuVueConfig;
|
|
12
|
+
formatters?: boolean | AntFuFormatterConfig;
|
|
13
|
+
javascript?: AntFuJsConfig;
|
|
14
|
+
typescript?: boolean | AntFuStrictTsConfig | AntFuTsConfig;
|
|
15
|
+
unocss?: boolean | AntFuUnocssConfig;
|
|
16
|
+
stylistic?: boolean | AntFuStylisticConfig;
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
declare function eslint9(options?: ConfigOptions): Promise<ReturnType<typeof antfu>>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { eslint9 as default };
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["options: ConfigOptions"],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;UAKU,aAAA;;EAHkC,IAGlC,CAAA,EAAA,OAAA;EAAA,IAAA,CAAA,EAAA,OAAA,GAGS,eAHT;EAAA,OAGS,CAAA,EAAA,MAAA,EAAA;EAAA,GAAA,CAAA,EAGD,OAAA;EAAA,GAAA,CAAA,EACO,OAAA,GADP,cACO;EAAA,UACV,CAAA,EAAA,OAAA,GADU,oBACV;EAAA,UACU,CAAA,EADV,aACU;EAAA,UAAsB,CAAA,EAAA,OAAA,GAAtB,mBAAsB,GAAA,aAAA;EAAA,MAC1B,CAAA,EAAA,OAAA,GAAA,iBAAA;EAAA,SACG,CAAA,EAAA,OAAA,GAAA,oBAAA;AAAA;AAGM,iBAAA,OAAA,CAAA,OAAA,CAAA,EAAiB,aAAjB,CAAA,EAAsC,OAAtC,CAA8C,UAA9C,CAAA,OAAgE,KAAhE,CAAA,CAAA"}
|