@nextcloud/eslint-config 9.0.0-rc.0 → 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 +80 -40
- package/README.md +142 -29
- package/dist/configs/codeStyle.d.ts +13 -0
- package/dist/configs/codeStyle.js +184 -0
- package/dist/configs/documentation.d.ts +12 -0
- package/dist/configs/documentation.js +123 -0
- package/dist/configs/filesystem.d.ts +9 -0
- package/dist/configs/filesystem.js +20 -0
- package/dist/configs/imports.d.ts +12 -0
- package/dist/configs/imports.js +114 -0
- package/dist/configs/javascript.d.ts +14 -0
- package/dist/configs/javascript.js +118 -0
- package/dist/configs/json.d.ts +9 -0
- package/dist/configs/json.js +45 -0
- package/dist/configs/node.d.ts +10 -0
- package/dist/configs/node.js +24 -0
- package/dist/configs/typescript.d.ts +12 -0
- package/dist/configs/typescript.js +60 -0
- package/dist/configs/vue.d.ts +12 -0
- package/dist/configs/vue.js +152 -0
- package/dist/configs/vue2.d.ts +12 -0
- package/dist/configs/vue2.js +30 -0
- package/dist/configs/vue3.d.ts +12 -0
- package/dist/configs/vue3.js +26 -0
- package/dist/globs.d.ts +20 -0
- package/dist/globs.js +39 -0
- package/dist/index.d.ts +27 -31
- package/dist/index.js +78 -0
- package/dist/plugins/l10n/index.d.ts +10 -0
- package/dist/plugins/l10n/index.js +17 -0
- package/dist/plugins/l10n/rules/enforce-ellipsis.d.ts +7 -0
- package/dist/plugins/l10n/rules/enforce-ellipsis.js +32 -0
- package/dist/plugins/l10n/rules/non-breaking-space.d.ts +7 -0
- package/dist/plugins/l10n/rules/non-breaking-space.js +30 -0
- package/dist/plugins/nextcloud/index.d.ts +7 -0
- package/dist/plugins/nextcloud/index.js +9 -0
- package/dist/plugins/nextcloud/rules/index.d.ts +6 -0
- package/dist/plugins/nextcloud/rules/index.js +6 -0
- package/dist/plugins/nextcloud/rules/no-deprecations.d.ts +7 -0
- package/dist/plugins/nextcloud/rules/no-deprecations.js +196 -0
- package/dist/plugins/nextcloud/rules/no-removed-apis.d.ts +7 -0
- package/dist/plugins/nextcloud/rules/no-removed-apis.js +152 -0
- package/dist/plugins/nextcloud/utils/version-parser.d.ts +41 -0
- package/dist/plugins/nextcloud/utils/version-parser.js +106 -0
- package/dist/plugins/nextcloud-vue/index.d.ts +28 -0
- package/dist/plugins/nextcloud-vue/index.js +13 -0
- package/dist/plugins/nextcloud-vue/rules/index.d.ts +17 -0
- package/dist/plugins/nextcloud-vue/rules/index.js +10 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-exports.d.ts +7 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-exports.js +44 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-props.d.ts +20 -0
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-props.js +61 -0
- package/dist/plugins/nextcloud-vue/utils/lib-version-parser.d.ts +33 -0
- package/dist/plugins/nextcloud-vue/utils/lib-version-parser.js +94 -0
- package/dist/plugins/packageJson.d.ts +10 -0
- package/dist/plugins/packageJson.js +66 -0
- package/dist/utils.d.ts +23 -0
- package/dist/utils.js +19 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +6 -0
- package/package.json +26 -22
- package/dist/index.mjs +0 -1464
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,51 +4,91 @@
|
|
|
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.
|
|
11
11
|
Please refer to the README on how to adjust your configuration for flat config.
|
|
12
12
|
|
|
13
13
|
### Added
|
|
14
|
-
* feat:
|
|
15
|
-
*
|
|
14
|
+
* feat: new modular config for (and with) ESLint v9 support [#887](https://github.com/nextcloud-libraries/eslint-config/pull/887)
|
|
15
|
+
* feat: merge plugin repository [#899](https://github.com/nextcloud-libraries/eslint-config/pull/899)
|
|
16
|
+
* feat: enforce non-breaking spaces before ellipsis for translations [\#948](https://github.com/nextcloud-libraries/eslint-config/pull/948)
|
|
17
|
+
* feat: add special config for libraries [\#949](https://github.com/nextcloud-libraries/eslint-config/pull/949)
|
|
18
|
+
* feat: add import and export rules [\#981](https://github.com/nextcloud-libraries/eslint-config/pull/981)
|
|
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))
|
|
16
25
|
|
|
17
26
|
### Fixed
|
|
27
|
+
* fix(codestyle): do not require splitting chains [\#951](https://github.com/nextcloud-libraries/eslint-config/pull/951)
|
|
28
|
+
* fix(codestyle): adjust empty lines style [\#952](https://github.com/nextcloud-libraries/eslint-config/pull/952)
|
|
18
29
|
* fix(codestyle): Enforce no space before function parenthesis [#901](https://github.com/nextcloud-libraries/eslint-config/pull/901)
|
|
19
30
|
* fix(codeStyle): Adjust `stylistic` rules config [#914](https://github.com/nextcloud-libraries/eslint-config/pull/914)
|
|
31
|
+
* fix(codeStyle): allow single line arrays [\#997](https://github.com/nextcloud-libraries/eslint-config/pull/997)
|
|
32
|
+
* fix(codeStyle): allow devs write small objects in one line [\#996](https://github.com/nextcloud-libraries/eslint-config/pull/996)
|
|
33
|
+
* fix(globs): properly ignore test files [\#974](https://github.com/nextcloud-libraries/eslint-config/pull/974)
|
|
34
|
+
* fix(imports): do not mix externals and internals [\#1000](https://github.com/nextcloud-libraries/eslint-config/pull/1000)
|
|
35
|
+
* fix(javascript): allow using functions before they are defined [\#970](https://github.com/nextcloud-libraries/eslint-config/pull/970)
|
|
36
|
+
* fix(javascript): add missing `appName` and `appVersion` global + fix access [\#972](https://github.com/nextcloud-libraries/eslint-config/pull/972)
|
|
37
|
+
* fix(typescript): allow to use function before definition [\#950](https://github.com/nextcloud-libraries/eslint-config/pull/950)
|
|
38
|
+
* fix(typescript): remove `@typescript-eslint/no-shadow` [\#993](https://github.com/nextcloud-libraries/eslint-config/pull/993)
|
|
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))
|
|
20
49
|
|
|
21
50
|
### Changed
|
|
22
51
|
* Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
|
|
23
52
|
* Updated development dependencies
|
|
24
53
|
* refactor(json): drop now unneeded `@ts-expect-error` [#915](https://github.com/nextcloud-libraries/eslint-config/pull/915)
|
|
25
|
-
*
|
|
54
|
+
* refactor: use camelCase for internal variables [#971](https://github.com/nextcloud-libraries/eslint-config/pull/971) ([susnux](https://github.com/susnux))
|
|
55
|
+
* chore: do not bundle config but just use Typescript [#967](https://github.com/nextcloud-libraries/eslint-config/pull/967)
|
|
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))
|
|
65
|
+
* Updated `@eslint/json` to 0.12.0
|
|
26
66
|
* Updated `@stylistic/eslint-plugin` 4.2.0
|
|
27
|
-
* Updated `eslint-plugin-jsdoc` to 50.6.
|
|
67
|
+
* Updated `eslint-plugin-jsdoc` to 50.6.11
|
|
28
68
|
* Updated `eslint-plugin-vue` to 10.0.0
|
|
29
|
-
* Updated `fast-xml-parser` to 5.
|
|
69
|
+
* Updated `fast-xml-parser` to 5.2.1
|
|
30
70
|
* Updated `sort-package-json` to 3.0.0
|
|
31
|
-
* Updated `typescript-eslint` to 8.
|
|
71
|
+
* Updated `typescript-eslint` to 8.31.0
|
|
32
72
|
|
|
33
73
|
## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
|
|
34
74
|
### Fixed
|
|
35
|
-
* fix(typescript): do not require returns type in jsdoc
|
|
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))
|
|
36
76
|
|
|
37
77
|
### Changed
|
|
38
78
|
* Updated development dependencies
|
|
39
|
-
* Add SPDX header
|
|
40
|
-
* enh(git): ignore formatting commits in git blame
|
|
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))
|
|
41
81
|
|
|
42
82
|
## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
|
|
43
83
|
|
|
44
84
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
|
|
45
85
|
|
|
46
86
|
### Fixes
|
|
47
|
-
* fix(vue3): align rules with Vue 2 rules
|
|
48
|
-
* fix(vue3): config crashes ESLint
|
|
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))
|
|
49
89
|
|
|
50
90
|
### Changed
|
|
51
|
-
* build(deps-dev): Bump eslint-plugin-jsdoc from 48.2.4 to 48.2.5
|
|
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))
|
|
52
92
|
|
|
53
93
|
## [v8.4.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.0) (2024-05-15)
|
|
54
94
|
### Features
|
|
@@ -59,36 +99,36 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
59
99
|
|
|
60
100
|
### Features
|
|
61
101
|
* Typescript 5 support
|
|
62
|
-
* Allow linting of typescript with module resolution set to `node16` or `nodenext`
|
|
63
|
-
* Support Composition API & Typescript + Vue projects
|
|
64
|
-
* Allow linting of TSX files
|
|
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))
|
|
65
105
|
|
|
66
106
|
### Fixes
|
|
67
|
-
* Ignore camelcase rule for __webpack variables
|
|
68
|
-
* Add Typescript overrides for all valid Typescript file extensions
|
|
69
|
-
* Allow empty functions
|
|
70
|
-
* fix(typescript): Also set the typescript settings to the vue overrides for typescript import resolving
|
|
71
|
-
* fix(typescript): Allow generic type parameters on function calls
|
|
72
|
-
* Make sure vue files written in Typescript are linted correctly
|
|
73
|
-
* fix: Allow to import packages from `devDependencies` within config files
|
|
74
|
-
* fix: Allow `@jest-environment` docblock for jest tests
|
|
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))
|
|
75
115
|
|
|
76
116
|
### Changed
|
|
77
117
|
* Various dependencies upgrades
|
|
78
|
-
* chore: Update `@nextcloud/eslint-plugin` to version 2.1.0
|
|
79
|
-
* Drop webpack dependency
|
|
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))
|
|
80
120
|
538
|
|
81
|
-
* Update node engines to next LTS (node 20 and NPM 9)
|
|
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))
|
|
82
122
|
565
|
|
83
|
-
* Make eslint to take this config for linting the config
|
|
84
|
-
* chore: Fix URLs after package got transfered
|
|
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))
|
|
85
125
|
|
|
86
126
|
## [v8.2.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.2.1) (2023-01-30)
|
|
87
127
|
|
|
88
128
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.2.0...v8.2.1)
|
|
89
129
|
|
|
90
130
|
**Fixed:**
|
|
91
|
-
- Fix resolving packages that use the package `exports` feature
|
|
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))
|
|
92
132
|
|
|
93
133
|
**Merged pull requests:**
|
|
94
134
|
- Various dependencies upgrades
|
|
@@ -110,8 +150,8 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
110
150
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.4...v8.1.5)
|
|
111
151
|
|
|
112
152
|
**Dependency updates:**
|
|
113
|
-
- Bump json5 from 1.0.1 to 1.0.2
|
|
114
|
-
- Bump json5 from 2.2.1 to 2.2.3
|
|
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))
|
|
115
155
|
|
|
116
156
|
## [v8.1.4](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.4) (2022-11-17)
|
|
117
157
|
|
|
@@ -125,16 +165,16 @@ Please refer to the README on how to adjust your configuration for flat config.
|
|
|
125
165
|
[Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.2...v8.1.3)
|
|
126
166
|
|
|
127
167
|
**Fixed:**
|
|
128
|
-
- Allow TypeScript syntax in JSDoc comments
|
|
168
|
+
- Allow TypeScript syntax in JSDoc comments [#413](https://github.com/nextcloud-libraries/eslint-config/pull/413) ([Pytal](https://github.com/Pytal))
|
|
129
169
|
|
|
130
170
|
**Dependency updates:**
|
|
131
|
-
- Bump @babel/core from 7.18.10 to 7.19.6
|
|
132
|
-
- Bump @babel/eslint-parser from 7.18.9 to 7.19.1
|
|
133
|
-
- Bump eslint from 8.21.0 to 8.26.0
|
|
134
|
-
- Bump eslint-plugin-jsdoc from 39.3.13 to 39.6.2
|
|
135
|
-
- Bump eslint-plugin-n from 15.2.4 to 15.4.0
|
|
136
|
-
- Bump eslint-plugin-promise from 6.0.0 to 6.1.1
|
|
137
|
-
- Bump eslint-plugin-vue from 9.3.0 to 9.7.0
|
|
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))
|
|
138
178
|
|
|
139
179
|
## [v8.1.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.2) (2022-08-09)
|
|
140
180
|
|
package/README.md
CHANGED
|
@@ -5,24 +5,29 @@
|
|
|
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
|
-
> [!NOTE]
|
|
30
|
+
> [!NOTE]
|
|
26
31
|
> Since version 9 this package depends on ESLint 9, which uses the new flat config system.
|
|
27
32
|
|
|
28
33
|
This package provides some predefined configurations you can choose from.
|
|
@@ -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,16 @@ 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
|
|
61
|
+
|
|
62
|
+
For libraries some of the presets make no sense, like checking Nextcloud deprecated API.
|
|
63
|
+
But on the otherhand some rules should be enforced, like documenting all properties.
|
|
64
|
+
So for libraries use following configurations:
|
|
65
|
+
|
|
66
|
+
* `recommendedLibrary`
|
|
67
|
+
* `recommendedVue2Library`
|
|
68
|
+
|
|
69
|
+
#### Bundled plugins
|
|
56
70
|
|
|
57
71
|
This configuration also provides some bundled plugins with new rules, those options are already included in the recommended configurations.
|
|
58
72
|
|
|
@@ -61,14 +75,14 @@ It is possible to override the recommended configurations:
|
|
|
61
75
|
// eslint.config.js
|
|
62
76
|
import { recommended } from '@nextcloud/eslint-config'
|
|
63
77
|
export default [
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
...recommended,
|
|
79
|
+
{
|
|
80
|
+
files: ['**/*.js'],
|
|
81
|
+
rules: {
|
|
82
|
+
// Make deprecations error instead of warning level
|
|
83
|
+
'@nextcloud/no-deprecations': ['error'],
|
|
84
|
+
}
|
|
85
|
+
}
|
|
72
86
|
]
|
|
73
87
|
```
|
|
74
88
|
|
|
@@ -77,25 +91,25 @@ You can even use the plugins without using the Nextcloud ESLint config:
|
|
|
77
91
|
// eslint.config.js
|
|
78
92
|
import { nextcloudPlugin } from '@nextcloud/eslint-config'
|
|
79
93
|
export default [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
{
|
|
95
|
+
files: ['**/*.js'],
|
|
96
|
+
plugins: {
|
|
83
97
|
'@nextcloud': nextcloudPlugin,
|
|
84
98
|
},
|
|
85
99
|
rules: {
|
|
86
100
|
'@nextcloud/no-removed-apis': ['error', { targetVersion: '29.0.0' }],
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
},
|
|
102
|
+
}
|
|
89
103
|
]
|
|
90
104
|
```
|
|
91
105
|
|
|
92
|
-
|
|
106
|
+
##### `package-json` plugin
|
|
93
107
|
Rules:
|
|
94
108
|
- `sort-package-json`
|
|
95
109
|
- Ensures the `package.json` is sorted in consistent order
|
|
96
110
|
- Included as `error` level in recommended configurations
|
|
97
111
|
|
|
98
|
-
|
|
112
|
+
##### `@nextcloud` plugin
|
|
99
113
|
Rules:
|
|
100
114
|
- `no-deprecations`
|
|
101
115
|
- Report usage of deprecated Nextcloud API
|
|
@@ -136,9 +150,108 @@ Rules:
|
|
|
136
150
|
}
|
|
137
151
|
```
|
|
138
152
|
|
|
139
|
-
|
|
153
|
+
##### `@nextcloud-l10n`
|
|
154
|
+
```ts
|
|
155
|
+
import { l10nPlugin } from '@nextcloud/eslint-config'
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Rules:
|
|
159
|
+
- `enforce-ellipsis`
|
|
160
|
+
- Enforce consistent usageof ellipsis instead of tripple dots
|
|
161
|
+
- Included as `error` level in recommended configuration
|
|
162
|
+
- `non-breaking-space`
|
|
163
|
+
- Enforce non-breaking spaces before ellipsis
|
|
164
|
+
- Included as `error` level in recommended configuration
|
|
165
|
+
|
|
166
|
+
#### Adding custom overrides
|
|
167
|
+
|
|
168
|
+
Sometimes additional rules need to be added for individual projects,
|
|
169
|
+
and while we do not recommend to override Nextcloud rules for code style (it should be consistent across all Nextcloud projects!),
|
|
170
|
+
it is possible to add such custom rules.
|
|
171
|
+
|
|
172
|
+
For example to enforce chains to be on separate lines:
|
|
173
|
+
|
|
174
|
+
```diff
|
|
175
|
+
- const a = foo().then((a) => a.b).catch((e) => e.c)
|
|
176
|
+
+ const a = foo()
|
|
177
|
+
+ .then((a) => a.b)
|
|
178
|
+
+ .catch((e) => e.c)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Adjust your `eslint.config.js` like this:
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
import { recommended } from '@nextcloud/eslint-config'
|
|
185
|
+
|
|
186
|
+
export default [
|
|
187
|
+
...recommended,
|
|
188
|
+
{
|
|
189
|
+
rules: {
|
|
190
|
+
'@stylistic/newline-per-chained-call': ['error'],
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
]
|
|
194
|
+
```
|
|
195
|
+
|
|
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
|
|
140
238
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
+

|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
*/
|
|
5
|
+
import type { Linter } from 'eslint';
|
|
6
|
+
import type { ConfigOptions } from '../types.d.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Config factory for general code style related rules
|
|
9
|
+
* See also: https://docs.nextcloud.com/server/latest/developer_manual/getting_started/coding_standards/javascript.html#code-style
|
|
10
|
+
*
|
|
11
|
+
* @param options options defining the config preset flavor
|
|
12
|
+
*/
|
|
13
|
+
export declare function codeStyle(options: ConfigOptions): (Linter.Config | Linter.BaseConfig)[];
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import stylistic from '@stylistic/eslint-plugin';
|
|
2
|
+
import eslintAntfuPlugin from 'eslint-plugin-antfu';
|
|
3
|
+
import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
|
|
4
|
+
import l10nPlugin from "../plugins/l10n/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Config factory for general code style related rules
|
|
7
|
+
* See also: https://docs.nextcloud.com/server/latest/developer_manual/getting_started/coding_standards/javascript.html#code-style
|
|
8
|
+
*
|
|
9
|
+
* @param options options defining the config preset flavor
|
|
10
|
+
*/
|
|
11
|
+
export function codeStyle(options) {
|
|
12
|
+
return [
|
|
13
|
+
// Nextcloud code style
|
|
14
|
+
{
|
|
15
|
+
name: '@stylistic/configs/recommended',
|
|
16
|
+
files: [
|
|
17
|
+
...GLOB_FILES_JAVASCRIPT,
|
|
18
|
+
...GLOB_FILES_TYPESCRIPT,
|
|
19
|
+
...GLOB_FILES_VUE,
|
|
20
|
+
],
|
|
21
|
+
...stylistic.configs.customize({
|
|
22
|
+
indent: 'tab',
|
|
23
|
+
semi: false,
|
|
24
|
+
quotes: 'single',
|
|
25
|
+
quoteProps: 'as-needed',
|
|
26
|
+
commaDangle: 'always-multiline',
|
|
27
|
+
arrowParens: true,
|
|
28
|
+
braceStyle: '1tbs',
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'nextcloud/stylistic/rules',
|
|
33
|
+
files: [
|
|
34
|
+
...GLOB_FILES_JAVASCRIPT,
|
|
35
|
+
...GLOB_FILES_TYPESCRIPT,
|
|
36
|
+
...GLOB_FILES_VUE,
|
|
37
|
+
],
|
|
38
|
+
plugins: {
|
|
39
|
+
antfu: eslintAntfuPlugin,
|
|
40
|
+
},
|
|
41
|
+
rules: {
|
|
42
|
+
// Overrides for the stylistic recommended rules
|
|
43
|
+
// Tabs should only be used for indention
|
|
44
|
+
'@stylistic/no-tabs': [
|
|
45
|
+
'error',
|
|
46
|
+
{ allowIndentationTabs: true },
|
|
47
|
+
],
|
|
48
|
+
// allow spaces after tabs for alignment
|
|
49
|
+
'@stylistic/no-mixed-spaces-and-tabs': [
|
|
50
|
+
'error',
|
|
51
|
+
'smart-tabs',
|
|
52
|
+
],
|
|
53
|
+
// allow backticks for strings that contain single quotes
|
|
54
|
+
'@stylistic/quotes': [
|
|
55
|
+
'error',
|
|
56
|
+
'single',
|
|
57
|
+
{
|
|
58
|
+
allowTemplateLiterals: false,
|
|
59
|
+
avoidEscape: true,
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
// Not included in stylistic preset but set by us:
|
|
63
|
+
// Enforce camelCase but allow legacy webpack variables
|
|
64
|
+
camelcase: [
|
|
65
|
+
'error',
|
|
66
|
+
{
|
|
67
|
+
allow: ['^__webpack_'],
|
|
68
|
+
properties: 'never',
|
|
69
|
+
ignoreGlobals: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
// Make sure to use object shorthand properties
|
|
73
|
+
'object-shorthand': [
|
|
74
|
+
'error',
|
|
75
|
+
'properties',
|
|
76
|
+
{ avoidQuotes: true },
|
|
77
|
+
],
|
|
78
|
+
// Enforce new lines after [ and before ] if there are multiline entries or more than 1 item in the array (better git diff)
|
|
79
|
+
'@stylistic/array-bracket-newline': [
|
|
80
|
+
'error',
|
|
81
|
+
{
|
|
82
|
+
multiline: true,
|
|
83
|
+
minItems: null, // disable
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
// Enforce new lines between array elements (better git diff) but allow to have single line arrays
|
|
87
|
+
'@stylistic/array-element-newline': ['error', 'consistent'],
|
|
88
|
+
// Same for objects as for arrays
|
|
89
|
+
'@stylistic/object-curly-newline': [
|
|
90
|
+
'error',
|
|
91
|
+
{
|
|
92
|
+
consistent: true,
|
|
93
|
+
multiline: true,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
'@stylistic/object-property-newline': [
|
|
97
|
+
'error',
|
|
98
|
+
{ allowAllPropertiesOnSameLine: true },
|
|
99
|
+
],
|
|
100
|
+
// No space between function name and parenthesis. Enforce fn() instead of fn ()
|
|
101
|
+
'@stylistic/function-call-spacing': [
|
|
102
|
+
'error',
|
|
103
|
+
'never',
|
|
104
|
+
],
|
|
105
|
+
// No space between function name and parenthesis on definition. Enforce `function foo()` instead of `function foo ()`.
|
|
106
|
+
'@stylistic/space-before-function-paren': [
|
|
107
|
+
'error',
|
|
108
|
+
{
|
|
109
|
+
// good: `function() {}` bad: `function () {}`
|
|
110
|
+
anonymous: 'never',
|
|
111
|
+
// good `function foo() {}` bad: `function foo () {}`
|
|
112
|
+
named: 'never',
|
|
113
|
+
// consistency for arrow functions regardless of async or sync:
|
|
114
|
+
// good `async () => {}` bad `async() => {}`
|
|
115
|
+
asyncArrow: 'always',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
// Enforce consistent newlines in function parameters, if one parameter is separated by newline, than all should
|
|
119
|
+
'@stylistic/function-call-argument-newline': [
|
|
120
|
+
'error',
|
|
121
|
+
'consistent',
|
|
122
|
+
],
|
|
123
|
+
// If parameters are separated by newlines, then the first one should also be separated by a newline from the parenthesis
|
|
124
|
+
'@stylistic/function-paren-newline': [
|
|
125
|
+
'error',
|
|
126
|
+
'multiline',
|
|
127
|
+
],
|
|
128
|
+
// Generator functions should have the * on the function keyword as this defines the type of function. "function* generator()"
|
|
129
|
+
'@stylistic/generator-star-spacing': [
|
|
130
|
+
'error',
|
|
131
|
+
'after',
|
|
132
|
+
],
|
|
133
|
+
// Arrow functions with implicit return should not have line breaks
|
|
134
|
+
// TODO: Discuss
|
|
135
|
+
'@stylistic/implicit-arrow-linebreak': [
|
|
136
|
+
'error',
|
|
137
|
+
'beside',
|
|
138
|
+
],
|
|
139
|
+
// Prevent issues with different OS by enforcing single line feed for new lien
|
|
140
|
+
'@stylistic/linebreak-style': [
|
|
141
|
+
'error',
|
|
142
|
+
'unix',
|
|
143
|
+
],
|
|
144
|
+
// No useless semicolons
|
|
145
|
+
'@stylistic/no-extra-semi': ['error'],
|
|
146
|
+
'no-useless-concat': 'error',
|
|
147
|
+
// Prefer { ...foo } over Object.assign({}, foo)
|
|
148
|
+
'prefer-object-spread': 'warn',
|
|
149
|
+
// Enforce function declarations for top level functions
|
|
150
|
+
'antfu/top-level-function': 'error',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'nextcloud/stylistic/ts-rules',
|
|
155
|
+
files: [
|
|
156
|
+
...GLOB_FILES_TYPESCRIPT,
|
|
157
|
+
...(options.vueIsTypescript ? GLOB_FILES_VUE : []),
|
|
158
|
+
],
|
|
159
|
+
rules: {
|
|
160
|
+
// consistent spacing for types
|
|
161
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
162
|
+
// consistent spacing for generics
|
|
163
|
+
'@stylistic/type-generic-spacing': 'error',
|
|
164
|
+
'@stylistic/type-named-tuple-spacing': 'error',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'nextcloud/stylistic/l10n',
|
|
169
|
+
files: [
|
|
170
|
+
...GLOB_FILES_JAVASCRIPT,
|
|
171
|
+
...GLOB_FILES_TYPESCRIPT,
|
|
172
|
+
...GLOB_FILES_VUE,
|
|
173
|
+
],
|
|
174
|
+
plugins: {
|
|
175
|
+
'@nextcloud-l10n': l10nPlugin,
|
|
176
|
+
},
|
|
177
|
+
// Enforce that translations use ellipsis instead of tripple dots
|
|
178
|
+
rules: {
|
|
179
|
+
'@nextcloud-l10n/non-breaking-space': 'error',
|
|
180
|
+
'@nextcloud-l10n/enforce-ellipsis': 'error',
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
];
|
|
184
|
+
}
|