@nextcloud/eslint-config 9.0.0-rc.1 → 9.0.0-rc.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/CHANGELOG.md CHANGED
@@ -4,7 +4,7 @@
4
4
  -->
5
5
  # Changelog
6
6
 
7
- ## [v9.0.0](https://github.com/nextcloud-libraries/eslint-config/tree/v9.0.0) (2025)
7
+ ## [v9.0.0](https://github.com/nextcloud-libraries/eslint-config/tree/v9.0.0) (unreleased)
8
8
 
9
9
  ### Breaking
10
10
  This package now is using ESLint v9 and requires ESLint flat configurations.
@@ -17,6 +17,11 @@ Please refer to the README on how to adjust your configuration for flat config.
17
17
  * feat: add special config for libraries [\#949](https://github.com/nextcloud-libraries/eslint-config/pull/949)
18
18
  * feat: add import and export rules [\#981](https://github.com/nextcloud-libraries/eslint-config/pull/981)
19
19
  * feat: introduce @nextcloud/vue eslint plugin [\#939](https://github.com/nextcloud-libraries/eslint-config/pull/939)
20
+ * feat(codeStyle): enforce top-level-function [#1033](https://github.com/nextcloud-libraries/eslint-config/pull/1033) ([ShGKme](https://github.com/ShGKme))
21
+ * feat(nextcloud-vue): add rule for deprecated NcButton props [#1045](https://github.com/nextcloud-libraries/eslint-config/pull/1045) ([susnux](https://github.com/susnux))
22
+ * feat(vue): add `vue/no-useless-v-bind` rule [#1063](https://github.com/nextcloud-libraries/eslint-config/pull/1063) ([susnux](https://github.com/susnux))
23
+ * feat(vue): add `vue/prefer-separate-static-class` rule [#1065](https://github.com/nextcloud-libraries/eslint-config/pull/1065) ([susnux](https://github.com/susnux))
24
+ * feat(vue3): add script-setup releated rules [#1064](https://github.com/nextcloud-libraries/eslint-config/pull/1064) ([susnux](https://github.com/susnux))
20
25
 
21
26
  ### Fixed
22
27
  * fix(codestyle): do not require splitting chains [\#951](https://github.com/nextcloud-libraries/eslint-config/pull/951)
@@ -32,13 +37,31 @@ Please refer to the README on how to adjust your configuration for flat config.
32
37
  * fix(typescript): allow to use function before definition [\#950](https://github.com/nextcloud-libraries/eslint-config/pull/950)
33
38
  * fix(typescript): remove `@typescript-eslint/no-shadow` [\#993](https://github.com/nextcloud-libraries/eslint-config/pull/993)
34
39
  * fix(typescript): enforce `import type` for type only imports [\#977](https://github.com/nextcloud-libraries/eslint-config/pull/977)
40
+ * fix(vue): allow JS Vue files [#998](https://github.com/nextcloud-libraries/eslint-config/pull/998) ([ShGKme](https://github.com/ShGKme))
41
+ * fix(documentation): do not remove JSDoc types in Vue JS files [#995](https://github.com/nextcloud-libraries/eslint-config/pull/995) ([ShGKme](https://github.com/ShGKme))
42
+ * fix(typescript): allow import in type annotation [#1034](https://github.com/nextcloud-libraries/eslint-config/pull/1034) ([ShGKme](https://github.com/ShGKme))
43
+ * fix(documentation): do not lint tests for documentation issues [#1062](https://github.com/nextcloud-libraries/eslint-config/pull/1062) ([susnux](https://github.com/susnux))
44
+ * fix: ignore `l10n` and `js` directory for apps [#1061](https://github.com/nextcloud-libraries/eslint-config/pull/1061) ([susnux](https://github.com/susnux))
45
+ * fix(imports): do not mix externals and internals [#1000](https://github.com/nextcloud-libraries/eslint-config/pull/1000) ([ShGKme](https://github.com/ShGKme))
46
+ * fix(codeStyle): allow single line arrays [#997](https://github.com/nextcloud-libraries/eslint-config/pull/997) ([ShGKme](https://github.com/ShGKme))
47
+ * fix(typescript): remove `@typescript-eslint/no-shadow` [#993](https://github.com/nextcloud-libraries/eslint-config/pull/993) ([ShGKme](https://github.com/ShGKme))
48
+ * fix(codeStyle): allow devs write small objects in one line [#996](https://github.com/nextcloud-libraries/eslint-config/pull/996) ([ShGKme](https://github.com/ShGKme))
35
49
 
36
50
  ### Changed
37
51
  * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
38
52
  * Updated development dependencies
39
53
  * refactor(json): drop now unneeded `@ts-expect-error` [#915](https://github.com/nextcloud-libraries/eslint-config/pull/915)
54
+ * refactor: use camelCase for internal variables [#971](https://github.com/nextcloud-libraries/eslint-config/pull/971) ([susnux](https://github.com/susnux))
40
55
  * chore: do not bundle config but just use Typescript [#967](https://github.com/nextcloud-libraries/eslint-config/pull/967)
41
56
  * chore: require node ^20.19 [\#982](https://github.com/nextcloud-libraries/eslint-config/pull/982)
57
+ * chore: allow to run `npm lint` without compile step [#975](https://github.com/nextcloud-libraries/eslint-config/pull/975) ([susnux](https://github.com/susnux))
58
+ * chore: prepare v9.0.0-rc.1 [#1010](https://github.com/nextcloud-libraries/eslint-config/pull/1010) ([susnux](https://github.com/susnux))
59
+ * docs: consistent badge style with the reuse one [#1060](https://github.com/nextcloud-libraries/eslint-config/pull/1060) ([susnux](https://github.com/susnux))
60
+ * docs: add documentation about update policy and development [#1009](https://github.com/nextcloud-libraries/eslint-config/pull/1009) ([susnux](https://github.com/susnux))
61
+ * test: fix tests and add workflow to run them on CI [#1046](https://github.com/nextcloud-libraries/eslint-config/pull/1046) ([susnux](https://github.com/susnux))
62
+ * ci: update workflows from organization [#1047](https://github.com/nextcloud-libraries/eslint-config/pull/1047) ([susnux](https://github.com/susnux))
63
+ * chore: add active node version (24) to supported engines [#1066](https://github.com/nextcloud-libraries/eslint-config/pull/1066) ([susnux](https://github.com/susnux))
64
+ * build: add common changelog formatting and documentation for it [#1067](https://github.com/nextcloud-libraries/eslint-config/pull/1067) ([susnux](https://github.com/susnux))
42
65
  * Updated `@eslint/json` to 0.12.0
43
66
  * Updated `@stylistic/eslint-plugin` 4.2.0
44
67
  * Updated `eslint-plugin-jsdoc` to 50.6.11
@@ -49,23 +72,23 @@ Please refer to the README on how to adjust your configuration for flat config.
49
72
 
50
73
  ## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
51
74
  ### Fixed
52
- * fix(typescript): do not require returns type in jsdoc by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/857
75
+ * fix(typescript): do not require returns type in jsdoc [#857](https://github.com/nextcloud-libraries/eslint-config/pull/857) ([ShGKme](https://github.com/ShGKme))
53
76
 
54
77
  ### Changed
55
78
  * Updated development dependencies
56
- * Add SPDX header by @AndyScherzinger in https://github.com/nextcloud-libraries/eslint-config/pull/802
57
- * enh(git): ignore formatting commits in git blame by @max-nextcloud in https://github.com/nextcloud-libraries/eslint-config/pull/854
79
+ * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802) ([AndyScherzinger](https://github.com/AndyScherzinger))
80
+ * enh(git): ignore formatting commits in git blame [#854](https://github.com/nextcloud-libraries/eslint-config/pull/854) ([max-nextcloud](https://github.com/max-nextcloud))
58
81
 
59
82
  ## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
60
83
 
61
84
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
62
85
 
63
86
  ### Fixes
64
- * fix(vue3): align rules with Vue 2 rules by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/771
65
- * fix(vue3): config crashes ESLint by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/770
87
+ * fix(vue3): align rules with Vue 2 rules [#771](https://github.com/nextcloud-libraries/eslint-config/pull/771) ([ShGKme](https://github.com/ShGKme))
88
+ * fix(vue3): config crashes ESLint [#770](https://github.com/nextcloud-libraries/eslint-config/pull/770) ([ShGKme](https://github.com/ShGKme))
66
89
 
67
90
  ### Changed
68
- * 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
91
+ * build(deps-dev): Bump eslint-plugin-jsdoc from 48.2.4 to 48.2.5 [#769](https://github.com/nextcloud-libraries/eslint-config/pull/769) ([dependabot](https://github.com/dependabot))
69
92
 
70
93
  ## [v8.4.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.0) (2024-05-15)
71
94
  ### Features
@@ -76,36 +99,36 @@ Please refer to the README on how to adjust your configuration for flat config.
76
99
 
77
100
  ### Features
78
101
  * Typescript 5 support
79
- * Allow linting of typescript with module resolution set to `node16` or `nodenext` by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/527
80
- * Support Composition API & Typescript + Vue projects by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/562
81
- * Allow linting of TSX files by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/456
102
+ * Allow linting of typescript with module resolution set to `node16` or `nodenext` [#527](https://github.com/nextcloud-libraries/eslint-config/pull/527) ([susnux](https://github.com/susnux))
103
+ * Support Composition API & Typescript + Vue projects [#562](https://github.com/nextcloud-libraries/eslint-config/pull/562) ([susnux](https://github.com/susnux))
104
+ * Allow linting of TSX files [#456](https://github.com/nextcloud-libraries/eslint-config/pull/456) ([susnux](https://github.com/susnux))
82
105
 
83
106
  ### Fixes
84
- * Ignore camelcase rule for __webpack variables by @kesselb in https://github.com/nextcloud-libraries/eslint-config/pull/530
85
- * Add Typescript overrides for all valid Typescript file extensions by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/567
86
- * Allow empty functions by @skjnldsv in https://github.com/nextcloud-libraries/eslint-config/pull/570
87
- * fix(typescript): Also set the typescript settings to the vue overrides for typescript import resolving by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/639
88
- * fix(typescript): Allow generic type parameters on function calls by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/571
89
- * Make sure vue files written in Typescript are linted correctly by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/579
90
- * fix: Allow to import packages from `devDependencies` within config files by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/580
91
- * fix: Allow `@jest-environment` docblock for jest tests by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/592
107
+ * Ignore camelcase rule for __webpack variables [#530](https://github.com/nextcloud-libraries/eslint-config/pull/530) ([kesselb](https://github.com/kesselb))
108
+ * Add Typescript overrides for all valid Typescript file extensions [#567](https://github.com/nextcloud-libraries/eslint-config/pull/567) ([susnux](https://github.com/susnux))
109
+ * Allow empty functions [#570](https://github.com/nextcloud-libraries/eslint-config/pull/570) ([skjnldsv](https://github.com/skjnldsv))
110
+ * fix(typescript): Also set the typescript settings to the vue overrides for typescript import resolving [#639](https://github.com/nextcloud-libraries/eslint-config/pull/639) ([susnux](https://github.com/susnux))
111
+ * fix(typescript): Allow generic type parameters on function calls [#571](https://github.com/nextcloud-libraries/eslint-config/pull/571) ([susnux](https://github.com/susnux))
112
+ * Make sure vue files written in Typescript are linted correctly [#579](https://github.com/nextcloud-libraries/eslint-config/pull/579) ([susnux](https://github.com/susnux))
113
+ * fix: Allow to import packages from `devDependencies` within config files [#580](https://github.com/nextcloud-libraries/eslint-config/pull/580) ([susnux](https://github.com/susnux))
114
+ * fix: Allow `@jest-environment` docblock for jest tests [#592](https://github.com/nextcloud-libraries/eslint-config/pull/592) ([susnux](https://github.com/susnux))
92
115
 
93
116
  ### Changed
94
117
  * Various dependencies upgrades
95
- * chore: Update `@nextcloud/eslint-plugin` to version 2.1.0 by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/605
96
- * Drop webpack dependency by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/528
118
+ * chore: Update `@nextcloud/eslint-plugin` to version 2.1.0 [#605](https://github.com/nextcloud-libraries/eslint-config/pull/605) ([susnux](https://github.com/susnux))
119
+ * Drop webpack dependency [#528](https://github.com/nextcloud-libraries/eslint-config/pull/528) ([susnux](https://github.com/susnux))
97
120
  538
98
- * Update node engines to next LTS (node 20 and NPM 9) by @nextcloud-command in https://github.com/nextcloud-libraries/eslint-config/pull/563
121
+ * Update node engines to next LTS (node 20 and NPM 9) [#563](https://github.com/nextcloud-libraries/eslint-config/pull/563) ([nextcloud-command](https://github.com/nextcloud-command))
99
122
  565
100
- * Make eslint to take this config for linting the config by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/572
101
- * chore: Fix URLs after package got transfered by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/602
123
+ * Make eslint to take this config for linting the config [#572](https://github.com/nextcloud-libraries/eslint-config/pull/572) ([susnux](https://github.com/susnux))
124
+ * chore: Fix URLs after package got transfered [#602](https://github.com/nextcloud-libraries/eslint-config/pull/602) ([susnux](https://github.com/susnux))
102
125
 
103
126
  ## [v8.2.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.2.1) (2023-01-30)
104
127
 
105
128
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.2.0...v8.2.1)
106
129
 
107
130
  **Fixed:**
108
- - Fix resolving packages that use the package `exports` feature by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/452
131
+ - Fix resolving packages that use the package `exports` feature [#452](https://github.com/nextcloud-libraries/eslint-config/pull/452) ([susnux](https://github.com/susnux))
109
132
 
110
133
  **Merged pull requests:**
111
134
  - Various dependencies upgrades
@@ -127,8 +150,8 @@ Please refer to the README on how to adjust your configuration for flat config.
127
150
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.4...v8.1.5)
128
151
 
129
152
  **Dependency updates:**
130
- - Bump json5 from 1.0.1 to 1.0.2 by @PVince81 in https://github.com/nextcloud-libraries/eslint-config/pull/430
131
- - Bump json5 from 2.2.1 to 2.2.3 by @PVince81 in https://github.com/nextcloud-libraries/eslint-config/pull/430
153
+ - Bump json5 from 1.0.1 to 1.0.2 [#430](https://github.com/nextcloud-libraries/eslint-config/pull/430) ([PVince81](https://github.com/PVince81))
154
+ - Bump json5 from 2.2.1 to 2.2.3 [#430](https://github.com/nextcloud-libraries/eslint-config/pull/430) ([PVince81](https://github.com/PVince81))
132
155
 
133
156
  ## [v8.1.4](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.4) (2022-11-17)
134
157
 
@@ -142,16 +165,16 @@ Please refer to the README on how to adjust your configuration for flat config.
142
165
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.2...v8.1.3)
143
166
 
144
167
  **Fixed:**
145
- - Allow TypeScript syntax in JSDoc comments by @Pytal in https://github.com/nextcloud-libraries/eslint-config/pull/413
168
+ - Allow TypeScript syntax in JSDoc comments [#413](https://github.com/nextcloud-libraries/eslint-config/pull/413) ([Pytal](https://github.com/Pytal))
146
169
 
147
170
  **Dependency updates:**
148
- - Bump @babel/core from 7.18.10 to 7.19.6 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/404
149
- - Bump @babel/eslint-parser from 7.18.9 to 7.19.1 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/392
150
- - Bump eslint from 8.21.0 to 8.26.0 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/406
151
- - Bump eslint-plugin-jsdoc from 39.3.13 to 39.6.2 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/414
152
- - Bump eslint-plugin-n from 15.2.4 to 15.4.0 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/409
153
- - Bump eslint-plugin-promise from 6.0.0 to 6.1.1 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/405
154
- - Bump eslint-plugin-vue from 9.3.0 to 9.7.0 by @dependabot in https://github.com/nextcloud-libraries/eslint-config/pull/410
171
+ - Bump @babel/core from 7.18.10 to 7.19.6 [#404](https://github.com/nextcloud-libraries/eslint-config/pull/404) ([dependabot](https://github.com/dependabot))
172
+ - Bump @babel/eslint-parser from 7.18.9 to 7.19.1 [#392](https://github.com/nextcloud-libraries/eslint-config/pull/392) ([dependabot](https://github.com/dependabot))
173
+ - Bump eslint from 8.21.0 to 8.26.0 [#406](https://github.com/nextcloud-libraries/eslint-config/pull/406) ([dependabot](https://github.com/dependabot))
174
+ - Bump eslint-plugin-jsdoc from 39.3.13 to 39.6.2 [#414](https://github.com/nextcloud-libraries/eslint-config/pull/414) ([dependabot](https://github.com/dependabot))
175
+ - Bump eslint-plugin-n from 15.2.4 to 15.4.0 [#409](https://github.com/nextcloud-libraries/eslint-config/pull/409) ([dependabot](https://github.com/dependabot))
176
+ - Bump eslint-plugin-promise from 6.0.0 to 6.1.1 [#405](https://github.com/nextcloud-libraries/eslint-config/pull/405) ([dependabot](https://github.com/dependabot))
177
+ - Bump eslint-plugin-vue from 9.3.0 to 9.7.0 [#410](https://github.com/nextcloud-libraries/eslint-config/pull/410) ([dependabot](https://github.com/dependabot))
155
178
 
156
179
  ## [v8.1.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.2) (2022-08-09)
157
180
 
package/README.md CHANGED
@@ -5,22 +5,27 @@
5
5
  ## @nextcloud/eslint-config
6
6
 
7
7
  [![REUSE status](https://api.reuse.software/badge/github.com/nextcloud-libraries/eslint-config)](https://api.reuse.software/info/github.com/nextcloud-libraries/eslint-config)
8
- [![npm last version](https://img.shields.io/npm/v/@nextcloud/eslint-config.svg?style=flat-square)](https://www.npmjs.com/package/@nextcloud/eslint-config)
9
- [![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)
10
- [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&style=flat-square&logo=dependabot)](https://dependabot.com)
8
+ [![npm last version](https://img.shields.io/npm/v/@nextcloud/eslint-config.svg)](https://www.npmjs.com/package/@nextcloud/eslint-config)
9
+ [![Lint status](https://img.shields.io/github/actions/workflow/status/nextcloud-libraries/eslint-config/lint-eslint.yml?label=lint)](https://github.com/nextcloud-libraries/eslint-config/actions/workflows/lint.yml)
10
+ [![Dependabot status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg?longCache=true&logo=dependabot)](https://dependabot.com)
11
11
 
12
12
 
13
13
  This is a package containing the unified global eslint config used by all nextcloud apps and libraries.
14
14
  It contains the necessary dependencies and peerDependencies so that other apps cannot update if this config does not support it.
15
15
  Please always use dependabot to update your apps, OR pay attention to the peer dependencies error messages!
16
16
 
17
- ## Installation
17
+ The rules within this configuration are based on, and enforce, the Nextcloud [coding style](https://docs.nextcloud.com/server/latest/developer_manual/getting_started/coding_standards/javascript.html#code-style). Additionally, we follow the common code styles and best practices used in the Vue ecosystem as we strongly focussed on Vue based UI code.
18
+
19
+ > [!TIP]
20
+ > For backend code there is also a similar configuration for PHP code available enforcing our PHP codestyle, see [Nextcloud cs-fixer](https://github.com/nextcloud/coding-standard/).
21
+
22
+ ### Installation
18
23
 
19
24
  ```bash
20
- npm install @nextcloud/eslint-config --save-dev
25
+ npm install --save-dev @nextcloud/eslint-config
21
26
  ```
22
27
 
23
- ## Usage
28
+ ### Usage
24
29
 
25
30
  > [!NOTE]
26
31
  > Since version 9 this package depends on ESLint 9, which uses the new flat config system.
@@ -36,7 +41,7 @@ export default [
36
41
  ]
37
42
  ```
38
43
 
39
- ### Available configurations
44
+ #### Available configurations
40
45
 
41
46
  Instead of the `recommended` configuration this package also provides some alternatives, depending on your app setup you can also choose:
42
47
 
@@ -52,7 +57,7 @@ Instead of the `recommended` configuration this package also provides some alter
52
57
  * `recommendedVue2Javascript`
53
58
  * Same as `recommended` but Vue files are considered in Vue 2 syntax and the script part will be handled as Javascript instead of Typescript.
54
59
 
55
- #### Configurations for Nextcloud libraries
60
+ ##### Configurations for Nextcloud libraries
56
61
 
57
62
  For libraries some of the presets make no sense, like checking Nextcloud deprecated API.
58
63
  But on the otherhand some rules should be enforced, like documenting all properties.
@@ -61,7 +66,7 @@ So for libraries use following configurations:
61
66
  * `recommendedLibrary`
62
67
  * `recommendedVue2Library`
63
68
 
64
- ### Bundled plugins
69
+ #### Bundled plugins
65
70
 
66
71
  This configuration also provides some bundled plugins with new rules, those options are already included in the recommended configurations.
67
72
 
@@ -98,13 +103,13 @@ export default [
98
103
  ]
99
104
  ```
100
105
 
101
- #### `package-json` plugin
106
+ ##### `package-json` plugin
102
107
  Rules:
103
108
  - `sort-package-json`
104
109
  - Ensures the `package.json` is sorted in consistent order
105
110
  - Included as `error` level in recommended configurations
106
111
 
107
- #### `@nextcloud` plugin
112
+ ##### `@nextcloud` plugin
108
113
  Rules:
109
114
  - `no-deprecations`
110
115
  - Report usage of deprecated Nextcloud API
@@ -145,7 +150,7 @@ Rules:
145
150
  }
146
151
  ```
147
152
 
148
- #### `@nextcloud-l10n`
153
+ ##### `@nextcloud-l10n`
149
154
  ```ts
150
155
  import { l10nPlugin } from '@nextcloud/eslint-config'
151
156
  ```
@@ -158,7 +163,7 @@ Rules:
158
163
  - Enforce non-breaking spaces before ellipsis
159
164
  - Included as `error` level in recommended configuration
160
165
 
161
- ### Adding custom overrides
166
+ #### Adding custom overrides
162
167
 
163
168
  Sometimes additional rules need to be added for individual projects,
164
169
  and while we do not recommend to override Nextcloud rules for code style (it should be consistent across all Nextcloud projects!),
@@ -188,9 +193,65 @@ export default [
188
193
  ]
189
194
  ```
190
195
 
191
- ## Release new version
196
+ ### Update policy
197
+
198
+ We follow semantic versioning.
199
+
200
+ #### 💥 Breaking changes
201
+
202
+ For breaking changes, we consider those changes that break linting in a technical term, so linting itself is broken with the update.
203
+ This means, for example, require a new config format (ESLint legacy vs flat configuration). But it does not mean new errors or warnings while linting.
204
+
205
+ #### ✨ Minor changes
206
+
207
+ For minor changes we consider adding new rules or adding or removing plugins.
208
+ This means after updating a minor version, there can be new warnings or errors when linting the same code base.
209
+
210
+ #### 🐛 Patch changes
211
+
212
+ For this configuration we consider following changes fixes:
213
+ - Adjusting rules to follow our official code style.
214
+ - Adjusting rules if the current behavior is considered a bug.
215
+ - Removing rules
216
+
217
+ ### Development
218
+
219
+ #### New rules
220
+
221
+ Adding new rules that enforce our code style can always be added.
222
+ Rules that are not directly covered by our code style should be discussed before.
223
+
224
+ If those rules are code style related, the matching section of the [Nextcloud developer documentation](https://github.com/nextcloud/documentation/) has to be updated to keep both in sync.
225
+
226
+ #### Rule severity
227
+
228
+ Either you care about a rule or you do not.
229
+ As such we only enforce rules that we consider either important for code quality or to have consistent code style.
230
+ For this reason all rules should be set to **error** severity, as all rules are considered must-follow.
231
+
232
+ Of course, in some edge cases rules do not apply, in such cases the users can still opt-in to disable that rule for a line or file.
233
+
234
+ To not break projects during updates new rules with non critical impact (code style related rules)
235
+ should be introduced with **warn** severity and moved to severity **error** only with a new major release or after a sane timeframe for migration.
236
+
237
+ #### Release new version
192
238
 
193
- 1. Update CHANGELOG.md file with the latest changes
194
- 2. Bump the package version with `npm version`
195
- 3. Push version bump commit
196
- 4. Create a new release with proper changelog https://github.com/nextcloud-libraries/eslint-config/releases/new
239
+ - Pull the latest changes from `main` or `stableX`
240
+ - Checkout a new branch with the tag name (e.g `v9.0.1`): `git checkout -b v<version>`
241
+ - Run `npm version patch --no-git-tag-version` (`npm version minor --no-git-tag-version` if minor).
242
+ This will return a new version name, make sure it matches what you expect
243
+ - Generate the changelog content from the [release](https://github.com/nextcloud-libraries/eslint-config/releases) page.
244
+ Create a draft release, select the previous tag, click `generate` then paste the content to the `CHANGELOG.md` file
245
+ 1. adjust the links to the merged pull requests and authors so that the changelog also works outside of GitHub
246
+ by running `npm run prerelease:format-changelog`.
247
+ This will apply this regex: `by @([^ ]+) in ((https://github.com/)nextcloud-libraries/eslint-config/pull/(\d+))`
248
+ Which this as the replacement: `[\#$4]($2) \([$1]($3$1)\)`
249
+ 2. use the the version as tag AND title (e.g `v4.0.1`)
250
+ 3. add the changelog content as description (https://github.com/nextcloud-libraries/eslint-config/releases)
251
+ - Commit, push and create PR
252
+ - Get your PR reviewed and merged
253
+ - Create a milestone with the follow-up version at https://github.com/nextcloud-libraries/eslint-config/milestones
254
+ - Move all open tickets and PRs to the follow-up
255
+ - Close the milestone of the version you release
256
+ - Publish the previously drafted release on GitHub
257
+ ![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png)
@@ -1,4 +1,5 @@
1
1
  import stylistic from '@stylistic/eslint-plugin';
2
+ import eslintAntfuPlugin from 'eslint-plugin-antfu';
2
3
  import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
3
4
  import l10nPlugin from "../plugins/l10n/index.js";
4
5
  /**
@@ -34,6 +35,9 @@ export function codeStyle(options) {
34
35
  ...GLOB_FILES_TYPESCRIPT,
35
36
  ...GLOB_FILES_VUE,
36
37
  ],
38
+ plugins: {
39
+ antfu: eslintAntfuPlugin,
40
+ },
37
41
  rules: {
38
42
  // Overrides for the stylistic recommended rules
39
43
  // Tabs should only be used for indention
@@ -142,6 +146,8 @@ export function codeStyle(options) {
142
146
  'no-useless-concat': 'error',
143
147
  // Prefer { ...foo } over Object.assign({}, foo)
144
148
  'prefer-object-spread': 'warn',
149
+ // Enforce function declarations for top level functions
150
+ 'antfu/top-level-function': 'error',
145
151
  },
146
152
  },
147
153
  {
@@ -1,5 +1,17 @@
1
1
  import jsdocPlugin from 'eslint-plugin-jsdoc';
2
2
  import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
3
+ const TS_FUNCTION_CONTEXTS = [
4
+ 'FunctionDeclaration:has(TSTypeAnnotation)',
5
+ 'FunctionExpression:has(TSTypeAnnotation)',
6
+ 'ArrowFunctionExpression:has(TSTypeAnnotation)',
7
+ 'MethodDefinition:has(TSTypeAnnotation)',
8
+ ];
9
+ const JS_FUNCTION_CONTEXTS = [
10
+ 'FunctionDeclaration:not(:has(TSTypeAnnotation))',
11
+ 'FunctionExpression:not(:has(TSTypeAnnotation))',
12
+ 'ArrowFunctionExpression:not(:has(TSTypeAnnotation))',
13
+ 'MethodDefinition:not(:has(TSTypeAnnotation))',
14
+ ];
3
15
  /**
4
16
  * Config factory for code documentation related rules (JSDoc)
5
17
  *
@@ -39,6 +51,13 @@ export function documentation(options) {
39
51
  ignores: GLOB_FILES_TESTING,
40
52
  },
41
53
  {
54
+ name: 'nextcloud/documentation/rules',
55
+ files: [
56
+ ...GLOB_FILES_JAVASCRIPT,
57
+ ...GLOB_FILES_TYPESCRIPT,
58
+ ...GLOB_FILES_VUE,
59
+ ],
60
+ ignores: GLOB_FILES_TESTING,
42
61
  rules: {
43
62
  // Force proper documentation
44
63
  'jsdoc/check-tag-names': 'error',
@@ -52,11 +71,6 @@ export function documentation(options) {
52
71
  { startLines: 1 },
53
72
  ],
54
73
  },
55
- files: [
56
- ...GLOB_FILES_JAVASCRIPT,
57
- ...GLOB_FILES_TYPESCRIPT,
58
- ...GLOB_FILES_VUE,
59
- ],
60
74
  settings: {
61
75
  jsdoc: {
62
76
  // We use the alias for legacy reasons to prevent unnecessary noise
@@ -65,20 +79,45 @@ export function documentation(options) {
65
79
  },
66
80
  },
67
81
  },
68
- name: 'nextcloud/documentation/rules',
69
82
  },
70
83
  {
84
+ name: 'nextcloud/documentation/rules-typescript',
85
+ files: [...GLOB_FILES_TYPESCRIPT],
86
+ ignores: GLOB_FILES_TESTING,
71
87
  rules: {
72
88
  // Overwrites for documentation as types are already provided by Typescript
89
+ 'jsdoc/no-types': 'error',
73
90
  'jsdoc/require-param-type': 'off',
74
- 'jsdoc/require-property-type': 'off',
75
91
  'jsdoc/require-returns-type': 'off',
76
92
  },
77
- files: [
78
- ...GLOB_FILES_TYPESCRIPT,
79
- ...(options.vueIsTypescript ? GLOB_FILES_VUE : []),
80
- ],
81
- name: 'nextcloud/documentation/rules-typescript',
82
93
  },
94
+ ...(options.vueIsTypescript
95
+ ? [
96
+ {
97
+ name: 'nextcloud/documentation/rules-vue',
98
+ files: [...(options.vueIsTypescript ? GLOB_FILES_VUE : [])],
99
+ ignores: GLOB_FILES_TESTING,
100
+ rules: {
101
+ // Vue files can be both Javascript and Typescript
102
+ // Try to apply TS files only for functions with TS definitions
103
+ 'jsdoc/no-types': [
104
+ 'error',
105
+ { contexts: TS_FUNCTION_CONTEXTS },
106
+ ],
107
+ 'jsdoc/require-param-type': [
108
+ 'error',
109
+ { contexts: JS_FUNCTION_CONTEXTS },
110
+ ],
111
+ // Unlike params, return values are often inferred and not explicitly typed
112
+ 'jsdoc/require-returns-type': 'off',
113
+ // Unfortunately, we cannot check when it is used in TS context and when not
114
+ 'jsdoc/check-tag-names': [
115
+ 'error',
116
+ { typed: false },
117
+ ],
118
+ },
119
+ },
120
+ ]
121
+ : []),
83
122
  ];
84
123
  }
@@ -10,6 +10,8 @@ export const filesystem = [
10
10
  name: 'nextcloud/filesystem/ignores',
11
11
  ignores: [
12
12
  '**/dist',
13
+ '**/js',
14
+ '**/l10n',
13
15
  '**/vendor',
14
16
  '**/vendor-bin',
15
17
  '**/package-lock.json',
@@ -1,5 +1,5 @@
1
1
  import typescriptPlugin from 'typescript-eslint';
2
- import { GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
2
+ import { GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_TYPESCRIPT_DECLARATIONS, GLOB_FILES_VUE, } from "../globs.js";
3
3
  import { restrictConfigFiles } from "../utils.js";
4
4
  /**
5
5
  * Typescript related ESLint rules for Nextcloud
@@ -41,6 +41,13 @@ export function typescript(options) {
41
41
  ],
42
42
  },
43
43
  },
44
+ {
45
+ name: 'nextcloud/typescript/declaration-rules',
46
+ files: [...GLOB_FILES_TYPESCRIPT_DECLARATIONS],
47
+ rules: {
48
+ '@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
49
+ },
50
+ },
44
51
  {
45
52
  files: GLOB_FILES_TESTING,
46
53
  rules: {
@@ -84,6 +84,8 @@ export function vue(options) {
84
84
  // Component names should match their export names - readability and maintainability ("where does this component come from?")
85
85
  'vue/match-component-import-name': 'error',
86
86
  'vue/match-component-file-name': 'error',
87
+ // Prevent useless v-bind like `<foo :bar="'bar'"/>`
88
+ 'vue/no-useless-v-bind': 'error',
87
89
  // Warn on undefined components - we need this on warning level as long as people use mixins (then we can move to error)
88
90
  'vue/no-undef-components': [
89
91
  'warn',
@@ -113,6 +115,21 @@ export function vue(options) {
113
115
  'vue/new-line-between-multi-line-property': 'error',
114
116
  // Add consistent padding between blocks
115
117
  'vue/padding-line-between-blocks': 'error',
118
+ // Prefer separated static and dynamic class attributes
119
+ 'vue/prefer-separate-static-class': 'error',
120
+ // For consistent layout of components
121
+ 'vue/define-macros-order': [
122
+ 'error', {
123
+ order: [
124
+ 'defineOptions',
125
+ 'defineModel',
126
+ 'defineProps',
127
+ 'defineEmits',
128
+ 'defineSlots',
129
+ 'defineExpose',
130
+ ],
131
+ },
132
+ ],
116
133
  },
117
134
  name: 'nextcloud/vue/stylistic-rules',
118
135
  },
@@ -127,6 +144,7 @@ export function vue(options) {
127
144
  },
128
145
  rules: {
129
146
  '@nextcloud/vue/no-deprecated-exports': 'error',
147
+ '@nextcloud/vue/no-deprecated-props': 'error',
130
148
  },
131
149
  name: 'nextcloud/vue/migration-rules',
132
150
  },
@@ -17,6 +17,8 @@ export function vue3(options) {
17
17
  rules: {
18
18
  // Deprecated thus we should not use it
19
19
  'vue/no-deprecated-delete-set': 'error',
20
+ // When using script-setup the modern approach should be used
21
+ 'vue/prefer-define-options': 'error',
20
22
  },
21
23
  name: 'nextcloud/vue3/rules',
22
24
  },
package/dist/globs.d.ts CHANGED
@@ -6,6 +6,8 @@
6
6
  export declare const GLOB_FILES_TESTING: string[];
7
7
  /** Glob pattern for Typescript files */
8
8
  export declare const GLOB_FILES_TYPESCRIPT: string[];
9
+ /** Glob pattern for Typescript declaration files */
10
+ export declare const GLOB_FILES_TYPESCRIPT_DECLARATIONS: string[];
9
11
  /** Glob pattern for Javascript files */
10
12
  export declare const GLOB_FILES_JAVASCRIPT: string[];
11
13
  /** Glob pattern for JSON files */
package/dist/globs.js CHANGED
@@ -17,6 +17,8 @@ export const GLOB_FILES_TYPESCRIPT = [
17
17
  '**/*.cts',
18
18
  '**/*.tsx',
19
19
  ];
20
+ /** Glob pattern for Typescript declaration files */
21
+ export const GLOB_FILES_TYPESCRIPT_DECLARATIONS = ['**/*.d.ts'];
20
22
  /** Glob pattern for Javascript files */
21
23
  export const GLOB_FILES_JAVASCRIPT = [
22
24
  '**/*.js',
@@ -1,5 +1,25 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
1
5
  declare const _default: {
2
- rules: Record<string, import("eslint").Rule.RuleModule>;
6
+ rules: {
7
+ 'no-deprecated-exports': import("eslint").Rule.RuleModule;
8
+ 'no-deprecated-props': {
9
+ meta: {
10
+ docs: {
11
+ description: string;
12
+ };
13
+ type: "problem";
14
+ fixable: "code";
15
+ messages: {
16
+ useTypeInstead: string;
17
+ useVariantInstead: string;
18
+ };
19
+ };
20
+ create(context: import("eslint").Rule.RuleContext): any;
21
+ };
22
+ };
3
23
  meta: {
4
24
  name: string;
5
25
  version: string;
@@ -1,3 +1,7 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
1
5
  import { packageVersion } from "../../version.js";
2
6
  import { rules } from "./rules/index.js";
3
7
  export default {
@@ -1,6 +1,17 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import type { Rule } from 'eslint';
6
- export declare const rules: Record<string, Rule.RuleModule>;
1
+ export declare const rules: {
2
+ 'no-deprecated-exports': import("eslint").Rule.RuleModule;
3
+ 'no-deprecated-props': {
4
+ meta: {
5
+ docs: {
6
+ description: string;
7
+ };
8
+ type: "problem";
9
+ fixable: "code";
10
+ messages: {
11
+ useTypeInstead: string;
12
+ useVariantInstead: string;
13
+ };
14
+ };
15
+ create(context: import("eslint").Rule.RuleContext): any;
16
+ };
17
+ };
@@ -1,4 +1,10 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
1
5
  import noDeprecatedExports from "./no-deprecated-exports.js";
6
+ import noDeprecatedProps from "./no-deprecated-props.js";
2
7
  export const rules = {
3
8
  'no-deprecated-exports': noDeprecatedExports,
9
+ 'no-deprecated-props': noDeprecatedProps,
4
10
  };
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import type { Rule } from 'eslint';
6
+ declare const _default: {
7
+ meta: {
8
+ docs: {
9
+ description: string;
10
+ };
11
+ type: "problem";
12
+ fixable: "code";
13
+ messages: {
14
+ useTypeInstead: string;
15
+ useVariantInstead: string;
16
+ };
17
+ };
18
+ create(context: Rule.RuleContext): any;
19
+ };
20
+ export default _default;
@@ -0,0 +1,61 @@
1
+ import * as vueUtils from 'eslint-plugin-vue/lib/utils/index.js';
2
+ export default {
3
+ meta: {
4
+ docs: {
5
+ description: 'Deprecated `@nextcloud/vue` properties',
6
+ },
7
+ type: 'problem',
8
+ fixable: 'code',
9
+ messages: {
10
+ useTypeInstead: 'Using `native-type` for button variant is deprecated - use `type` instead.',
11
+ useVariantInstead: 'Using `type` for button variant is deprecated - use `variant` instead.',
12
+ },
13
+ },
14
+ create(context) {
15
+ const legacyTypes = ['primary', 'error', 'warning', 'success', 'secondary', 'tertiary', 'tertiary-no-background'];
16
+ return vueUtils.defineTemplateBodyVisitor(context, {
17
+ 'VElement[name="ncbutton"] VAttribute:has(VIdentifier[name="type"])': function (node) {
18
+ const hasNativeType = node.parent.attributes.find((attr) => (attr.key.name === 'native-type'
19
+ || (attr.key.type === 'VDirectiveKey' && attr.key.argument && attr.key.argument.name === 'native-type')));
20
+ const isLiteral = node.value.type === 'VLiteral' && legacyTypes.includes(node.value.value);
21
+ const isExpression = node.value.type === 'VExpressionContainer'
22
+ && node.value.expression.type === 'ConditionalExpression'
23
+ && (legacyTypes.includes(node.value.expression.consequent.value)
24
+ || legacyTypes.includes(node.value.expression.alternate.value));
25
+ /**
26
+ * if it is a literal with a deprecated value -> we migrate
27
+ * if it is an expression with a defined deprecated value -> we migrate
28
+ * if it is unknown value (e.g. computed), but there is also the `native-type` we assume it is legacy and we migrate
29
+ */
30
+ if (isLiteral || isExpression || hasNativeType) {
31
+ context.report({
32
+ node,
33
+ messageId: 'useVariantInstead',
34
+ fix: (fixer) => {
35
+ if (node.key.type === 'VIdentifier') {
36
+ return fixer.replaceTextRange(node.key.range, 'variant');
37
+ }
38
+ else if (node.key.type === 'VDirectiveKey') {
39
+ return fixer.replaceTextRange(node.key.argument.range, 'variant');
40
+ }
41
+ },
42
+ });
43
+ }
44
+ },
45
+ 'VElement[name="ncbutton"] VAttribute:has(VIdentifier[name="native-type"])': function (node) {
46
+ context.report({
47
+ node,
48
+ messageId: 'useTypeInstead',
49
+ fix: (fixer) => {
50
+ if (node.key.type === 'VIdentifier') {
51
+ return fixer.replaceTextRange(node.key.range, 'type');
52
+ }
53
+ else if (node.key.type === 'VDirectiveKey') {
54
+ return fixer.replaceTextRange(node.key.argument.range, 'type');
55
+ }
56
+ },
57
+ });
58
+ },
59
+ });
60
+ },
61
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/eslint-config",
3
- "version": "9.0.0-rc.1",
3
+ "version": "9.0.0-rc.2",
4
4
  "description": "Eslint shared config for nextcloud apps and libraries",
5
5
  "keywords": [
6
6
  "eslint",
@@ -39,32 +39,34 @@
39
39
  "build:source": "tsc",
40
40
  "lint": "npx --node-options='--experimental-strip-types' eslint --flag unstable_native_nodejs_ts_config",
41
41
  "lint:fix": "npx --node-options='--experimental-strip-types' eslint --flag unstable_native_nodejs_ts_config --fix",
42
+ "prerelease:format-changelog": "node build/format-changelog.mjs",
42
43
  "test": "vitest run"
43
44
  },
44
45
  "dependencies": {
45
46
  "@eslint/json": "^0.12.0",
46
- "@stylistic/eslint-plugin": "^4.2.0",
47
- "eslint-plugin-jsdoc": "^50.6.11",
48
- "eslint-plugin-perfectionist": "^4.12.3",
49
- "eslint-plugin-vue": "^10.0.0",
50
- "fast-xml-parser": "^5.2.1",
51
- "globals": "^16.0.0",
52
- "semver": "^7.7.1",
53
- "sort-package-json": "^3.0.0",
54
- "typescript-eslint": "^8.31.0"
47
+ "@stylistic/eslint-plugin": "^4.4.1",
48
+ "eslint-plugin-antfu": "^3.1.1",
49
+ "eslint-plugin-jsdoc": "^50.7.1",
50
+ "eslint-plugin-perfectionist": "^4.14.0",
51
+ "eslint-plugin-vue": "^10.1.0",
52
+ "fast-xml-parser": "^5.2.3",
53
+ "globals": "^16.2.0",
54
+ "semver": "^7.7.2",
55
+ "sort-package-json": "^3.2.1",
56
+ "typescript-eslint": "^8.33.1"
55
57
  },
56
58
  "devDependencies": {
57
- "@types/node": "^22.15.3",
59
+ "@types/node": "^22.15.29",
58
60
  "@types/semver": "^7.7.0",
59
- "eslint": "^9.25.1",
60
- "memfs": "^4.17.0",
61
- "vitest": "^3.1.2"
61
+ "eslint": "^9.28.0",
62
+ "memfs": "^4.17.2",
63
+ "vitest": "^3.2.1"
62
64
  },
63
65
  "peerDependencies": {
64
66
  "eslint": ">=9"
65
67
  },
66
68
  "engines": {
67
- "node": "^20.19 || ^22"
69
+ "node": "^20.19 || ^22 || ^24"
68
70
  },
69
71
  "devEngines": {
70
72
  "packageManager": {