@nextcloud/eslint-config 9.0.0-rc.3 → 9.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -25,6 +25,7 @@ Please refer to the README on how to adjust your configuration for flat config.
25
25
  * feat(no-deprecated-props): extend existing rules to support other components [\#1069](https://github.com/nextcloud-libraries/eslint-config/pull/1069) \([Antreesy](https://github.com/Antreesy)\)
26
26
  * feat(imports): add custom plugin to suggest file extensions [\#1110](https://github.com/nextcloud-libraries/eslint-config/pull/1110) \([susnux](https://github.com/susnux)\)
27
27
  * feat(filesystem): ignore all files within the `.gitignore` [\#1108](https://github.com/nextcloud-libraries/eslint-config/pull/1108) \([susnux](https://github.com/susnux)\)
28
+ * feat(l10n-plugin): also handle vue templates by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/1113
28
29
 
29
30
  ### Fixed
30
31
  * fix(codestyle): do not require splitting chains [\#951](https://github.com/nextcloud-libraries/eslint-config/pull/951)
@@ -53,6 +54,8 @@ Please refer to the README on how to adjust your configuration for flat config.
53
54
  * fix(vue): also ignore the global router link component [\#1097](https://github.com/nextcloud-libraries/eslint-config/pull/1097) \([susnux](https://github.com/susnux)\)
54
55
  * fix(no-deprecated-props): respect nextcloud/vue library version for the rule [\#1084](https://github.com/nextcloud-libraries/eslint-config/pull/1084) \([Antreesy](https://github.com/Antreesy)\)
55
56
  * fix(codestyle): replace deprecated config in `@stylistic/quotes` rule [\#1109](https://github.com/nextcloud-libraries/eslint-config/pull/1109) \([susnux](https://github.com/susnux)\)
57
+ * fix(l10n-plugin): also check translation strings in `n` method by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/1112
58
+ * fix(filesystem): relax ignored files by @susnux in https://github.com/nextcloud-libraries/eslint-config/pull/1114
56
59
 
57
60
  ### Changed
58
61
  * Add SPDX header [#802](https://github.com/nextcloud-libraries/eslint-config/pull/802)
@@ -14,13 +14,11 @@ export const filesystem = [
14
14
  {
15
15
  name: 'nextcloud/filesystem/ignores',
16
16
  ignores: [
17
- '**/coverage',
18
- '**/dist',
19
- '**/js',
20
- '**/l10n',
21
- '**/playwright-report',
22
- '**/vendor',
23
- '**/vendor-bin',
17
+ 'dist/',
18
+ 'js/',
19
+ 'l10n/',
20
+ 'vendor/',
21
+ 'vendor-bin/',
24
22
  '**/package-lock.json',
25
23
  ],
26
24
  },
@@ -35,6 +35,7 @@ export function vue(options) {
35
35
  : []),
36
36
  {
37
37
  files: GLOB_FILES_VUE,
38
+ name: 'nextcloud/vue/rules',
38
39
  rules: {
39
40
  // PascalCase components names for vuejs
40
41
  'vue/component-name-in-template-casing': [
@@ -99,13 +100,16 @@ export function vue(options) {
99
100
  // Warn on unused props
100
101
  'vue/no-unused-properties': 'warn',
101
102
  },
102
- name: 'nextcloud/vue/rules',
103
103
  },
104
104
  {
105
105
  files: GLOB_FILES_VUE,
106
+ name: 'nextcloud/vue/stylistic-rules',
106
107
  rules: {
107
108
  // same as the stylistic rules but for the <template> in Vue files
108
109
  ...Object.fromEntries(vueStylisticRules),
110
+ // same as in the codeStyle config but for the <template> in Vue files
111
+ '@nextcloud-l10n/non-breaking-space-vue': 'error',
112
+ '@nextcloud-l10n/enforce-ellipsis-vue': 'error',
109
113
  // Also enforce tabs for template
110
114
  'vue/html-indent': [
111
115
  'error',
@@ -131,7 +135,6 @@ export function vue(options) {
131
135
  },
132
136
  ],
133
137
  },
134
- name: 'nextcloud/vue/stylistic-rules',
135
138
  },
136
139
  {
137
140
  files: [
@@ -1,6 +1,9 @@
1
+ /*!
2
+ * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
3
+ * SPDX-License-Identifier: AGPL-3.0-or-later
4
+ */
1
5
  import { packageVersion } from "../../version.js";
2
- import RuleEllipsis from "./rules/enforce-ellipsis.js";
3
- import RuleNonBreakingSpace from "./rules/non-breaking-space.js";
6
+ import { rules } from "./rules/index.js";
4
7
  /**
5
8
  * ESLint plugin to enforce consistent translations
6
9
  */
@@ -9,9 +12,6 @@ const Plugin = {
9
12
  name: '@nextcloud/l10n-plugin',
10
13
  version: packageVersion,
11
14
  },
12
- rules: {
13
- 'non-breaking-space': RuleNonBreakingSpace,
14
- 'enforce-ellipsis': RuleEllipsis,
15
- },
15
+ rules,
16
16
  };
17
17
  export default Plugin;
@@ -0,0 +1,7 @@
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;
@@ -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 * 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
+ });
@@ -7,24 +7,30 @@ export default defineRule({
7
7
  docs: {
8
8
  description: 'Enforce consistent usageof ellipsis instead of tripple dots',
9
9
  },
10
+ messages: {
11
+ shoudUseEllipsis: 'Translated strings should use ellipsis character instead of triple dots',
12
+ },
10
13
  },
11
14
  create(context) {
12
15
  return {
13
- Literal(node) {
14
- if (typeof node.value !== 'string'
15
- || node.parent.type !== 'CallExpression'
16
- || node.parent.callee.type !== 'Identifier'
17
- || node.parent.callee.name !== 't') {
16
+ CallExpression(node) {
17
+ if (node.callee.type !== 'Identifier'
18
+ || (node.callee.name !== 't' && node.callee.name !== 'n')) {
18
19
  return;
19
20
  }
20
- if (node.raw?.match(/(?<=[^.])\.\.\.(?!\.)/)) {
21
- context.report({
22
- node,
23
- message: 'Strings should ellipsis instead of triple dots',
24
- fix(fixer) {
25
- return fixer.replaceText(node, node.raw.replaceAll(/(?<=[^.])\.\.\.(?!\.)/g, '…'));
26
- },
27
- });
21
+ for (const argument of node.arguments) {
22
+ if (argument.type !== 'Literal') {
23
+ continue;
24
+ }
25
+ if (argument.raw?.match(/(?<=[^.])\.\.\.(?!\.)/)) {
26
+ context.report({
27
+ node,
28
+ messageId: 'shoudUseEllipsis',
29
+ fix(fixer) {
30
+ return fixer.replaceText(argument, argument.raw.replaceAll(/(?<=[^.])\.\.\.(?!\.)/g, '…'));
31
+ },
32
+ });
33
+ }
28
34
  }
29
35
  },
30
36
  };
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +1,14 @@
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
+ };
@@ -0,0 +1,7 @@
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;
@@ -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 * 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
+ });
@@ -7,6 +7,9 @@ export default defineRule({
7
7
  docs: {
8
8
  description: 'Enforce non-breaking spaces before ellipsis',
9
9
  },
10
+ messages: {
11
+ precedeWithNonbreakingSpace: 'Ellipsis must be preceded by non-breaking spaces',
12
+ },
10
13
  },
11
14
  create(context) {
12
15
  return {
@@ -18,7 +21,7 @@ export default defineRule({
18
21
  if (matches && matches[1] !== ' ') {
19
22
  context.report({
20
23
  node,
21
- message: 'Ellipsis must be preceded by non-breaking spaces',
24
+ messageId: 'precedeWithNonbreakingSpace',
22
25
  fix(fixer) {
23
26
  return fixer.replaceText(node, node.raw.replaceAll(/\s+…/g, ' …'));
24
27
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextcloud/eslint-config",
3
- "version": "9.0.0-rc.3",
3
+ "version": "9.0.0-rc.4",
4
4
  "description": "Eslint shared config for nextcloud apps and libraries",
5
5
  "keywords": [
6
6
  "eslint",