@nextcloud/eslint-config 9.0.0-rc.1 → 9.0.0-rc.10

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +114 -42
  2. package/README.md +85 -31
  3. package/dist/configs/codeStyle.d.ts +1 -1
  4. package/dist/configs/codeStyle.js +27 -29
  5. package/dist/configs/documentation.js +71 -38
  6. package/dist/configs/filesystem.js +10 -3
  7. package/dist/configs/imports.d.ts +1 -1
  8. package/dist/configs/imports.js +15 -18
  9. package/dist/configs/javascript.js +2 -2
  10. package/dist/configs/typescript.js +8 -1
  11. package/dist/configs/vue.js +36 -12
  12. package/dist/configs/vue2.js +2 -2
  13. package/dist/configs/vue3.js +24 -0
  14. package/dist/globs.d.ts +2 -0
  15. package/dist/globs.js +6 -2
  16. package/dist/index.d.ts +11 -7
  17. package/dist/index.js +4 -1
  18. package/dist/plugins/import-extensions/index.d.ts +15 -0
  19. package/dist/plugins/{nextcloud-vue → import-extensions}/index.js +4 -0
  20. package/dist/plugins/import-extensions/rules/ban-inline-type-imports.d.ts +7 -0
  21. package/dist/plugins/import-extensions/rules/ban-inline-type-imports.js +176 -0
  22. package/dist/plugins/import-extensions/rules/extensions.d.ts +11 -0
  23. package/dist/plugins/import-extensions/rules/extensions.js +143 -0
  24. package/dist/plugins/import-extensions/rules/index.d.ts +8 -0
  25. package/dist/plugins/import-extensions/rules/index.js +10 -0
  26. package/dist/plugins/nextcloud/rules/index.js +16 -4
  27. package/dist/plugins/nextcloud/rules/l10n-enforce-ellipsis.js +44 -0
  28. package/dist/plugins/{l10n/rules/non-breaking-space.js → nextcloud/rules/l10n-non-breaking-space.js} +11 -2
  29. package/dist/plugins/nextcloud/rules/{no-deprecations.js → no-deprecated-globals.js} +16 -3
  30. package/dist/plugins/nextcloud/rules/no-deprecated-library-exports.js +89 -0
  31. package/dist/plugins/nextcloud/rules/no-deprecated-library-props.d.ts +41 -0
  32. package/dist/plugins/nextcloud/rules/no-deprecated-library-props.js +429 -0
  33. package/dist/plugins/nextcloud/rules/{no-removed-apis.js → no-removed-globals.js} +53 -2
  34. package/dist/plugins/nextcloud/utils/lib-version-parser.d.ts +18 -0
  35. package/dist/plugins/nextcloud/utils/lib-version-parser.js +49 -0
  36. package/dist/plugins/nextcloud/utils/vue-template-visitor.d.ts +26 -0
  37. package/dist/plugins/nextcloud/utils/vue-template-visitor.js +38 -0
  38. package/dist/utils.d.ts +1 -12
  39. package/package.json +31 -25
  40. package/dist/plugins/l10n/index.d.ts +0 -10
  41. package/dist/plugins/l10n/index.js +0 -17
  42. package/dist/plugins/l10n/rules/enforce-ellipsis.js +0 -32
  43. package/dist/plugins/nextcloud-vue/index.d.ts +0 -8
  44. package/dist/plugins/nextcloud-vue/rules/index.d.ts +0 -6
  45. package/dist/plugins/nextcloud-vue/rules/index.js +0 -4
  46. package/dist/plugins/nextcloud-vue/rules/no-deprecated-exports.js +0 -44
  47. package/dist/plugins/nextcloud-vue/utils/lib-version-parser.d.ts +0 -33
  48. package/dist/plugins/nextcloud-vue/utils/lib-version-parser.js +0 -94
  49. /package/dist/plugins/{l10n/rules/enforce-ellipsis.d.ts → nextcloud/rules/l10n-enforce-ellipsis.d.ts} +0 -0
  50. /package/dist/plugins/{l10n/rules/non-breaking-space.d.ts → nextcloud/rules/l10n-non-breaking-space.d.ts} +0 -0
  51. /package/dist/plugins/{nextcloud-vue/rules/no-deprecated-exports.d.ts → nextcloud/rules/no-deprecated-globals.d.ts} +0 -0
  52. /package/dist/plugins/nextcloud/rules/{no-deprecations.d.ts → no-deprecated-library-exports.d.ts} +0 -0
  53. /package/dist/plugins/nextcloud/rules/{no-removed-apis.d.ts → no-removed-globals.d.ts} +0 -0
  54. /package/dist/plugins/nextcloud/utils/{version-parser.d.ts → app-version-parser.d.ts} +0 -0
  55. /package/dist/plugins/nextcloud/utils/{version-parser.js → app-version-parser.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -4,19 +4,47 @@
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
- This package now is using ESLint v9 and requires ESLint flat configurations.
10
+ This package now is using ESLint v10 and requires ESLint flat configurations.
11
11
  Please refer to the README on how to adjust your configuration for flat config.
12
12
 
13
+ #### Potential pitfalls
14
+ Some of the used eslint plugins still keep a ESLint v8 compatibility,
15
+ this can cause some issues if not all packages are updated to the ESLint v10 compatible version.
16
+
17
+ If you see a linter error like the one below make sure to update all nested dependencies,
18
+ either using the sledge hammer method (remove the lock file and run `npm i`) or by running `npm update`.
19
+
20
+ > TypeError: scopeManager.addGlobals is not a function
21
+
13
22
  ### Added
23
+ * feat: migrate to ESLint v10 [\#1323](https://github.com/nextcloud-libraries/eslint-config/pull/1323) \([susnux](https://github.com/susnux)\)
14
24
  * feat: new modular config for (and with) ESLint v9 support [#887](https://github.com/nextcloud-libraries/eslint-config/pull/887)
15
25
  * feat: merge plugin repository [#899](https://github.com/nextcloud-libraries/eslint-config/pull/899)
16
26
  * feat: enforce non-breaking spaces before ellipsis for translations [\#948](https://github.com/nextcloud-libraries/eslint-config/pull/948)
17
27
  * feat: add special config for libraries [\#949](https://github.com/nextcloud-libraries/eslint-config/pull/949)
18
28
  * feat: add import and export rules [\#981](https://github.com/nextcloud-libraries/eslint-config/pull/981)
19
29
  * feat: introduce @nextcloud/vue eslint plugin [\#939](https://github.com/nextcloud-libraries/eslint-config/pull/939)
30
+ * feat(codeStyle): enforce top-level-function [#1033](https://github.com/nextcloud-libraries/eslint-config/pull/1033) ([ShGKme](https://github.com/ShGKme))
31
+ * feat(nextcloud-vue): add rule for deprecated NcButton props [#1045](https://github.com/nextcloud-libraries/eslint-config/pull/1045) ([susnux](https://github.com/susnux))
32
+ * feat(vue): add `vue/no-useless-v-bind` rule [#1063](https://github.com/nextcloud-libraries/eslint-config/pull/1063) ([susnux](https://github.com/susnux))
33
+ * feat(vue): add `vue/prefer-separate-static-class` rule [#1065](https://github.com/nextcloud-libraries/eslint-config/pull/1065) ([susnux](https://github.com/susnux))
34
+ * feat(vue3): add script-setup releated rules [#1064](https://github.com/nextcloud-libraries/eslint-config/pull/1064) ([susnux](https://github.com/susnux))
35
+ * 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)\)
36
+ * feat(imports): add custom plugin to suggest file extensions [\#1110](https://github.com/nextcloud-libraries/eslint-config/pull/1110) \([susnux](https://github.com/susnux)\)
37
+ * feat(filesystem): ignore all files within the `.gitignore` [\#1108](https://github.com/nextcloud-libraries/eslint-config/pull/1108) \([susnux](https://github.com/susnux)\)
38
+ * feat(l10n-plugin): also handle vue templates [\#1113](https://github.com/nextcloud-libraries/eslint-config/pull/1113) \([susnux](https://github.com/susnux)\)
39
+ * feat(nextcloud-vue-plugin): deprecate additional props [\#1163](https://github.com/nextcloud-libraries/eslint-config/pull/1163) \([Antreesy](https://github.com/Antreesy)\)
40
+ * feat(nextcloud-vue-plugin): deprecate additional exports [\#1162](https://github.com/nextcloud-libraries/eslint-config/pull/1162) \([Antreesy](https://github.com/Antreesy)\)
41
+ * feat(nextcloud-vue-plugin): deprecate NcPopover props [\#1165](https://github.com/nextcloud-libraries/eslint-config/pull/1165) \([Antreesy](https://github.com/Antreesy)\)
42
+ * feat(vue): add vue/component-options-name-casing with PascalCase [\#1261](https://github.com/nextcloud-libraries/eslint-config/pull/1261) \([ShGKme](https://github.com/ShGKme)\)
43
+ * feat(vue3): force camelCase for events in `<script>` [\#1262](https://github.com/nextcloud-libraries/eslint-config/pull/1262) \([ShGKme](https://github.com/ShGKme)\)
44
+ * feat(vue3): force camelCase for events in `<template>` [\#1263](https://github.com/nextcloud-libraries/eslint-config/pull/1263) \([ShGKme](https://github.com/ShGKme)\)
45
+ * feat(vue3): force camelCase for slot names [\#1264](https://github.com/nextcloud-libraries/eslint-config/pull/1264) \([ShGKme](https://github.com/ShGKme)\)
46
+ * feat(vue3): force camelCase for props in template [\#1266](https://github.com/nextcloud-libraries/eslint-config/pull/1266) \([ShGKme](https://github.com/ShGKme)\)
47
+ * feat(import): enforce consistent types imports and ban usage of inline type specifiers [\#1382](https://github.com/nextcloud-libraries/eslint-config/pull/1382) \([susnux](https://github.com/susnux)\)
20
48
 
21
49
  ### Fixed
22
50
  * fix(codestyle): do not require splitting chains [\#951](https://github.com/nextcloud-libraries/eslint-config/pull/951)
@@ -32,40 +60,84 @@ Please refer to the README on how to adjust your configuration for flat config.
32
60
  * fix(typescript): allow to use function before definition [\#950](https://github.com/nextcloud-libraries/eslint-config/pull/950)
33
61
  * fix(typescript): remove `@typescript-eslint/no-shadow` [\#993](https://github.com/nextcloud-libraries/eslint-config/pull/993)
34
62
  * fix(typescript): enforce `import type` for type only imports [\#977](https://github.com/nextcloud-libraries/eslint-config/pull/977)
63
+ * fix(vue): allow JS Vue files [#998](https://github.com/nextcloud-libraries/eslint-config/pull/998) ([ShGKme](https://github.com/ShGKme))
64
+ * 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))
65
+ * fix(typescript): allow import in type annotation [#1034](https://github.com/nextcloud-libraries/eslint-config/pull/1034) ([ShGKme](https://github.com/ShGKme))
66
+ * fix(documentation): do not lint tests for documentation issues [#1062](https://github.com/nextcloud-libraries/eslint-config/pull/1062) ([susnux](https://github.com/susnux))
67
+ * fix: ignore `l10n` and `js` directory for apps [#1061](https://github.com/nextcloud-libraries/eslint-config/pull/1061) ([susnux](https://github.com/susnux))
68
+ * fix(imports): do not mix externals and internals [#1000](https://github.com/nextcloud-libraries/eslint-config/pull/1000) ([ShGKme](https://github.com/ShGKme))
69
+ * fix(codeStyle): allow single line arrays [#997](https://github.com/nextcloud-libraries/eslint-config/pull/997) ([ShGKme](https://github.com/ShGKme))
70
+ * fix(typescript): remove `@typescript-eslint/no-shadow` [#993](https://github.com/nextcloud-libraries/eslint-config/pull/993) ([ShGKme](https://github.com/ShGKme))
71
+ * 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))
72
+ * fix: ignore test report directories from linting [\#1096](https://github.com/nextcloud-libraries/eslint-config/pull/1096) \([Antreesy](https://github.com/Antreesy)\)
73
+ * fix(vue): also ignore the global router link component [\#1097](https://github.com/nextcloud-libraries/eslint-config/pull/1097) \([susnux](https://github.com/susnux)\)
74
+ * 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)\)
75
+ * fix(codestyle): replace deprecated config in `@stylistic/quotes` rule [\#1109](https://github.com/nextcloud-libraries/eslint-config/pull/1109) \([susnux](https://github.com/susnux)\)
76
+ * fix(l10n-plugin): also check translation strings in `n` method [\#1112](https://github.com/nextcloud-libraries/eslint-config/pull/1112) \([susnux](https://github.com/susnux)\)
77
+ * fix(filesystem): relax ignored files [\#1114](https://github.com/nextcloud-libraries/eslint-config/pull/1114) \([susnux](https://github.com/susnux)\)
78
+ * fix(globs): adjust globs for test related files [\#1128](https://github.com/nextcloud-libraries/eslint-config/pull/1128) \([susnux](https://github.com/susnux)\)
79
+ * fix(vue): use vue variant of `no-irregular-whitespace` [\#1129](https://github.com/nextcloud-libraries/eslint-config/pull/1129) \([susnux](https://github.com/susnux)\)
80
+ * fix(nextcloud): add missing deprecations and removals [\#1206](https://github.com/nextcloud-libraries/eslint-config/pull/1206) \([susnux](https://github.com/susnux)\)
81
+ * fix(plugin:nextcloud-vue): use resolved dependency for detecting nextcloud-vue version [\#1220](https://github.com/nextcloud-libraries/eslint-config/pull/1220) \([susnux](https://github.com/susnux)\)
82
+ * fix: switch to `@stylistic/exp-list-style` to resolve array edge-cases [\#1203](https://github.com/nextcloud-libraries/eslint-config/pull/1203) \([susnux](https://github.com/susnux)\)
83
+ * fix(nextcloud-plugin): add more removed API in Nextcloud 33 [\#1269](https://github.com/nextcloud-libraries/eslint-config/pull/1269) \([susnux](https://github.com/susnux)\)
84
+ * fix: use vue-eslint-parser directly [\#1277](https://github.com/nextcloud-libraries/eslint-config/pull/1277) \([susnux](https://github.com/susnux)\)
85
+ * fix(imports): no newline inside import statements [\#1379](https://github.com/nextcloud-libraries/eslint-config/pull/1379) \([max-nextcloud](https://github.com/max-nextcloud)\)
35
86
 
36
87
  ### Changed
37
88
  * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
38
89
  * Updated development dependencies
39
90
  * refactor(json): drop now unneeded `@ts-expect-error` [#915](https://github.com/nextcloud-libraries/eslint-config/pull/915)
91
+ * refactor: use camelCase for internal variables [#971](https://github.com/nextcloud-libraries/eslint-config/pull/971) ([susnux](https://github.com/susnux))
40
92
  * chore: do not bundle config but just use Typescript [#967](https://github.com/nextcloud-libraries/eslint-config/pull/967)
41
93
  * chore: require node ^20.19 [\#982](https://github.com/nextcloud-libraries/eslint-config/pull/982)
42
- * Updated `@eslint/json` to 0.12.0
43
- * Updated `@stylistic/eslint-plugin` 4.2.0
44
- * Updated `eslint-plugin-jsdoc` to 50.6.11
45
- * Updated `eslint-plugin-vue` to 10.0.0
46
- * Updated `fast-xml-parser` to 5.2.1
47
- * Updated `sort-package-json` to 3.0.0
48
- * Updated `typescript-eslint` to 8.31.0
94
+ * chore: remove EOL Node version and add new future LTS [\#1381](https://github.com/nextcloud-libraries/eslint-config/pull/1381) \([susnux](https://github.com/susnux)\)
95
+ * chore: allow to run `npm lint` without compile step [#975](https://github.com/nextcloud-libraries/eslint-config/pull/975) ([susnux](https://github.com/susnux))
96
+ * chore: prepare v9.0.0-rc.1 [#1010](https://github.com/nextcloud-libraries/eslint-config/pull/1010) ([susnux](https://github.com/susnux))
97
+ * docs: consistent badge style with the reuse one [#1060](https://github.com/nextcloud-libraries/eslint-config/pull/1060) ([susnux](https://github.com/susnux))
98
+ * docs: add documentation about update policy and development [#1009](https://github.com/nextcloud-libraries/eslint-config/pull/1009) ([susnux](https://github.com/susnux))
99
+ * 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))
100
+ * ci: update workflows from organization [#1047](https://github.com/nextcloud-libraries/eslint-config/pull/1047) ([susnux](https://github.com/susnux))
101
+ * chore: add active node version (24) to supported engines [#1066](https://github.com/nextcloud-libraries/eslint-config/pull/1066) ([susnux](https://github.com/susnux))
102
+ * build: add common changelog formatting and documentation for it [#1067](https://github.com/nextcloud-libraries/eslint-config/pull/1067) ([susnux](https://github.com/susnux))
103
+ * chore: lint this project as a library [\#1130](https://github.com/nextcloud-libraries/eslint-config/pull/1130) \([susnux](https://github.com/susnux)\)
104
+ * chore: update devEngines to align with apps [\#1204](https://github.com/nextcloud-libraries/eslint-config/pull/1204) \([susnux](https://github.com/susnux)\)
105
+ * build: disable libcheck for Typescript [\#1205](https://github.com/nextcloud-libraries/eslint-config/pull/1205) \([susnux](https://github.com/susnux)\)
106
+ * chore(gitignore): ignore IDE configs [\#1265](https://github.com/nextcloud-libraries/eslint-config/pull/1265) \([ShGKme](https://github.com/ShGKme)\)
107
+ * test(vue3): add some formatting tests [\#1267](https://github.com/nextcloud-libraries/eslint-config/pull/1267) \([ShGKme](https://github.com/ShGKme)\)
108
+ * refactor: merge Nextcloud specific rules into the `@nextcloud` plugin [\#1278](https://github.com/nextcloud-libraries/eslint-config/pull/1278) \([susnux](https://github.com/susnux)\)
109
+ * Updated `@eslint/json` to 2.0.0
110
+ * Updated `@stylistic/eslint-plugin` to 5.7.0
111
+ * Updated `eslint-config-flat-gitignore` to 2.1.0
112
+ * Updated `eslint-plugin-antfu` to 3.2.3
113
+ * Updated `eslint-plugin-jsdoc` to 63.0.4
114
+ * Updated `eslint-plugin-perfectionist` to 5.9.1
115
+ * Updated `eslint-plugin-vue` to 10.9.2
116
+ * Updated `fast-xml-parser` to 5.9.0
117
+ * Updated `globals` to 17.6.0
118
+ * Updated `semver` to 7.8.4
119
+ * Updated `sort-package-json` to 4.0.0
120
+ * Updated `typescript-eslint` to 8.61.1
49
121
 
50
122
  ## [v8.4.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.2) (2025-02-16)
51
123
  ### Fixed
52
- * fix(typescript): do not require returns type in jsdoc by @ShGKme in https://github.com/nextcloud-libraries/eslint-config/pull/857
124
+ * 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
125
 
54
126
  ### Changed
55
127
  * 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
128
+ * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802) ([AndyScherzinger](https://github.com/AndyScherzinger))
129
+ * 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
130
 
59
131
  ## [v8.4.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.1) (2024-05-16)
60
132
 
61
133
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.4.0...v8.4.1)
62
134
 
63
135
  ### 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
136
+ * fix(vue3): align rules with Vue 2 rules [#771](https://github.com/nextcloud-libraries/eslint-config/pull/771) ([ShGKme](https://github.com/ShGKme))
137
+ * fix(vue3): config crashes ESLint [#770](https://github.com/nextcloud-libraries/eslint-config/pull/770) ([ShGKme](https://github.com/ShGKme))
66
138
 
67
139
  ### 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
140
+ * 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
141
 
70
142
  ## [v8.4.0](https://github.com/nextcloud-libraries/eslint-config/tree/v8.4.0) (2024-05-15)
71
143
  ### Features
@@ -76,36 +148,36 @@ Please refer to the README on how to adjust your configuration for flat config.
76
148
 
77
149
  ### Features
78
150
  * 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
151
+ * 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))
152
+ * Support Composition API & Typescript + Vue projects [#562](https://github.com/nextcloud-libraries/eslint-config/pull/562) ([susnux](https://github.com/susnux))
153
+ * Allow linting of TSX files [#456](https://github.com/nextcloud-libraries/eslint-config/pull/456) ([susnux](https://github.com/susnux))
82
154
 
83
155
  ### 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
156
+ * Ignore camelcase rule for __webpack variables [#530](https://github.com/nextcloud-libraries/eslint-config/pull/530) ([kesselb](https://github.com/kesselb))
157
+ * Add Typescript overrides for all valid Typescript file extensions [#567](https://github.com/nextcloud-libraries/eslint-config/pull/567) ([susnux](https://github.com/susnux))
158
+ * Allow empty functions [#570](https://github.com/nextcloud-libraries/eslint-config/pull/570) ([skjnldsv](https://github.com/skjnldsv))
159
+ * 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))
160
+ * fix(typescript): Allow generic type parameters on function calls [#571](https://github.com/nextcloud-libraries/eslint-config/pull/571) ([susnux](https://github.com/susnux))
161
+ * 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))
162
+ * 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))
163
+ * fix: Allow `@jest-environment` docblock for jest tests [#592](https://github.com/nextcloud-libraries/eslint-config/pull/592) ([susnux](https://github.com/susnux))
92
164
 
93
165
  ### Changed
94
166
  * 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
167
+ * 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))
168
+ * Drop webpack dependency [#528](https://github.com/nextcloud-libraries/eslint-config/pull/528) ([susnux](https://github.com/susnux))
97
169
  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
170
+ * 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
171
  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
172
+ * 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))
173
+ * chore: Fix URLs after package got transfered [#602](https://github.com/nextcloud-libraries/eslint-config/pull/602) ([susnux](https://github.com/susnux))
102
174
 
103
175
  ## [v8.2.1](https://github.com/nextcloud-libraries/eslint-config/tree/v8.2.1) (2023-01-30)
104
176
 
105
177
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.2.0...v8.2.1)
106
178
 
107
179
  **Fixed:**
108
- - Fix resolving packages that use the package `exports` feature by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/452
180
+ - 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
181
 
110
182
  **Merged pull requests:**
111
183
  - Various dependencies upgrades
@@ -127,8 +199,8 @@ Please refer to the README on how to adjust your configuration for flat config.
127
199
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.4...v8.1.5)
128
200
 
129
201
  **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
202
+ - 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))
203
+ - 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
204
 
133
205
  ## [v8.1.4](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.4) (2022-11-17)
134
206
 
@@ -142,16 +214,16 @@ Please refer to the README on how to adjust your configuration for flat config.
142
214
  [Full Changelog](https://github.com/nextcloud-libraries/eslint-config/compare/v8.1.2...v8.1.3)
143
215
 
144
216
  **Fixed:**
145
- - Allow TypeScript syntax in JSDoc comments by @Pytal in https://github.com/nextcloud-libraries/eslint-config/pull/413
217
+ - Allow TypeScript syntax in JSDoc comments [#413](https://github.com/nextcloud-libraries/eslint-config/pull/413) ([Pytal](https://github.com/Pytal))
146
218
 
147
219
  **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
220
+ - 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))
221
+ - 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))
222
+ - 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))
223
+ - 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))
224
+ - 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))
225
+ - 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))
226
+ - 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
227
 
156
228
  ## [v8.1.2](https://github.com/nextcloud-libraries/eslint-config/tree/v8.1.2) (2022-08-09)
157
229
 
package/README.md CHANGED
@@ -5,25 +5,30 @@
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
- > Since version 9 this package depends on ESLint 9, which uses the new flat config system.
31
+ > Since version 9 this package depends on ESLint 10, which uses the new flat config system.
27
32
 
28
33
  This package provides some predefined configurations you can choose from.
29
34
  For the recommended setup add a file `eslint.config.js` in the root directory of your app repository with the following content:
@@ -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
 
@@ -75,7 +80,7 @@ export default [
75
80
  files: ['**/*.js'],
76
81
  rules: {
77
82
  // Make deprecations error instead of warning level
78
- '@nextcloud/no-deprecations': ['error'],
83
+ '@nextcloud/no-deprecated-globals': ['error'],
79
84
  }
80
85
  }
81
86
  ]
@@ -92,21 +97,21 @@ export default [
92
97
  '@nextcloud': nextcloudPlugin,
93
98
  },
94
99
  rules: {
95
- '@nextcloud/no-removed-apis': ['error', { targetVersion: '29.0.0' }],
100
+ '@nextcloud/no-removed-globals': ['error', { targetVersion: '29.0.0' }],
96
101
  },
97
102
  }
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
- - `no-deprecations`
114
+ - `no-deprecated-globals`
110
115
  - Report usage of deprecated Nextcloud API
111
116
  - Included as `warn` level in recommended configuration
112
117
  - Available options
@@ -125,7 +130,7 @@ Rules:
125
130
  parseAppInfo?: boolean
126
131
  }
127
132
  ```
128
- - `no-removed-apis`
133
+ - `no-removed-globals`
129
134
  - Report usage of removed Nextcloud API
130
135
  - Included as `error` level in recommended configuration
131
136
  - Available options
@@ -144,21 +149,14 @@ Rules:
144
149
  parseAppInfo?: boolean
145
150
  }
146
151
  ```
147
-
148
- #### `@nextcloud-l10n`
149
- ```ts
150
- import { l10nPlugin } from '@nextcloud/eslint-config'
151
- ```
152
-
153
- Rules:
154
- - `enforce-ellipsis`
152
+ - `l10n-enforce-ellipsis`
155
153
  - Enforce consistent usageof ellipsis instead of tripple dots
156
154
  - Included as `error` level in recommended configuration
157
- - `non-breaking-space`
155
+ - `l10n-non-breaking-space`
158
156
  - Enforce non-breaking spaces before ellipsis
159
157
  - Included as `error` level in recommended configuration
160
158
 
161
- ### Adding custom overrides
159
+ #### Adding custom overrides
162
160
 
163
161
  Sometimes additional rules need to be added for individual projects,
164
162
  and while we do not recommend to override Nextcloud rules for code style (it should be consistent across all Nextcloud projects!),
@@ -188,9 +186,65 @@ export default [
188
186
  ]
189
187
  ```
190
188
 
191
- ## Release new version
189
+ ### Update policy
190
+
191
+ We follow semantic versioning.
192
+
193
+ #### 💥 Breaking changes
194
+
195
+ For breaking changes, we consider those changes that break linting in a technical term, so linting itself is broken with the update.
196
+ 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.
197
+
198
+ #### ✨ Minor changes
199
+
200
+ For minor changes we consider adding new rules or adding or removing plugins.
201
+ This means after updating a minor version, there can be new warnings or errors when linting the same code base.
202
+
203
+ #### 🐛 Patch changes
204
+
205
+ For this configuration we consider following changes fixes:
206
+ - Adjusting rules to follow our official code style.
207
+ - Adjusting rules if the current behavior is considered a bug.
208
+ - Removing rules
209
+
210
+ ### Development
211
+
212
+ #### New rules
213
+
214
+ Adding new rules that enforce our code style can always be added.
215
+ Rules that are not directly covered by our code style should be discussed before.
216
+
217
+ 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.
218
+
219
+ #### Rule severity
220
+
221
+ Either you care about a rule or you do not.
222
+ As such we only enforce rules that we consider either important for code quality or to have consistent code style.
223
+ For this reason all rules should be set to **error** severity, as all rules are considered must-follow.
224
+
225
+ 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.
226
+
227
+ To not break projects during updates new rules with non critical impact (code style related rules)
228
+ should be introduced with **warn** severity and moved to severity **error** only with a new major release or after a sane timeframe for migration.
229
+
230
+ #### Release new version
192
231
 
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
232
+ - Pull the latest changes from `main` or `stableX`
233
+ - Checkout a new branch with the tag name (e.g `v9.0.1`): `git checkout -b v<version>`
234
+ - Run `npm version patch --no-git-tag-version` (`npm version minor --no-git-tag-version` if minor).
235
+ This will return a new version name, make sure it matches what you expect
236
+ - Generate the changelog content from the [release](https://github.com/nextcloud-libraries/eslint-config/releases) page.
237
+ Create a draft release, select the previous tag, click `generate` then paste the content to the `CHANGELOG.md` file
238
+ 1. adjust the links to the merged pull requests and authors so that the changelog also works outside of GitHub
239
+ by running `npm run prerelease:format-changelog`.
240
+ This will apply this regex: `by @([^ ]+) in ((https://github.com/)nextcloud-libraries/eslint-config/pull/(\d+))`
241
+ Which this as the replacement: `[\#$4]($2) \([$1]($3$1)\)`
242
+ 2. use the the version as tag AND title (e.g `v4.0.1`)
243
+ 3. add the changelog content as description (https://github.com/nextcloud-libraries/eslint-config/releases)
244
+ - Commit, push and create PR
245
+ - Get your PR reviewed and merged
246
+ - Create a milestone with the follow-up version at https://github.com/nextcloud-libraries/eslint-config/milestones
247
+ - Move all open tickets and PRs to the follow-up
248
+ - Close the milestone of the version you release
249
+ - Publish the previously drafted release on GitHub
250
+ ![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png)
@@ -10,4 +10,4 @@ import type { ConfigOptions } from '../types.d.ts';
10
10
  *
11
11
  * @param options options defining the config preset flavor
12
12
  */
13
- export declare function codeStyle(options: ConfigOptions): (Linter.Config | Linter.BaseConfig)[];
13
+ export declare function codeStyle(options: ConfigOptions): Linter.Config[];
@@ -1,6 +1,6 @@
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
- import l10nPlugin from "../plugins/l10n/index.js";
4
4
  /**
5
5
  * Config factory for general code style related rules
6
6
  * See also: https://docs.nextcloud.com/server/latest/developer_manual/getting_started/coding_standards/javascript.html#code-style
@@ -34,6 +34,9 @@ export function codeStyle(options) {
34
34
  ...GLOB_FILES_TYPESCRIPT,
35
35
  ...GLOB_FILES_VUE,
36
36
  ],
37
+ plugins: {
38
+ antfu: eslintAntfuPlugin,
39
+ },
37
40
  rules: {
38
41
  // Overrides for the stylistic recommended rules
39
42
  // Tabs should only be used for indention
@@ -51,7 +54,7 @@ export function codeStyle(options) {
51
54
  'error',
52
55
  'single',
53
56
  {
54
- allowTemplateLiterals: false,
57
+ allowTemplateLiterals: 'never',
55
58
  avoidEscape: true,
56
59
  },
57
60
  ],
@@ -71,28 +74,24 @@ export function codeStyle(options) {
71
74
  'properties',
72
75
  { avoidQuotes: true },
73
76
  ],
74
- // Enforce new lines after [ and before ] if there are multiline entries or more than 1 item in the array (better git diff)
75
- '@stylistic/array-bracket-newline': [
76
- 'error',
77
- {
78
- multiline: true,
79
- minItems: null, // disable
80
- },
81
- ],
82
- // Enforce new lines between array elements (better git diff) but allow to have single line arrays
83
- '@stylistic/array-element-newline': ['error', 'consistent'],
84
- // Same for objects as for arrays
85
- '@stylistic/object-curly-newline': [
86
- 'error',
87
- {
88
- consistent: true,
89
- multiline: true,
90
- },
91
- ],
92
- '@stylistic/object-property-newline': [
93
- 'error',
94
- { allowAllPropertiesOnSameLine: true },
95
- ],
77
+ // Enforce consistent new lines after brackets
78
+ '@stylistic/array-bracket-newline': 'off',
79
+ '@stylistic/array-bracket-spacing': 'off',
80
+ '@stylistic/array-element-newline': 'off',
81
+ '@stylistic/jsx-function-call-newline': 'off',
82
+ '@stylistic/object-curly-newline': 'off',
83
+ '@stylistic/object-curly-spacing': 'off',
84
+ '@stylistic/object-property-newline': 'off',
85
+ '@stylistic/exp-list-style': ['error', {
86
+ singleLine: {
87
+ spacing: 'never',
88
+ },
89
+ overrides: {
90
+ '{}': {
91
+ singleLine: { spacing: 'always' },
92
+ },
93
+ },
94
+ }],
96
95
  // No space between function name and parenthesis. Enforce fn() instead of fn ()
97
96
  '@stylistic/function-call-spacing': [
98
97
  'error',
@@ -142,6 +141,8 @@ export function codeStyle(options) {
142
141
  'no-useless-concat': 'error',
143
142
  // Prefer { ...foo } over Object.assign({}, foo)
144
143
  'prefer-object-spread': 'warn',
144
+ // Enforce function declarations for top level functions
145
+ 'antfu/top-level-function': 'error',
145
146
  },
146
147
  },
147
148
  {
@@ -165,13 +166,10 @@ export function codeStyle(options) {
165
166
  ...GLOB_FILES_TYPESCRIPT,
166
167
  ...GLOB_FILES_VUE,
167
168
  ],
168
- plugins: {
169
- '@nextcloud-l10n': l10nPlugin,
170
- },
171
169
  // Enforce that translations use ellipsis instead of tripple dots
172
170
  rules: {
173
- '@nextcloud-l10n/non-breaking-space': 'error',
174
- '@nextcloud-l10n/enforce-ellipsis': 'error',
171
+ '@nextcloud/l10n-non-breaking-space': 'error',
172
+ '@nextcloud/l10n-enforce-ellipsis': 'error',
175
173
  },
176
174
  },
177
175
  ];