@lntvow/eslint-config 9.1.2 → 9.2.0

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.
Files changed (46) hide show
  1. package/package.json +4 -1
  2. package/.czrc +0 -3
  3. package/.editorconfig +0 -14
  4. package/.env.development +0 -1
  5. package/.env.production +0 -1
  6. package/.env.uat +0 -1
  7. package/.github/workflows/publish-npm.yml +0 -44
  8. package/.husky/commit-msg +0 -4
  9. package/.husky/pre-commit +0 -4
  10. package/.lintstagedrc +0 -4
  11. package/.prettierrc +0 -10
  12. package/.vscode/settings.json +0 -14
  13. package/api/basic.js +0 -22
  14. package/api/vue.js +0 -34
  15. package/commitlint.config.cjs +0 -4
  16. package/eslint.config.js +0 -21
  17. package/packages/eslint-config-ts/index.js +0 -85
  18. package/packages/eslint-config-ts/package.json +0 -18
  19. package/packages/eslint-plugin/index.js +0 -5
  20. package/packages/eslint-plugin/package.json +0 -16
  21. package/packages/eslint-plugin/rules/get.js +0 -18
  22. package/packages/eslint-plugin/test/get.test.js +0 -39
  23. package/src/configs/gitignore.ts +0 -34
  24. package/src/configs/ignores.ts +0 -10
  25. package/src/configs/imports.ts +0 -17
  26. package/src/configs/index.ts +0 -8
  27. package/src/configs/javascript.ts +0 -161
  28. package/src/configs/prettier.ts +0 -18
  29. package/src/configs/stylistic.ts +0 -59
  30. package/src/configs/typescript.ts +0 -63
  31. package/src/configs/vue.ts +0 -316
  32. package/src/factory.ts +0 -167
  33. package/src/globs.ts +0 -86
  34. package/src/index.ts +0 -7
  35. package/src/typegen.d.ts +0 -15123
  36. package/src/types.ts +0 -127
  37. package/src/typings/index.d.ts +0 -3
  38. package/src/utils/index.ts +0 -30
  39. package/test/js.vue +0 -28
  40. package/test/jsx.vue +0 -27
  41. package/test/test.js +0 -11
  42. package/test/test.ts +0 -18
  43. package/test/ts.vue +0 -26
  44. package/test/tsx.vue +0 -23
  45. package/tsconfig.json +0 -20
  46. package/tsup.config.ts +0 -10
@@ -1,59 +0,0 @@
1
- import pluginStylistic from '@stylistic/eslint-plugin'
2
- import type { StylisticConfig, TypedFlatConfigItem } from '../types'
3
-
4
- export const StylisticConfigDefaults: StylisticConfig = {
5
- indent: 2,
6
- jsx: true,
7
- quotes: 'single',
8
- semi: false,
9
- }
10
-
11
- export async function stylistic(options: StylisticConfig = {}): Promise<TypedFlatConfigItem[]> {
12
- const {
13
- indent,
14
- jsx,
15
- overrides = {},
16
- quotes,
17
- semi,
18
- } = {
19
- ...StylisticConfigDefaults,
20
- ...options,
21
- }
22
-
23
- const config = pluginStylistic.configs.customize({
24
- flat: true,
25
- indent,
26
- jsx,
27
- pluginName: 'style',
28
- quotes,
29
- semi,
30
- })
31
-
32
- return [
33
- {
34
- name: 'lntvow/stylistic/rules',
35
- plugins: {
36
- style: pluginStylistic,
37
- },
38
- rules: {
39
- // ...config.rules,
40
-
41
- /**
42
- * Custom rules
43
- */
44
- 'style/spaced-comment': 'error',
45
- 'style/padding-line-between-statements': [
46
- 'error',
47
- // { blankLine: 'always', prev: '*', next: 'cjs-export' },
48
- // { blankLine: 'always', prev: '*', next: 'export' },
49
- { blankLine: 'always', prev: '*', next: 'function' },
50
- ],
51
-
52
- /**
53
- * overrides
54
- */
55
- ...overrides,
56
- },
57
- },
58
- ]
59
- }
@@ -1,63 +0,0 @@
1
- import pluginTs from '@typescript-eslint/eslint-plugin'
2
- import tsParser from '@typescript-eslint/parser'
3
- import { GLOB_SRC } from '../globs'
4
- import type { OptionsComponentExts, OptionsTypeScript, TypedFlatConfigItem } from '../types'
5
- import { renameRules } from '../utils'
6
-
7
- // todo 类型没加
8
- export async function typescript(
9
- options: OptionsTypeScript & OptionsComponentExts = {}
10
- ): Promise<TypedFlatConfigItem[]> {
11
- const { componentExts = [], overrides = {}, parserOptions = {} } = options
12
-
13
- const files = [GLOB_SRC, ...componentExts.map(ext => `**/*.${ext}`)]
14
-
15
- // const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX]
16
- // const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : undefined
17
- // const isTypeAware = !!tsconfigPath
18
-
19
- return [
20
- {
21
- name: 'lntvow/typescript/rules',
22
- plugins: {
23
- typescript: pluginTs,
24
- },
25
- languageOptions: {
26
- parser: tsParser,
27
- parserOptions: {
28
- sourceType: 'module',
29
- },
30
- },
31
- files,
32
- rules: {
33
- ...renameRules(pluginTs.configs['eslint-recommended'].overrides![0].rules!, {
34
- '@typescript-eslint': 'typescript',
35
- }),
36
- ...renameRules(pluginTs.configs.strict.rules!, { '@typescript-eslint': 'typescript' }),
37
-
38
- /**
39
- * Override default configuration
40
- */
41
- // 禁止使用!断言
42
- 'typescript/no-non-null-assertion': 'off',
43
- // 禁止使用any
44
- 'typescript/no-explicit-any': 'off',
45
- // 禁止使用ts注释
46
- 'typescript/ban-ts-comment': 'off',
47
- // 未使用的变量
48
- 'typescript/no-unused-vars': 'warn',
49
-
50
- /**
51
- * Override javascript configuration
52
- */
53
- 'no-use-before-define': 'off',
54
- 'typescript/no-use-before-define': ['error', { functions: false }],
55
-
56
- /**
57
- * Overrides
58
- */
59
- ...overrides,
60
- },
61
- },
62
- ]
63
- }
@@ -1,316 +0,0 @@
1
- import { getPackageInfoSync } from 'local-pkg'
2
- import parserTs from '@typescript-eslint/parser'
3
- import parserVue from 'vue-eslint-parser'
4
- import pluginVue from 'eslint-plugin-vue'
5
- import { GLOB_VUE } from '../globs'
6
- import type { OptionsVue, TypedFlatConfigItem } from '../types'
7
-
8
- export async function vue(options: OptionsVue = {}): Promise<TypedFlatConfigItem[]> {
9
- const { overrides = {}, vueVersion = getVueVersion() } = options
10
-
11
- const vue3Rules = {
12
- ...pluginVue.configs['vue3-essential'].rules,
13
- ...pluginVue.configs['vue3-strongly-recommended'].rules,
14
- ...pluginVue.configs['vue3-recommended'].rules,
15
- 'vue/block-lang': ['error', { script: { lang: ['ts', 'tsx'] } }],
16
- 'vue/block-order': ['error', { order: ['script[setup]', 'template', 'style[scoped]'] }],
17
- 'vue/component-api-style': 'error',
18
- }
19
-
20
- const vue2Rules = {
21
- ...pluginVue.configs.essential.rules,
22
- ...pluginVue.configs['strongly-recommended'].rules,
23
- ...pluginVue.configs.recommended.rules,
24
- 'vue/block-lang': ['error', { script: { allowNoLang: true } }],
25
- 'vue/block-order': ['error', { order: [['script', 'template'], 'style[scoped]'] }],
26
- }
27
-
28
- return [
29
- {
30
- name: 'lntvow/vue/rules',
31
- plugins: {
32
- vue: pluginVue,
33
- },
34
- languageOptions: {
35
- parser: parserVue,
36
- parserOptions: {
37
- ecmaFeatures: {
38
- jsx: true,
39
- },
40
- parser: {
41
- ts: parserTs,
42
- tsx: parserTs,
43
- },
44
- sourceType: 'module',
45
- },
46
- // globals: {
47
- // computed: 'readonly',
48
- // defineEmits: 'readonly',
49
- // defineExpose: 'readonly',
50
- // defineProps: 'readonly',
51
- // onMounted: 'readonly',
52
- // onUnmounted: 'readonly',
53
- // reactive: 'readonly',
54
- // ref: 'readonly',
55
- // shallowReactive: 'readonly',
56
- // shallowRef: 'readonly',
57
- // toRef: 'readonly',
58
- // toRefs: 'readonly',
59
- // watch: 'readonly',
60
- // watchEffect: 'readonly',
61
- // },
62
- },
63
- processor: pluginVue.processors['.vue'],
64
- files: [GLOB_VUE],
65
- rules: {
66
- /**
67
- * Update to eslint-plugin-vue v9.26.0
68
- */
69
- ...pluginVue.configs.base.rules,
70
- // eslint-disable-next-line no-magic-numbers
71
- ...(vueVersion === 3 ? vue3Rules : vue2Rules),
72
-
73
- /**
74
- * Override default configuration
75
- */
76
- // vue禁用多个单词组件名
77
- 'vue/multi-word-component-names': 'off',
78
- // vue禁用 属性-连接 个人喜欢驼峰
79
- 'vue/attribute-hyphenation': ['error', 'never'],
80
- // vue禁用标签缩进
81
- 'vue/html-indent': 'off',
82
- // 标签自闭合
83
- 'vue/html-self-closing': [
84
- 'error',
85
- {
86
- html: { void: 'always', normal: 'always', component: 'always' },
87
- svg: 'always',
88
- math: 'always',
89
- },
90
- ],
91
- // vue禁用标签属性换行
92
- 'vue/max-attributes-per-line': 'off',
93
- // vue内容强制换行
94
- 'vue/singleline-html-element-content-newline': 'off',
95
- // 禁用事件驼峰 个人喜欢驼峰
96
- 'vue/v-on-event-hyphenation': ['error', 'never'],
97
-
98
- /**
99
- * Custom rules
100
- */
101
- // 标签换行
102
- 'vue/block-tag-newline': 'error',
103
- // 强制模板组件名称为PascalCase
104
- 'vue/component-name-in-template-casing': ['error', 'PascalCase', { ignores: ['/-/'] }],
105
- // 强制组件名大驼峰
106
- 'vue/component-options-name-casing': 'error',
107
- // 强制事件名小驼峰
108
- 'vue/custom-event-name-casing': 'error',
109
- // 强制定义emits
110
- 'vue/define-emits-declaration': 'error',
111
- // 强制定义宏defineProps defineEmits的顺序
112
- 'vue/define-macros-order': 'error',
113
- // 强制定义props
114
- 'vue/define-props-declaration': 'error',
115
- // 强制style属性
116
- 'vue/enforce-style-attribute': 'error',
117
- // 禁止button没有type
118
- 'vue/html-button-has-type': 'off',
119
- // 强制html注释换行
120
- 'vue/html-comment-content-newline': 'error',
121
- // 强制html注释空格
122
- 'vue/html-comment-content-spacing': 'error',
123
- // 强制html注释缩进
124
- 'vue/html-comment-indent': 'off',
125
- // 强制组件名和文件名一致
126
- 'vue/match-component-file-name': ['error', { extensions: ['jsx', 'tsx'], shouldMatchCase: true }],
127
- // 强制组件名导入名称一致
128
- 'vue/match-component-import-name': 'error',
129
- // 强制单个标签最大行数
130
- 'vue/max-lines-per-block': 'off',
131
- // 强制多行属性空行
132
- 'vue/new-line-between-multi-line-property': 'off',
133
- // 强制nextTick风格
134
- 'vue/next-tick-style': 'off',
135
- // 禁止模板中出现未翻译的字符串
136
- 'vue/no-bare-strings-in-template': 'off',
137
- // 布尔类型默认值校验
138
- 'vue/no-boolean-default': 'off',
139
- // 禁止使用已弃用的v-model定义
140
- 'vue/no-deprecated-model-definition': 'error',
141
- // 禁止重复继承属性
142
- 'vue/no-duplicate-attr-inheritance': 'error',
143
- // 禁止空的标签
144
- 'vue/no-empty-component-block': 'off',
145
- // 禁止class 中出现多个对象
146
- 'vue/no-multiple-objects-in-class': 'error',
147
- // 禁止潜在的组件选项拼写错误
148
- 'vue/no-potential-component-option-typo': 'error',
149
- // 禁止ref对象丢失响应性
150
- 'vue/no-ref-object-reactivity-loss': 'error',
151
- // 禁止default和required同时存在
152
- 'vue/no-required-prop-with-default': 'error',
153
- // 禁止特定的模板语法
154
- 'vue/no-restricted-block': 'off',
155
- // 禁止await后调用特定的函数
156
- 'vue/no-restricted-call-after-await': 'off',
157
- // 禁止特定的class
158
- 'vue/no-restricted-class': 'off',
159
- // 禁止特定的组件名
160
- 'vue/no-restricted-component-names': 'off',
161
- // 禁止特定的组件选项
162
- 'vue/no-restricted-component-options': 'off',
163
- // 禁止特定的事件名
164
- 'vue/no-restricted-custom-event': 'off',
165
- // 禁止特定的html标签
166
- 'vue/no-restricted-html-elements': 'off',
167
- // 禁止特定的props
168
- 'vue/no-restricted-props': 'off',
169
- // 禁止特定的静态属性
170
- 'vue/no-restricted-static-attribute': 'off',
171
- // 禁止特定的v-bind
172
- 'vue/no-restricted-v-bind': 'off',
173
- // 禁止根元素使用v-if
174
- 'vue/no-root-v-if': 'off',
175
- // 禁止setup中props丢失响应性
176
- 'vue/no-setup-props-reactivity-loss': 'error',
177
- // 禁止内联样式
178
- 'vue/no-static-inline-styles': 'error',
179
- // 禁止target="_blank"
180
- 'vue/no-template-target-blank': 'error',
181
- // 禁止在beforeRouteEnter中使用this
182
- 'vue/no-this-in-before-route-enter': 'error',
183
- // 禁止未定义的组件
184
- 'vue/no-undef-components': 'off',
185
- // 禁止未定义的属性 mixin vuex冲突
186
- 'vue/no-undef-properties': 'error',
187
- // 禁止不支持的特性
188
- 'vue/no-unsupported-features': 'off',
189
- // 禁止未使用的emits
190
- 'vue/no-unused-emit-declarations': 'error',
191
- // 未使用属性校验
192
- 'vue/no-unused-properties': ['warn', { groups: ['props', 'data', 'computed', 'methods', 'setup'] }],
193
- // 禁止未使用属性ref
194
- 'vue/no-unused-refs': 'error',
195
- // 禁止v-else和v-for同时使用
196
- 'vue/no-use-v-else-with-v-for': 'error',
197
- // 禁止使用无效的模板语法
198
- 'vue/no-useless-mustaches': 'error',
199
- // v-bind强制简写
200
- 'vue/no-useless-v-bind': 'error',
201
- // 禁止使用v-text
202
- 'vue/no-v-text': 'error',
203
- // 模板三标签之间强制空一行
204
- 'vue/padding-line-between-blocks': 'error',
205
- // 禁止模板空行
206
- 'vue/padding-line-between-tags': ['error', [{ blankLine: 'never', prev: '*', next: '*' }]],
207
- // 组件定义强制空行
208
- 'vue/padding-lines-in-component-definition': ['error', { betweenOptions: 'never' }],
209
- // 宏定义选项强制
210
- 'vue/prefer-define-options': 'error',
211
- // props强制boolean类型在前
212
- 'vue/prefer-prop-type-boolean-first': 'error',
213
- // 要求模板中的静态类名位于单独的class属性中
214
- 'vue/prefer-separate-static-class': 'error',
215
- // props 强制true简写
216
- 'vue/prefer-true-attribute-shorthand': 'error',
217
- // 要求组件直接导出
218
- 'vue/require-direct-export': 'error',
219
- // 要求emit事件校验
220
- 'vue/require-emit-validator': 'off',
221
- // 要求明确的插槽
222
- 'vue/require-explicit-slots': 'error',
223
- // 强制expose
224
- 'vue/require-expose': 'error',
225
- // 宏定义变量名强制
226
- 'vue/require-macro-variable-name': 'error',
227
- // 强制name属性
228
- 'vue/require-name-property': 'off',
229
- // 强制prop注释
230
- 'vue/require-prop-comment': 'off',
231
- // 强制对象类型
232
- 'vue/require-typed-object-prop': 'error',
233
- // 强制ref类型
234
- 'vue/require-typed-ref': 'error',
235
- // script缩进
236
- 'vue/script-indent': 'off',
237
- // 强制属性排序
238
- 'vue/sort-keys': 'off',
239
- // class排序
240
- 'vue/static-class-names-order': 'error',
241
- // 强制v-for指令的分隔符样式
242
- 'vue/v-for-delimiter-style': 'error',
243
- // 强制v-on指令的风格
244
- 'vue/v-on-handler-style': 'error',
245
- // 宏定义选项校验
246
- 'vue/valid-define-options': 'error',
247
-
248
- /**
249
- * Stylistic
250
- */
251
- 'vue/array-bracket-newline': 'off',
252
- 'vue/array-bracket-spacing': 'off',
253
- 'vue/array-element-newline': 'off',
254
- 'vue/arrow-spacing': 'off',
255
- 'vue/block-spacing': 'off',
256
- 'vue/brace-style': 'off',
257
- // 强制驼峰
258
- 'vue/camelcase': 'error',
259
- 'vue/comma-dangle': 'off',
260
- 'vue/comma-spacing': 'off',
261
- 'vue/comma-style': 'off',
262
- 'vue/dot-location': 'off',
263
- // 要求使用点号
264
- 'vue/dot-notation': 'error',
265
- // 要求使用 === 和 !==
266
- 'vue/eqeqeq': 'error',
267
- 'vue/func-call-spacing': 'off',
268
- 'vue/key-spacing': 'off',
269
- 'vue/keyword-spacing': 'off',
270
- 'vue/max-len': 'off',
271
- 'vue/multiline-ternary': 'off',
272
- 'vue/no-console': 'off',
273
- // 禁止在条件中使用常量表达式
274
- 'vue/no-constant-condition': 'error',
275
- 'vue/no-extra-parens': 'off',
276
- // 禁止使用空解构模式
277
- 'vue/no-empty-pattern': 'error',
278
- // 禁止不规则的空白
279
- 'vue/no-irregular-whitespace': 'error',
280
- 'vue/no-loss-of-precision': 'off',
281
- 'vue/no-restricted-syntax': 'off',
282
- // 禁用稀疏数组
283
- 'vue/no-sparse-arrays': 'error',
284
- // 禁止没有必要的字符拼接
285
- 'vue/no-useless-concat': 'error',
286
- 'vue/object-curly-newline': 'off',
287
- 'vue/object-curly-spacing': 'off',
288
- 'vue/object-property-newline': 'off',
289
- // 要求对象字面量简写语法
290
- 'vue/object-shorthand': 'error',
291
- 'vue/operator-linebreak': 'off',
292
- // 优先使用模板字符串
293
- 'vue/prefer-template': 'error',
294
- 'vue/quote-props': 'off',
295
- 'vue/space-in-parens': 'off',
296
- 'vue/space-infix-ops': 'off',
297
- 'vue/space-unary-ops': 'off',
298
- 'vue/template-curly-spacing': 'off',
299
-
300
- /**
301
- * Overrides
302
- */
303
- ...overrides,
304
- },
305
- },
306
- ]
307
- }
308
-
309
- export function getVueVersion() {
310
- const pkg = getPackageInfoSync('vue', { paths: [process.cwd()] })
311
- if (pkg && pkg.version) {
312
- return +pkg.version[0]
313
- }
314
- // eslint-disable-next-line no-magic-numbers
315
- return 3
316
- }
package/src/factory.ts DELETED
@@ -1,167 +0,0 @@
1
- import { FlatConfigComposer } from 'eslint-flat-config-utils'
2
- import type { Linter } from 'eslint'
3
- import { isBoolean } from '@lntvow/utils'
4
- import { isPackageExists } from 'local-pkg'
5
- import { gitignore, ignores, javascript, typescript, vue } from './configs'
6
- import type { Awaitable, ConfigNames, OptionsConfig, TypedFlatConfigItem } from './types'
7
- import { stylistic } from './configs/stylistic'
8
- import { imports } from './configs/imports'
9
- import { prettier } from './configs/prettier'
10
-
11
- const flatConfigProps: (keyof TypedFlatConfigItem)[] = [
12
- 'name',
13
- 'files',
14
- 'ignores',
15
- 'languageOptions',
16
- 'linterOptions',
17
- 'processor',
18
- 'plugins',
19
- 'rules',
20
- 'settings',
21
- ]
22
-
23
- export function lntvow(
24
- options: OptionsConfig & TypedFlatConfigItem = {},
25
- ...userConfigs: Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer | Linter.FlatConfig[]>[]
26
- ): FlatConfigComposer<TypedFlatConfigItem, ConfigNames> {
27
- const {
28
- // autoRenamePlugins = true,
29
- componentExts = [],
30
- gitignore: enableGitignore = true,
31
- // regexp: enableRegexp = true,
32
- typescript: enableTypeScript = isPackageExists('typescript'),
33
- vue: enableVue = ['vue', 'nuxt', 'vitepress'].some(i => isPackageExists(i)),
34
- } = options
35
-
36
- const stylisticOptions =
37
- options.stylistic === false ? false : typeof options.stylistic === 'object' ? options.stylistic : {}
38
-
39
- // if (stylisticOptions && !('jsx' in stylisticOptions)) stylisticOptions.jsx = options.jsx ?? true
40
-
41
- const configs: Awaitable<TypedFlatConfigItem[]>[] = []
42
-
43
- // Base configs
44
- configs.push(
45
- ignores(),
46
- javascript({
47
- ...resolveSubOptions(options, 'javascript'),
48
- }),
49
- imports()
50
- // comments(),
51
- // node(),
52
- // jsdoc({
53
- // stylistic: stylisticOptions,
54
- // }),
55
- // unicorn(),
56
- // command(),
57
-
58
- // Optional plugins (installed but not enabled by default)
59
- // perfectionist(),
60
- )
61
-
62
- if (enableGitignore) {
63
- configs.push(gitignore(resolveSubOptions(options, 'gitignore')))
64
- }
65
-
66
- if (enableVue) {
67
- componentExts.push('vue')
68
- }
69
-
70
- if (enableTypeScript) {
71
- configs.push(typescript({ ...resolveSubOptions(options, 'typescript'), componentExts }))
72
- }
73
-
74
- if (stylisticOptions) {
75
- configs.push(stylistic({ ...stylisticOptions }))
76
- }
77
-
78
- // if (enableRegexp)
79
- // configs.push(regexp(typeof enableRegexp === 'boolean' ? {} : enableRegexp))
80
-
81
- // if (options.test ?? true) {
82
- // configs.push(test({
83
- // isInEditor,
84
- // overrides: getOverrides(options, 'test'),
85
- // }))
86
- // }
87
-
88
- if (enableVue) {
89
- configs.push(vue({ ...resolveSubOptions(options, 'vue') }))
90
- }
91
-
92
- // if (options.jsonc ?? true) {
93
- // configs.push(
94
- // jsonc({
95
- // overrides: getOverrides(options, 'jsonc'),
96
- // stylistic: stylisticOptions,
97
- // }),
98
- // sortPackageJson(),
99
- // sortTsconfig(),
100
- // )
101
- // }
102
-
103
- // if (options.yaml ?? true) {
104
- // configs.push(yaml({
105
- // overrides: getOverrides(options, 'yaml'),
106
- // stylistic: stylisticOptions,
107
- // }))
108
- // }
109
-
110
- // if (options.toml ?? true) {
111
- // configs.push(toml({
112
- // overrides: getOverrides(options, 'toml'),
113
- // stylistic: stylisticOptions,
114
- // }))
115
- // }
116
-
117
- // if (options.markdown ?? true) {
118
- // configs.push(
119
- // markdown(
120
- // {
121
- // componentExts,
122
- // overrides: getOverrides(options, 'markdown'),
123
- // },
124
- // ),
125
- // )
126
- // }
127
-
128
- // if (options.formatters) {
129
- // configs.push(formatters(
130
- // options.formatters,
131
- // typeof stylisticOptions === 'boolean' ? {} : stylisticOptions,
132
- // ))
133
- // }
134
-
135
- configs.push(prettier())
136
-
137
- // User can optionally pass a flat config item to the first argument
138
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
139
- if (key in options) {
140
- acc[key] = options[key] as any
141
- }
142
- return acc
143
- }, {} as TypedFlatConfigItem)
144
-
145
- if (Object.keys(fusedConfig).length) {
146
- configs.push([fusedConfig])
147
- }
148
-
149
- // Merge all configs
150
- let composer = new FlatConfigComposer<TypedFlatConfigItem, ConfigNames>()
151
- composer = composer.append(...configs, ...(userConfigs as any))
152
-
153
- // if (autoRenamePlugins) {
154
- // composer = composer.renamePlugins(defaultPluginRenaming)
155
- // }
156
-
157
- return composer
158
- }
159
-
160
- export type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>
161
-
162
- export function resolveSubOptions<K extends keyof OptionsConfig>(
163
- options: OptionsConfig,
164
- key: K
165
- ): ResolvedOptions<OptionsConfig[K]> {
166
- return isBoolean(options[key]) ? ({} as any) : options[key] || {}
167
- }
package/src/globs.ts DELETED
@@ -1,86 +0,0 @@
1
- export const GLOB_SRC_EXT = '?([cm])[jt]s?(x)'
2
- export const GLOB_SRC = '**/*.?([cm])[jt]s?(x)'
3
-
4
- export const GLOB_JS = '**/*.?([cm])js'
5
- export const GLOB_JSX = '**/*.?([cm])jsx'
6
-
7
- export const GLOB_TS = '**/*.?([cm])ts'
8
- export const GLOB_TSX = '**/*.?([cm])tsx'
9
-
10
- export const GLOB_STYLE = '**/*.{c,le,sc}ss'
11
- export const GLOB_CSS = '**/*.css'
12
- export const GLOB_POSTCSS = '**/*.{p,post}css'
13
- export const GLOB_LESS = '**/*.less'
14
- export const GLOB_SCSS = '**/*.scss'
15
-
16
- export const GLOB_JSON = '**/*.json'
17
- export const GLOB_JSON5 = '**/*.json5'
18
- export const GLOB_JSONC = '**/*.jsonc'
19
-
20
- export const GLOB_MARKDOWN = '**/*.md'
21
- export const GLOB_MARKDOWN_IN_MARKDOWN = '**/*.md/*.md'
22
- export const GLOB_SVELTE = '**/*.svelte'
23
- export const GLOB_VUE = '**/*.vue'
24
- export const GLOB_YAML = '**/*.y?(a)ml'
25
- export const GLOB_TOML = '**/*.toml'
26
- export const GLOB_XML = '**/*.xml'
27
- export const GLOB_HTML = '**/*.htm?(l)'
28
- export const GLOB_ASTRO = '**/*.astro'
29
- export const GLOB_GRAPHQL = '**/*.{g,graph}ql'
30
-
31
- export const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`
32
-
33
- export const GLOB_TESTS = [
34
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
35
- `**/*.spec.${GLOB_SRC_EXT}`,
36
- `**/*.test.${GLOB_SRC_EXT}`,
37
- `**/*.bench.${GLOB_SRC_EXT}`,
38
- `**/*.benchmark.${GLOB_SRC_EXT}`,
39
- ]
40
-
41
- export const GLOB_ALL_SRC = [
42
- GLOB_SRC,
43
- GLOB_STYLE,
44
- GLOB_JSON,
45
- GLOB_JSON5,
46
- GLOB_MARKDOWN,
47
- GLOB_SVELTE,
48
- GLOB_VUE,
49
- GLOB_YAML,
50
- GLOB_XML,
51
- GLOB_HTML,
52
- ]
53
-
54
- export const GLOB_EXCLUDE = [
55
- '**/node_modules',
56
- '**/dist',
57
- '**/package-lock.json',
58
- '**/yarn.lock',
59
- '**/pnpm-lock.yaml',
60
- '**/bun.lockb',
61
-
62
- '**/output',
63
- '**/coverage',
64
- '**/temp',
65
- '**/.temp',
66
- '**/tmp',
67
- '**/.tmp',
68
- '**/.history',
69
- '**/.vitepress/cache',
70
- '**/.nuxt',
71
- '**/.next',
72
- '**/.vercel',
73
- '**/.changeset',
74
- '**/.idea',
75
- '**/.cache',
76
- '**/.output',
77
- '**/.vite-inspect',
78
- '**/.yarn',
79
-
80
- '**/CHANGELOG*.md',
81
- '**/*.min.*',
82
- '**/LICENSE*',
83
- '**/__snapshots__',
84
- '**/auto-import?(s).d.ts',
85
- '**/components.d.ts',
86
- ]