forked from Kong/public-ui-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.cjs
106 lines (105 loc) · 3.33 KB
/
.eslintrc.cjs
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')
const kongponentsUtilityClasses = require('./utilities/disallowed-utility-classes')
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'plugin:vue/vue3-recommended',
'@vue/standard',
'plugin:cypress/recommended', // if this is missing, it looks like type errors
],
parserOptions: {
ecmaVersion: 'latest',
},
rules: {
indent: 'off',
semi: ['error', 'never'],
'space-before-function-paren': 'off',
quotes: ['error', 'single', {avoidEscape: true}],
'no-multi-spaces': 'error',
'no-unused-vars': 'off',
'no-trailing-spaces': 'error',
'padded-blocks': 'off',
'comma-dangle': ['error', 'always-multiline'],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'max-len': [process.env.NODE_ENV === 'production' ? 'warn' : 'off', {
code: 120,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
}],
'@typescript-eslint/space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
}],
// Ensures ESLint understands that `defineEmits<{ ... }>()` does _not_ fail this rule.
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'vue/attributes-order': ['error', {
alphabetical: true,
}],
'vue/multiline-html-element-content-newline': ['error', {
ignoreWhenEmpty: true,
ignores: ['code', 'pre', 'textarea', 'a', 'span', 'router-link'],
}],
// Disallow Kongponents utility classes
'vue/no-restricted-class': ['error', ...kongponentsUtilityClasses],
// This rule is too restrictive: https://github.com/vuejs/eslint-plugin-vue/issues/2259
'vue/no-setup-props-destructure': 'off',
'vue/no-restricted-static-attribute': ['error',
{
key: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
key: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
],
'vue/no-restricted-v-bind': ['error',
{
argument: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
argument: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
],
},
overrides: [
{
files: [
'cypress/integration/**.spec.{js,ts,jsx,tsx}',
'cypress/integration/**.cy.{js,ts,jsx,tsx}',
],
extends: [
'plugin:cypress/recommended',
],
},
{
files: [
'packages/portal/document-viewer/src/components/**/*.vue',
],
rules: {
'vue/multi-word-component-names': ['off'],
},
},
],
}