@nextcloud/eslint-config 9.0.0-rc.7 → 9.0.0-rc.9

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 (40) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +7 -14
  3. package/dist/configs/codeStyle.js +2 -6
  4. package/dist/configs/javascript.js +2 -2
  5. package/dist/configs/vue.js +6 -6
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.js +0 -1
  8. package/dist/plugins/nextcloud/rules/index.js +16 -4
  9. package/dist/plugins/{l10n/rules/enforce-ellipsis.js → nextcloud/rules/l10n-enforce-ellipsis.js} +7 -1
  10. package/dist/plugins/{l10n/rules/non-breaking-space.js → nextcloud/rules/l10n-non-breaking-space.js} +7 -1
  11. package/dist/plugins/nextcloud/rules/{no-deprecations.js → no-deprecated-globals.js} +5 -2
  12. package/dist/plugins/{nextcloud-vue/rules/no-deprecated-exports.js → nextcloud/rules/no-deprecated-library-exports.js} +4 -3
  13. package/dist/plugins/{nextcloud-vue/rules/no-deprecated-props.d.ts → nextcloud/rules/no-deprecated-library-props.d.ts} +1 -1
  14. package/dist/plugins/{nextcloud-vue/rules/no-deprecated-props.js → nextcloud/rules/no-deprecated-library-props.js} +17 -10
  15. package/dist/plugins/nextcloud/rules/{no-removed-apis.js → no-removed-globals.js} +14 -2
  16. package/dist/plugins/nextcloud/utils/vue-template-visitor.d.ts +26 -0
  17. package/dist/plugins/nextcloud/utils/vue-template-visitor.js +38 -0
  18. package/dist/plugins/packageJson.js +0 -1
  19. package/package.json +20 -19
  20. package/dist/plugins/l10n/index.d.ts +0 -10
  21. package/dist/plugins/l10n/index.js +0 -17
  22. package/dist/plugins/l10n/rules/enforce-ellipsis-vue.js +0 -13
  23. package/dist/plugins/l10n/rules/index.d.ts +0 -10
  24. package/dist/plugins/l10n/rules/index.js +0 -14
  25. package/dist/plugins/l10n/rules/non-breaking-space-vue.d.ts +0 -7
  26. package/dist/plugins/l10n/rules/non-breaking-space-vue.js +0 -13
  27. package/dist/plugins/l10n/rules/non-breaking-space.d.ts +0 -7
  28. package/dist/plugins/nextcloud-vue/index.d.ts +0 -49
  29. package/dist/plugins/nextcloud-vue/index.js +0 -13
  30. package/dist/plugins/nextcloud-vue/rules/index.d.ts +0 -38
  31. package/dist/plugins/nextcloud-vue/rules/index.js +0 -10
  32. /package/dist/plugins/{l10n/rules/enforce-ellipsis-vue.d.ts → nextcloud/rules/l10n-enforce-ellipsis.d.ts} +0 -0
  33. /package/dist/plugins/{l10n/rules/enforce-ellipsis.d.ts → nextcloud/rules/l10n-non-breaking-space.d.ts} +0 -0
  34. /package/dist/plugins/{nextcloud-vue/rules/no-deprecated-exports.d.ts → nextcloud/rules/no-deprecated-globals.d.ts} +0 -0
  35. /package/dist/plugins/nextcloud/rules/{no-deprecations.d.ts → no-deprecated-library-exports.d.ts} +0 -0
  36. /package/dist/plugins/nextcloud/rules/{no-removed-apis.d.ts → no-removed-globals.d.ts} +0 -0
  37. /package/dist/plugins/nextcloud/utils/{version-parser.d.ts → app-version-parser.d.ts} +0 -0
  38. /package/dist/plugins/nextcloud/utils/{version-parser.js → app-version-parser.js} +0 -0
  39. /package/dist/plugins/{nextcloud-vue → nextcloud}/utils/lib-version-parser.d.ts +0 -0
  40. /package/dist/plugins/{nextcloud-vue → nextcloud}/utils/lib-version-parser.js +0 -0
package/CHANGELOG.md CHANGED
@@ -7,10 +7,20 @@
7
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)
@@ -69,6 +79,8 @@ Please refer to the README on how to adjust your configuration for flat config.
69
79
  * fix(nextcloud): add missing deprecations and removals [\#1206](https://github.com/nextcloud-libraries/eslint-config/pull/1206) \([susnux](https://github.com/susnux)\)
70
80
  * 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)\)
71
81
  * 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)\)
82
+ * 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)\)
83
+ * fix: use vue-eslint-parser directly [\#1277](https://github.com/nextcloud-libraries/eslint-config/pull/1277) \([susnux](https://github.com/susnux)\)
72
84
 
73
85
  ### Changed
74
86
  * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
@@ -90,6 +102,7 @@ Please refer to the README on how to adjust your configuration for flat config.
90
102
  * build: disable libcheck for Typescript [\#1205](https://github.com/nextcloud-libraries/eslint-config/pull/1205) \([susnux](https://github.com/susnux)\)
91
103
  * chore(gitignore): ignore IDE configs [\#1265](https://github.com/nextcloud-libraries/eslint-config/pull/1265) \([ShGKme](https://github.com/ShGKme)\)
92
104
  * test(vue3): add some formatting tests [\#1267](https://github.com/nextcloud-libraries/eslint-config/pull/1267) \([ShGKme](https://github.com/ShGKme)\)
105
+ * refactor: merge Nextcloud specific rules into the `@nextcloud` plugin [\#1278](https://github.com/nextcloud-libraries/eslint-config/pull/1278) \([susnux](https://github.com/susnux)\)
93
106
  * Updated `@eslint/json` to 0.14.0
94
107
  * Updated `@stylistic/eslint-plugin` to 5.7.0
95
108
  * Updated `eslint-config-flat-gitignore` to 2.1.0
package/README.md CHANGED
@@ -28,7 +28,7 @@ npm install --save-dev @nextcloud/eslint-config
28
28
  ### Usage
29
29
 
30
30
  > [!NOTE]
31
- > 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.
32
32
 
33
33
  This package provides some predefined configurations you can choose from.
34
34
  For the recommended setup add a file `eslint.config.js` in the root directory of your app repository with the following content:
@@ -80,7 +80,7 @@ export default [
80
80
  files: ['**/*.js'],
81
81
  rules: {
82
82
  // Make deprecations error instead of warning level
83
- '@nextcloud/no-deprecations': ['error'],
83
+ '@nextcloud/no-deprecated-globals': ['error'],
84
84
  }
85
85
  }
86
86
  ]
@@ -97,7 +97,7 @@ export default [
97
97
  '@nextcloud': nextcloudPlugin,
98
98
  },
99
99
  rules: {
100
- '@nextcloud/no-removed-apis': ['error', { targetVersion: '29.0.0' }],
100
+ '@nextcloud/no-removed-globals': ['error', { targetVersion: '29.0.0' }],
101
101
  },
102
102
  }
103
103
  ]
@@ -111,7 +111,7 @@ Rules:
111
111
 
112
112
  ##### `@nextcloud` plugin
113
113
  Rules:
114
- - `no-deprecations`
114
+ - `no-deprecated-globals`
115
115
  - Report usage of deprecated Nextcloud API
116
116
  - Included as `warn` level in recommended configuration
117
117
  - Available options
@@ -130,7 +130,7 @@ Rules:
130
130
  parseAppInfo?: boolean
131
131
  }
132
132
  ```
133
- - `no-removed-apis`
133
+ - `no-removed-globals`
134
134
  - Report usage of removed Nextcloud API
135
135
  - Included as `error` level in recommended configuration
136
136
  - Available options
@@ -149,17 +149,10 @@ Rules:
149
149
  parseAppInfo?: boolean
150
150
  }
151
151
  ```
152
-
153
- ##### `@nextcloud-l10n`
154
- ```ts
155
- import { l10nPlugin } from '@nextcloud/eslint-config'
156
- ```
157
-
158
- Rules:
159
- - `enforce-ellipsis`
152
+ - `l10n-enforce-ellipsis`
160
153
  - Enforce consistent usageof ellipsis instead of tripple dots
161
154
  - Included as `error` level in recommended configuration
162
- - `non-breaking-space`
155
+ - `l10n-non-breaking-space`
163
156
  - Enforce non-breaking spaces before ellipsis
164
157
  - Included as `error` level in recommended configuration
165
158
 
@@ -1,7 +1,6 @@
1
1
  import stylistic from '@stylistic/eslint-plugin';
2
2
  import eslintAntfuPlugin from 'eslint-plugin-antfu';
3
3
  import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
4
- import l10nPlugin from "../plugins/l10n/index.js";
5
4
  /**
6
5
  * Config factory for general code style related rules
7
6
  * See also: https://docs.nextcloud.com/server/latest/developer_manual/getting_started/coding_standards/javascript.html#code-style
@@ -167,13 +166,10 @@ export function codeStyle(options) {
167
166
  ...GLOB_FILES_TYPESCRIPT,
168
167
  ...GLOB_FILES_VUE,
169
168
  ],
170
- plugins: {
171
- '@nextcloud-l10n': l10nPlugin,
172
- },
173
169
  // Enforce that translations use ellipsis instead of tripple dots
174
170
  rules: {
175
- '@nextcloud-l10n/non-breaking-space': 'error',
176
- '@nextcloud-l10n/enforce-ellipsis': 'error',
171
+ '@nextcloud/l10n-non-breaking-space': 'error',
172
+ '@nextcloud/l10n-enforce-ellipsis': 'error',
177
173
  },
178
174
  },
179
175
  ];
@@ -62,8 +62,8 @@ export function javascript(options) {
62
62
  '@nextcloud': nextcloudPlugin,
63
63
  },
64
64
  rules: {
65
- '@nextcloud/no-deprecations': ['warn'],
66
- '@nextcloud/no-removed-apis': ['error'],
65
+ '@nextcloud/no-deprecated-globals': ['warn'],
66
+ '@nextcloud/no-removed-globals': ['error'],
67
67
  },
68
68
  files: [
69
69
  ...GLOB_FILES_JAVASCRIPT,
@@ -1,6 +1,6 @@
1
1
  import vuePlugin from 'eslint-plugin-vue';
2
2
  import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
3
- import nextcloudVuePlugin from "../plugins/nextcloud-vue/index.js";
3
+ import { nextcloudPlugin } from "../index.js";
4
4
  import { codeStyle } from "./codeStyle.js";
5
5
  const stylisticRules = codeStyle({
6
6
  isLibrary: false,
@@ -110,8 +110,8 @@ export function vue(options) {
110
110
  // same as the stylistic rules but for the <template> in Vue files
111
111
  ...Object.fromEntries(vueStylisticRules),
112
112
  // same as in the codeStyle config but for the <template> in Vue files
113
- '@nextcloud-l10n/non-breaking-space-vue': 'error',
114
- '@nextcloud-l10n/enforce-ellipsis-vue': 'error',
113
+ '@nextcloud/l10n-non-breaking-space': 'error',
114
+ '@nextcloud/l10n-enforce-ellipsis': 'error',
115
115
  // Also enforce tabs for template
116
116
  'vue/html-indent': [
117
117
  'error',
@@ -146,11 +146,11 @@ export function vue(options) {
146
146
  ...GLOB_FILES_VUE,
147
147
  ],
148
148
  plugins: {
149
- '@nextcloud/vue': nextcloudVuePlugin,
149
+ '@nextcloud': nextcloudPlugin,
150
150
  },
151
151
  rules: {
152
- '@nextcloud/vue/no-deprecated-exports': 'error',
153
- '@nextcloud/vue/no-deprecated-props': 'error',
152
+ '@nextcloud/no-deprecated-library-exports': 'error',
153
+ '@nextcloud/no-deprecated-library-props': 'error',
154
154
  },
155
155
  name: 'nextcloud/vue/migration-rules',
156
156
  },
package/dist/index.d.ts CHANGED
@@ -29,4 +29,3 @@ export declare const recommendedLibrary: Linter.Config[];
29
29
  export declare const recommendedVue2Library: Linter.Config[];
30
30
  export { default as packageJsonPlugin } from './plugins/packageJson.ts';
31
31
  export { default as nextcloudPlugin } from './plugins/nextcloud/index.ts';
32
- export { default as l10nPlugin } from './plugins/l10n/index.ts';
package/dist/index.js CHANGED
@@ -59,7 +59,6 @@ export const recommendedVue2Library = createConfig({
59
59
  });
60
60
  export { default as packageJsonPlugin } from "./plugins/packageJson.js";
61
61
  export { default as nextcloudPlugin } from "./plugins/nextcloud/index.js";
62
- export { default as l10nPlugin } from "./plugins/l10n/index.js";
63
62
  /**
64
63
  * Generate a configuration based on given options
65
64
  *
@@ -1,6 +1,18 @@
1
- import noDeprecations from "./no-deprecations.js";
2
- import noRemovedApis from "./no-removed-apis.js";
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import l10nEnforceEllipsis from "./l10n-enforce-ellipsis.js";
6
+ import l10nNonBreakingSpace from "./l10n-non-breaking-space.js";
7
+ import noDeprecatedGlobals from "./no-deprecated-globals.js";
8
+ import noDeprecatedLibraryExports from "./no-deprecated-library-exports.js";
9
+ import noDeprecatedLibraryProps from "./no-deprecated-library-props.js";
10
+ import noRemovedGlobals from "./no-removed-globals.js";
3
11
  export const rules = {
4
- 'no-deprecations': noDeprecations,
5
- 'no-removed-apis': noRemovedApis,
12
+ 'l10n-enforce-ellipsis': l10nEnforceEllipsis,
13
+ 'l10n-non-breaking-space': l10nNonBreakingSpace,
14
+ 'no-deprecated-globals': noDeprecatedGlobals,
15
+ 'no-removed-globals': noRemovedGlobals,
16
+ 'no-deprecated-library-exports': noDeprecatedLibraryExports,
17
+ 'no-deprecated-library-props': noDeprecatedLibraryProps,
6
18
  };
@@ -1,3 +1,8 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import { defineTemplateBodyVisitor } from "../utils/vue-template-visitor.js";
1
6
  const defineRule = (r) => r;
2
7
  export default defineRule({
3
8
  meta: {
@@ -12,7 +17,7 @@ export default defineRule({
12
17
  },
13
18
  },
14
19
  create(context) {
15
- return {
20
+ const visitor = {
16
21
  CallExpression(node) {
17
22
  if (node.callee.type !== 'Identifier'
18
23
  || (node.callee.name !== 't' && node.callee.name !== 'n')) {
@@ -34,5 +39,6 @@ export default defineRule({
34
39
  }
35
40
  },
36
41
  };
42
+ return defineTemplateBodyVisitor(context, visitor, visitor);
37
43
  },
38
44
  });
@@ -1,3 +1,8 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import { defineTemplateBodyVisitor } from "../utils/vue-template-visitor.js";
1
6
  const defineRule = (r) => r;
2
7
  export default defineRule({
3
8
  meta: {
@@ -12,7 +17,7 @@ export default defineRule({
12
17
  },
13
18
  },
14
19
  create(context) {
15
- return {
20
+ const visitor = {
16
21
  Literal(node) {
17
22
  if (typeof node.value !== 'string') {
18
23
  return;
@@ -29,5 +34,6 @@ export default defineRule({
29
34
  }
30
35
  },
31
36
  };
37
+ return defineTemplateBodyVisitor(context, visitor, visitor);
32
38
  },
33
39
  });
@@ -1,4 +1,8 @@
1
- import { createVersionValidator } from "../utils/version-parser.js";
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import { createVersionValidator } from "../utils/app-version-parser.js";
2
6
  // ------------------------------------------------------------------------------
3
7
  // Rule Definition
4
8
  // ------------------------------------------------------------------------------
@@ -86,7 +90,6 @@ const rule = {
86
90
  meta: {
87
91
  docs: {
88
92
  description: 'Deprecated Nextcloud APIs',
89
- category: 'Nextcloud',
90
93
  recommended: true,
91
94
  },
92
95
  // fixable: null or "code" or "whitespace"
@@ -1,7 +1,8 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
1
5
  import { createLibVersionValidator } from "../utils/lib-version-parser.js";
2
- // ------------------------------------------------------------------------------
3
- // Rule Definition
4
- // ------------------------------------------------------------------------------
5
6
  /*
6
7
  Introduced in @nextcloud/vue v8.23.0
7
8
  https://github.com/nextcloud-libraries/nextcloud-vue/pull/6385
@@ -36,6 +36,6 @@ declare const _default: {
36
36
  useModelValueInsteadValue: string;
37
37
  };
38
38
  };
39
- create(context: Rule.RuleContext): any;
39
+ create(context: Rule.RuleContext): Rule.RuleListener;
40
40
  };
41
41
  export default _default;
@@ -1,5 +1,9 @@
1
- import * as vueUtils from 'eslint-plugin-vue/lib/utils/index.js';
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
2
5
  import { createLibVersionValidator } from "../utils/lib-version-parser.js";
6
+ import { defineTemplateBodyVisitor } from "../utils/vue-template-visitor.js";
3
7
  export default {
4
8
  meta: {
5
9
  docs: {
@@ -56,7 +60,7 @@ export default {
56
60
  'tertiary',
57
61
  'tertiary-no-background',
58
62
  ];
59
- return vueUtils.defineTemplateBodyVisitor(context, {
63
+ return defineTemplateBodyVisitor(context, {
60
64
  'VElement VAttribute:has(VIdentifier[name="type"])': function (node) {
61
65
  if (![
62
66
  'ncactions',
@@ -72,12 +76,12 @@ export default {
72
76
  return;
73
77
  }
74
78
  const hasNativeType = node.parent.attributes.find((attr) => (attr.key.name === 'native-type'
75
- || (attr.key.type === 'VDirectiveKey' && attr.key.argument && attr.key.argument.name === 'native-type')));
79
+ || (attr.key.type === 'VDirectiveKey' && attr.key.argument && attr.key.argument.type === 'VIdentifier' && attr.key.argument.name === 'native-type')));
76
80
  const isLiteral = node.value.type === 'VLiteral' && legacyTypes.includes(node.value.value);
77
81
  const isExpression = node.value.type === 'VExpressionContainer'
78
82
  && node.value.expression.type === 'ConditionalExpression'
79
- && (legacyTypes.includes(node.value.expression.consequent.value)
80
- || legacyTypes.includes(node.value.expression.alternate.value));
83
+ && (('value' in node.value.expression.consequent && legacyTypes.includes(node.value.expression.consequent.value.toString()))
84
+ || ('value' in node.value.expression.alternate && legacyTypes.includes(node.value.expression.alternate.value.toString())));
81
85
  /**
82
86
  * if it is a literal with a deprecated value -> we migrate
83
87
  * if it is an expression with a defined deprecated value -> we migrate
@@ -290,8 +294,10 @@ export default {
290
294
  return;
291
295
  }
292
296
  const isLiteral = node.value.type === 'VLiteral' && node.value.value === 'arrowRight';
293
- const isExpression = node.value.type === 'VExpressionContainer' && node.value.expression?.type === 'ConditionalExpression'
294
- && (node.value.expression.consequent.value === 'arrowRight' || node.value.expression.alternate.value === 'arrowRight');
297
+ const isExpression = node.value.type === 'VExpressionContainer'
298
+ && node.value.expression?.type === 'ConditionalExpression'
299
+ && (('value' in node.value.expression.consequent && node.value.expression.consequent.value === 'arrowRight')
300
+ || ('value' in node.value.expression.alternate && node.value.expression.alternate.value === 'arrowRight'));
295
301
  /**
296
302
  * if it is a literal with a deprecated value -> we migrate
297
303
  * if it is an expression with a defined deprecated value -> we migrate
@@ -305,9 +311,10 @@ export default {
305
311
  return fixer.replaceTextRange(node.value.range, '"arrowEnd"');
306
312
  }
307
313
  else if (node.key.type === 'VDirectiveKey') {
308
- return (node.value.expression.consequent.value === 'arrowRight')
309
- ? fixer.replaceTextRange(node.value.expression.consequent.range, '\'arrowEnd\'')
310
- : fixer.replaceTextRange(node.value.expression.alternate.range, '\'arrowEnd\'');
314
+ const expression = node.value.expression;
315
+ return expression.consequent.value === 'arrowRight'
316
+ ? fixer.replaceTextRange(expression.consequent.range, '\'arrowEnd\'')
317
+ : fixer.replaceTextRange(expression.alternate.range, '\'arrowEnd\'');
311
318
  }
312
319
  },
313
320
  });
@@ -1,4 +1,8 @@
1
- import { createVersionValidator } from "../utils/version-parser.js";
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import { createVersionValidator } from "../utils/app-version-parser.js";
2
6
  // ------------------------------------------------------------------------------
3
7
  // Rule Definition
4
8
  // ------------------------------------------------------------------------------
@@ -44,6 +48,9 @@ const ocNested = {
44
48
  scaleFixForIE8: '15.0.0',
45
49
  isIE8: '15.0.0',
46
50
  },
51
+ Settings: {
52
+ UserSettings: '33.0.0',
53
+ },
47
54
  };
48
55
  const oca = {
49
56
  // ref: https://github.com/nextcloud/server/commit/6eced42b7a40f5b0ea0489244583219d0ee2e7af
@@ -51,6 +58,12 @@ const oca = {
51
58
  FilesSharingDrop: '31.0.0',
52
59
  };
53
60
  const ocaNested = {
61
+ Core: {
62
+ ProfileSections: '33.0.0',
63
+ },
64
+ Files: {
65
+ Sidebar: '33.0.0',
66
+ },
54
67
  Sharing: {
55
68
  ExternalLinkActions: '33.0.0',
56
69
  },
@@ -61,7 +74,6 @@ const rule = {
61
74
  meta: {
62
75
  docs: {
63
76
  description: 'Removed Nextcloud APIs',
64
- category: 'Nextcloud',
65
77
  recommended: true,
66
78
  },
67
79
  // fixable: "code" or "whitespace"
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import type { Rule } from 'eslint';
6
+ type TemplateVisitor = {
7
+ [key: string]: (...args: unknown[]) => void;
8
+ };
9
+ type TemplateVisitorOptions = {
10
+ templateBodyTriggerSelector: 'Program' | 'Program:exit';
11
+ };
12
+ /**
13
+ * Register the given visitor to parser services.
14
+ * If the parser service of `vue-eslint-parser` was not found,
15
+ * this generates a warning.
16
+ *
17
+ * @param context - The rule context to use parser services.
18
+ * @param templateBodyVisitor - The visitor to traverse the template body.
19
+ * @param scriptVisitor - The visitor to traverse the script.
20
+ * @param options - The options.
21
+ *
22
+ * @return The merged visitor.
23
+ * @see https://github.com/vuejs/eslint-plugin-vue/blob/745fd4e1f3719c3a2f93bd3531da5e886c16f008/lib/utils/index.js#L2281-L2315
24
+ */
25
+ export declare function defineTemplateBodyVisitor(context: Rule.RuleContext, templateBodyVisitor: TemplateVisitor, scriptVisitor?: Rule.RuleListener, options?: TemplateVisitorOptions): Rule.RuleListener;
26
+ export {};
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
5
+ import { extname } from 'node:path';
6
+ /**
7
+ * Register the given visitor to parser services.
8
+ * If the parser service of `vue-eslint-parser` was not found,
9
+ * this generates a warning.
10
+ *
11
+ * @param context - The rule context to use parser services.
12
+ * @param templateBodyVisitor - The visitor to traverse the template body.
13
+ * @param scriptVisitor - The visitor to traverse the script.
14
+ * @param options - The options.
15
+ *
16
+ * @return The merged visitor.
17
+ * @see https://github.com/vuejs/eslint-plugin-vue/blob/745fd4e1f3719c3a2f93bd3531da5e886c16f008/lib/utils/index.js#L2281-L2315
18
+ */
19
+ export function defineTemplateBodyVisitor(context, templateBodyVisitor, scriptVisitor, options) {
20
+ const sourceCode = context.sourceCode;
21
+ if (!sourceCode.parserServices?.defineTemplateBodyVisitor) {
22
+ const filename = context.filename;
23
+ if (extname(filename) === '.vue') {
24
+ context.report({
25
+ loc: {
26
+ line: 1,
27
+ column: 0,
28
+ },
29
+ message: 'Use the latest vue-eslint-parser. See also https://eslint.vuejs.org/user-guide/#what-is-the-use-the-latest-vue-eslint-parser-error.',
30
+ });
31
+ }
32
+ else {
33
+ return scriptVisitor ?? {};
34
+ }
35
+ }
36
+ return sourceCode.parserServices
37
+ .defineTemplateBodyVisitor(templateBodyVisitor, scriptVisitor, options);
38
+ }
@@ -43,7 +43,6 @@ const SortPackageJsonRule = {
43
43
  node: body,
44
44
  message: 'package.json is not sorted correctly',
45
45
  fix(fixer) {
46
- // @ts-expect-error its always an object node
47
46
  return fixer.replaceText(body, sortedPackageJsonText);
48
47
  },
49
48
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/eslint-config",
3
- "version": "9.0.0-rc.7",
3
+ "version": "9.0.0-rc.9",
4
4
  "description": "Eslint shared config for nextcloud apps and libraries",
5
5
  "keywords": [
6
6
  "eslint",
@@ -43,31 +43,32 @@
43
43
  "test": "vitest run"
44
44
  },
45
45
  "dependencies": {
46
- "@eslint/json": "^0.14.0",
47
- "@stylistic/eslint-plugin": "^5.7.0",
48
- "eslint-config-flat-gitignore": "^2.1.0",
49
- "eslint-plugin-antfu": "^3.1.3",
50
- "eslint-plugin-jsdoc": "^62.0.0",
51
- "eslint-plugin-perfectionist": "^5.3.1",
52
- "eslint-plugin-vue": "^10.6.2",
53
- "fast-xml-parser": "^5.3.3",
54
- "globals": "^17.0.0",
55
- "semver": "^7.7.3",
56
- "sort-package-json": "^3.6.0",
57
- "typescript-eslint": "^8.53.0"
46
+ "@eslint/js": "^10.0.1",
47
+ "@eslint/json": "^1.2.0",
48
+ "@stylistic/eslint-plugin": "^5.10.0",
49
+ "eslint-config-flat-gitignore": "^2.3.0",
50
+ "eslint-plugin-antfu": "^3.2.2",
51
+ "eslint-plugin-jsdoc": "^62.9.0",
52
+ "eslint-plugin-perfectionist": "^5.8.0",
53
+ "eslint-plugin-vue": "^10.8.0",
54
+ "fast-xml-parser": "^5.5.10",
55
+ "globals": "^17.4.0",
56
+ "semver": "^7.7.4",
57
+ "sort-package-json": "^3.6.1",
58
+ "typescript-eslint": "^8.58.0"
58
59
  },
59
60
  "devDependencies": {
60
- "@types/node": "^25.0.6",
61
+ "@types/node": "^25.5.2",
61
62
  "@types/semver": "^7.7.1",
62
- "eslint": "^9.39.2",
63
- "memfs": "^4.51.1",
64
- "vitest": "^4.0.17"
63
+ "eslint": "^10.2.0",
64
+ "memfs": "^4.57.1",
65
+ "vitest": "^4.1.3"
65
66
  },
66
67
  "peerDependencies": {
67
- "eslint": ">=9"
68
+ "eslint": ">=10"
68
69
  },
69
70
  "engines": {
70
- "node": "^20.19 || ^22 || ^24"
71
+ "node": "^20.19 || ^22.13 || ^24"
71
72
  },
72
73
  "devEngines": {
73
74
  "packageManager": [
@@ -1,10 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import type { ESLint } from 'eslint';
6
- /**
7
- * ESLint plugin to enforce consistent translations
8
- */
9
- declare const Plugin: ESLint.Plugin;
10
- export default Plugin;
@@ -1,17 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import { packageVersion } from "../../version.js";
6
- import { rules } from "./rules/index.js";
7
- /**
8
- * ESLint plugin to enforce consistent translations
9
- */
10
- const Plugin = {
11
- meta: {
12
- name: '@nextcloud/l10n-plugin',
13
- version: packageVersion,
14
- },
15
- rules,
16
- };
17
- export default Plugin;
@@ -1,13 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import * as vueUtils from 'eslint-plugin-vue/lib/utils/index.js';
6
- import enforceEllipsis from "./enforce-ellipsis.js";
7
- const defineRule = (r) => r;
8
- export default defineRule({
9
- ...enforceEllipsis,
10
- create(context) {
11
- return vueUtils.defineTemplateBodyVisitor(context, enforceEllipsis.create(context));
12
- },
13
- });
@@ -1,10 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- export declare const rules: {
6
- 'enforce-ellipsis': import("eslint").Rule.RuleModule;
7
- 'enforce-ellipsis-vue': import("eslint").Rule.RuleModule;
8
- 'non-breaking-space': import("eslint").Rule.RuleModule;
9
- 'non-breaking-space-vue': import("eslint").Rule.RuleModule;
10
- };
@@ -1,14 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import enforceEllipsisVue from "./enforce-ellipsis-vue.js";
6
- import enforceEllipsis from "./enforce-ellipsis.js";
7
- import nonBreakingSpaceVue from "./non-breaking-space-vue.js";
8
- import nonBreakingSpace from "./non-breaking-space.js";
9
- export const rules = {
10
- 'enforce-ellipsis': enforceEllipsis,
11
- 'enforce-ellipsis-vue': enforceEllipsisVue,
12
- 'non-breaking-space': nonBreakingSpace,
13
- 'non-breaking-space-vue': nonBreakingSpaceVue,
14
- };
@@ -1,7 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import type { Rule } from 'eslint';
6
- declare const _default: Rule.RuleModule;
7
- export default _default;
@@ -1,13 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import * as vueUtils from 'eslint-plugin-vue/lib/utils/index.js';
6
- import nonBreakingSpace from "./non-breaking-space.js";
7
- const defineRule = (r) => r;
8
- export default defineRule({
9
- ...nonBreakingSpace,
10
- create(context) {
11
- return vueUtils.defineTemplateBodyVisitor(context, nonBreakingSpace.create(context));
12
- },
13
- });
@@ -1,7 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import type { Rule } from 'eslint';
6
- declare const _default: Rule.RuleModule;
7
- export default _default;
@@ -1,49 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- declare const _default: {
6
- rules: {
7
- 'no-deprecated-exports': import("eslint").Rule.RuleModule;
8
- 'no-deprecated-props': {
9
- meta: {
10
- docs: {
11
- description: string;
12
- };
13
- type: "problem";
14
- fixable: "code";
15
- messages: {
16
- outdatedVueLibrary: string;
17
- useTypeInstead: string;
18
- useVariantInstead: string;
19
- useDisableSwipeForNavInstead: string;
20
- useHideStatusInstead: string;
21
- useVerboseStatusInstead: string;
22
- useNoPlaceholderInstead: string;
23
- useFormatInstead: string;
24
- useLocaleInstead: string;
25
- useTypeDateRangeInstead: string;
26
- useNoCloseInstead: string;
27
- useNoCloseOnClickOutsideInstead: string;
28
- useDisableSwipeForModalInstead: string;
29
- useNoFocusTrapInstead: string;
30
- useKeepOpenInstead: string;
31
- useNcSelectUsersInstead: string;
32
- useArrowEndInstead: string;
33
- removeAriaHidden: string;
34
- removeLimitWidth: string;
35
- removeExact: string;
36
- useCloseButtonOutsideInstead: string;
37
- useModelValueInsteadChecked: string;
38
- useModelValueInsteadValue: string;
39
- };
40
- };
41
- create(context: import("eslint").Rule.RuleContext): any;
42
- };
43
- };
44
- meta: {
45
- name: string;
46
- version: string;
47
- };
48
- };
49
- export default _default;
@@ -1,13 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import { packageVersion } from "../../version.js";
6
- import { rules } from "./rules/index.js";
7
- export default {
8
- rules,
9
- meta: {
10
- name: '@nextcloud/eslint-plugin',
11
- version: packageVersion,
12
- },
13
- };
@@ -1,38 +0,0 @@
1
- export declare const rules: {
2
- 'no-deprecated-exports': import("eslint").Rule.RuleModule;
3
- 'no-deprecated-props': {
4
- meta: {
5
- docs: {
6
- description: string;
7
- };
8
- type: "problem";
9
- fixable: "code";
10
- messages: {
11
- outdatedVueLibrary: string;
12
- useTypeInstead: string;
13
- useVariantInstead: string;
14
- useDisableSwipeForNavInstead: string;
15
- useHideStatusInstead: string;
16
- useVerboseStatusInstead: string;
17
- useNoPlaceholderInstead: string;
18
- useFormatInstead: string;
19
- useLocaleInstead: string;
20
- useTypeDateRangeInstead: string;
21
- useNoCloseInstead: string;
22
- useNoCloseOnClickOutsideInstead: string;
23
- useDisableSwipeForModalInstead: string;
24
- useNoFocusTrapInstead: string;
25
- useKeepOpenInstead: string;
26
- useNcSelectUsersInstead: string;
27
- useArrowEndInstead: string;
28
- removeAriaHidden: string;
29
- removeLimitWidth: string;
30
- removeExact: string;
31
- useCloseButtonOutsideInstead: string;
32
- useModelValueInsteadChecked: string;
33
- useModelValueInsteadValue: string;
34
- };
35
- };
36
- create(context: import("eslint").Rule.RuleContext): any;
37
- };
38
- };
@@ -1,10 +0,0 @@
1
- /*!
2
- * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
- * SPDX-License-Identifier: AGPL-3.0-or-later
4
- */
5
- import noDeprecatedExports from "./no-deprecated-exports.js";
6
- import noDeprecatedProps from "./no-deprecated-props.js";
7
- export const rules = {
8
- 'no-deprecated-exports': noDeprecatedExports,
9
- 'no-deprecated-props': noDeprecatedProps,
10
- };