@nextcloud/eslint-config 8.3.0 → 8.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
4
+
5
+ [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
6
+
7
+ ### Fixes
8
+ * fix(vue3): align rules with Vue 2 rules by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/771
9
+ * fix(vue3): config crashes ESLint by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/770
10
+
11
+ ### Changed
12
+ * build(deps-dev): Bump eslint-plugin-jsdoc from 48.2.4 to 48.2.5 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/769
13
+
14
+ ## [v8.4.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.0) (2024-05-15)
15
+ ### Features
16
+ * Vue 3 support: There is a new sub-configuration for projects using Vue 3
17
+
3
18
  ## [v8.3.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.3.0) (2023-09-25)
4
19
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.2.1...v8.3.0)
5
20
 
package/README.md CHANGED
@@ -42,6 +42,21 @@ 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/eslint-config",
3
- "version": "8.3.0",
3
+ "version": "8.4.1",
4
4
  "description": "Eslint shared config for nextcloud vue.js apps",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -13,10 +13,10 @@
13
13
  "test": "jest"
14
14
  },
15
15
  "peerDependencies": {
16
- "@babel/core": "^7.22.20",
16
+ "@babel/core": "^7.24.5",
17
17
  "@babel/eslint-parser": "^7.16.5",
18
- "@nextcloud/eslint-plugin": "^2.1.0",
19
- "@vue/eslint-config-typescript": "^12.0.0",
18
+ "@nextcloud/eslint-plugin": "^2.2.1",
19
+ "@vue/eslint-config-typescript": "^13.0.0",
20
20
  "eslint": "^8.27.0",
21
21
  "eslint-config-standard": "^17.1.0",
22
22
  "eslint-import-resolver-exports": "^1.0.0-beta.5",
@@ -29,25 +29,25 @@
29
29
  "typescript": "^5.0.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/core": "^7.22.20",
33
- "@babel/eslint-parser": "^7.22.11",
34
- "@nextcloud/eslint-plugin": "^2.1.0",
35
- "@types/eslint": "^8.44.2",
36
- "@types/jest": "^29.5.5",
37
- "@vue/eslint-config-typescript": "^12.0.0",
38
- "eslint": "^8.50.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",
39
39
  "eslint-config-standard": "^17.1.0",
40
40
  "eslint-import-resolver-exports": "^1.0.0-beta.5",
41
41
  "eslint-import-resolver-typescript": "^3.6.1",
42
- "eslint-plugin-import": "^2.28.1",
43
- "eslint-plugin-jsdoc": "^46.8.2",
44
- "eslint-plugin-n": "^16.1.0",
42
+ "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-jsdoc": "^48.2.5",
44
+ "eslint-plugin-n": "^16.6.2",
45
45
  "eslint-plugin-promise": "^6.1.1",
46
- "eslint-plugin-vue": "^9.17.0",
46
+ "eslint-plugin-vue": "^9.26.0",
47
47
  "jest": "^29.7.0",
48
- "ts-jest": "^29.1.0",
49
- "typescript": "^5.2.2",
50
- "vue-eslint-parser": "^9.3.1"
48
+ "ts-jest": "^29.1.2",
49
+ "typescript": "^5.4.5",
50
+ "vue-eslint-parser": "^9.4.2"
51
51
  },
52
52
  "keywords": [
53
53
  "eslint",
@@ -64,7 +64,7 @@
64
64
  "homepage": "https://github.com/nextcloud-libraries/eslint-config#readme",
65
65
  "engines": {
66
66
  "node": "^20.0.0",
67
- "npm": "^9.0.0"
67
+ "npm": "^10.0.0"
68
68
  },
69
69
  "eslintConfig": {
70
70
  "extends": "./index.js"
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:vue/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: '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': 'warn',
38
+ },
39
+ }
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
+ }