@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.
- package/CHANGELOG.md +114 -42
- package/README.md +85 -31
- package/dist/configs/codeStyle.d.ts +1 -1
- package/dist/configs/codeStyle.js +27 -29
- package/dist/configs/documentation.js +71 -38
- package/dist/configs/filesystem.js +10 -3
- package/dist/configs/imports.d.ts +1 -1
- package/dist/configs/imports.js +15 -18
- package/dist/configs/javascript.js +2 -2
- package/dist/configs/typescript.js +8 -1
- package/dist/configs/vue.js +36 -12
- package/dist/configs/vue2.js +2 -2
- package/dist/configs/vue3.js +24 -0
- package/dist/globs.d.ts +2 -0
- package/dist/globs.js +6 -2
- package/dist/index.d.ts +11 -7
- package/dist/index.js +4 -1
- package/dist/plugins/import-extensions/index.d.ts +15 -0
- package/dist/plugins/{nextcloud-vue → import-extensions}/index.js +4 -0
- package/dist/plugins/import-extensions/rules/ban-inline-type-imports.d.ts +7 -0
- package/dist/plugins/import-extensions/rules/ban-inline-type-imports.js +176 -0
- package/dist/plugins/import-extensions/rules/extensions.d.ts +11 -0
- package/dist/plugins/import-extensions/rules/extensions.js +143 -0
- package/dist/plugins/import-extensions/rules/index.d.ts +8 -0
- package/dist/plugins/import-extensions/rules/index.js +10 -0
- package/dist/plugins/nextcloud/rules/index.js +16 -4
- package/dist/plugins/nextcloud/rules/l10n-enforce-ellipsis.js +44 -0
- package/dist/plugins/{l10n/rules/non-breaking-space.js → nextcloud/rules/l10n-non-breaking-space.js} +11 -2
- package/dist/plugins/nextcloud/rules/{no-deprecations.js → no-deprecated-globals.js} +16 -3
- package/dist/plugins/nextcloud/rules/no-deprecated-library-exports.js +89 -0
- package/dist/plugins/nextcloud/rules/no-deprecated-library-props.d.ts +41 -0
- package/dist/plugins/nextcloud/rules/no-deprecated-library-props.js +429 -0
- package/dist/plugins/nextcloud/rules/{no-removed-apis.js → no-removed-globals.js} +53 -2
- package/dist/plugins/nextcloud/utils/lib-version-parser.d.ts +18 -0
- package/dist/plugins/nextcloud/utils/lib-version-parser.js +49 -0
- package/dist/plugins/nextcloud/utils/vue-template-visitor.d.ts +26 -0
- package/dist/plugins/nextcloud/utils/vue-template-visitor.js +38 -0
- package/dist/utils.d.ts +1 -12
- package/package.json +31 -25
- package/dist/plugins/l10n/index.d.ts +0 -10
- package/dist/plugins/l10n/index.js +0 -17
- package/dist/plugins/l10n/rules/enforce-ellipsis.js +0 -32
- package/dist/plugins/nextcloud-vue/index.d.ts +0 -8
- package/dist/plugins/nextcloud-vue/rules/index.d.ts +0 -6
- package/dist/plugins/nextcloud-vue/rules/index.js +0 -4
- package/dist/plugins/nextcloud-vue/rules/no-deprecated-exports.js +0 -44
- package/dist/plugins/nextcloud-vue/utils/lib-version-parser.d.ts +0 -33
- package/dist/plugins/nextcloud-vue/utils/lib-version-parser.js +0 -94
- /package/dist/plugins/{l10n/rules/enforce-ellipsis.d.ts → nextcloud/rules/l10n-enforce-ellipsis.d.ts} +0 -0
- /package/dist/plugins/{l10n/rules/non-breaking-space.d.ts → nextcloud/rules/l10n-non-breaking-space.d.ts} +0 -0
- /package/dist/plugins/{nextcloud-vue/rules/no-deprecated-exports.d.ts → nextcloud/rules/no-deprecated-globals.d.ts} +0 -0
- /package/dist/plugins/nextcloud/rules/{no-deprecations.d.ts → no-deprecated-library-exports.d.ts} +0 -0
- /package/dist/plugins/nextcloud/rules/{no-removed-apis.d.ts → no-removed-globals.d.ts} +0 -0
- /package/dist/plugins/nextcloud/utils/{version-parser.d.ts → app-version-parser.d.ts} +0 -0
- /package/dist/plugins/nextcloud/utils/{version-parser.js → app-version-parser.js} +0 -0
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsdoc } from 'eslint-plugin-jsdoc';
|
|
2
2
|
import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
|
|
3
|
+
const TS_FUNCTION_CONTEXTS = [
|
|
4
|
+
'FunctionDeclaration:has(TSTypeAnnotation)',
|
|
5
|
+
'FunctionExpression:has(TSTypeAnnotation)',
|
|
6
|
+
'ArrowFunctionExpression:has(TSTypeAnnotation)',
|
|
7
|
+
'MethodDefinition:has(TSTypeAnnotation)',
|
|
8
|
+
];
|
|
9
|
+
const JS_FUNCTION_CONTEXTS = [
|
|
10
|
+
'FunctionDeclaration:not(:has(TSTypeAnnotation))',
|
|
11
|
+
'FunctionExpression:not(:has(TSTypeAnnotation))',
|
|
12
|
+
'ArrowFunctionExpression:not(:has(TSTypeAnnotation))',
|
|
13
|
+
'MethodDefinition:not(:has(TSTypeAnnotation))',
|
|
14
|
+
];
|
|
15
|
+
const SHARED_JSDOC_SETTINGS = {
|
|
16
|
+
// We use the alias for legacy reasons to prevent unnecessary noise
|
|
17
|
+
tagNamePreference: {
|
|
18
|
+
returns: 'return',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
3
21
|
/**
|
|
4
22
|
* Config factory for code documentation related rules (JSDoc)
|
|
5
23
|
*
|
|
@@ -8,30 +26,26 @@ import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_
|
|
|
8
26
|
export function documentation(options) {
|
|
9
27
|
return [
|
|
10
28
|
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
...jsdocPlugin.configs['flat/recommended-typescript-flavor'],
|
|
29
|
+
...jsdoc({
|
|
30
|
+
config: 'flat/recommended-typescript-flavor',
|
|
31
|
+
settings: {
|
|
32
|
+
...SHARED_JSDOC_SETTINGS,
|
|
33
|
+
mode: 'permissive',
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
name: 'nextcloud/documentation/javascript',
|
|
22
37
|
files: [
|
|
23
38
|
...GLOB_FILES_JAVASCRIPT,
|
|
24
39
|
...(options.vueIsTypescript ? [] : GLOB_FILES_VUE),
|
|
25
40
|
],
|
|
26
|
-
settings: {
|
|
27
|
-
jsdoc: {
|
|
28
|
-
mode: 'permissive',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
41
|
ignores: GLOB_FILES_TESTING,
|
|
32
42
|
},
|
|
33
43
|
{
|
|
34
|
-
...
|
|
44
|
+
...jsdoc({
|
|
45
|
+
config: 'flat/recommended-typescript',
|
|
46
|
+
settings: SHARED_JSDOC_SETTINGS,
|
|
47
|
+
}),
|
|
48
|
+
name: 'nextcloud/documentation/typescript',
|
|
35
49
|
files: [
|
|
36
50
|
...GLOB_FILES_TYPESCRIPT,
|
|
37
51
|
...(options.vueIsTypescript ? GLOB_FILES_VUE : []),
|
|
@@ -39,6 +53,13 @@ export function documentation(options) {
|
|
|
39
53
|
ignores: GLOB_FILES_TESTING,
|
|
40
54
|
},
|
|
41
55
|
{
|
|
56
|
+
name: 'nextcloud/documentation/rules',
|
|
57
|
+
files: [
|
|
58
|
+
...GLOB_FILES_JAVASCRIPT,
|
|
59
|
+
...GLOB_FILES_TYPESCRIPT,
|
|
60
|
+
...GLOB_FILES_VUE,
|
|
61
|
+
],
|
|
62
|
+
ignores: GLOB_FILES_TESTING,
|
|
42
63
|
rules: {
|
|
43
64
|
// Force proper documentation
|
|
44
65
|
'jsdoc/check-tag-names': 'error',
|
|
@@ -52,33 +73,45 @@ export function documentation(options) {
|
|
|
52
73
|
{ startLines: 1 },
|
|
53
74
|
],
|
|
54
75
|
},
|
|
55
|
-
files: [
|
|
56
|
-
...GLOB_FILES_JAVASCRIPT,
|
|
57
|
-
...GLOB_FILES_TYPESCRIPT,
|
|
58
|
-
...GLOB_FILES_VUE,
|
|
59
|
-
],
|
|
60
|
-
settings: {
|
|
61
|
-
jsdoc: {
|
|
62
|
-
// We use the alias for legacy reasons to prevent unnecessary noise
|
|
63
|
-
tagNamePreference: {
|
|
64
|
-
returns: 'return',
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
name: 'nextcloud/documentation/rules',
|
|
69
76
|
},
|
|
70
77
|
{
|
|
78
|
+
name: 'nextcloud/documentation/rules-typescript',
|
|
79
|
+
files: [...GLOB_FILES_TYPESCRIPT],
|
|
80
|
+
ignores: GLOB_FILES_TESTING,
|
|
71
81
|
rules: {
|
|
72
82
|
// Overwrites for documentation as types are already provided by Typescript
|
|
83
|
+
'jsdoc/no-types': 'error',
|
|
73
84
|
'jsdoc/require-param-type': 'off',
|
|
74
|
-
'jsdoc/require-property-type': 'off',
|
|
75
85
|
'jsdoc/require-returns-type': 'off',
|
|
76
86
|
},
|
|
77
|
-
files: [
|
|
78
|
-
...GLOB_FILES_TYPESCRIPT,
|
|
79
|
-
...(options.vueIsTypescript ? GLOB_FILES_VUE : []),
|
|
80
|
-
],
|
|
81
|
-
name: 'nextcloud/documentation/rules-typescript',
|
|
82
87
|
},
|
|
88
|
+
...(options.vueIsTypescript
|
|
89
|
+
? [
|
|
90
|
+
{
|
|
91
|
+
name: 'nextcloud/documentation/rules-vue',
|
|
92
|
+
files: [...(options.vueIsTypescript ? GLOB_FILES_VUE : [])],
|
|
93
|
+
ignores: GLOB_FILES_TESTING,
|
|
94
|
+
rules: {
|
|
95
|
+
// Vue files can be both Javascript and Typescript
|
|
96
|
+
// Try to apply TS files only for functions with TS definitions
|
|
97
|
+
'jsdoc/no-types': [
|
|
98
|
+
'error',
|
|
99
|
+
{ contexts: TS_FUNCTION_CONTEXTS },
|
|
100
|
+
],
|
|
101
|
+
'jsdoc/require-param-type': [
|
|
102
|
+
'error',
|
|
103
|
+
{ contexts: JS_FUNCTION_CONTEXTS },
|
|
104
|
+
],
|
|
105
|
+
// Unlike params, return values are often inferred and not explicitly typed
|
|
106
|
+
'jsdoc/require-returns-type': 'off',
|
|
107
|
+
// Unfortunately, we cannot check when it is used in TS context and when not
|
|
108
|
+
'jsdoc/check-tag-names': [
|
|
109
|
+
'error',
|
|
110
|
+
{ typed: false },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
]
|
|
115
|
+
: []),
|
|
83
116
|
];
|
|
84
117
|
}
|
|
@@ -2,16 +2,23 @@
|
|
|
2
2
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
4
|
*/
|
|
5
|
+
import gitignore from 'eslint-config-flat-gitignore';
|
|
5
6
|
/**
|
|
6
7
|
* General config to exclude known non-source directories from linting
|
|
7
8
|
*/
|
|
8
9
|
export const filesystem = [
|
|
10
|
+
{
|
|
11
|
+
...gitignore(),
|
|
12
|
+
name: 'nextcloud/filesystem/gitignore',
|
|
13
|
+
},
|
|
9
14
|
{
|
|
10
15
|
name: 'nextcloud/filesystem/ignores',
|
|
11
16
|
ignores: [
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
17
|
+
'dist/',
|
|
18
|
+
'js/',
|
|
19
|
+
'l10n/',
|
|
20
|
+
'vendor/',
|
|
21
|
+
'vendor-bin/',
|
|
15
22
|
'**/package-lock.json',
|
|
16
23
|
],
|
|
17
24
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Linter } from 'eslint';
|
|
2
1
|
/*!
|
|
3
2
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
4
3
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
5
4
|
*/
|
|
5
|
+
import type { Linter } from 'eslint';
|
|
6
6
|
import type { ConfigOptions } from '../types.d.ts';
|
|
7
7
|
/**
|
|
8
8
|
* Generate imports and exports related ESLint rules.
|
package/dist/configs/imports.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
*/
|
|
1
5
|
import perfectionist from 'eslint-plugin-perfectionist';
|
|
2
6
|
import { GLOB_FILES_JAVASCRIPT, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
|
|
7
|
+
import importExtensions from "../plugins/import-extensions/index.js";
|
|
3
8
|
/**
|
|
4
9
|
* Generate imports and exports related ESLint rules.
|
|
5
10
|
*
|
|
@@ -12,6 +17,7 @@ export function imports(options) {
|
|
|
12
17
|
name: 'nextcloud/imports/setup',
|
|
13
18
|
plugins: {
|
|
14
19
|
perfectionist,
|
|
20
|
+
'import-extensions': importExtensions,
|
|
15
21
|
},
|
|
16
22
|
},
|
|
17
23
|
{
|
|
@@ -23,41 +29,32 @@ export function imports(options) {
|
|
|
23
29
|
],
|
|
24
30
|
rules: {
|
|
25
31
|
// Require file extensions
|
|
26
|
-
'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
patterns: [
|
|
30
|
-
{
|
|
31
|
-
regex: '^(\\.*)/(.+/)*[^/.]+$',
|
|
32
|
-
message: 'Import is missing the file extension.',
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
],
|
|
32
|
+
'import-extensions/extensions': 'error',
|
|
33
|
+
// enforce explicit type imports (no inline types)
|
|
34
|
+
'import-extensions/ban-inline-type-imports': 'error',
|
|
37
35
|
// Sorting of imports
|
|
38
36
|
'sort-imports': 'off',
|
|
39
37
|
'perfectionist/sort-imports': [
|
|
40
38
|
'error',
|
|
41
39
|
{
|
|
42
40
|
type: 'natural',
|
|
43
|
-
newlinesBetween:
|
|
41
|
+
newlinesBetween: 0,
|
|
44
42
|
groups: [
|
|
45
43
|
// type first
|
|
46
|
-
'external-
|
|
47
|
-
'type',
|
|
48
|
-
{ newlinesBetween:
|
|
44
|
+
['type-external', 'type-builtin'],
|
|
45
|
+
'type-import',
|
|
46
|
+
{ newlinesBetween: 1 },
|
|
49
47
|
// external things
|
|
50
48
|
[
|
|
51
49
|
'builtin',
|
|
52
50
|
'external',
|
|
53
|
-
'object',
|
|
54
51
|
],
|
|
55
52
|
// Vue components
|
|
56
53
|
'vue', // external modules (e.g. nextcloud-vue)
|
|
57
54
|
'internalVue', // internal local vue components
|
|
58
55
|
// everything else which is everything internal
|
|
59
56
|
'unknown',
|
|
60
|
-
{ newlinesBetween:
|
|
57
|
+
{ newlinesBetween: 1 },
|
|
61
58
|
// side effect only: import 'sideeffect.js'
|
|
62
59
|
'side-effect',
|
|
63
60
|
// import style from 'my.module.css'
|
|
@@ -101,7 +98,7 @@ export function imports(options) {
|
|
|
101
98
|
function createSortingConfig(type) {
|
|
102
99
|
return {
|
|
103
100
|
type: 'natural',
|
|
104
|
-
newlinesBetween:
|
|
101
|
+
newlinesBetween: 0,
|
|
105
102
|
partitionByNewLine: false,
|
|
106
103
|
groups: [
|
|
107
104
|
`type-${type}`,
|
|
@@ -62,8 +62,8 @@ export function javascript(options) {
|
|
|
62
62
|
'@nextcloud': nextcloudPlugin,
|
|
63
63
|
},
|
|
64
64
|
rules: {
|
|
65
|
-
'@nextcloud/no-
|
|
66
|
-
'@nextcloud/no-removed-
|
|
65
|
+
'@nextcloud/no-deprecated-globals': ['warn'],
|
|
66
|
+
'@nextcloud/no-removed-globals': ['error'],
|
|
67
67
|
},
|
|
68
68
|
files: [
|
|
69
69
|
...GLOB_FILES_JAVASCRIPT,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import typescriptPlugin from 'typescript-eslint';
|
|
2
|
-
import { GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_VUE, } from "../globs.js";
|
|
2
|
+
import { GLOB_FILES_TESTING, GLOB_FILES_TYPESCRIPT, GLOB_FILES_TYPESCRIPT_DECLARATIONS, GLOB_FILES_VUE, } from "../globs.js";
|
|
3
3
|
import { restrictConfigFiles } from "../utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* Typescript related ESLint rules for Nextcloud
|
|
@@ -41,6 +41,13 @@ export function typescript(options) {
|
|
|
41
41
|
],
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: 'nextcloud/typescript/declaration-rules',
|
|
46
|
+
files: [...GLOB_FILES_TYPESCRIPT_DECLARATIONS],
|
|
47
|
+
rules: {
|
|
48
|
+
'@typescript-eslint/consistent-type-imports': ['error', { disallowTypeAnnotations: false }],
|
|
49
|
+
},
|
|
50
|
+
},
|
|
44
51
|
{
|
|
45
52
|
files: GLOB_FILES_TESTING,
|
|
46
53
|
rules: {
|
package/dist/configs/vue.js
CHANGED
|
@@ -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
|
|
3
|
+
import { nextcloudPlugin } from "../index.js";
|
|
4
4
|
import { codeStyle } from "./codeStyle.js";
|
|
5
5
|
const stylisticRules = codeStyle({
|
|
6
6
|
isLibrary: false,
|
|
@@ -35,12 +35,12 @@ export function vue(options) {
|
|
|
35
35
|
: []),
|
|
36
36
|
{
|
|
37
37
|
files: GLOB_FILES_VUE,
|
|
38
|
+
name: 'nextcloud/vue/rules',
|
|
38
39
|
rules: {
|
|
39
|
-
// PascalCase components names
|
|
40
|
-
'vue/component-name-in-template-casing': [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
],
|
|
40
|
+
// PascalCase components names in template tag names
|
|
41
|
+
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
|
42
|
+
// Also in registration
|
|
43
|
+
'vue/component-options-name-casing': ['error', 'PascalCase'],
|
|
44
44
|
// space before self-closing elements
|
|
45
45
|
'vue/html-closing-bracket-spacing': 'error',
|
|
46
46
|
// no ending html tag on a new line
|
|
@@ -84,26 +84,34 @@ export function vue(options) {
|
|
|
84
84
|
// Component names should match their export names - readability and maintainability ("where does this component come from?")
|
|
85
85
|
'vue/match-component-import-name': 'error',
|
|
86
86
|
'vue/match-component-file-name': 'error',
|
|
87
|
+
// Prevent useless v-bind like `<foo :bar="'bar'"/>`
|
|
88
|
+
'vue/no-useless-v-bind': 'error',
|
|
87
89
|
// Warn on undefined components - we need this on warning level as long as people use mixins (then we can move to error)
|
|
88
90
|
'vue/no-undef-components': [
|
|
89
91
|
'warn',
|
|
90
92
|
{
|
|
91
|
-
// Ignore the router view as this is most often globally registered
|
|
92
|
-
ignorePatterns: ['
|
|
93
|
+
// Ignore the router link and view as this is (most often) globally registered
|
|
94
|
+
ignorePatterns: ['RouterLink', 'RouterView'],
|
|
93
95
|
},
|
|
94
96
|
],
|
|
95
97
|
// Warn on unused refs
|
|
96
98
|
'vue/no-unused-refs': 'warn',
|
|
97
99
|
// Warn on unused props
|
|
98
100
|
'vue/no-unused-properties': 'warn',
|
|
101
|
+
// This rule does not work in vue files, we must use the vue one
|
|
102
|
+
'no-irregular-whitespace': 'off',
|
|
103
|
+
'vue/no-irregular-whitespace': 'error',
|
|
99
104
|
},
|
|
100
|
-
name: 'nextcloud/vue/rules',
|
|
101
105
|
},
|
|
102
106
|
{
|
|
103
107
|
files: GLOB_FILES_VUE,
|
|
108
|
+
name: 'nextcloud/vue/stylistic-rules',
|
|
104
109
|
rules: {
|
|
105
110
|
// same as the stylistic rules but for the <template> in Vue files
|
|
106
111
|
...Object.fromEntries(vueStylisticRules),
|
|
112
|
+
// same as in the codeStyle config but for the <template> in Vue files
|
|
113
|
+
'@nextcloud/l10n-non-breaking-space': 'error',
|
|
114
|
+
'@nextcloud/l10n-enforce-ellipsis': 'error',
|
|
107
115
|
// Also enforce tabs for template
|
|
108
116
|
'vue/html-indent': [
|
|
109
117
|
'error',
|
|
@@ -113,8 +121,23 @@ export function vue(options) {
|
|
|
113
121
|
'vue/new-line-between-multi-line-property': 'error',
|
|
114
122
|
// Add consistent padding between blocks
|
|
115
123
|
'vue/padding-line-between-blocks': 'error',
|
|
124
|
+
// Prefer separated static and dynamic class attributes
|
|
125
|
+
'vue/prefer-separate-static-class': 'error',
|
|
126
|
+
// For consistent layout of components
|
|
127
|
+
'vue/define-macros-order': [
|
|
128
|
+
'error',
|
|
129
|
+
{
|
|
130
|
+
order: [
|
|
131
|
+
'defineOptions',
|
|
132
|
+
'defineModel',
|
|
133
|
+
'defineProps',
|
|
134
|
+
'defineEmits',
|
|
135
|
+
'defineSlots',
|
|
136
|
+
'defineExpose',
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
116
140
|
},
|
|
117
|
-
name: 'nextcloud/vue/stylistic-rules',
|
|
118
141
|
},
|
|
119
142
|
{
|
|
120
143
|
files: [
|
|
@@ -123,10 +146,11 @@ export function vue(options) {
|
|
|
123
146
|
...GLOB_FILES_VUE,
|
|
124
147
|
],
|
|
125
148
|
plugins: {
|
|
126
|
-
'@nextcloud
|
|
149
|
+
'@nextcloud': nextcloudPlugin,
|
|
127
150
|
},
|
|
128
151
|
rules: {
|
|
129
|
-
'@nextcloud/
|
|
152
|
+
'@nextcloud/no-deprecated-library-exports': 'error',
|
|
153
|
+
'@nextcloud/no-deprecated-library-props': 'error',
|
|
130
154
|
},
|
|
131
155
|
name: 'nextcloud/vue/migration-rules',
|
|
132
156
|
},
|
package/dist/configs/vue2.js
CHANGED
|
@@ -13,12 +13,12 @@ export function vue2(option) {
|
|
|
13
13
|
...vue(option),
|
|
14
14
|
{
|
|
15
15
|
rules: {
|
|
16
|
-
// custom event
|
|
16
|
+
// Force kebab-case for custom event name definitions (recommended by Vue 2 documentation)
|
|
17
17
|
'vue/custom-event-name-casing': [
|
|
18
18
|
'error',
|
|
19
19
|
'kebab-case',
|
|
20
20
|
{
|
|
21
|
-
//
|
|
21
|
+
// Allow namespace formats namespace:event
|
|
22
22
|
ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'],
|
|
23
23
|
},
|
|
24
24
|
],
|
package/dist/configs/vue3.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
*/
|
|
1
5
|
import vuePlugin from 'eslint-plugin-vue';
|
|
2
6
|
import { GLOB_FILES_VUE } from "../globs.js";
|
|
3
7
|
import { restrictConfigFiles } from "../utils.js";
|
|
@@ -15,8 +19,28 @@ export function vue3(options) {
|
|
|
15
19
|
{
|
|
16
20
|
files: GLOB_FILES_VUE,
|
|
17
21
|
rules: {
|
|
22
|
+
// Force camelCase in props/attrs for consistency with <script> and prevent tooling issues
|
|
23
|
+
'vue/attribute-hyphenation': ['error', 'never'],
|
|
24
|
+
// Force camelCase for custom event name definitions (recommended by Vue 3 documentation and consistent with JS)
|
|
25
|
+
'vue/custom-event-name-casing': [
|
|
26
|
+
'error',
|
|
27
|
+
'camelCase',
|
|
28
|
+
{
|
|
29
|
+
// Allow namespace formats namespace:event
|
|
30
|
+
ignores: ['/^[a-z]+:[a-z]+$/iu'],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
// Force camelCase for events in template for consistency with <script>
|
|
34
|
+
'vue/v-on-event-hyphenation': ['error', 'never', { autofix: true }],
|
|
35
|
+
// Force camelCase for slot names.
|
|
36
|
+
// Changing case is breaking for component users.
|
|
37
|
+
// For libraries it may result in a breaking change. Warn to prevent unintended breaking change.
|
|
38
|
+
// TODO: allow namespace:slotName format like in events
|
|
39
|
+
'vue/slot-name-casing': [options.isLibrary ? 'warn' : 'error', 'camelCase'],
|
|
18
40
|
// Deprecated thus we should not use it
|
|
19
41
|
'vue/no-deprecated-delete-set': 'error',
|
|
42
|
+
// When using script-setup the modern approach should be used
|
|
43
|
+
'vue/prefer-define-options': 'error',
|
|
20
44
|
},
|
|
21
45
|
name: 'nextcloud/vue3/rules',
|
|
22
46
|
},
|
package/dist/globs.d.ts
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
export declare const GLOB_FILES_TESTING: string[];
|
|
7
7
|
/** Glob pattern for Typescript files */
|
|
8
8
|
export declare const GLOB_FILES_TYPESCRIPT: string[];
|
|
9
|
+
/** Glob pattern for Typescript declaration files */
|
|
10
|
+
export declare const GLOB_FILES_TYPESCRIPT_DECLARATIONS: string[];
|
|
9
11
|
/** Glob pattern for Javascript files */
|
|
10
12
|
export declare const GLOB_FILES_JAVASCRIPT: string[];
|
|
11
13
|
/** Glob pattern for JSON files */
|
package/dist/globs.js
CHANGED
|
@@ -7,8 +7,10 @@ export const GLOB_FILES_TESTING = [
|
|
|
7
7
|
'**/*.test.*',
|
|
8
8
|
'**/*.spec.*',
|
|
9
9
|
'**/*.cy.*',
|
|
10
|
-
'**/test',
|
|
11
|
-
'**/tests',
|
|
10
|
+
'**/test/**',
|
|
11
|
+
'**/tests/**',
|
|
12
|
+
'**/__tests__/**',
|
|
13
|
+
'**/__mocks__/**',
|
|
12
14
|
];
|
|
13
15
|
/** Glob pattern for Typescript files */
|
|
14
16
|
export const GLOB_FILES_TYPESCRIPT = [
|
|
@@ -17,6 +19,8 @@ export const GLOB_FILES_TYPESCRIPT = [
|
|
|
17
19
|
'**/*.cts',
|
|
18
20
|
'**/*.tsx',
|
|
19
21
|
];
|
|
22
|
+
/** Glob pattern for Typescript declaration files */
|
|
23
|
+
export const GLOB_FILES_TYPESCRIPT_DECLARATIONS = ['**/*.d.ts'];
|
|
20
24
|
/** Glob pattern for Javascript files */
|
|
21
25
|
export const GLOB_FILES_JAVASCRIPT = [
|
|
22
26
|
'**/*.js',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
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';
|
|
1
6
|
/**
|
|
2
7
|
* Nextcloud shared configuration for projects using Vue 2 with Javascript <script> blocks
|
|
3
8
|
*/
|
|
4
|
-
export declare const recommendedVue2Javascript:
|
|
9
|
+
export declare const recommendedVue2Javascript: Linter.Config[];
|
|
5
10
|
/**
|
|
6
11
|
* Nextcloud shared configuration for projects using Vue 2 with Typescript <script> blocks
|
|
7
12
|
*/
|
|
8
|
-
export declare const recommendedVue2:
|
|
13
|
+
export declare const recommendedVue2: Linter.Config[];
|
|
9
14
|
/**
|
|
10
15
|
* Nextcloud shared configuration for projects using Vue 3 with Javascript <script> blocks
|
|
11
16
|
*/
|
|
12
|
-
export declare const recommendedJavascript:
|
|
17
|
+
export declare const recommendedJavascript: Linter.Config[];
|
|
13
18
|
/**
|
|
14
19
|
* Nextcloud shared configuration for projects using Vue 3 with Typescript <script> blocks
|
|
15
20
|
*/
|
|
16
|
-
export declare const recommended:
|
|
21
|
+
export declare const recommended: Linter.Config[];
|
|
17
22
|
/**
|
|
18
23
|
* Nextcloud shared configuration for projects using Vue 3 with Typescript <script> blocks
|
|
19
24
|
*/
|
|
20
|
-
export declare const recommendedLibrary:
|
|
25
|
+
export declare const recommendedLibrary: Linter.Config[];
|
|
21
26
|
/**
|
|
22
27
|
* Nextcloud shared configuration for projects using Vue 3 with Typescript <script> blocks
|
|
23
28
|
*/
|
|
24
|
-
export declare const recommendedVue2Library:
|
|
29
|
+
export declare const recommendedVue2Library: Linter.Config[];
|
|
25
30
|
export { default as packageJsonPlugin } from './plugins/packageJson.ts';
|
|
26
31
|
export { default as nextcloudPlugin } from './plugins/nextcloud/index.ts';
|
|
27
|
-
export { default as l10nPlugin } from './plugins/l10n/index.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
3
|
+
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
4
|
+
*/
|
|
1
5
|
import { codeStyle } from "./configs/codeStyle.js";
|
|
2
6
|
import { documentation } from "./configs/documentation.js";
|
|
3
7
|
import { filesystem } from "./configs/filesystem.js";
|
|
@@ -55,7 +59,6 @@ export const recommendedVue2Library = createConfig({
|
|
|
55
59
|
});
|
|
56
60
|
export { default as packageJsonPlugin } from "./plugins/packageJson.js";
|
|
57
61
|
export { default as nextcloudPlugin } from "./plugins/nextcloud/index.js";
|
|
58
|
-
export { default as l10nPlugin } from "./plugins/l10n/index.js";
|
|
59
62
|
/**
|
|
60
63
|
* Generate a configuration based on given options
|
|
61
64
|
*
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
'ban-inline-type-imports': import("eslint").Rule.RuleModule;
|
|
8
|
+
extensions: import("eslint").Rule.RuleModule;
|
|
9
|
+
};
|
|
10
|
+
meta: {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|