@sxzz/eslint-config 3.0.0-beta.1 → 3.0.0-beta.2
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/package.json +1 -1
- package/src/js.js +2 -0
- package/src/jsonc.js +1 -1
- package/src/markdown.js +6 -2
- package/src/presets.js +20 -15
- package/src/shared.js +2 -0
- package/src/typescript.js +2 -0
- package/src/vue.js +2 -0
package/package.json
CHANGED
package/src/js.js
CHANGED
|
@@ -3,6 +3,8 @@ import jsConfig from '@eslint/js'
|
|
|
3
3
|
import importPlugin from 'eslint-plugin-import'
|
|
4
4
|
import unicornPlugin from 'eslint-plugin-unicorn'
|
|
5
5
|
|
|
6
|
+
export { importPlugin, unicornPlugin }
|
|
7
|
+
|
|
6
8
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
7
9
|
export const js = [
|
|
8
10
|
jsConfig.configs.recommended,
|
package/src/jsonc.js
CHANGED
|
@@ -5,7 +5,7 @@ import { GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from './shared.js'
|
|
|
5
5
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
6
6
|
export const jsonc = [
|
|
7
7
|
{
|
|
8
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC
|
|
8
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
9
9
|
plugins: {
|
|
10
10
|
jsonc: jsoncPlugin,
|
|
11
11
|
},
|
package/src/markdown.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import markdownPlugin from 'eslint-plugin-markdown'
|
|
2
|
-
import
|
|
2
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
3
|
+
import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js'
|
|
3
4
|
|
|
4
5
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
5
6
|
export const markdown = [
|
|
@@ -11,7 +12,7 @@ export const markdown = [
|
|
|
11
12
|
processor: 'markdown/markdown',
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
|
-
files: [
|
|
15
|
+
files: [`**/*.md/${GLOB_SRC}`, `**/*.md/${GLOB_VUE}`],
|
|
15
16
|
languageOptions: {
|
|
16
17
|
parserOptions: {
|
|
17
18
|
ecmaFeatures: {
|
|
@@ -19,6 +20,9 @@ export const markdown = [
|
|
|
19
20
|
},
|
|
20
21
|
},
|
|
21
22
|
},
|
|
23
|
+
plugins: {
|
|
24
|
+
'@typescript-eslint': tsPlugin,
|
|
25
|
+
},
|
|
22
26
|
rules: {
|
|
23
27
|
...markdownPlugin.configs.recommended.overrides[1].rules,
|
|
24
28
|
|
package/src/presets.js
CHANGED
|
@@ -16,10 +16,8 @@ import { yml } from './yml.js'
|
|
|
16
16
|
|
|
17
17
|
/** @type {FlatESLintConfigItem[]} */
|
|
18
18
|
export const basic = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ignores: GLOB_EXCLUDE,
|
|
22
|
-
},
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
{ ignores: GLOB_EXCLUDE },
|
|
23
21
|
...js,
|
|
24
22
|
...jsx,
|
|
25
23
|
...typescript,
|
|
@@ -28,31 +26,38 @@ export const basic = [
|
|
|
28
26
|
...jsonc,
|
|
29
27
|
...pkgOrder,
|
|
30
28
|
...yml,
|
|
31
|
-
...markdown,
|
|
32
29
|
...eslintComments,
|
|
33
30
|
]
|
|
34
31
|
|
|
35
32
|
/** @type { FlatESLintConfigItem[] } */
|
|
36
|
-
export const all = [...
|
|
33
|
+
export const all = [...vue, ...basic, ...prettier]
|
|
37
34
|
|
|
38
|
-
/** @type {(
|
|
35
|
+
/** @type {(config?: FlatESLintConfigItem | FlatESLintConfigItem[], enables?: Partial<{
|
|
39
36
|
* vue: boolean
|
|
40
37
|
* prettier: boolean
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
* markdown: boolean
|
|
39
|
+
* }>) => FlatESLintConfigItem[]} */
|
|
40
|
+
export function sxzz(
|
|
41
|
+
config = [],
|
|
42
|
+
{
|
|
43
|
+
vue: enableVue = true,
|
|
44
|
+
prettier: enablePrettier = true,
|
|
45
|
+
markdown: enableMarkdown = true,
|
|
46
|
+
} = {}
|
|
47
|
+
) {
|
|
48
|
+
const configs = []
|
|
49
|
+
configs.push(...basic)
|
|
48
50
|
if (enableVue !== false) {
|
|
49
51
|
configs.push(...vue)
|
|
50
52
|
}
|
|
53
|
+
if (enableMarkdown !== false) {
|
|
54
|
+
configs.push(...markdown)
|
|
55
|
+
}
|
|
51
56
|
if (enablePrettier !== false) {
|
|
52
57
|
configs.push(...prettier)
|
|
53
58
|
}
|
|
54
59
|
if (Object.keys(config).length > 0) {
|
|
55
|
-
configs.push(config)
|
|
60
|
+
configs.push(...(Array.isArray(config) ? config : [config]))
|
|
56
61
|
}
|
|
57
62
|
return configs
|
|
58
63
|
}
|
package/src/shared.js
CHANGED
package/src/typescript.js
CHANGED
|
@@ -2,6 +2,8 @@ import tsParser from '@typescript-eslint/parser'
|
|
|
2
2
|
import tsPlugin from '@typescript-eslint/eslint-plugin'
|
|
3
3
|
import { GLOB_TS, GLOB_TSX } from './shared.js'
|
|
4
4
|
|
|
5
|
+
export { tsParser, tsPlugin }
|
|
6
|
+
|
|
5
7
|
/** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
|
|
6
8
|
export const typescript = [
|
|
7
9
|
{
|
package/src/vue.js
CHANGED
|
@@ -3,6 +3,8 @@ import vueParser from 'vue-eslint-parser'
|
|
|
3
3
|
import vuePlugin from 'eslint-plugin-vue'
|
|
4
4
|
import { typescript } from './typescript.js'
|
|
5
5
|
|
|
6
|
+
export { vueParser, vuePlugin }
|
|
7
|
+
|
|
6
8
|
export function getVueVersion() {
|
|
7
9
|
const pkg = getPackageInfoSync('vue', { paths: [process.cwd()] })
|
|
8
10
|
if (
|