@truenine/eslint9-config 1.0.14 → 1.0.17

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.
@@ -1,200 +1,191 @@
1
+ //#region src/defaults/index.ts
1
2
  const defaultUnocssConfig = {
2
- attributify: true,
3
- strict: true
3
+ attributify: true,
4
+ strict: true
4
5
  };
5
6
  const defaultVueConfig = {
6
- vueVersion: 3,
7
- overrides: {
8
- "vue/html-self-closing": ["error", {
9
- html: {
10
- void: "always",
11
- normal: "always",
12
- component: "always"
13
- }
14
- }],
15
- "vue/html-comment-content-spacing": ["error", "always", { exceptions: [] }],
16
- "vue/html-comment-indent": ["error", 2],
17
- "vue/html-indent": ["error", 2, {
18
- baseIndent: 0,
19
- alignAttributesVertically: true
20
- }],
21
- "vue/define-emits-declaration": ["error", "type-literal"],
22
- "vue/define-props-declaration": ["error", "type-based"],
23
- "vue/define-macros-order": [
24
- "error",
25
- {
26
- order: [
27
- "defineProps",
28
- "defineEmits",
29
- "defineModel",
30
- "defineSlots"
31
- ],
32
- defineExposeLast: true
33
- }
34
- ],
35
- "vue/block-order": [
36
- "error",
37
- {
38
- order: ["script", "template", "style"]
39
- }
40
- ],
41
- "vue/attributes-order": [
42
- "error",
43
- {
44
- order: ["DEFINITION", "LIST_RENDERING", "CONDITIONALS", "RENDER_MODIFIERS", "GLOBAL", "UNIQUE", "TWO_WAY_BINDING", "OTHER_DIRECTIVES", "OTHER_ATTR", "EVENTS", "CONTENT"]
45
- }
46
- ],
47
- "vue/v-on-event-hyphenation": [
48
- "error",
49
- "never",
50
- {
51
- autofix: true
52
- }
53
- ],
54
- "vue/attribute-hyphenation": [
55
- "error",
56
- "never",
57
- {
58
- ignoreTags: ["i-", "v-", "v-bind"]
59
- }
60
- ],
61
- "vue/prop-name-casing": ["error", "camelCase"],
62
- "vue/component-name-in-template-casing": [
63
- "error",
64
- "PascalCase",
65
- {
66
- ignores: ["router-view", "router-link", "scroll-view"],
67
- registeredComponentsOnly: false
68
- }
69
- ]
70
- }
71
- };
72
- const defaultJsConfig = {
73
- overrides: {
74
- "no-inline-comments": "error",
75
- "unicorn/no-useless-spread": "error",
76
- "curly": ["error", "all"],
77
- "no-undefined": "error",
78
- "no-cond-assign": ["error", "always"],
79
- "no-constant-condition": "error",
80
- "no-restricted-syntax": "error",
81
- "no-global-assign": "error",
82
- "no-unused-vars": "error",
83
- "no-var": "error",
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
- css: "prettier",
119
- html: "prettier",
120
- prettierOptions: {
121
- printWidth: 160,
122
- tabWidth: 2,
123
- arrowParens: "always",
124
- vueIndentScriptAndStyle: true,
125
- useTabs: false,
126
- singleQuote: true,
127
- jsxSingleQuote: true,
128
- trailingComma: "all",
129
- bracketSpacing: true
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
- jsx: true,
143
- indent: 2,
144
- quotes: "single",
145
- semi: false,
146
- overrides: {
147
- "style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
148
- "style/brace-style": ["error", "1tbs"],
149
- "style/arrow-parens": ["error", "always"]
150
- }
151
- };
152
- const defaultTestConfig = {
153
- overrides: {
154
- "no-console": "off",
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
- if (defaults === false || defaults === null || defaults === void 0) {
165
- if (value === true) {
166
- return true;
167
- }
168
- if (value === false || value === null) {
169
- return false;
170
- }
171
- return value;
172
- }
173
- if (value === void 0) {
174
- return defaults;
175
- }
176
- if (value === false || value === null) {
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
- export {
191
- defaultFormatterConfig,
192
- defaultJsConfig,
193
- defaultStrictTsConfig,
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"],"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.d.ts CHANGED
@@ -1,17 +1,22 @@
1
- import { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from './types';
2
- import { antfu } from '@antfu/eslint-config';
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
- type?: 'app' | 'lib';
5
- pnpm?: boolean;
6
- test?: boolean | AntFuTestConfig;
7
- ignores?: string[];
8
- jsx?: boolean;
9
- vue?: boolean | AntFuVueConfig;
10
- formatters?: boolean | AntFuFormatterConfig;
11
- javascript?: AntFuJsConfig;
12
- typescript?: boolean | AntFuStrictTsConfig | AntFuTsConfig;
13
- unocss?: boolean | AntFuUnocssConfig;
14
- stylistic?: boolean | AntFuStylisticConfig;
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
- export default function eslint9(options?: ConfigOptions): Promise<ReturnType<typeof antfu>>;
17
- export {};
18
+ declare function applyPreset(options?: ConfigOptions): Promise<ReturnType<typeof antfu>>;
19
+ declare function eslint9(options?: ConfigOptions): Promise<ReturnType<typeof antfu>>;
20
+ //#endregion
21
+ export { ConfigOptions, applyPreset, eslint9 as default };
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;UAKiB,aAAA;;EAAjB,IAAiB,CAAA,EAAA,OAAA;EAAA,IAAA,CAAA,EAAA,OAAA,GAGE,eAHF;SAGE,CAAA,EAAA,MAAA,EAAA;QAGD,OAAA;QACO,OAAA,GADP,cACO;YACV,CAAA,EAAA,OAAA,GADU,oBACV;YACU,CAAA,EADV,aACU;YAAsB,CAAA,EAAA,OAAA,GAAtB,mBAAsB,GAAA,aAAA;QAC1B,CAAA,EAAA,OAAA,GAAA,iBAAA;WACG,CAAA,EAAA,OAAA,GAAA,oBAAA;;AAGF,iBAAA,WAAA,CAAA,OAAA,CAAA,EAAqB,aAArB,CAAA,EAA0C,OAA1C,CAAkD,UAAlD,CAAA,OAAoE,KAApE,CAAA,CAAA;AAAA,iBAIQ,OAAA,CAJR,OAAA,CAAA,EAIyB,aAJzB,CAAA,EAI8C,OAJ9C,CAIsD,UAJtD,CAAA,OAIwE,KAJxE,CAAA,CAAA"}
package/dist/index.js CHANGED
@@ -1,52 +1,40 @@
1
+ import { defaultFormatterConfig, defaultJsConfig, defaultStrictTsConfig, defaultStylisticConfig, defaultTestConfig, defaultTsConfig, defaultUnocssConfig, defaultVueConfig, mergeWithDefaults } from "./defaults/index.js";
1
2
  import { antfu } from "@antfu/eslint-config";
2
- import { defaultJsConfig, defaultTsConfig, mergeWithDefaults, defaultTestConfig, defaultUnocssConfig, defaultVueConfig, defaultStylisticConfig, defaultFormatterConfig, defaultStrictTsConfig } from "./defaults/index.js";
3
+
4
+ //#region src/index.ts
5
+ async function applyPreset(options = {}) {
6
+ return eslint9(options);
7
+ }
3
8
  async function eslint9(options = {}) {
4
- const {
5
- type = "lib",
6
- ignores = [],
7
- test = true,
8
- unocss = false,
9
- vue = false,
10
- jsx = false,
11
- pnpm = false,
12
- stylistic = true,
13
- javascript = defaultJsConfig,
14
- typescript = defaultTsConfig,
15
- formatters = false
16
- } = options;
17
- const _test = mergeWithDefaults(test, defaultTestConfig);
18
- const _unocss = mergeWithDefaults(unocss, defaultUnocssConfig);
19
- const _vue = mergeWithDefaults(vue, defaultVueConfig);
20
- const _javascript = mergeWithDefaults(javascript, defaultJsConfig);
21
- const _stylistic = mergeWithDefaults(stylistic, defaultStylisticConfig);
22
- const _formatters = mergeWithDefaults(formatters, defaultFormatterConfig);
23
- let _typescript = typescript;
24
- let _pnpm = pnpm;
25
- if (type === "app") {
26
- _pnpm = false;
27
- }
28
- if (_typescript !== null && typeof _typescript === "object" && "strictTypescriptEslint" in _typescript && _typescript.strictTypescriptEslint === true) {
29
- _typescript = mergeWithDefaults(typescript, defaultStrictTsConfig);
30
- if (typeof _typescript === "object" && "tsconfigPath" in _typescript) {
31
- _typescript.parserOptions = {
32
- projectService: true
33
- };
34
- }
35
- }
36
- return antfu({
37
- type,
38
- ignores,
39
- pnpm: _pnpm,
40
- test: _test,
41
- unocss: _unocss,
42
- vue: _vue,
43
- jsx,
44
- typescript: _typescript,
45
- javascript: _javascript,
46
- stylistic: _stylistic,
47
- formatters: _formatters
48
- });
9
+ const { type = "lib", ignores = [], test = true, unocss = false, vue = false, jsx = false, pnpm = false, stylistic = true, javascript = defaultJsConfig, typescript = defaultTsConfig, formatters = false } = options;
10
+ const _test = mergeWithDefaults(test, defaultTestConfig);
11
+ const _unocss = mergeWithDefaults(unocss, defaultUnocssConfig);
12
+ const _vue = mergeWithDefaults(vue, defaultVueConfig);
13
+ const _javascript = mergeWithDefaults(javascript, defaultJsConfig);
14
+ const _stylistic = mergeWithDefaults(stylistic, defaultStylisticConfig);
15
+ const _formatters = mergeWithDefaults(formatters, defaultFormatterConfig);
16
+ let _typescript = typescript;
17
+ let _pnpm = pnpm;
18
+ if (type === "app") _pnpm = false;
19
+ if (_typescript !== null && typeof _typescript === "object" && "strictTypescriptEslint" in _typescript && _typescript.strictTypescriptEslint === true) {
20
+ _typescript = mergeWithDefaults(typescript, defaultStrictTsConfig);
21
+ if (typeof _typescript === "object" && "tsconfigPath" in _typescript) _typescript.parserOptions = { projectService: true };
22
+ }
23
+ return antfu({
24
+ type,
25
+ ignores,
26
+ pnpm: _pnpm,
27
+ test: _test,
28
+ unocss: _unocss,
29
+ vue: _vue,
30
+ jsx,
31
+ typescript: _typescript,
32
+ javascript: _javascript,
33
+ stylistic: _stylistic,
34
+ formatters: _formatters
35
+ });
49
36
  }
50
- export {
51
- eslint9 as default
52
- };
37
+
38
+ //#endregion
39
+ export { applyPreset, eslint9 as default };
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { OptionsTypeScriptParserOptions } from '@antfu/eslint-config'\nimport type { AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig } from './types/index'\nimport { antfu } from '@antfu/eslint-config'\nimport { defaultFormatterConfig, defaultJsConfig, defaultStrictTsConfig, defaultStylisticConfig, defaultTestConfig, defaultTsConfig, defaultUnocssConfig, defaultVueConfig, mergeWithDefaults } from './defaults/index'\n\nexport interface 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 async function applyPreset(options: ConfigOptions = {}): Promise<ReturnType<typeof antfu>> {\n return eslint9(options)\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,eAAsB,YAAY,UAAyB,EAAE,EAAqC;AAChG,QAAO,QAAQ,QAAQ;;AAGzB,eAA8B,QAAQ,UAAyB,EAAE,EAAqC;CACpG,MAAM,EACJ,OAAO,OACP,UAAU,EAAE,EACZ,OAAO,MACP,SAAS,OACT,MAAM,OACN,MAAM,OACN,OAAO,OACP,YAAY,MACZ,aAAa,iBACb,aAAa,iBACb,aAAa,UACX;CAEJ,MAAM,QAAQ,kBAAkB,MAAM,kBAAkB;CACxD,MAAM,UAAU,kBAAkB,QAAQ,oBAAoB;CAC9D,MAAM,OAAO,kBAAkB,KAAK,iBAAiB;CACrD,MAAM,cAAc,kBAAkB,YAAY,gBAAgB;CAClE,MAAM,aAAa,kBAAkB,WAAW,uBAAuB;CACvE,MAAM,cAAc,kBAAkB,YAAY,uBAAuB;CACzE,IAAI,cAAc;CAGlB,IAAI,QAAQ;AACZ,KAAI,SAAS,MACX,SAAQ;AAIV,KACE,gBAAgB,QACb,OAAO,gBAAgB,YACvB,4BAA4B,eAC5B,YAAY,2BAA2B,MAC1C;AACA,gBAAc,kBAAkB,YAAY,sBAAsB;AAClE,MAAI,OAAO,gBAAgB,YAAY,kBAAkB,YACvD,CAAC,YAA+C,gBAAgB,EAC9D,gBAAgB,MACjB;;AAIL,QAAO,MAAM;EACX;EACA;EACA,MAAM;EACN,MAAM;EACN,QAAQ;EACR,KAAK;EACL;EACA,YAAY;EACZ,YAAY;EACZ,WAAW;EACX,YAAY;EACb,CAAC"}
@@ -1,40 +1,46 @@
1
- import { default as antfu } from '@antfu/eslint-config';
2
- /**
3
- * AntFu Config
4
- */
5
- export type AntFuConfig = NonNullable<Parameters<typeof antfu>[0]>;
6
- /**
7
- * typescript config options
8
- */
9
- export type AntFuTsConfig = Exclude<AntFuConfig['typescript'], boolean | undefined>;
10
- /**
11
- * javascript config options
12
- */
13
- export type AntFuJsConfig = Exclude<AntFuConfig['javascript'], boolean | undefined>;
14
- /**
15
- * vue config options
16
- */
17
- export type AntFuVueConfig = Exclude<AntFuConfig['vue'], boolean | undefined>;
18
- /**
19
- * unocss config options
20
- */
21
- export type AntFuUnocssConfig = Exclude<AntFuConfig['unocss'], boolean | undefined>;
22
- /**
23
- * stylistic config options
24
- */
25
- export type AntFuStylisticConfig = Exclude<AntFuConfig['stylistic'], boolean | undefined>;
26
- /**
27
- * formatter config options
28
- */
29
- export type AntFuFormatterConfig = Exclude<AntFuConfig['formatters'], boolean | undefined>;
30
- /**
31
- * test config options
32
- */
33
- export type AntFuTestConfig = Exclude<AntFuConfig['test'], boolean | undefined>;
34
- /**
35
- * 严格的 typescript config
36
- */
37
- export type AntFuStrictTsConfig = AntFuTsConfig & {
38
- strictTypescriptEslint: true;
39
- tsconfigPath: string;
1
+ import antfu$1 from "@antfu/eslint-config";
2
+
3
+ //#region src/types/index.d.ts
4
+
5
+ /**
6
+ * AntFu Config
7
+ */
8
+ type AntFuConfig = NonNullable<Parameters<typeof antfu$1>[0]>;
9
+ /**
10
+ * typescript config options
11
+ */
12
+ type AntFuTsConfig = Exclude<AntFuConfig["typescript"], boolean | undefined>;
13
+ /**
14
+ * javascript config options
15
+ */
16
+ type AntFuJsConfig = Exclude<AntFuConfig["javascript"], boolean | undefined>;
17
+ /**
18
+ * vue config options
19
+ */
20
+ type AntFuVueConfig = Exclude<AntFuConfig["vue"], boolean | undefined>;
21
+ /**
22
+ * unocss config options
23
+ */
24
+ type AntFuUnocssConfig = Exclude<AntFuConfig["unocss"], boolean | undefined>;
25
+ /**
26
+ * stylistic config options
27
+ */
28
+ type AntFuStylisticConfig = Exclude<AntFuConfig["stylistic"], boolean | undefined>;
29
+ /**
30
+ * formatter config options
31
+ */
32
+ type AntFuFormatterConfig = Exclude<AntFuConfig["formatters"], boolean | undefined>;
33
+ /**
34
+ * test config options
35
+ */
36
+ type AntFuTestConfig = Exclude<AntFuConfig["test"], boolean | undefined>;
37
+ /**
38
+ * 严格的 typescript config
39
+ */
40
+ type AntFuStrictTsConfig = AntFuTsConfig & {
41
+ strictTypescriptEslint: true;
42
+ tsconfigPath: string;
40
43
  };
44
+ //#endregion
45
+ export { AntFuConfig, AntFuFormatterConfig, AntFuJsConfig, AntFuStrictTsConfig, AntFuStylisticConfig, AntFuTestConfig, AntFuTsConfig, AntFuUnocssConfig, AntFuVueConfig };
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":[],"mappings":";;;;;;AAKA;AAAY,KAAA,WAAA,GAAc,WAAd,CAA0B,UAA1B,CAAA,OAA4C,OAA5C,CAAA,CAAA,CAAA,CAAA,CAAA;;;;AAAc,KAKd,aAAA,GAAgB,OALF,CAKU,WALV,CAAA,YAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;AAK1B;;;AAA4B,KAKhB,aAAA,GAAgB,OALA,CAKQ,WALR,CAAA,YAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;;AAK5B;;AAAoC,KAKxB,cAAA,GAAiB,OALO,CAKC,WALD,CAAA,KAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;;;AAKpC;AAAY,KAKA,iBAAA,GAAoB,OALpB,CAK4B,WAL5B,CAAA,QAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;;;;AAKA,KAKA,oBAAA,GAAuB,OALvB,CAK+B,WAL/B,CAAA,WAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;;;;AAAoB,KAUpB,oBAAA,GAAuB,OAVH,CAUW,WAVX,CAAA,YAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;AAKhC;;;AAAmC,KAUvB,eAAA,GAAkB,OAVK,CAUG,WAVH,CAAA,MAAA,CAAA,EAAA,OAAA,GAAA,SAAA,CAAA;;AAKnC;;AAA2C,KAS/B,mBAAA,GAAsB,aATS,GAAA;wBAAR,EAAA,IAAA;EAAA,YAAA,EAAA,MAAA;AAKnC,CAAA"}
File without changes