@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sxzz/eslint-config",
3
- "version": "3.0.0-beta.1",
3
+ "version": "3.0.0-beta.2",
4
4
  "packageManager": "pnpm@7.27.0",
5
5
  "description": "ESLint config for @sxzz.",
6
6
  "type": "module",
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, '**/*rc'],
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 { GLOB_MARKDOWN } from './shared.js'
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: ['**/*.md/*'],
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
- // @ts-ignore
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 = [...basic, ...vue, ...prettier]
33
+ export const all = [...vue, ...basic, ...prettier]
37
34
 
38
- /** @type {(options: Partial<{
35
+ /** @type {(config?: FlatESLintConfigItem | FlatESLintConfigItem[], enables?: Partial<{
39
36
  * vue: boolean
40
37
  * prettier: boolean
41
- * } & FlatESLintConfigItem>) => FlatESLintConfigItem[]} */
42
- export function sxzz({
43
- vue: enableVue = true,
44
- prettier: enablePrettier = true,
45
- ...config
46
- } = {}) {
47
- const configs = [...basic]
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
@@ -51,6 +51,8 @@ export const GLOB_EXCLUDE = /** @type {const} */ ([
51
51
  '**/fixtures',
52
52
  '**/.vitepress/cache',
53
53
  '**/.nuxt',
54
+ '**/.vercel',
55
+ '**/.changeset',
54
56
  '**/.idea',
55
57
  '**/.output',
56
58
  '**/.vite-inspect',
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 (