@curev/eslint-config 0.3.0 → 0.3.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.
Files changed (107) hide show
  1. package/dist/chunk-TMQW6NVO.js +69 -0
  2. package/dist/dist-QAUNCL3U.js +226708 -0
  3. package/dist/index.cjs +228976 -0
  4. package/dist/index.d.cts +516 -0
  5. package/dist/index.d.ts +516 -0
  6. package/dist/index.js +2153 -0
  7. package/package.json +5 -2
  8. package/.eslintignore +0 -1
  9. package/.github/workflows/release.yml +0 -37
  10. package/.vscode/settings.json +0 -36
  11. package/CHANGELOG.md +0 -740
  12. package/eslint.config.ts +0 -3
  13. package/fixtures/input/css.css +0 -10
  14. package/fixtures/input/html.html +0 -17
  15. package/fixtures/input/javascript.js +0 -69
  16. package/fixtures/input/jsx.jsx +0 -27
  17. package/fixtures/input/markdown.md +0 -34
  18. package/fixtures/input/svelte.svelte +0 -8
  19. package/fixtures/input/toml.toml +0 -23
  20. package/fixtures/input/tsx.tsx +0 -32
  21. package/fixtures/input/typescript.ts +0 -84
  22. package/fixtures/input/vue-ts.vue +0 -35
  23. package/fixtures/input/vue.vue +0 -27
  24. package/fixtures/output/all/javascript.js +0 -72
  25. package/fixtures/output/all/jsx.jsx +0 -26
  26. package/fixtures/output/all/markdown.md +0 -33
  27. package/fixtures/output/all/svelte.svelte +0 -8
  28. package/fixtures/output/all/toml.toml +0 -23
  29. package/fixtures/output/all/tsx.tsx +0 -32
  30. package/fixtures/output/all/typescript.ts +0 -83
  31. package/fixtures/output/all/vue-ts.vue +0 -35
  32. package/fixtures/output/all/vue.vue +0 -24
  33. package/fixtures/output/js/javascript.js +0 -72
  34. package/fixtures/output/js/markdown.md +0 -33
  35. package/fixtures/output/js/toml.toml +0 -23
  36. package/fixtures/output/no-markdown-with-formatters/javascript.js +0 -72
  37. package/fixtures/output/no-markdown-with-formatters/jsx.jsx +0 -24
  38. package/fixtures/output/no-markdown-with-formatters/markdown.md +0 -33
  39. package/fixtures/output/no-markdown-with-formatters/toml.toml +0 -23
  40. package/fixtures/output/no-markdown-with-formatters/tsx.tsx +0 -23
  41. package/fixtures/output/no-markdown-with-formatters/typescript.ts +0 -83
  42. package/fixtures/output/no-style/javascript.js +0 -72
  43. package/fixtures/output/no-style/jsx.jsx +0 -21
  44. package/fixtures/output/no-style/toml.toml +0 -23
  45. package/fixtures/output/no-style/typescript.ts +0 -80
  46. package/fixtures/output/no-style/vue-ts.vue +0 -35
  47. package/fixtures/output/no-style/vue.vue +0 -24
  48. package/fixtures/output/tab-double-quotes/javascript.js +0 -72
  49. package/fixtures/output/tab-double-quotes/jsx.jsx +0 -26
  50. package/fixtures/output/tab-double-quotes/markdown.md +0 -33
  51. package/fixtures/output/tab-double-quotes/toml.toml +0 -23
  52. package/fixtures/output/tab-double-quotes/tsx.tsx +0 -32
  53. package/fixtures/output/tab-double-quotes/typescript.ts +0 -83
  54. package/fixtures/output/tab-double-quotes/vue-ts.vue +0 -35
  55. package/fixtures/output/tab-double-quotes/vue.vue +0 -24
  56. package/fixtures/output/ts-override/javascript.js +0 -72
  57. package/fixtures/output/ts-override/jsx.jsx +0 -26
  58. package/fixtures/output/ts-override/markdown.md +0 -33
  59. package/fixtures/output/ts-override/toml.toml +0 -23
  60. package/fixtures/output/ts-override/tsx.tsx +0 -32
  61. package/fixtures/output/ts-override/typescript.ts +0 -83
  62. package/fixtures/output/ts-override/vue-ts.vue +0 -35
  63. package/fixtures/output/ts-override/vue.vue +0 -24
  64. package/fixtures/output/with-formatters/css.css +0 -11
  65. package/fixtures/output/with-formatters/html.html +0 -28
  66. package/fixtures/output/with-formatters/javascript.js +0 -72
  67. package/fixtures/output/with-formatters/jsx.jsx +0 -26
  68. package/fixtures/output/with-formatters/markdown.md +0 -34
  69. package/fixtures/output/with-formatters/toml.toml +0 -23
  70. package/fixtures/output/with-formatters/tsx.tsx +0 -32
  71. package/fixtures/output/with-formatters/typescript.ts +0 -83
  72. package/fixtures/output/with-formatters/vue-ts.vue +0 -38
  73. package/fixtures/output/with-formatters/vue.vue +0 -24
  74. package/src/configs/comments.ts +0 -19
  75. package/src/configs/formatters.ts +0 -187
  76. package/src/configs/ignores.ts +0 -10
  77. package/src/configs/imports.ts +0 -46
  78. package/src/configs/index.ts +0 -21
  79. package/src/configs/javascript.ts +0 -277
  80. package/src/configs/jsdoc.ts +0 -41
  81. package/src/configs/jsonc.ts +0 -86
  82. package/src/configs/markdown.ts +0 -110
  83. package/src/configs/node.ts +0 -24
  84. package/src/configs/perfectionist.ts +0 -18
  85. package/src/configs/react.ts +0 -111
  86. package/src/configs/sort.ts +0 -223
  87. package/src/configs/stylistic.ts +0 -52
  88. package/src/configs/svelte.ts +0 -107
  89. package/src/configs/test.ts +0 -54
  90. package/src/configs/toml.ts +0 -72
  91. package/src/configs/typescript.ts +0 -171
  92. package/src/configs/unicorn.ts +0 -41
  93. package/src/configs/unocss.ts +0 -43
  94. package/src/configs/vue.ts +0 -170
  95. package/src/configs/yaml.ts +0 -72
  96. package/src/factory.ts +0 -255
  97. package/src/globs.ts +0 -81
  98. package/src/index.ts +0 -9
  99. package/src/plugins.ts +0 -10
  100. package/src/stub.d.ts +0 -3
  101. package/src/types.ts +0 -364
  102. package/src/utils.ts +0 -76
  103. package/src/vender/prettier-types.ts +0 -136
  104. package/test/cli.spec.ts +0 -90
  105. package/test/fixtures.test.ts +0 -127
  106. package/tsconfig.json +0 -17
  107. package/tsup.config.ts +0 -8
@@ -1,41 +0,0 @@
1
- import type { FlatConfigItem } from "../types";
2
- import { pluginUnicorn } from "../plugins";
3
-
4
- export async function unicorn(): Promise<FlatConfigItem[]> {
5
- return [
6
- {
7
- name: "curev:unicorn",
8
- plugins: {
9
- unicorn: pluginUnicorn
10
- },
11
- rules: {
12
- // Pass error message when throwing errors
13
- "unicorn/error-message": "error",
14
- // Uppercase regex escapes
15
- "unicorn/escape-case": "error",
16
- // Array.isArray instead of instanceof
17
- "unicorn/no-instanceof-array": "error",
18
- // Ban `new Array` as `Array` constructor's params are ambiguous
19
- "unicorn/no-new-array": "error",
20
- // Prevent deprecated `new Buffer()`
21
- "unicorn/no-new-buffer": "error",
22
- // Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
23
- "unicorn/number-literal-case": "error",
24
- // textContent instead of innerText
25
- "unicorn/prefer-dom-node-text-content": "error",
26
- // includes over indexOf when checking for existence
27
- "unicorn/prefer-includes": "error",
28
- // Prefer using the node: protocol
29
- "unicorn/prefer-node-protocol": "error",
30
- // Prefer using number properties like `Number.isNaN` rather than `isNaN`
31
- "unicorn/prefer-number-properties": "error",
32
- // String methods startsWith/endsWith instead of more complicated stuff
33
- "unicorn/prefer-string-starts-ends-with": "error",
34
- // Enforce throwing type error when throwing error while checking typeof
35
- "unicorn/prefer-type-error": "error",
36
- // Use new when throwing error
37
- "unicorn/throw-new-error": "error"
38
- }
39
- }
40
- ];
41
- }
@@ -1,43 +0,0 @@
1
- import { ensurePackages, interopDefault } from "../utils";
2
- import type { FlatConfigItem, OptionsUnoCSS } from "../types";
3
-
4
- export async function unocss(
5
- options: OptionsUnoCSS = {}
6
- ): Promise<FlatConfigItem[]> {
7
- const {
8
- attributify = true,
9
- strict = false
10
- } = options;
11
-
12
- await ensurePackages([
13
- "@unocss/eslint-plugin"
14
- ]);
15
-
16
- const [
17
- pluginUnoCSS
18
- ] = await Promise.all([
19
- interopDefault(import("@unocss/eslint-plugin"))
20
- ] as const);
21
-
22
- return [
23
- {
24
- name: "curev:unocss",
25
- plugins: {
26
- unocss: pluginUnoCSS
27
- },
28
- rules: {
29
- "unocss/order": "warn",
30
- ...attributify
31
- ? {
32
- "unocss/order-attributify": "warn"
33
- }
34
- : {},
35
- ...strict
36
- ? {
37
- "unocss/blocklist": "error"
38
- }
39
- : {}
40
- }
41
- }
42
- ];
43
- }
@@ -1,170 +0,0 @@
1
- import { mergeProcessors } from "eslint-merge-processors";
2
- import { interopDefault } from "../utils";
3
- import type { FlatConfigItem, OptionsFiles, OptionsHasTypeScript, OptionsOverrides, OptionsStylistic, OptionsVue } from "../types";
4
- import { GLOB_VUE } from "../globs";
5
-
6
- export async function vue(
7
- options: OptionsVue & OptionsHasTypeScript & OptionsOverrides & OptionsStylistic & OptionsFiles = {}
8
- ): Promise<FlatConfigItem[]> {
9
- const {
10
- files = [GLOB_VUE],
11
- overrides = {},
12
- stylistic = true,
13
- vueVersion = 3
14
- } = options;
15
-
16
- const sfcBlocks = options.sfcBlocks === true
17
- ? {}
18
- : options.sfcBlocks ?? {};
19
-
20
- const {
21
- indent = 2
22
- } = typeof stylistic === "boolean" ? {} : stylistic;
23
-
24
- const [
25
- pluginVue,
26
- parserVue,
27
- processorVueBlocks
28
- ] = await Promise.all([
29
- // @ts-expect-error missing types
30
- interopDefault(import("eslint-plugin-vue")),
31
- interopDefault(import("vue-eslint-parser")),
32
- interopDefault(import("eslint-processor-vue-blocks"))
33
- ] as const);
34
-
35
- return [
36
- {
37
- name: "curev:vue:setup",
38
- plugins: {
39
- vue: pluginVue
40
- }
41
- },
42
- {
43
- files,
44
- languageOptions: {
45
- parser: parserVue,
46
- parserOptions: {
47
- ecmaFeatures: {
48
- jsx: true
49
- },
50
- extraFileExtensions: [".vue"],
51
- parser: options.typescript
52
- ? await interopDefault(import("@typescript-eslint/parser")) as any
53
- : null,
54
- sourceType: "module"
55
- }
56
- },
57
- name: "curev:vue:rules",
58
- processor: sfcBlocks === false
59
- ? pluginVue.processors[".vue"]
60
- : mergeProcessors([
61
- pluginVue.processors[".vue"],
62
- processorVueBlocks({
63
- ...sfcBlocks,
64
- blocks: {
65
- styles: true,
66
- ...sfcBlocks.blocks
67
- }
68
- })
69
- ]),
70
- rules: {
71
- ...pluginVue.configs.base.rules as any,
72
-
73
- ...vueVersion === 2
74
- ? {
75
- ...pluginVue.configs.essential.rules as any,
76
- ...pluginVue.configs["strongly-recommended"].rules as any,
77
- ...pluginVue.configs.recommended.rules as any
78
- }
79
- : {
80
- ...pluginVue.configs["vue3-essential"].rules as any,
81
- ...pluginVue.configs["vue3-strongly-recommended"].rules as any,
82
- ...pluginVue.configs["vue3-recommended"].rules as any
83
- },
84
-
85
- "node/prefer-global/process": "off",
86
- "vue/block-order": ["error", {
87
- order: ["script", "template", "style"]
88
- }],
89
-
90
- "vue/component-name-in-template-casing": ["error", "PascalCase"],
91
- "vue/component-options-name-casing": ["error", "PascalCase"],
92
- // this is deprecated
93
- "vue/component-tags-order": "off",
94
- "vue/custom-event-name-casing": ["error", "camelCase"],
95
- "vue/define-macros-order": ["error", {
96
- order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
97
- }],
98
- "vue/dot-location": ["error", "property"],
99
- "vue/dot-notation": ["error", { allowKeywords: true }],
100
- "vue/eqeqeq": ["error", "smart"],
101
- "vue/html-indent": ["error", indent],
102
- "vue/html-quotes": ["error", "double"],
103
- "vue/max-attributes-per-line": "off",
104
- "vue/multi-word-component-names": "off",
105
- "vue/no-dupe-keys": "off",
106
- "vue/no-empty-pattern": "error",
107
- "vue/no-irregular-whitespace": "error",
108
- "vue/no-loss-of-precision": "error",
109
- "vue/no-restricted-syntax": [
110
- "error",
111
- "DebuggerStatement",
112
- "LabeledStatement",
113
- "WithStatement"
114
- ],
115
- "vue/no-restricted-v-bind": ["error", "/^v-/"],
116
- "vue/no-setup-props-reactivity-loss": "off",
117
- "vue/no-sparse-arrays": "error",
118
- "vue/no-unused-refs": "error",
119
- "vue/no-useless-v-bind": "error",
120
- "vue/no-v-html": "off",
121
- "vue/object-shorthand": [
122
- "error",
123
- "always",
124
- {
125
- avoidQuotes: true,
126
- ignoreConstructors: false
127
- }
128
- ],
129
- "vue/prefer-separate-static-class": "error",
130
- "vue/prefer-template": "error",
131
- "vue/prop-name-casing": ["error", "camelCase"],
132
- "vue/require-default-prop": "off",
133
- "vue/require-prop-types": "off",
134
- "vue/space-infix-ops": "error",
135
- "vue/space-unary-ops": ["error", { nonwords: false, words: true }],
136
-
137
- ...stylistic
138
- ? {
139
- "vue/array-bracket-spacing": ["error", "never"],
140
- "vue/arrow-spacing": ["error", { after: true, before: true }],
141
- "vue/block-spacing": ["error", "always"],
142
- "vue/block-tag-newline": ["error", {
143
- multiline: "always",
144
- singleline: "always"
145
- }],
146
- "vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
147
- "vue/comma-dangle": ["error", "always-multiline"],
148
- "vue/comma-spacing": ["error", { after: true, before: false }],
149
- "vue/comma-style": ["error", "last"],
150
- "vue/html-comment-content-spacing": ["error", "always", {
151
- exceptions: ["-"]
152
- }],
153
- "vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
154
- "vue/keyword-spacing": ["error", { after: true, before: true }],
155
- "vue/object-curly-newline": "off",
156
- "vue/object-curly-spacing": ["error", "always"],
157
- "vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
158
- "vue/operator-linebreak": ["error", "before"],
159
- "vue/padding-line-between-blocks": ["error", "always"],
160
- "vue/quote-props": ["error", "consistent-as-needed"],
161
- "vue/space-in-parens": ["error", "never"],
162
- "vue/template-curly-spacing": "error"
163
- }
164
- : {},
165
-
166
- ...overrides
167
- }
168
- }
169
- ];
170
- }
@@ -1,72 +0,0 @@
1
- import type { FlatConfigItem, OptionsFiles, OptionsOverrides, OptionsStylistic } from "../types";
2
- import { GLOB_YAML } from "../globs";
3
- import { interopDefault } from "../utils";
4
-
5
- export async function yaml(
6
- options: OptionsOverrides & OptionsStylistic & OptionsFiles = {}
7
- ): Promise<FlatConfigItem[]> {
8
- const {
9
- files = [GLOB_YAML],
10
- overrides = {},
11
- stylistic = true
12
- } = options;
13
-
14
- const {
15
- indent = 2,
16
- quotes = "single"
17
- } = typeof stylistic === "boolean" ? {} : stylistic;
18
-
19
- const [
20
- pluginYaml,
21
- parserYaml
22
- ] = await Promise.all([
23
- interopDefault(import("eslint-plugin-yml")),
24
- interopDefault(import("yaml-eslint-parser"))
25
- ] as const);
26
-
27
- return [
28
- {
29
- name: "curev:yaml:setup",
30
- plugins: {
31
- yaml: pluginYaml
32
- }
33
- },
34
- {
35
- files,
36
- languageOptions: {
37
- parser: parserYaml
38
- },
39
- name: "curev:yaml:rules",
40
- rules: {
41
- "style/spaced-comment": "off",
42
-
43
- "yaml/block-mapping": "error",
44
- "yaml/block-sequence": "error",
45
- "yaml/no-empty-key": "error",
46
- "yaml/no-empty-sequence-entry": "error",
47
- "yaml/no-irregular-whitespace": "error",
48
- "yaml/plain-scalar": "error",
49
-
50
- "yaml/vue-custom-block/no-parsing-error": "error",
51
-
52
- ...stylistic
53
- ? {
54
- "yaml/block-mapping-question-indicator-newline": "error",
55
- "yaml/block-sequence-hyphen-indicator-newline": "error",
56
- "yaml/flow-mapping-curly-newline": "error",
57
- "yaml/flow-mapping-curly-spacing": "error",
58
- "yaml/flow-sequence-bracket-newline": "error",
59
- "yaml/flow-sequence-bracket-spacing": "error",
60
- "yaml/indent": ["error", indent === "tab" ? 2 : indent],
61
- "yaml/key-spacing": "error",
62
- "yaml/no-tab-indent": "error",
63
- "yaml/quotes": ["error", { avoidEscape: false, prefer: quotes }],
64
- "yaml/spaced-comment": "error"
65
- }
66
- : {},
67
-
68
- ...overrides
69
- }
70
- }
71
- ];
72
- }
package/src/factory.ts DELETED
@@ -1,255 +0,0 @@
1
- import process from "node:process";
2
- import fs from "node:fs";
3
- import { isPackageExists } from "local-pkg";
4
- import type { Awaitable, FlatConfigItem, OptionsConfig, UserConfigItem } from "./types";
5
- import {
6
- comments,
7
- ignores,
8
- imports,
9
- javascript,
10
- jsdoc,
11
- jsonc,
12
- markdown,
13
- node,
14
- perfectionist,
15
- react,
16
- sortPackageJson,
17
- sortTsconfig,
18
- stylistic,
19
- svelte,
20
- test,
21
- toml,
22
- typescript,
23
- unicorn,
24
- unocss,
25
- vue,
26
- yaml
27
- } from "./configs";
28
- import { combine, interopDefault } from "./utils";
29
- import { formatters } from "./configs/formatters";
30
-
31
- const flatConfigProps: (keyof FlatConfigItem)[] = [
32
- "name",
33
- "files",
34
- "ignores",
35
- "languageOptions",
36
- "linterOptions",
37
- "processor",
38
- "plugins",
39
- "rules",
40
- "settings"
41
- ];
42
-
43
- const VuePackages = [
44
- "vue",
45
- "nuxt",
46
- "vitepress",
47
- "@slidev/cli"
48
- ];
49
-
50
- /**
51
- * Construct an array of ESLint flat config items.
52
- */
53
- export async function curev(
54
- options: OptionsConfig & FlatConfigItem = {},
55
- ...userConfigs: Awaitable<UserConfigItem | UserConfigItem[]>[]
56
- ): Promise<UserConfigItem[]> {
57
- const {
58
- componentExts = [],
59
- gitignore: enableGitignore = true,
60
- isInEditor = !!((process.env.VSCODE_PID || process.env.JETBRAINS_IDE || process.env.VIM) && !process.env.CI),
61
- react: enableReact = false,
62
- svelte: enableSvelte = false,
63
- typescript: enableTypeScript = isPackageExists("typescript"),
64
- unocss: enableUnoCSS = false,
65
- vue: enableVue = VuePackages.some(i => isPackageExists(i))
66
- } = options;
67
-
68
- const stylisticOptions = options.stylistic === false
69
- ? false
70
- : typeof options.stylistic === "object"
71
- ? options.stylistic
72
- : {};
73
-
74
- if (stylisticOptions && !("jsx" in stylisticOptions)) {
75
- stylisticOptions.jsx = options.jsx ?? true;
76
- }
77
-
78
- const configs: Awaitable<FlatConfigItem[]>[] = [];
79
-
80
- if (enableGitignore) {
81
- if (typeof enableGitignore !== "boolean") {
82
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then(r => [r(enableGitignore)]));
83
- } else {
84
- if (fs.existsSync(".gitignore")) {
85
- configs.push(interopDefault(import("eslint-config-flat-gitignore")).then(r => [r()]));
86
- }
87
- }
88
- }
89
-
90
- // Base configs
91
- configs.push(
92
- ignores(),
93
- javascript({
94
- isInEditor,
95
- overrides: getOverrides(options, "javascript")
96
- }),
97
- comments(),
98
- node(),
99
- jsdoc({
100
- stylistic: stylisticOptions
101
- }),
102
- imports({
103
- stylistic: stylisticOptions
104
- }),
105
- unicorn(),
106
-
107
- // Optional plugins (installed but not enabled by default)
108
- perfectionist()
109
- );
110
-
111
- if (enableVue) {
112
- componentExts.push("vue");
113
- }
114
-
115
- if (enableTypeScript) {
116
- configs.push(typescript({
117
- ...resolveSubOptions(options, "typescript"),
118
- componentExts,
119
- overrides: getOverrides(options, "typescript")
120
- }));
121
- }
122
-
123
- if (stylisticOptions) {
124
- configs.push(stylistic({
125
- ...stylisticOptions,
126
- overrides: getOverrides(options, "stylistic")
127
- }));
128
- }
129
-
130
- if (options.test ?? true) {
131
- configs.push(test({
132
- isInEditor,
133
- overrides: getOverrides(options, "test")
134
- }));
135
- }
136
-
137
- if (enableVue) {
138
- configs.push(vue({
139
- ...resolveSubOptions(options, "vue"),
140
- overrides: getOverrides(options, "vue"),
141
- stylistic: stylisticOptions,
142
- typescript: !!enableTypeScript
143
- }));
144
- }
145
-
146
- if (enableReact) {
147
- configs.push(react({
148
- overrides: getOverrides(options, "react"),
149
- typescript: !!enableTypeScript
150
- }));
151
- }
152
-
153
- if (enableSvelte) {
154
- configs.push(svelte({
155
- overrides: getOverrides(options, "svelte"),
156
- stylistic: stylisticOptions,
157
- typescript: !!enableTypeScript
158
- }));
159
- }
160
-
161
- if (enableUnoCSS) {
162
- configs.push(unocss({
163
- ...resolveSubOptions(options, "unocss"),
164
- overrides: getOverrides(options, "unocss")
165
- }));
166
- }
167
-
168
- if (options.jsonc ?? true) {
169
- configs.push(
170
- jsonc({
171
- overrides: getOverrides(options, "jsonc"),
172
- stylistic: stylisticOptions
173
- }),
174
- sortPackageJson(),
175
- sortTsconfig()
176
- );
177
- }
178
-
179
- if (options.yaml ?? true) {
180
- configs.push(yaml({
181
- overrides: getOverrides(options, "yaml"),
182
- stylistic: stylisticOptions
183
- }));
184
- }
185
-
186
- if (options.toml ?? true) {
187
- configs.push(toml({
188
- overrides: getOverrides(options, "toml"),
189
- stylistic: stylisticOptions
190
- }));
191
- }
192
-
193
- if (options.markdown ?? true) {
194
- configs.push(
195
- markdown(
196
- {
197
- componentExts,
198
- overrides: getOverrides(options, "markdown")
199
- }
200
- )
201
- );
202
- }
203
-
204
- if (options.formatters) {
205
- configs.push(formatters(
206
- options.formatters,
207
- typeof stylisticOptions === "boolean" ? {} : stylisticOptions
208
- ));
209
- }
210
-
211
- // User can optionally pass a flat config item to the first argument
212
- // We pick the known keys as ESLint would do schema validation
213
- const fusedConfig = flatConfigProps.reduce((acc, key) => {
214
- if (key in options) {
215
- acc[key] = options[key] as any;
216
- }
217
- return acc;
218
- }, {} as FlatConfigItem);
219
- if (Object.keys(fusedConfig).length) {
220
- configs.push([fusedConfig]);
221
- }
222
-
223
- const merged = combine(
224
- ...configs,
225
- ...userConfigs
226
- );
227
-
228
- return merged;
229
- }
230
-
231
- export type ResolvedOptions<T> = T extends boolean
232
- ? never
233
- : NonNullable<T>;
234
-
235
- export function resolveSubOptions<K extends keyof OptionsConfig>(
236
- options: OptionsConfig,
237
- key: K
238
- ): ResolvedOptions<OptionsConfig[K]> {
239
- return typeof options[key] === "boolean"
240
- ? {} as any
241
- : options[key] || {};
242
- }
243
-
244
- export function getOverrides<K extends keyof OptionsConfig>(
245
- options: OptionsConfig,
246
- key: K
247
- ) {
248
- const sub = resolveSubOptions(options, key);
249
- return {
250
- ...(options.overrides as any)?.[key],
251
- ..."overrides" in sub
252
- ? sub.overrides
253
- : {}
254
- };
255
- }
package/src/globs.ts DELETED
@@ -1,81 +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_HTML = "**/*.htm?(l)";
27
-
28
- export const GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
29
-
30
- export const GLOB_TESTS = [
31
- `**/__tests__/**/*.${GLOB_SRC_EXT}`,
32
- `**/*.spec.${GLOB_SRC_EXT}`,
33
- `**/*.test.${GLOB_SRC_EXT}`,
34
- `**/*.bench.${GLOB_SRC_EXT}`,
35
- `**/*.benchmark.${GLOB_SRC_EXT}`
36
- ];
37
-
38
- export const GLOB_ALL_SRC = [
39
- GLOB_SRC,
40
- GLOB_STYLE,
41
- GLOB_JSON,
42
- GLOB_JSON5,
43
- GLOB_MARKDOWN,
44
- GLOB_SVELTE,
45
- GLOB_VUE,
46
- GLOB_YAML,
47
- GLOB_HTML
48
- ];
49
-
50
- export const GLOB_EXCLUDE = [
51
- "**/node_modules",
52
- "**/dist",
53
- "**/package-lock.json",
54
- "**/yarn.lock",
55
- "**/pnpm-lock.yaml",
56
- "**/bun.lockb",
57
-
58
- "**/output",
59
- "**/coverage",
60
- "**/temp",
61
- "**/.temp",
62
- "**/tmp",
63
- "**/.tmp",
64
- "**/.history",
65
- "**/.vitepress/cache",
66
- "**/.nuxt",
67
- "**/.next",
68
- "**/.vercel",
69
- "**/.changeset",
70
- "**/.idea",
71
- "**/.cache",
72
- "**/.output",
73
- "**/.vite-inspect",
74
-
75
- "**/CHANGELOG*.md",
76
- "**/*.min.*",
77
- "**/LICENSE*",
78
- "**/__snapshots__",
79
- "**/auto-import?(s).d.ts",
80
- "**/components.d.ts"
81
- ];
package/src/index.ts DELETED
@@ -1,9 +0,0 @@
1
- import { curev } from "./factory";
2
-
3
- export * from "./configs";
4
- export * from "./factory";
5
- export * from "./globs";
6
- export * from "./types";
7
- export * from "./utils";
8
-
9
- export default curev;
package/src/plugins.ts DELETED
@@ -1,10 +0,0 @@
1
- // eslint-disable-next-line ts/ban-ts-comment
2
- // @ts-nocheck
3
-
4
- export { default as pluginAntfu } from "eslint-plugin-antfu";
5
- export { default as pluginComments } from "eslint-plugin-eslint-comments";
6
- export * as pluginImport from "eslint-plugin-i";
7
- export { default as pluginNode } from "eslint-plugin-n";
8
- export { default as pluginUnicorn } from "eslint-plugin-unicorn";
9
- export { default as pluginUnusedImports } from "eslint-plugin-unused-imports";
10
- export { default as pluginPerfectionist } from "eslint-plugin-perfectionist";
package/src/stub.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare module "eslint-plugin-react"
2
- declare module "eslint-plugin-react-hooks"
3
- declare module "eslint-plugin-react-refresh"