summaryrefslogtreecommitdiffstats
path: root/.eslintrc.js
blob: e552112743ba33125482cf2460646ae79265a1b0 (plain)
1
2
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
module.exports = {
	extends: [
		'@nextcloud',
	],
	globals: {
		// @nextcloud/webpack-vue-config globals
		appName: 'readonly',
		appVersion: 'readonly',
		// Desktop build globals
		IS_DESKTOP: 'readonly',
	},
	rules: {
		'comma-dangle': 'off',
		'jsdoc/no-defaults': 'off',
		'import/newline-after-import': 'warn',
		'import/no-named-as-default-member': 'off',
		'import/order': [
			'off', // TODO disabled with #10622 as it breaks tests and changes many components
			{
				groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'unknown'],
				pathGroups: [
					{
						// group all style imports at the end
						pattern: '{*.css,*.scss}',
						patternOptions: { matchBase: true },
						group: 'unknown',
						position: 'after',
					},
					{
						// group material design icons
						pattern: 'vue-material-design-icons/**',
						group: 'external',
						position: 'after',
					},
					{
						// group @nextcloud imports
						pattern: '@nextcloud/{!(vue),!(vue)/**}',
						group: 'external',
						position: 'after',
					},
					{
						// group @nextcloud/vue imports
						pattern: '{@nextcloud/vue,@nextcloud/vue/**}',
						group: 'external',
						position: 'after',
					},
					{
						// group project components
						pattern: '*.vue',
						patternOptions: { matchBase: true },
						group: 'external',
						position: 'after',
					},
				],
				pathGroupsExcludedImportTypes: ['@nextcloud', 'vue-material-design-icons'],
				'newlines-between': 'always',
				alphabetize: {
					order: 'asc',
					caseInsensitive: true,
				},
				warnOnUnassignedImports: true,
			},
		],
		// Prepare for Vue 3 Migration
		'vue/no-deprecated-data-object-declaration': 'warn',
		'vue/no-deprecated-events-api': 'warn',
		'vue/no-deprecated-filter': 'warn',
		'vue/no-deprecated-functional-template': 'warn',
		'vue/no-deprecated-html-element-is': 'warn',
		'vue/no-deprecated-props-default-this': 'warn',
		'vue/no-deprecated-router-link-tag-prop': 'warn',
		'vue/no-deprecated-scope-attribute': 'warn',
		'vue/no-deprecated-slot-attribute': 'warn',
		'vue/no-deprecated-slot-scope-attribute': 'warn',
		'vue/no-deprecated-v-is': 'warn',
		'vue/no-deprecated-v-on-number-modifiers': 'warn',
		'vue/require-explicit-emits': 'warn',
	},
	overrides: [
		{
			files: ['**/*.spec.js'],
			rules: {
				'node/no-unpublished-import': 'off',
			},
		},
	],
}