@ocavue/eslint-config 1.9.0 → 1.10.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.
package/README.md CHANGED
@@ -37,6 +37,15 @@ import { basic, react } from '@ocavue/eslint-config'
37
37
  export default [...basic(), ...react()]
38
38
  ```
39
39
 
40
+ If you want to use the Vue config, you can do the following:
41
+
42
+ ```JS
43
+ // eslint.config.js
44
+ import { basic, vue } from '@ocavue/eslint-config'
45
+
46
+ export default [...basic(), ...vue()]
47
+ ```
48
+
40
49
  If you want to use the check the code blocks in markdown files, you can do the following:
41
50
 
42
51
  ```JS
@@ -0,0 +1,3 @@
1
+ /** @type {import('eslint').Linter.FlatConfig['languageOptions']} */
2
+ export const typescriptLanguageOptions: import("eslint").Linter.FlatConfig["languageOptions"];
3
+ //# sourceMappingURL=typescript-language-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-language-options.d.ts","sourceRoot":"","sources":["../../src/typescript-language-options.js"],"names":[],"mappings":"AAIA,oEAAoE;AACpE,wCADW,OAAO,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAS/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"AAWA,wGA6FC;;qBAnGoB,mBAAmB"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/typescript.js"],"names":[],"mappings":"AAYA,wGAqFC;;qBA5FoB,mBAAmB"}
@@ -0,0 +1,2 @@
1
+ export function vue(): import("eslint").Linter.FlatConfig<import("eslint").Linter.RulesRecord>[];
2
+ //# sourceMappingURL=vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../../src/vue.js"],"names":[],"mappings":"AAYA,iGAyBC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocavue/eslint-config",
3
3
  "type": "module",
4
- "version": "1.9.0",
4
+ "version": "1.10.0",
5
5
  "packageManager": "pnpm@8.15.9",
6
6
  "description": "",
7
7
  "author": "ocavue <ocavue@gmail.com>",
@@ -46,6 +46,7 @@
46
46
  "eslint-plugin-react": "^7.35.0",
47
47
  "eslint-plugin-react-hooks": "^4.6.2",
48
48
  "eslint-plugin-unicorn": "^54.0.0",
49
+ "eslint-plugin-vue": "^9.27.0",
49
50
  "jsonc-eslint-parser": "^2.4.0",
50
51
  "typescript-eslint": "^7.17.0"
51
52
  },
package/src/imports.js CHANGED
@@ -20,8 +20,8 @@ export function imports() {
20
20
  },
21
21
  },
22
22
  rules: {
23
- // External modules must be declared in the package.json
24
- 'import/no-extraneous-dependencies': 'warn',
23
+ // External modules must be declared in the package.json. Only enforced in CI.
24
+ 'import/no-extraneous-dependencies': process.env.CI ? 'error' : 'off',
25
25
  'import/first': 'warn',
26
26
  'import/no-mutable-exports': 'warn',
27
27
  'import/no-useless-path-segments': 'warn',
@@ -0,0 +1,14 @@
1
+ // @ts-check
2
+
3
+ import tseslint from 'typescript-eslint'
4
+
5
+ /** @type {import('eslint').Linter.FlatConfig['languageOptions']} */
6
+ export const typescriptLanguageOptions = {
7
+ // @ts-expect-error: conflict type
8
+ parser: tseslint.parser,
9
+ parserOptions: {
10
+ project: true,
11
+ sourceType: 'module',
12
+ ecmaVersion: 'latest',
13
+ },
14
+ }
package/src/typescript.js CHANGED
@@ -6,6 +6,7 @@ import deprecationPlugin from 'eslint-plugin-deprecation'
6
6
  import tseslint from 'typescript-eslint'
7
7
 
8
8
  import { GLOB_JS, GLOB_JSX, GLOB_TEST, GLOB_TS, GLOB_TSX } from './shared.js'
9
+ import { typescriptLanguageOptions } from './typescript-language-options.js'
9
10
 
10
11
  export { tseslint }
11
12
 
@@ -19,15 +20,7 @@ export function typescript() {
19
20
  {
20
21
  name: 'typescript',
21
22
  files: [GLOB_TS, GLOB_TSX, GLOB_JS, GLOB_JSX],
22
- languageOptions: {
23
- // @ts-expect-error: conflict type
24
- parser: tseslint.parser,
25
- parserOptions: {
26
- project: true,
27
- sourceType: 'module',
28
- ecmaVersion: 'latest',
29
- },
30
- },
23
+ languageOptions: typescriptLanguageOptions,
31
24
  plugins: {
32
25
  // @ts-expect-error: conflict type
33
26
  '@typescript-eslint': tseslint.plugin,
package/src/vue.js ADDED
@@ -0,0 +1,38 @@
1
+ // @ts-check
2
+
3
+ import prettierConfig from 'eslint-config-prettier'
4
+ // @ts-expect-error no types
5
+ import pluginVue from 'eslint-plugin-vue'
6
+
7
+ import { GLOB_VUE } from './shared.js'
8
+ import { typescriptLanguageOptions } from './typescript-language-options.js'
9
+
10
+ /** @type {import('eslint').Linter.FlatConfig} */
11
+ const vueRecommended = pluginVue.configs['flat/recommended']
12
+
13
+ export function vue() {
14
+ /** @type {import('eslint').Linter.FlatConfig[]} */
15
+ const config = [
16
+ {
17
+ ...vueRecommended,
18
+ name: 'vue',
19
+ files: [GLOB_VUE],
20
+ languageOptions: typescriptLanguageOptions,
21
+ rules: {
22
+ ...vueRecommended.rules,
23
+
24
+ ...Object.fromEntries(
25
+ Object.entries(prettierConfig.rules)
26
+ .filter(([key]) => key.startsWith('vue/'))
27
+ .map(([key, value]) => [key, value]),
28
+ ),
29
+
30
+ 'vue/multi-word-component-names': 'off',
31
+ 'vue/one-component-per-file': 'off',
32
+ 'vue/require-prop-types': 'off',
33
+ },
34
+ },
35
+ ]
36
+
37
+ return config
38
+ }