@sxzz/eslint-config 3.0.0-beta.3 → 3.0.0-beta.5

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/README.md CHANGED
@@ -4,12 +4,39 @@ Flat ESLint config for JavaScript, TypeScript, Vue 2, Vue 3, Prettier.
4
4
 
5
5
  [Legacy Version](https://github.com/sxzz/eslint-config-legacy)
6
6
 
7
+ ## Features
8
+
9
+ - Support Vue 2 and 3 out-of-box.
10
+ - Select the required file types as needed.
11
+ - Support JSON(5), YAML, Markdown...
12
+
7
13
  ## Install
8
14
 
9
15
  ```bash
10
16
  npm i @sxzz/eslint-config
11
17
  ```
12
18
 
19
+ ## Usage
20
+
21
+ ```js
22
+ // eslint.config.js
23
+ import { all } from '@sxzz/eslint-config'
24
+
25
+ export default defineFlatConfig(all)
26
+ ```
27
+
28
+ ### Custom Config
29
+
30
+ ```js
31
+ import { sxzz } from '@sxzz/eslint-config'
32
+ export default sxzz(
33
+ [
34
+ /* your custom config */
35
+ ],
36
+ { vue: true, prettier: true, markdown: true }
37
+ )
38
+ ```
39
+
13
40
  ## Sponsors
14
41
 
15
42
  <p align="center">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sxzz/eslint-config",
3
- "version": "3.0.0-beta.3",
4
- "packageManager": "pnpm@7.27.0",
3
+ "version": "3.0.0-beta.5",
4
+ "packageManager": "pnpm@8.2.0",
5
5
  "description": "ESLint config for @sxzz.",
6
6
  "type": "module",
7
7
  "license": "MIT",
@@ -33,31 +33,32 @@
33
33
  "eslint": "^8.0.0"
34
34
  },
35
35
  "dependencies": {
36
- "@eslint/js": "^8.36.0",
37
- "@typescript-eslint/eslint-plugin": "^5.56.0",
38
- "@typescript-eslint/parser": "^5.56.0",
36
+ "@eslint/js": "^8.38.0",
37
+ "@typescript-eslint/eslint-plugin": "^5.58.0",
38
+ "@typescript-eslint/parser": "^5.58.0",
39
39
  "eslint-config-prettier": "^8.8.0",
40
+ "eslint-plugin-antfu": "^0.38.4",
40
41
  "eslint-plugin-eslint-comments": "^3.2.0",
41
42
  "eslint-plugin-import": "^2.27.5",
42
43
  "eslint-plugin-jsonc": "^2.7.0",
43
44
  "eslint-plugin-markdown": "^3.0.0",
44
45
  "eslint-plugin-prettier": "^4.2.1",
45
46
  "eslint-plugin-unicorn": "^46.0.0",
46
- "eslint-plugin-vue": "^9.9.0",
47
+ "eslint-plugin-vue": "^9.11.0",
47
48
  "eslint-plugin-yml": "^1.5.0",
48
49
  "globals": "^13.20.0",
49
50
  "jsonc-eslint-parser": "^2.2.0",
50
51
  "local-pkg": "^0.4.3",
51
- "prettier": "^2.8.6",
52
- "vue-eslint-parser": "^9.1.0",
52
+ "prettier": "^2.8.7",
53
+ "vue-eslint-parser": "^9.1.1",
53
54
  "yaml-eslint-parser": "^1.2.0"
54
55
  },
55
56
  "devDependencies": {
56
- "@types/node": "^18.15.5",
57
- "bumpp": "^9.0.0",
58
- "eslint": "^8.36.0",
59
- "eslint-define-config": "^1.17.0",
60
- "typescript": "^5.0.2"
57
+ "@types/node": "^18.15.11",
58
+ "bumpp": "^9.1.0",
59
+ "eslint": "^8.38.0",
60
+ "eslint-define-config": "^1.18.0",
61
+ "typescript": "^5.0.4"
61
62
  },
62
63
  "engines": {
63
64
  "node": ">=14.19.0"
package/src/js.js CHANGED
@@ -1,9 +1,10 @@
1
- import globals from 'globals'
2
1
  import jsConfig from '@eslint/js'
2
+ import antfuPlugin from 'eslint-plugin-antfu'
3
3
  import importPlugin from 'eslint-plugin-import'
4
4
  import unicornPlugin from 'eslint-plugin-unicorn'
5
+ import globals from 'globals'
5
6
 
6
- export { importPlugin, unicornPlugin }
7
+ export { importPlugin, unicornPlugin, antfuPlugin }
7
8
 
8
9
  /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
9
10
  export const js = [
@@ -115,6 +116,7 @@ export const imports = [
115
116
  {
116
117
  plugins: {
117
118
  import: importPlugin,
119
+ antfu: antfuPlugin,
118
120
  },
119
121
  settings: {
120
122
  'import/resolver': {
@@ -136,12 +138,16 @@ export const imports = [
136
138
  'sibling',
137
139
  'index',
138
140
  'object',
139
- 'type',
140
141
  ],
141
142
  pathGroups: [{ pattern: '@/**', group: 'internal' }],
142
- pathGroupsExcludedImportTypes: ['type'],
143
+ alphabetize: {
144
+ order: 'asc',
145
+ },
143
146
  },
144
147
  ],
148
+
149
+ 'antfu/import-dedupe': 'error',
150
+ 'antfu/prefer-inline-type-import': 'error',
145
151
  },
146
152
  },
147
153
  ]
package/src/markdown.js CHANGED
@@ -1,5 +1,5 @@
1
- import markdownPlugin from 'eslint-plugin-markdown'
2
1
  import tsPlugin from '@typescript-eslint/eslint-plugin'
2
+ import markdownPlugin from 'eslint-plugin-markdown'
3
3
  import { GLOB_MARKDOWN, GLOB_SRC, GLOB_VUE } from './shared.js'
4
4
 
5
5
  /** @type {import('eslint-define-config').FlatESLintConfigItem[]} */
package/src/prettier.js CHANGED
@@ -1,5 +1,5 @@
1
- import prettierPlugin from 'eslint-plugin-prettier'
2
1
  import prettierConfig from 'eslint-config-prettier'
2
+ import prettierPlugin from 'eslint-plugin-prettier'
3
3
 
4
4
  const prettierConflictRules = { ...prettierConfig.rules }
5
5
  delete prettierConflictRules['vue/html-self-closing']
package/src/typescript.js CHANGED
@@ -1,5 +1,5 @@
1
- import tsParser from '@typescript-eslint/parser'
2
1
  import tsPlugin from '@typescript-eslint/eslint-plugin'
2
+ import tsParser from '@typescript-eslint/parser'
3
3
  import { GLOB_TS, GLOB_TSX } from './shared.js'
4
4
 
5
5
  export { tsParser, tsPlugin }
@@ -28,7 +28,7 @@ export const typescript = [
28
28
  '@typescript-eslint/ban-types': 'off',
29
29
  '@typescript-eslint/consistent-type-imports': [
30
30
  'error',
31
- { fixStyle: 'separate-type-imports', disallowTypeAnnotations: false },
31
+ { fixStyle: 'inline-type-imports', disallowTypeAnnotations: false },
32
32
  ],
33
33
  '@typescript-eslint/explicit-module-boundary-types': 'off',
34
34
  '@typescript-eslint/no-explicit-any': 'off',
package/src/vue.js CHANGED
@@ -1,9 +1,9 @@
1
+ import tsPlugin from '@typescript-eslint/eslint-plugin'
2
+ import vuePlugin from 'eslint-plugin-vue'
1
3
  import { getPackageInfoSync } from 'local-pkg'
2
4
  import vueParser from 'vue-eslint-parser'
3
- import vuePlugin from 'eslint-plugin-vue'
4
- import tsPlugin from '@typescript-eslint/eslint-plugin'
5
- import { typescript } from './typescript.js'
6
5
  import { GLOB_VUE } from './shared.js'
6
+ import { typescript } from './typescript.js'
7
7
 
8
8
  export { vueParser, vuePlugin }
9
9
 
@@ -48,6 +48,8 @@ const vueBaseRules = {
48
48
  'vue/max-attributes-per-line': 'off',
49
49
  'vue/no-v-html': 'off',
50
50
  'vue/multi-word-component-names': 'off',
51
+ 'vue/require-prop-types': 'off',
52
+
51
53
  'vue/html-self-closing': [
52
54
  'error',
53
55
  {
@@ -60,6 +62,28 @@ const vueBaseRules = {
60
62
  math: 'always',
61
63
  },
62
64
  ],
65
+ 'vue/component-tags-order': [
66
+ 'error',
67
+ { order: ['script', 'template', 'style'] },
68
+ ],
69
+ 'vue/custom-event-name-casing': ['error', 'camelCase'],
70
+ 'vue/no-useless-v-bind': 'error',
71
+ 'vue/no-unused-refs': 'error',
72
+ 'vue/padding-line-between-blocks': ['error', 'always'],
73
+
74
+ 'vue/prefer-template': 'error',
75
+ 'vue/eqeqeq': ['error', 'smart'],
76
+ 'vue/no-constant-condition': 'warn',
77
+ 'vue/object-shorthand': [
78
+ 'error',
79
+ 'always',
80
+ {
81
+ ignoreConstructors: false,
82
+ avoidQuotes: true,
83
+ },
84
+ ],
85
+ 'vue/no-loss-of-precision': 'error',
86
+ 'vue/no-empty-pattern': 'error',
63
87
  }
64
88
 
65
89
  /** @type {import('eslint-define-config').Rules} */