@nextcloud/eslint-config 8.3.0-beta.1 → 8.3.0
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 +245 -237
- package/README.md +2 -2
- package/package.json +32 -28
- package/parts/base.js +110 -93
- package/parts/typescript.js +41 -34
- package/parts/vue.js +39 -40
- package/typescript.js +23 -7
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## @nextcloud/eslint-config
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@nextcloud/eslint-config)
|
|
4
|
-
[](https://github.com/nextcloud/eslint-config/actions/workflows/lint.yml)
|
|
4
|
+
[](https://github.com/nextcloud-libraries/eslint-config/actions/workflows/lint.yml)
|
|
5
5
|
[](https://dependabot.com)
|
|
6
6
|
|
|
7
7
|
|
|
@@ -47,4 +47,4 @@ module.exports = {
|
|
|
47
47
|
1. Update CHANGELOG.md file with the latest changes
|
|
48
48
|
2. Bump the package version with `npm version`
|
|
49
49
|
3. Push version bump commit
|
|
50
|
-
4. Create a new release with proper changelog https://github.com/nextcloud/eslint-config/releases/new
|
|
50
|
+
4. Create a new release with proper changelog https://github.com/nextcloud-libraries/eslint-config/releases/new
|
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextcloud/eslint-config",
|
|
3
|
-
"version": "8.3.0
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "Eslint shared config for nextcloud vue.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/nextcloud/eslint-config.git"
|
|
8
|
+
"url": "git+https://github.com/nextcloud-libraries/eslint-config.git"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"lint": "eslint
|
|
12
|
-
"lint:fix": "eslint
|
|
11
|
+
"lint": "eslint parts *.js",
|
|
12
|
+
"lint:fix": "eslint --fix parts *.js",
|
|
13
13
|
"test": "jest"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@babel/core": "^7.
|
|
16
|
+
"@babel/core": "^7.22.20",
|
|
17
17
|
"@babel/eslint-parser": "^7.16.5",
|
|
18
|
-
"@nextcloud/eslint-plugin": "^2.
|
|
19
|
-
"@vue/eslint-config-typescript": "^
|
|
18
|
+
"@nextcloud/eslint-plugin": "^2.1.0",
|
|
19
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
20
20
|
"eslint": "^8.27.0",
|
|
21
|
-
"eslint-config-standard": "^17.
|
|
22
|
-
"eslint-import-resolver-exports": "^1.0.0-beta.
|
|
23
|
-
"eslint-import-resolver-typescript": "^3.
|
|
21
|
+
"eslint-config-standard": "^17.1.0",
|
|
22
|
+
"eslint-import-resolver-exports": "^1.0.0-beta.5",
|
|
23
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
24
24
|
"eslint-plugin-import": "^2.26.0",
|
|
25
25
|
"eslint-plugin-jsdoc": "^46.2.6",
|
|
26
26
|
"eslint-plugin-n": "^16.0.0",
|
|
@@ -29,23 +29,24 @@
|
|
|
29
29
|
"typescript": "^5.0.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@babel/core": "^7.
|
|
33
|
-
"@babel/eslint-parser": "^7.
|
|
34
|
-
"@nextcloud/eslint-plugin": "^2.
|
|
35
|
-
"@types/
|
|
36
|
-
"@
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint
|
|
39
|
-
"eslint-
|
|
40
|
-
"eslint-import-resolver-
|
|
41
|
-
"eslint-
|
|
42
|
-
"eslint-plugin-
|
|
43
|
-
"eslint-plugin-
|
|
32
|
+
"@babel/core": "^7.22.20",
|
|
33
|
+
"@babel/eslint-parser": "^7.22.11",
|
|
34
|
+
"@nextcloud/eslint-plugin": "^2.1.0",
|
|
35
|
+
"@types/eslint": "^8.44.2",
|
|
36
|
+
"@types/jest": "^29.5.5",
|
|
37
|
+
"@vue/eslint-config-typescript": "^12.0.0",
|
|
38
|
+
"eslint": "^8.50.0",
|
|
39
|
+
"eslint-config-standard": "^17.1.0",
|
|
40
|
+
"eslint-import-resolver-exports": "^1.0.0-beta.5",
|
|
41
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
42
|
+
"eslint-plugin-import": "^2.28.1",
|
|
43
|
+
"eslint-plugin-jsdoc": "^46.8.2",
|
|
44
|
+
"eslint-plugin-n": "^16.1.0",
|
|
44
45
|
"eslint-plugin-promise": "^6.1.1",
|
|
45
|
-
"eslint-plugin-vue": "^9.
|
|
46
|
-
"jest": "^29.
|
|
47
|
-
"ts-jest": "^29.0
|
|
48
|
-
"typescript": "^5.
|
|
46
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
47
|
+
"jest": "^29.7.0",
|
|
48
|
+
"ts-jest": "^29.1.0",
|
|
49
|
+
"typescript": "^5.2.2",
|
|
49
50
|
"vue-eslint-parser": "^9.3.1"
|
|
50
51
|
},
|
|
51
52
|
"keywords": [
|
|
@@ -58,13 +59,16 @@
|
|
|
58
59
|
"author": "John Molakvoæ <skjnldsv@protonmail.com>",
|
|
59
60
|
"license": "AGPL-3.0-or-later",
|
|
60
61
|
"bugs": {
|
|
61
|
-
"url": "https://github.com/nextcloud/eslint-config/issues"
|
|
62
|
+
"url": "https://github.com/nextcloud-libraries/eslint-config/issues"
|
|
62
63
|
},
|
|
63
|
-
"homepage": "https://github.com/nextcloud/eslint-config#readme",
|
|
64
|
+
"homepage": "https://github.com/nextcloud-libraries/eslint-config#readme",
|
|
64
65
|
"engines": {
|
|
65
66
|
"node": "^20.0.0",
|
|
66
67
|
"npm": "^9.0.0"
|
|
67
68
|
},
|
|
69
|
+
"eslintConfig": {
|
|
70
|
+
"extends": "./index.js"
|
|
71
|
+
},
|
|
68
72
|
"jest": {
|
|
69
73
|
"preset": "ts-jest",
|
|
70
74
|
"testEnvironment": "node",
|
package/parts/base.js
CHANGED
|
@@ -1,96 +1,113 @@
|
|
|
1
1
|
/** Base rules */
|
|
2
2
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
3
|
+
root: true,
|
|
4
|
+
env: {
|
|
5
|
+
browser: true,
|
|
6
|
+
commonjs: true,
|
|
7
|
+
es6: true,
|
|
8
|
+
node: true,
|
|
9
|
+
// Allow jest syntax in the src folder
|
|
10
|
+
jest: true,
|
|
11
|
+
},
|
|
12
|
+
parser: '@babel/eslint-parser',
|
|
13
|
+
parserOptions: {
|
|
14
|
+
requireConfigFile: false,
|
|
15
|
+
},
|
|
16
|
+
extends: [
|
|
17
|
+
'eslint:recommended',
|
|
18
|
+
'plugin:import/errors',
|
|
19
|
+
'plugin:import/warnings',
|
|
20
|
+
'plugin:n/recommended',
|
|
21
|
+
'plugin:@nextcloud/recommended',
|
|
22
|
+
'plugin:jsdoc/recommended',
|
|
23
|
+
'standard',
|
|
24
|
+
],
|
|
25
|
+
settings: {
|
|
26
|
+
'import/resolver': {
|
|
27
|
+
node: {
|
|
28
|
+
paths: ['src'],
|
|
29
|
+
extensions: ['.js', '.vue'],
|
|
30
|
+
},
|
|
31
|
+
exports: {
|
|
32
|
+
conditions: ['import'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
jsdoc: {
|
|
36
|
+
tagNamePreference: {
|
|
37
|
+
returns: 'return',
|
|
38
|
+
},
|
|
39
|
+
mode: 'typescript',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
plugins: ['vue', 'n', 'jsdoc'],
|
|
43
|
+
rules: {
|
|
44
|
+
// space before function ()
|
|
45
|
+
'space-before-function-paren': ['error', {
|
|
46
|
+
anonymous: 'never',
|
|
47
|
+
named: 'never',
|
|
48
|
+
asyncArrow: 'always',
|
|
49
|
+
}],
|
|
50
|
+
// stay consistent with array brackets
|
|
51
|
+
'array-bracket-newline': ['error', 'consistent'],
|
|
52
|
+
// tabs only for indentation
|
|
53
|
+
indent: ['error', 'tab'],
|
|
54
|
+
'no-tabs': ['error', { allowIndentationTabs: true }],
|
|
55
|
+
// allow spaces after tabs for alignment
|
|
56
|
+
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
|
|
57
|
+
// only debug console
|
|
58
|
+
'no-console': ['error', { allow: ['error', 'warn', 'info', 'debug'] }],
|
|
59
|
+
// classes blocks
|
|
60
|
+
'padded-blocks': ['error', { classes: 'always' }],
|
|
61
|
+
// always have the operator in front
|
|
62
|
+
'operator-linebreak': ['error', 'before'],
|
|
63
|
+
// ternary on multiline
|
|
64
|
+
'multiline-ternary': ['error', 'always-multiline'],
|
|
65
|
+
// force proper JSDocs
|
|
66
|
+
'jsdoc/check-tag-names': [
|
|
67
|
+
'warn', {
|
|
68
|
+
definedTags: [
|
|
69
|
+
// for jest
|
|
70
|
+
'jest-environment',
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
'jsdoc/require-returns': 0,
|
|
75
|
+
'jsdoc/require-returns-description': 0,
|
|
76
|
+
'jsdoc/tag-lines': ['off'],
|
|
77
|
+
// disallow use of "var"
|
|
78
|
+
'no-var': 'error',
|
|
79
|
+
// suggest using const
|
|
80
|
+
'prefer-const': 'error',
|
|
81
|
+
// es6 import/export and require
|
|
82
|
+
'n/no-unpublished-require': ['off'],
|
|
83
|
+
'n/no-unsupported-features/es-syntax': ['off'],
|
|
84
|
+
// always add a trailing comma (for diff readability)
|
|
85
|
+
'comma-dangle': ['warn', 'always-multiline'],
|
|
86
|
+
// Allow shallow import of @vue/test-utils and @testing-library/vue in order to be able to use it in
|
|
87
|
+
// the src folder
|
|
88
|
+
'n/no-unpublished-import': ['error', {
|
|
89
|
+
allowModules: ['@vue/test-utils', '@testing-library/vue'],
|
|
90
|
+
}],
|
|
91
|
+
// require object literal shorthand syntax
|
|
92
|
+
'object-shorthand': ['error', 'always'],
|
|
93
|
+
// Warn when file extensions are not used on import paths
|
|
94
|
+
'import/extensions': ['warn', 'always', {
|
|
95
|
+
ignorePackages: true,
|
|
96
|
+
}],
|
|
97
|
+
// ignore camelcase for __webpack variables
|
|
98
|
+
camelcase: ['error', {
|
|
99
|
+
allow: ['^UNSAFE_', '^__webpack_'],
|
|
100
|
+
properties: 'never',
|
|
101
|
+
ignoreGlobals: true,
|
|
102
|
+
}],
|
|
103
|
+
},
|
|
104
|
+
overrides: [
|
|
105
|
+
{
|
|
106
|
+
// Allow "unpublished" == devDependencies to be imported in config files
|
|
107
|
+
files: ['*.config.*', 'cypress/**/*', 'tests/**/*', '__tests__/**/*', '__mocks__/**/*'],
|
|
108
|
+
rules: {
|
|
109
|
+
'n/no-unpublished-import': 'off',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
],
|
|
96
113
|
}
|
package/parts/typescript.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
/** Rules for typescript */
|
|
2
2
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
3
|
+
files: ['**/*.ts', '**/*.cts', '**/*.mts', '**/*.tsx'],
|
|
4
|
+
extends: [
|
|
5
|
+
'@vue/eslint-config-typescript/recommended',
|
|
6
|
+
'plugin:import/typescript',
|
|
7
|
+
],
|
|
8
|
+
parser: '@typescript-eslint/parser',
|
|
9
|
+
parserOptions: {},
|
|
10
|
+
rules: {
|
|
11
|
+
// allow for generic type parameters on function calls
|
|
12
|
+
'func-call-spacing': 'off',
|
|
13
|
+
'@typescript-eslint/func-call-spacing': 'error',
|
|
14
|
+
//
|
|
15
|
+
'n/no-missing-import': 'off',
|
|
16
|
+
'import/extensions': 'off',
|
|
17
|
+
'jsdoc/check-tag-names': [
|
|
18
|
+
'warn', {
|
|
19
|
+
definedTags: [
|
|
20
|
+
// for projects using typedoc
|
|
21
|
+
'notExported',
|
|
22
|
+
'packageDocumentation',
|
|
23
|
+
// for jest
|
|
24
|
+
'jest-environment',
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
// Does not make sense with TypeScript
|
|
29
|
+
'jsdoc/require-param-type': 'off',
|
|
30
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
31
|
+
},
|
|
32
|
+
settings: {
|
|
33
|
+
'import/resolver': {
|
|
34
|
+
typescript: {
|
|
35
|
+
alwaysTryTypes: true,
|
|
36
|
+
},
|
|
37
|
+
node: {
|
|
38
|
+
paths: ['src'],
|
|
39
|
+
extensions: ['.(m|c)?js', '.ts', '.tsx', '.vue'],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}
|
package/parts/vue.js
CHANGED
|
@@ -1,42 +1,41 @@
|
|
|
1
|
-
|
|
2
1
|
module.exports = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
files: ['**/*.vue'],
|
|
3
|
+
parser: 'vue-eslint-parser',
|
|
4
|
+
parserOptions: {
|
|
5
|
+
parser: '@babel/eslint-parser',
|
|
6
|
+
},
|
|
7
|
+
extends: ['plugin:vue/recommended'],
|
|
8
|
+
rules: {
|
|
9
|
+
'vue/html-indent': ['error', 'tab'],
|
|
10
|
+
// PascalCase components names for vuejs
|
|
11
|
+
// https://vuejs.org/v2/style-guide/#Single-file-component-filename-casing-strongly-recommended
|
|
12
|
+
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
|
|
13
|
+
// force name
|
|
14
|
+
'vue/match-component-file-name': ['error', {
|
|
15
|
+
extensions: ['jsx', 'vue', 'js'],
|
|
16
|
+
shouldMatchCase: true,
|
|
17
|
+
}],
|
|
18
|
+
// space before self-closing elements
|
|
19
|
+
'vue/html-closing-bracket-spacing': 'error',
|
|
20
|
+
// no ending html tag on a new line
|
|
21
|
+
'vue/html-closing-bracket-newline': ['error', { multiline: 'never' }],
|
|
22
|
+
// check vue files too
|
|
23
|
+
'n/no-missing-import': ['error', {}],
|
|
24
|
+
// code spacing with attributes
|
|
25
|
+
'vue/max-attributes-per-line': ['error', {
|
|
26
|
+
singleline: 3,
|
|
27
|
+
multiline: 1,
|
|
28
|
+
}],
|
|
29
|
+
'vue/first-attribute-linebreak': ['error', {
|
|
30
|
+
singleline: 'beside',
|
|
31
|
+
multiline: 'beside',
|
|
32
|
+
}],
|
|
33
|
+
// Allow single-word components names
|
|
34
|
+
'vue/multi-word-component-names': ['off'],
|
|
35
|
+
// custom event naming convention
|
|
36
|
+
'vue/custom-event-name-casing': ['error', 'kebab-case', {
|
|
37
|
+
// allows custom xxxx:xxx events formats
|
|
38
|
+
ignores: ['/^[a-z]+(?:-[a-z]+)*:[a-z]+(?:-[a-z]+)*$/u'],
|
|
39
|
+
}],
|
|
40
|
+
},
|
|
42
41
|
}
|
package/typescript.js
CHANGED
|
@@ -2,24 +2,40 @@ const base = require('./parts/base.js')
|
|
|
2
2
|
const typescriptOverrides = require('./parts/typescript.js')
|
|
3
3
|
const vueOverrides = require('./parts/vue.js')
|
|
4
4
|
|
|
5
|
+
// Use different parser for vue files script section
|
|
6
|
+
vueOverrides.parserOptions = {
|
|
7
|
+
parser: '@typescript-eslint/parser',
|
|
8
|
+
sourceType: 'module',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Override vue rules with rules for Typescript
|
|
12
|
+
vueOverrides.rules = {
|
|
13
|
+
...vueOverrides.rules,
|
|
14
|
+
...typescriptOverrides.rules,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// Add settings, required for import resolver
|
|
18
|
+
vueOverrides.settings = {
|
|
19
|
+
...(vueOverrides.settings || []),
|
|
20
|
+
...typescriptOverrides.settings,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Also extend from vue typescript eslint
|
|
24
|
+
vueOverrides.extends.push('@vue/eslint-config-typescript/recommended')
|
|
25
|
+
|
|
5
26
|
/**
|
|
6
27
|
* Config for projects written in Typescript + vue including vue files written in Typescript (`<script lang='ts'>`)
|
|
7
28
|
*/
|
|
8
29
|
module.exports = {
|
|
9
30
|
...base,
|
|
10
31
|
overrides: [
|
|
11
|
-
//
|
|
32
|
+
// Overrides for Typescript files
|
|
12
33
|
{
|
|
13
34
|
...typescriptOverrides,
|
|
14
|
-
files: ['**/*.ts', '**/*.tsx', '**/*.vue'],
|
|
15
35
|
},
|
|
16
|
-
//
|
|
36
|
+
// Setup different vue parser to support `<script setup>` correctly, especially for `lang="ts"`
|
|
17
37
|
{
|
|
18
38
|
...vueOverrides,
|
|
19
|
-
parserOptions: {
|
|
20
|
-
parser: '@typescript-eslint/parser',
|
|
21
|
-
sourceType: 'module',
|
|
22
|
-
},
|
|
23
39
|
},
|
|
24
40
|
],
|
|
25
41
|
}
|