@nextcloud/eslint-config 9.0.0-rc.1 → 9.0.0-rc.3
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 +64 -34
- package/README.md +79 -18
- package/dist/configs/codeStyle.js +9 -6
- package/dist/configs/documentation.js +51 -12
- package/dist/configs/filesystem.js +9 -0
- package/dist/configs/imports.js +3 -11
- package/dist/configs/typescript.js +8 -1
- package/dist/configs/vue.js +20 -2
- package/dist/configs/vue3.js +2 -0
- package/dist/globs.d.ts +2 -0
- package/dist/globs.js +2 -0
- package/dist/plugins/import-extensions/index.d.ts +14 -0
- package/dist/plugins/import-extensions/index.js +13 -0
- package/dist/plugins/import-extensions/rules/extensions.d.ts +11 -0
- package/dist/plugins/import-extensions/rules/extensions.js +143 -0
- package/dist/plugins/import-extensions/rules/index.d.ts +7 -0
- package/dist/plugins/import-extensions/rules/index.js +8 -0
- package/dist/plugins/nextcloud-vue/index.d.ts +34 -1
- package/dist/plugins/nextcloud-vue/index.js +4 -0
- package/dist/plugins/nextcloud-vue/rules/index.d.ts +30 -6
- package/dist/plugins/nextcloud-vue/rules/index.js +6 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-exports.js +9 -6
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-props.d.ts +33 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-props.js +236 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +25 -20
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) (
|
|
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,14 @@ 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))
|
|
25
|
+
* feat(no-deprecated-props): extend existing rules to support other components [\#1069](https://github.com/nextcloud-libraries/eslint-config/pull/1069) \([Antreesy](https://github.com/Antreesy)\)
|
|
26
|
+
* feat(imports): add custom plugin to suggest file extensions [\#1110](https://github.com/nextcloud-libraries/eslint-config/pull/1110) \([susnux](https://github.com/susnux)\)
|
|
27
|
+
* feat(filesystem): ignore all files within the `.gitignore` [\#1108](https://github.com/nextcloud-libraries/eslint-config/pull/1108) \([susnux](https://github.com/susnux)\)
|
|
20
28
|
|
|
21
29
|
### Fixed
|
|
22
30
|
* fix(codestyle): do not require splitting chains [\#951](https://github.com/nextcloud-libraries/eslint-config/pull/951)
|
|
@@ -32,13 +40,35 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
32
40
|
* fix(typescript): allow to use function before definition [\#950](https://github.com/nextcloud-libraries/eslint-config/pull/950)
|
|
33
41
|
* fix(typescript): remove `@typescript-eslint/no-shadow` [\#993](https://github.com/nextcloud-libraries/eslint-config/pull/993)
|
|
34
42
|
* fix(typescript): enforce `import type` for type only imports [\#977](https://github.com/nextcloud-libraries/eslint-config/pull/977)
|
|
43
|
+
* fix(vue): allow JS Vue files [#998](https://github.com/nextcloud-libraries/eslint-config/pull/998) ([ShGKme](https://github.com/ShGKme))
|
|
44
|
+
* 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))
|
|
45
|
+
* fix(typescript): allow import in type annotation [#1034](https://github.com/nextcloud-libraries/eslint-config/pull/1034) ([ShGKme](https://github.com/ShGKme))
|
|
46
|
+
* fix(documentation): do not lint tests for documentation issues [#1062](https://github.com/nextcloud-libraries/eslint-config/pull/1062) ([susnux](https://github.com/susnux))
|
|
47
|
+
* fix: ignore `l10n` and `js` directory for apps [#1061](https://github.com/nextcloud-libraries/eslint-config/pull/1061) ([susnux](https://github.com/susnux))
|
|
48
|
+
* fix(imports): do not mix externals and internals [#1000](https://github.com/nextcloud-libraries/eslint-config/pull/1000) ([ShGKme](https://github.com/ShGKme))
|
|
49
|
+
* fix(codeStyle): allow single line arrays [#997](https://github.com/nextcloud-libraries/eslint-config/pull/997) ([ShGKme](https://github.com/ShGKme))
|
|
50
|
+
* fix(typescript): remove `@typescript-eslint/no-shadow` [#993](https://github.com/nextcloud-libraries/eslint-config/pull/993) ([ShGKme](https://github.com/ShGKme))
|
|
51
|
+
* 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))
|
|
52
|
+
* fix: ignore test report directories from linting [\#1096](https://github.com/nextcloud-libraries/eslint-config/pull/1096) \([Antreesy](https://github.com/Antreesy)\)
|
|
53
|
+
* fix(vue): also ignore the global router link component [\#1097](https://github.com/nextcloud-libraries/eslint-config/pull/1097) \([susnux](https://github.com/susnux)\)
|
|
54
|
+
* fix(no-deprecated-props): respect nextcloud/vue library version for the rule [\#1084](https://github.com/nextcloud-libraries/eslint-config/pull/1084) \([Antreesy](https://github.com/Antreesy)\)
|
|
55
|
+
* fix(codestyle): replace deprecated config in `@stylistic/quotes` rule [\#1109](https://github.com/nextcloud-libraries/eslint-config/pull/1109) \([susnux](https://github.com/susnux)\)
|
|
35
56
|
|
|
36
57
|
### Changed
|
|
37
58
|
* Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
|
|
38
59
|
* Updated development dependencies
|
|
39
60
|
* refactor(json): drop now unneeded `@ts-expect-error` [#915](https://github.com/nextcloud-libraries/eslint-config/pull/915)
|
|
61
|
+
* refactor: use camelCase for internal variables [#971](https://github.com/nextcloud-libraries/eslint-config/pull/971) ([susnux](https://github.com/susnux))
|
|
40
62
|
* chore: do not bundle config but just use Typescript [#967](https://github.com/nextcloud-libraries/eslint-config/pull/967)
|
|
41
63
|
* chore: require node ^20.19 [\#982](https://github.com/nextcloud-libraries/eslint-config/pull/982)
|
|
64
|
+
* chore: allow to run `npm lint` without compile step [#975](https://github.com/nextcloud-libraries/eslint-config/pull/975) ([susnux](https://github.com/susnux))
|
|
65
|
+
* chore: prepare v9.0.0-rc.1 [#1010](https://github.com/nextcloud-libraries/eslint-config/pull/1010) ([susnux](https://github.com/susnux))
|
|
66
|
+
* docs: consistent badge style with the reuse one [#1060](https://github.com/nextcloud-libraries/eslint-config/pull/1060) ([susnux](https://github.com/susnux))
|
|
67
|
+
* docs: add documentation about update policy and development [#1009](https://github.com/nextcloud-libraries/eslint-config/pull/1009) ([susnux](https://github.com/susnux))
|
|
68
|
+
* 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))
|
|
69
|
+
* ci: update workflows from organization [#1047](https://github.com/nextcloud-libraries/eslint-config/pull/1047) ([susnux](https://github.com/susnux))
|
|
70
|
+
* chore: add active node version (24) to supported engines [#1066](https://github.com/nextcloud-libraries/eslint-config/pull/1066) ([susnux](https://github.com/susnux))
|
|
71
|
+
* 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
72
|
* Updated `@eslint/json` to 0.12.0
|
|
43
73
|
* Updated `@stylistic/eslint-plugin` 4.2.0
|
|
44
74
|
* Updated `eslint-plugin-jsdoc` to 50.6.11
|
|
@@ -49,23 +79,23 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
49
79
|
|
|
50
80
|
## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
|
|
51
81
|
### Fixed
|
|
52
|
-
* fix(typescript): do not require returns type in jsdoc
|
|
82
|
+
* 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
83
|
|
|
54
84
|
### Changed
|
|
55
85
|
* Updated development dependencies
|
|
56
|
-
* Add SPDX header
|
|
57
|
-
* enh(git): ignore formatting commits in git blame
|
|
86
|
+
* Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802) ([AndyScherzinger](https://github.com/AndyScherzinger))
|
|
87
|
+
* 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
88
|
|
|
59
89
|
## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
|
|
60
90
|
|
|
61
91
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
|
|
62
92
|
|
|
63
93
|
### Fixes
|
|
64
|
-
* fix(vue3): align rules with Vue 2 rules
|
|
65
|
-
* fix(vue3): config crashes ESLint
|
|
94
|
+
* fix(vue3): align rules with Vue 2 rules [#771](https://github.com/nextcloud-libraries/eslint-config/pull/771) ([ShGKme](https://github.com/ShGKme))
|
|
95
|
+
* fix(vue3): config crashes ESLint [#770](https://github.com/nextcloud-libraries/eslint-config/pull/770) ([ShGKme](https://github.com/ShGKme))
|
|
66
96
|
|
|
67
97
|
### Changed
|
|
68
|
-
* build(deps-dev): Bump eslint-plugin-jsdoc from 48.2.4 to 48.2.5
|
|
98
|
+
* 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
99
|
|
|
70
100
|
## [v8.4.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.0) (2024-05-15)
|
|
71
101
|
### Features
|
|
@@ -76,36 +106,36 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
76
106
|
|
|
77
107
|
### Features
|
|
78
108
|
* Typescript 5 support
|
|
79
|
-
* Allow linting of typescript with module resolution set to `node16` or `nodenext`
|
|
80
|
-
* Support Composition API & Typescript + Vue projects
|
|
81
|
-
* Allow linting of TSX files
|
|
109
|
+
* 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))
|
|
110
|
+
* Support Composition API & Typescript + Vue projects [#562](https://github.com/nextcloud-libraries/eslint-config/pull/562) ([susnux](https://github.com/susnux))
|
|
111
|
+
* Allow linting of TSX files [#456](https://github.com/nextcloud-libraries/eslint-config/pull/456) ([susnux](https://github.com/susnux))
|
|
82
112
|
|
|
83
113
|
### Fixes
|
|
84
|
-
* Ignore camelcase rule for __webpack variables
|
|
85
|
-
* Add Typescript overrides for all valid Typescript file extensions
|
|
86
|
-
* Allow empty functions
|
|
87
|
-
* fix(typescript): Also set the typescript settings to the vue overrides for typescript import resolving
|
|
88
|
-
* fix(typescript): Allow generic type parameters on function calls
|
|
89
|
-
* Make sure vue files written in Typescript are linted correctly
|
|
90
|
-
* fix: Allow to import packages from `devDependencies` within config files
|
|
91
|
-
* fix: Allow `@jest-environment` docblock for jest tests
|
|
114
|
+
* Ignore camelcase rule for __webpack variables [#530](https://github.com/nextcloud-libraries/eslint-config/pull/530) ([kesselb](https://github.com/kesselb))
|
|
115
|
+
* Add Typescript overrides for all valid Typescript file extensions [#567](https://github.com/nextcloud-libraries/eslint-config/pull/567) ([susnux](https://github.com/susnux))
|
|
116
|
+
* Allow empty functions [#570](https://github.com/nextcloud-libraries/eslint-config/pull/570) ([skjnldsv](https://github.com/skjnldsv))
|
|
117
|
+
* 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))
|
|
118
|
+
* fix(typescript): Allow generic type parameters on function calls [#571](https://github.com/nextcloud-libraries/eslint-config/pull/571) ([susnux](https://github.com/susnux))
|
|
119
|
+
* 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))
|
|
120
|
+
* 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))
|
|
121
|
+
* fix: Allow `@jest-environment` docblock for jest tests [#592](https://github.com/nextcloud-libraries/eslint-config/pull/592) ([susnux](https://github.com/susnux))
|
|
92
122
|
|
|
93
123
|
### Changed
|
|
94
124
|
* Various dependencies upgrades
|
|
95
|
-
* chore: Update `@nextcloud/eslint-plugin` to version 2.1.0
|
|
96
|
-
* Drop webpack dependency
|
|
125
|
+
* 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))
|
|
126
|
+
* Drop webpack dependency [#528](https://github.com/nextcloud-libraries/eslint-config/pull/528) ([susnux](https://github.com/susnux))
|
|
97
127
|
538
|
|
98
|
-
* Update node engines to next LTS (node 20 and NPM 9)
|
|
128
|
+
* 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
129
|
565
|
|
100
|
-
* Make eslint to take this config for linting the config
|
|
101
|
-
* chore: Fix URLs after package got transfered
|
|
130
|
+
* 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))
|
|
131
|
+
* chore: Fix URLs after package got transfered [#602](https://github.com/nextcloud-libraries/eslint-config/pull/602) ([susnux](https://github.com/susnux))
|
|
102
132
|
|
|
103
133
|
## [v8.2.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.2.1) (2023-01-30)
|
|
104
134
|
|
|
105
135
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.2.0...v8.2.1)
|
|
106
136
|
|
|
107
137
|
**Fixed:**
|
|
108
|
-
- Fix resolving packages that use the package `exports` feature
|
|
138
|
+
- 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
139
|
|
|
110
140
|
**Merged pull requests:**
|
|
111
141
|
- Various dependencies upgrades
|
|
@@ -127,8 +157,8 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
127
157
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.4...v8.1.5)
|
|
128
158
|
|
|
129
159
|
**Dependency updates:**
|
|
130
|
-
- Bump json5 from 1.0.1 to 1.0.2
|
|
131
|
-
- Bump json5 from 2.2.1 to 2.2.3
|
|
160
|
+
- 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))
|
|
161
|
+
- 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
162
|
|
|
133
163
|
## [v8.1.4](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.4) (2022-11-17)
|
|
134
164
|
|
|
@@ -142,16 +172,16 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
142
172
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.2...v8.1.3)
|
|
143
173
|
|
|
144
174
|
**Fixed:**
|
|
145
|
-
- Allow TypeScript syntax in JSDoc comments
|
|
175
|
+
- Allow TypeScript syntax in JSDoc comments [#413](https://github.com/nextcloud-libraries/eslint-config/pull/413) ([Pytal](https://github.com/Pytal))
|
|
146
176
|
|
|
147
177
|
**Dependency updates:**
|
|
148
|
-
- Bump @babel/core from 7.18.10 to 7.19.6
|
|
149
|
-
- Bump @babel/eslint-parser from 7.18.9 to 7.19.1
|
|
150
|
-
- Bump eslint from 8.21.0 to 8.26.0
|
|
151
|
-
- Bump eslint-plugin-jsdoc from 39.3.13 to 39.6.2
|
|
152
|
-
- Bump eslint-plugin-n from 15.2.4 to 15.4.0
|
|
153
|
-
- Bump eslint-plugin-promise from 6.0.0 to 6.1.1
|
|
154
|
-
- Bump eslint-plugin-vue from 9.3.0 to 9.7.0
|
|
178
|
+
- 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))
|
|
179
|
+
- 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))
|
|
180
|
+
- 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))
|
|
181
|
+
- 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))
|
|
182
|
+
- 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))
|
|
183
|
+
- 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))
|
|
184
|
+
- 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
185
|
|
|
156
186
|
## [v8.1.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.2) (2022-08-09)
|
|
157
187
|
|
package/README.md
CHANGED
|
@@ -5,22 +5,27 @@
|
|
|
5
5
|
## @nextcloud/eslint-config
|
|
6
6
|
|
|
7
7
|
[](https://api.reuse.software/info/github.com/nextcloud-libraries/eslint-config)
|
|
8
|
-
[](https://www.npmjs.com/package/@nextcloud/eslint-config)
|
|
9
|
+
[](https://github.com/nextcloud-libraries/eslint-config/actions/workflows/lint.yml)
|
|
10
|
+
[](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
|
-
|
|
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
|
|
25
|
+
npm install --save-dev @nextcloud/eslint-config
|
|
21
26
|
```
|
|
22
27
|
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
+

|
|
@@ -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
|
|
@@ -51,7 +55,7 @@ export function codeStyle(options) {
|
|
|
51
55
|
'error',
|
|
52
56
|
'single',
|
|
53
57
|
{
|
|
54
|
-
allowTemplateLiterals:
|
|
58
|
+
allowTemplateLiterals: 'never',
|
|
55
59
|
avoidEscape: true,
|
|
56
60
|
},
|
|
57
61
|
],
|
|
@@ -71,13 +75,10 @@ export function codeStyle(options) {
|
|
|
71
75
|
'properties',
|
|
72
76
|
{ avoidQuotes: true },
|
|
73
77
|
],
|
|
74
|
-
// Enforce new lines after [ and before ]
|
|
78
|
+
// Enforce consistent new lines after [ and before ]
|
|
75
79
|
'@stylistic/array-bracket-newline': [
|
|
76
80
|
'error',
|
|
77
|
-
|
|
78
|
-
multiline: true,
|
|
79
|
-
minItems: null, // disable
|
|
80
|
-
},
|
|
81
|
+
'consistent',
|
|
81
82
|
],
|
|
82
83
|
// Enforce new lines between array elements (better git diff) but allow to have single line arrays
|
|
83
84
|
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
@@ -142,6 +143,8 @@ export function codeStyle(options) {
|
|
|
142
143
|
'no-useless-concat': 'error',
|
|
143
144
|
// Prefer { ...foo } over Object.assign({}, foo)
|
|
144
145
|
'prefer-object-spread': 'warn',
|
|
146
|
+
// Enforce function declarations for top level functions
|
|
147
|
+
'antfu/top-level-function': 'error',
|
|
145
148
|
},
|
|
146
149
|
},
|
|
147
150
|
{
|
|
@@ -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
|
}
|
|
@@ -2,14 +2,23 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
+
import gitignore from 'eslint-config-flat-gitignore';
|
|
5
6
|
/**
|
|
6
7
|
* General config to exclude known non-source directories from linting
|
|
7
8
|
*/
|
|
8
9
|
export const filesystem = [
|
|
10
|
+
{
|
|
11
|
+
...gitignore(),
|
|
12
|
+
name: 'nextcloud/filesystem/gitignore',
|
|
13
|
+
},
|
|
9
14
|
{
|
|
10
15
|
name: 'nextcloud/filesystem/ignores',
|
|
11
16
|
ignores: [
|
|
17
|
+
'**/coverage',
|
|
12
18
|
'**/dist',
|
|
19
|
+
'**/js',
|
|
20
|
+
'**/l10n',
|
|
21
|
+
'**/playwright-report',
|
|
13
22
|
'**/vendor',
|
|
14
23
|
'**/vendor-bin',
|
|
15
24
|
'**/package-lock.json',
|
package/dist/configs/imports.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
2
2
|
import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
|
|
3
|
+
import importExtensions from "../plugins/import-extensions/index.js";
|
|
3
4
|
/**
|
|
4
5
|
* Generate imports and exports related ESLint rules.
|
|
5
6
|
*
|
|
@@ -12,6 +13,7 @@ export function imports(options) {
|
|
|
12
13
|
name: 'nextcloud/imports/setup',
|
|
13
14
|
plugins: {
|
|
14
15
|
perfectionist,
|
|
16
|
+
'import-extensions': importExtensions,
|
|
15
17
|
},
|
|
16
18
|
},
|
|
17
19
|
{
|
|
@@ -23,17 +25,7 @@ export function imports(options) {
|
|
|
23
25
|
],
|
|
24
26
|
rules: {
|
|
25
27
|
// Require file extensions
|
|
26
|
-
'
|
|
27
|
-
'error',
|
|
28
|
-
{
|
|
29
|
-
patterns: [
|
|
30
|
-
{
|
|
31
|
-
regex: '^(\\.*)/(.+/)*[^/.]+$',
|
|
32
|
-
message: 'Import is missing the file extension.',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
28
|
+
'import-extensions/extensions': 'error',
|
|
37
29
|
// Sorting of imports
|
|
38
30
|
'sort-imports': 'off',
|
|
39
31
|
'perfectionist/sort-imports': [
|
|
@@ -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: {
|
package/dist/configs/vue.js
CHANGED
|
@@ -84,12 +84,14 @@ 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',
|
|
90
92
|
{
|
|
91
|
-
// Ignore the router view as this is most often globally registered
|
|
92
|
-
ignorePatterns: ['
|
|
93
|
+
// Ignore the router link and view as this is (most often) globally registered
|
|
94
|
+
ignorePatterns: ['RouterLink', 'RouterView'],
|
|
93
95
|
},
|
|
94
96
|
],
|
|
95
97
|
// Warn on unused refs
|
|
@@ -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
|
},
|
package/dist/configs/vue3.js
CHANGED
|
@@ -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
|
},
|