@nextcloud/eslint-config 8.3.0-beta.2 → 8.4.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
@@ -1,7 +1,7 @@
1
1
  ## @nextcloud/eslint-config
2
2
 
3
3
  [![npm last version](https://img.shields.io/npm/v/@nextcloud/eslint-config.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/eslint-config)
4
- [![Lint status](https://img.shields.io/github/actions/workflow/status/nextcloud/eslint-config/lint-eslint.yml?label=lint&style=flat-square)](https://github.com/nextcloud/eslint-config/actions/workflows/lint.yml)
4
+ [![Lint status](https://img.shields.io/github/actions/workflow/status/nextcloud-libraries/eslint-config/lint-eslint.yml?label=lint&style=flat-square)](https://github.com/nextcloud-libraries/eslint-config/actions/workflows/lint.yml)
5
5
  [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&style=flat-square&logo=dependabot)](https://dependabot.com)
6
6
 
7
7
 
@@ -42,9 +42,24 @@ module.exports = {
42
42
  }
43
43
  ```
44
44
 
45
+ ### Usage with Vue 3 projects
46
+
47
+ If your projects uses Vue 3 you have to use the `vue3` sub-configuration.
48
+ This configuration also includes Typescript support by default.
49
+
50
+ Add a file `.eslintrc.js` in the root directory of your app repository with the following content:
51
+
52
+ ```js
53
+ module.exports = {
54
+ extends: [
55
+ '@nextcloud/eslint-config/vue3',
56
+ ],
57
+ }
58
+ ```
59
+
45
60
  ## Release new version
46
61
 
47
62
  1. Update CHANGELOG.md file with the latest changes
48
63
  2. Bump the package version with `npm version`
49
64
  3. Push version bump commit
50
- 4. Create a new release with proper changelog https://github.com/nextcloud/eslint-config/releases/new
65
+ 4. Create a new release with proper changelog https://github.com/nextcloud-libraries/eslint-config/releases/new
package/package.json CHANGED
@@ -1,26 +1,26 @@
1
1
  {
2
2
  "name": "@nextcloud/eslint-config",
3
- "version": "8.3.0-beta.2",
3
+ "version": "8.4.0",
4
4
  "description": "Eslint shared config for nextcloud vue.js apps",
5
5
  "main": "index.js",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/nextcloud/eslint-config.git"
8
+ "url": "git+https://github.com/nextcloud-libraries/eslint-config.git"
9
9
  },
10
10
  "scripts": {
11
- "lint": "eslint -c index.js *.js",
12
- "lint:fix": "eslint -c index.js --fix *.js",
11
+ "lint": "eslint parts *.js",
12
+ "lint:fix": "eslint --fix parts *.js",
13
13
  "test": "jest"
14
14
  },
15
15
  "peerDependencies": {
16
- "@babel/core": "^7.13.10",
16
+ "@babel/core": "^7.24.5",
17
17
  "@babel/eslint-parser": "^7.16.5",
18
- "@nextcloud/eslint-plugin": "^2.0.0",
19
- "@vue/eslint-config-typescript": "^11.0.2",
18
+ "@nextcloud/eslint-plugin": "^2.2.1",
19
+ "@vue/eslint-config-typescript": "^13.0.0",
20
20
  "eslint": "^8.27.0",
21
- "eslint-config-standard": "^17.0.0",
22
- "eslint-import-resolver-exports": "^1.0.0-beta.4",
23
- "eslint-import-resolver-typescript": "^3.5.5",
21
+ "eslint-config-standard": "^17.1.0",
22
+ "eslint-import-resolver-exports": "^1.0.0-beta.5",
23
+ "eslint-import-resolver-typescript": "^3.6.1",
24
24
  "eslint-plugin-import": "^2.26.0",
25
25
  "eslint-plugin-jsdoc": "^46.2.6",
26
26
  "eslint-plugin-n": "^16.0.0",
@@ -29,24 +29,25 @@
29
29
  "typescript": "^5.0.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/core": "^7.13.10",
33
- "@babel/eslint-parser": "^7.22.5",
34
- "@nextcloud/eslint-plugin": "^2.0.0",
35
- "@types/jest": "^29.5.2",
36
- "@vue/eslint-config-typescript": "^11.0.3",
37
- "eslint": "^8.43.0",
32
+ "@babel/core": "^7.24.5",
33
+ "@babel/eslint-parser": "^7.24.5",
34
+ "@nextcloud/eslint-plugin": "^2.2.1",
35
+ "@types/eslint": "^8.56.7",
36
+ "@types/jest": "^29.5.12",
37
+ "@vue/eslint-config-typescript": "^13.0.0",
38
+ "eslint": "^8.57.0",
38
39
  "eslint-config-standard": "^17.1.0",
39
40
  "eslint-import-resolver-exports": "^1.0.0-beta.5",
40
- "eslint-import-resolver-typescript": "^3.5.5",
41
- "eslint-plugin-import": "^2.27.5",
42
- "eslint-plugin-jsdoc": "^46.3.0",
43
- "eslint-plugin-n": "^16.0.1",
41
+ "eslint-import-resolver-typescript": "^3.6.1",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-jsdoc": "^48.2.4",
44
+ "eslint-plugin-n": "^16.6.2",
44
45
  "eslint-plugin-promise": "^6.1.1",
45
- "eslint-plugin-vue": "^9.15.1",
46
- "jest": "^29.5.0",
47
- "ts-jest": "^29.1.0",
48
- "typescript": "^5.1.3",
49
- "vue-eslint-parser": "^9.3.1"
46
+ "eslint-plugin-vue": "^9.26.0",
47
+ "jest": "^29.7.0",
48
+ "ts-jest": "^29.1.2",
49
+ "typescript": "^5.4.5",
50
+ "vue-eslint-parser": "^9.4.2"
50
51
  },
51
52
  "keywords": [
52
53
  "eslint",
@@ -58,12 +59,15 @@
58
59
  "author": "John Molakvoæ <skjnldsv@protonmail.com>",
59
60
  "license": "AGPL-3.0-or-later",
60
61
  "bugs": {
61
- "url": "https://github.com/nextcloud/eslint-config/issues"
62
+ "url": "https://github.com/nextcloud-libraries/eslint-config/issues"
62
63
  },
63
- "homepage": "https://github.com/nextcloud/eslint-config#readme",
64
+ "homepage": "https://github.com/nextcloud-libraries/eslint-config#readme",
64
65
  "engines": {
65
66
  "node": "^20.0.0",
66
- "npm": "^9.0.0"
67
+ "npm": "^10.0.0"
68
+ },
69
+ "eslintConfig": {
70
+ "extends": "./index.js"
67
71
  },
68
72
  "jest": {
69
73
  "preset": "ts-jest",
package/parts/base.js CHANGED
@@ -1,96 +1,113 @@
1
1
  /** Base rules */
2
2
  module.exports = {
3
- root: true,
4
- env: {
5
- browser: true,
6
- commonjs: true,
7
- es6: true,
8
- node: true,
9
- // Allow jest syntax in the src folder
10
- jest: true,
11
- },
12
- parser: '@babel/eslint-parser',
13
- parserOptions: {
14
- requireConfigFile: false,
15
- },
16
- extends: [
17
- 'eslint:recommended',
18
- 'plugin:import/errors',
19
- 'plugin:import/warnings',
20
- 'plugin:n/recommended',
21
- 'plugin:@nextcloud/recommended',
22
- 'plugin:jsdoc/recommended',
23
- 'standard',
24
- ],
25
- settings: {
26
- 'import/resolver': {
27
- node: {
28
- paths: ['src'],
29
- extensions: ['.js', '.vue'],
30
- },
31
- exports: {
32
- conditions: ['import'],
33
- },
34
- },
35
- jsdoc: {
36
- tagNamePreference: {
37
- returns: 'return',
38
- },
39
- mode: 'typescript',
40
- },
41
- },
42
- plugins: ['vue', 'n', 'jsdoc'],
43
- rules: {
44
- // space before function ()
45
- 'space-before-function-paren': ['error', {
46
- anonymous: 'never',
47
- named: 'never',
48
- asyncArrow: 'always',
49
- }],
50
- // stay consistent with array brackets
51
- 'array-bracket-newline': ['error', 'consistent'],
52
- // tabs only for indentation
53
- indent: ['error', 'tab'],
54
- 'no-tabs': ['error', { allowIndentationTabs: true }],
55
- // allow spaces after tabs for alignment
56
- 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
57
- // only debug console
58
- 'no-console': ['error', { allow: ['error', 'warn', 'info', 'debug'] }],
59
- // classes blocks
60
- 'padded-blocks': ['error', { classes: 'always' }],
61
- // always have the operator in front
62
- 'operator-linebreak': ['error', 'before'],
63
- // ternary on multiline
64
- 'multiline-ternary': ['error', 'always-multiline'],
65
- // force proper JSDocs
66
- 'jsdoc/require-returns': 0,
67
- 'jsdoc/require-returns-description': 0,
68
- 'jsdoc/tag-lines': ['off'],
69
- // disallow use of "var"
70
- 'no-var': 'error',
71
- // suggest using const
72
- 'prefer-const': 'error',
73
- // es6 import/export and require
74
- 'n/no-unpublished-require': ['off'],
75
- 'n/no-unsupported-features/es-syntax': ['off'],
76
- // always add a trailing comma (for diff readability)
77
- 'comma-dangle': ['warn', 'always-multiline'],
78
- // Allow shallow import of @vue/test-utils and @testing-library/vue in order to be able to use it in
79
- // the src folder
80
- 'n/no-unpublished-import': ['error', {
81
- allowModules: ['@vue/test-utils', '@testing-library/vue'],
82
- }],
83
- // require object literal shorthand syntax
84
- 'object-shorthand': ['error', 'always'],
85
- // Warn when file extensions are not used on import paths
86
- 'import/extensions': ['warn', 'always', {
87
- ignorePackages: true,
88
- }],
89
- // ignore camelcase for __webpack variables
90
- camelcase: ['error', {
91
- allow: ['^UNSAFE_', '^__webpack_'],
92
- properties: 'never',
93
- ignoreGlobals: true,
94
- }],
95
- },
3
+ root: true,
4
+ env: {
5
+ browser: true,
6
+ commonjs: true,
7
+ es6: true,
8
+ node: true,
9
+ // Allow jest syntax in the src folder
10
+ jest: true,
11
+ },
12
+ parser: '@babel/eslint-parser',
13
+ parserOptions: {
14
+ requireConfigFile: false,
15
+ },
16
+ extends: [
17
+ 'eslint:recommended',
18
+ 'plugin:import/errors',
19
+ 'plugin:import/warnings',
20
+ 'plugin:n/recommended',
21
+ 'plugin:@nextcloud/recommended',
22
+ 'plugin:jsdoc/recommended',
23
+ 'standard',
24
+ ],
25
+ settings: {
26
+ 'import/resolver': {
27
+ node: {
28
+ paths: ['src'],
29
+ extensions: ['.js', '.vue'],
30
+ },
31
+ exports: {
32
+ conditions: ['import'],
33
+ },
34
+ },
35
+ jsdoc: {
36
+ tagNamePreference: {
37
+ returns: 'return',
38
+ },
39
+ mode: 'typescript',
40
+ },
41
+ },
42
+ plugins: ['vue', 'n', 'jsdoc'],
43
+ rules: {
44
+ // space before function ()
45
+ 'space-before-function-paren': ['error', {
46
+ anonymous: 'never',
47
+ named: 'never',
48
+ asyncArrow: 'always',
49
+ }],
50
+ // stay consistent with array brackets
51
+ 'array-bracket-newline': ['error', 'consistent'],
52
+ // tabs only for indentation
53
+ indent: ['error', 'tab'],
54
+ 'no-tabs': ['error', { allowIndentationTabs: true }],
55
+ // allow spaces after tabs for alignment
56
+ 'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
57
+ // only debug console
58
+ 'no-console': ['error', { allow: ['error', 'warn', 'info', 'debug'] }],
59
+ // classes blocks
60
+ 'padded-blocks': ['error', { classes: 'always' }],
61
+ // always have the operator in front
62
+ 'operator-linebreak': ['error', 'before'],
63
+ // ternary on multiline
64
+ 'multiline-ternary': ['error', 'always-multiline'],
65
+ // force proper JSDocs
66
+ 'jsdoc/check-tag-names': [
67
+ 'warn', {
68
+ definedTags: [
69
+ // for jest
70
+ 'jest-environment',
71
+ ],
72
+ },
73
+ ],
74
+ 'jsdoc/require-returns': 0,
75
+ 'jsdoc/require-returns-description': 0,
76
+ 'jsdoc/tag-lines': ['off'],
77
+ // disallow use of "var"
78
+ 'no-var': 'error',
79
+ // suggest using const
80
+ 'prefer-const': 'error',
81
+ // es6 import/export and require
82
+ 'n/no-unpublished-require': ['off'],
83
+ 'n/no-unsupported-features/es-syntax': ['off'],
84
+ // always add a trailing comma (for diff readability)
85
+ 'comma-dangle': ['warn', 'always-multiline'],
86
+ // Allow shallow import of @vue/test-utils and @testing-library/vue in order to be able to use it in
87
+ // the src folder
88
+ 'n/no-unpublished-import': ['error', {
89
+ allowModules: ['@vue/test-utils', '@testing-library/vue'],
90
+ }],
91
+ // require object literal shorthand syntax
92
+ 'object-shorthand': ['error', 'always'],
93
+ // Warn when file extensions are not used on import paths
94
+ 'import/extensions': ['warn', 'always', {
95
+ ignorePackages: true,
96
+ }],
97
+ // ignore camelcase for __webpack variables
98
+ camelcase: ['error', {
99
+ allow: ['^UNSAFE_', '^__webpack_'],
100
+ properties: 'never',
101
+ ignoreGlobals: true,
102
+ }],
103
+ },
104
+ overrides: [
105
+ {
106
+ // Allow "unpublished" == devDependencies to be imported in config files
107
+ files: ['*.config.*', 'cypress/**/*', 'tests/**/*', '__tests__/**/*', '__mocks__/**/*'],
108
+ rules: {
109
+ 'n/no-unpublished-import': 'off',
110
+ },
111
+ },
112
+ ],
96
113
  }
@@ -1,37 +1,43 @@
1
1
  /** Rules for typescript */
2
2
  module.exports = {
3
- files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx'],
4
- extends: [
5
- '@vue/eslint-config-typescript/recommended',
6
- 'plugin:import/typescript',
7
- ],
8
- parser: '@typescript-eslint/parser',
9
- parserOptions: {},
10
- rules: {
11
- 'n/no-missing-import': 'off',
12
- 'import/extensions': 'off',
13
- 'jsdoc/check-tag-names': [
14
- 'warn', {
15
- // for projects using typedoc
16
- definedTags: [
17
- 'notExported',
18
- 'packageDocumentation',
19
- ],
20
- },
21
- ],
22
- // Does not make sense with TypeScript
23
- 'jsdoc/require-param-type': 'off',
24
- '@typescript-eslint/no-empty-function': 'off',
25
- },
26
- settings: {
27
- 'import/resolver': {
28
- typescript: {
29
- alwaysTryTypes: true,
30
- },
31
- node: {
32
- paths: ['src'],
33
- extensions: ['.(m|c)?js', '.ts', '.tsx', '.vue'],
34
- },
35
- },
36
- },
37
- }
3
+ files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx'],
4
+ extends: [
5
+ '@vue/eslint-config-typescript/recommended',
6
+ 'plugin:import/typescript',
7
+ ],
8
+ parser: '@typescript-eslint/parser',
9
+ parserOptions: {},
10
+ rules: {
11
+ // allow for generic type parameters on function calls
12
+ 'func-call-spacing': 'off',
13
+ '@typescript-eslint/func-call-spacing': 'error',
14
+ //
15
+ 'n/no-missing-import': 'off',
16
+ 'import/extensions': 'off',
17
+ 'jsdoc/check-tag-names': [
18
+ 'warn', {
19
+ definedTags: [
20
+ // for projects using typedoc
21
+ 'notExported',
22
+ 'packageDocumentation',
23
+ // for jest
24
+ 'jest-environment',
25
+ ],
26
+ },
27
+ ],
28
+ // Does not make sense with TypeScript
29
+ 'jsdoc/require-param-type': 'off',
30
+ '@typescript-eslint/no-empty-function': 'off',
31
+ },
32
+ settings: {
33
+ 'import/resolver': {
34
+ typescript: {
35
+ alwaysTryTypes: true,
36
+ },
37
+ node: {
38
+ paths: ['src'],
39
+ extensions: ['.(m|c)?js', '.ts', '.tsx', '.vue'],
40
+ },
41
+ },
42
+ },
43
+ }
package/parts/vue.js CHANGED
@@ -1,42 +1,41 @@
1
-
2
1
  module.exports = {
3
- files: ['**/*.vue'],
4
- parser: 'vue-eslint-parser',
5
- parserOptions: {
6
- parser: '@babel/eslint-parser',
7
- },
8
- extends: ['plugin:vue/recommended'],
9
- rules: {
10
- 'vue/html-indent': ['error', 'tab'],
11
- // PascalCase components names for vuejs
12
- // https://vuejs.org/v2/style-guide/#Single-file-component-filename-casing-strongly-recommended
13
- 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
14
- // force name
15
- 'vue/match-component-file-name': ['error', {
16
- extensions: ['jsx', 'vue', 'js'],
17
- shouldMatchCase: true,
18
- }],
19
- // space before self-closing elements
20
- 'vue/html-closing-bracket-spacing': 'error',
21
- // no ending html tag on a new line
22
- 'vue/html-closing-bracket-newline': ['error', { multiline: 'never' }],
23
- // check vue files too
24
- 'n/no-missing-import': ['error', {}],
25
- // code spacing with attributes
26
- 'vue/max-attributes-per-line': ['error', {
27
- singleline: 3,
28
- multiline: 1,
29
- }],
30
- 'vue/first-attribute-linebreak': ['error', {
31
- singleline: 'beside',
32
- multiline: 'beside',
33
- }],
34
- // Allow single-word components names
35
- 'vue/multi-word-component-names': ['off'],
36
- // custom event naming convention
37
- 'vue/custom-event-name-casing': ['error', 'kebab-case', {
38
- // allows custom xxxx:xxx events formats
39
- ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'],
40
- }],
41
- },
2
+ files: ['**/*.vue'],
3
+ parser: 'vue-eslint-parser',
4
+ parserOptions: {
5
+ parser: '@babel/eslint-parser',
6
+ },
7
+ extends: ['plugin:vue/recommended'],
8
+ rules: {
9
+ 'vue/html-indent': ['error', 'tab'],
10
+ // PascalCase components names for vuejs
11
+ // https://vuejs.org/v2/style-guide/#Single-file-component-filename-casing-strongly-recommended
12
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
13
+ // force name
14
+ 'vue/match-component-file-name': ['error', {
15
+ extensions: ['jsx', 'vue', 'js'],
16
+ shouldMatchCase: true,
17
+ }],
18
+ // space before self-closing elements
19
+ 'vue/html-closing-bracket-spacing': 'error',
20
+ // no ending html tag on a new line
21
+ 'vue/html-closing-bracket-newline': ['error', { multiline: 'never' }],
22
+ // check vue files too
23
+ 'n/no-missing-import': ['error', {}],
24
+ // code spacing with attributes
25
+ 'vue/max-attributes-per-line': ['error', {
26
+ singleline: 3,
27
+ multiline: 1,
28
+ }],
29
+ 'vue/first-attribute-linebreak': ['error', {
30
+ singleline: 'beside',
31
+ multiline: 'beside',
32
+ }],
33
+ // Allow single-word components names
34
+ 'vue/multi-word-component-names': ['off'],
35
+ // custom event naming convention
36
+ 'vue/custom-event-name-casing': ['error', 'kebab-case', {
37
+ // allows custom xxxx:xxx events formats
38
+ ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'],
39
+ }],
40
+ },
42
41
  }
package/parts/vue3.js ADDED
@@ -0,0 +1,39 @@
1
+ module.exports = {
2
+ files: ['**/*.vue'],
3
+ parser: 'vue-eslint-parser',
4
+ parserOptions: {
5
+ parser: '@babel/eslint-parser',
6
+ },
7
+ extends: ['plugin:vue3/recommended'],
8
+ rules: {
9
+ 'vue/html-indent': ['error', 'tab'],
10
+ // PascalCase components names for vuejs
11
+ // https://vuejs.org/style-guide/rules-strongly-recommended.html#component-name-casing-in-templates
12
+ 'vue/component-name-in-template-casing': ['error', 'PascalCase'],
13
+ // force name
14
+ 'vue/match-component-file-name': ['error', {
15
+ extensions: ['jsx', 'vue', 'js', 'ts', 'tsx'],
16
+ shouldMatchCase: true,
17
+ }],
18
+ // space before self-closing elements
19
+ 'vue/html-closing-bracket-spacing': 'error',
20
+ // no ending html tag on a new line
21
+ 'vue/html-closing-bracket-newline': ['error', { multiline: 'never' }],
22
+ // check vue files too
23
+ 'n/no-missing-import': ['error', {}],
24
+ // code spacing with attributes
25
+ 'vue/max-attributes-per-line': ['error', {
26
+ singleline: 3,
27
+ multiline: 1,
28
+ }],
29
+ // See https://vuejs.org/style-guide/rules-strongly-recommended.html#multi-attribute-elements
30
+ 'vue/first-attribute-linebreak': ['error', {
31
+ singleline: 'beside',
32
+ multiline: 'below',
33
+ }],
34
+ // Prevent conflicts with native HTML elements
35
+ 'vue/multi-word-component-names': 'error',
36
+ // custom event naming convention
37
+ 'vue/custom-event-name-casing': 'warning',
38
+ },
39
+ }
package/typescript.js CHANGED
@@ -2,24 +2,40 @@ const base = require('./parts/base.js')
2
2
  const typescriptOverrides = require('./parts/typescript.js')
3
3
  const vueOverrides = require('./parts/vue.js')
4
4
 
5
+ // Use different parser for vue files script section
6
+ vueOverrides.parserOptions = {
7
+ parser: '@typescript-eslint/parser',
8
+ sourceType: 'module',
9
+ }
10
+
11
+ // Override vue rules with rules for Typescript
12
+ vueOverrides.rules = {
13
+ ...vueOverrides.rules,
14
+ ...typescriptOverrides.rules,
15
+ }
16
+
17
+ // Add settings, required for import resolver
18
+ vueOverrides.settings = {
19
+ ...(vueOverrides.settings || []),
20
+ ...typescriptOverrides.settings,
21
+ }
22
+
23
+ // Also extend from vue typescript eslint
24
+ vueOverrides.extends.push('@vue/eslint-config-typescript/recommended')
25
+
5
26
  /**
6
27
  * Config for projects written in Typescript + vue including vue files written in Typescript (`<script lang='ts'>`)
7
28
  */
8
29
  module.exports = {
9
30
  ...base,
10
31
  overrides: [
11
- // Add Typescript rules also for vue files
32
+ // Overrides for Typescript files
12
33
  {
13
34
  ...typescriptOverrides,
14
- files: ['**/*.ts', '**/*.tsx', '**/*.vue'],
15
35
  },
16
- // Use different parser for vue files script section
36
+ // Setup different vue parser to support `<script setup>` correctly, especially for `lang="ts"`
17
37
  {
18
38
  ...vueOverrides,
19
- parserOptions: {
20
- parser: '@typescript-eslint/parser',
21
- sourceType: 'module',
22
- },
23
39
  },
24
40
  ],
25
41
  }
package/vue3.js ADDED
@@ -0,0 +1,41 @@
1
+ const base = require('./parts/base.js')
2
+ const typescriptOverrides = require('./parts/typescript.js')
3
+ const vueOverrides = require('./parts/vue3.js')
4
+
5
+ // Use different parser for vue files script section
6
+ vueOverrides.parserOptions = {
7
+ parser: '@typescript-eslint/parser',
8
+ sourceType: 'module',
9
+ }
10
+
11
+ // Override vue rules with rules for Typescript
12
+ vueOverrides.rules = {
13
+ ...vueOverrides.rules,
14
+ ...typescriptOverrides.rules,
15
+ }
16
+
17
+ // Add settings, required for import resolver
18
+ vueOverrides.settings = {
19
+ ...(vueOverrides.settings || []),
20
+ ...typescriptOverrides.settings,
21
+ }
22
+
23
+ // Also extend from vue typescript eslint
24
+ vueOverrides.extends.push('@vue/eslint-config-typescript/recommended')
25
+
26
+ /**
27
+ * Config for projects written in Typescript + vue including vue files written in Typescript (`<script lang='ts'>`)
28
+ */
29
+ module.exports = {
30
+ ...base,
31
+ overrides: [
32
+ // Overrides for Typescript files
33
+ {
34
+ ...typescriptOverrides,
35
+ },
36
+ // Setup different vue parser to support `<script setup>` correctly, especially for `lang="ts"`
37
+ {
38
+ ...vueOverrides,
39
+ },
40
+ ],
41
+ }