forked from FreeTubeApp/FreeTube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
127 lines (117 loc) · 3.79 KB
/
.eslintrc.js
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const path = require('path')
const { readFileSync } = require('fs')
const activeLocales = JSON.parse(readFileSync(path.join(__dirname, './static/locales/activeLocales.json')))
module.exports = {
// https://eslint.org/docs/user-guide/configuring#using-configuration-files-1
root: true,
// https://eslint.org/docs/user-guide/configuring#specifying-environments
env: {
browser: true,
node: true
},
// https://eslint.org/docs/user-guide/configuring#specifying-parser
parser: 'vue-eslint-parser',
// https://eslint.vuejs.org/user-guide/#faq
parserOptions: {
parser: '@babel/eslint-parser',
ecmaVersion: 2022,
sourceType: 'module'
},
overrides: [
{
files: ['*.json'],
parser: 'jsonc-eslint-parser',
extends: ['plugin:jsonc/base'],
rules: {
'no-tabs': 'off',
'comma-spacing': 'off'
}
},
{
files: ['*.yaml', '*.yml'],
parser: 'yaml-eslint-parser',
extends: ['plugin:yml/recommended'],
rules: {
'yml/no-irregular-whitespace': 'off'
}
}
],
// https://eslint.org/docs/user-guide/configuring#extending-configuration-files
// order matters: from least important to most important in terms of overriding
// Prettier + Vue: https://medium.com/@gogl.alex/how-to-properly-set-up-eslint-with-prettier-for-vue-or-nuxt-in-vscode-e42532099a9c
extends: [
'prettier',
'eslint:recommended',
'plugin:vue/recommended',
'standard',
'plugin:jsonc/recommended-with-json',
'plugin:vuejs-accessibility/recommended',
'plugin:@intlify/vue-i18n/recommended'
],
// https://eslint.org/docs/user-guide/configuring#configuring-plugins
plugins: ['vue', 'vuejs-accessibility', 'n', 'unicorn', '@intlify/vue-i18n'],
rules: {
'space-before-function-paren': 'off',
'comma-dangle': ['error', 'only-multiline'],
'vue/no-v-html': 'off',
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-unused-vars': 'warn',
'no-undef': 'warn',
'object-shorthand': 'off',
'vue/no-template-key': 'warn',
'vue/no-useless-template-attributes': 'off',
'vue/multi-word-component-names': 'off',
'vuejs-accessibility/no-onchange': 'off',
'vuejs-accessibility/label-has-for': ['error', {
required: {
some: ['nesting', 'id']
}
}],
'vuejs-accessibility/no-static-element-interactions': 'off',
'n/no-callback-literal': 'warn',
'n/no-path-concat': 'warn',
'unicorn/better-regex': 'error',
'unicorn/no-array-push-push': 'error',
'unicorn/prefer-keyboard-event-key': 'error',
'unicorn/prefer-regexp-test': 'error',
'unicorn/prefer-string-replace-all': 'error',
'@intlify/vue-i18n/no-dynamic-keys': 'error',
// TODO: enable at a later date. currently disabled to prevent massive conflicts for initial PR
// '@intlify/vue-i18n/no-unused-keys': [
// 'error',
// {
// extensions: ['.js', '.vue', 'yaml']
// }
// ],
'@intlify/vue-i18n/no-duplicate-keys-in-locale': 'error',
'@intlify/vue-i18n/no-raw-text': [
'error',
{
attributes: {
'/.+/': [
'title',
'aria-label',
'aria-placeholder',
'aria-roledescription',
'aria-valuetext',
'tooltip',
'message'
],
input: ['placeholder', 'value'],
img: ['alt']
},
ignoreText: ['-', '•', '/', 'YouTube', 'Invidious', 'FreeTube']
}
],
// Only applicable when we upgrade to Vue 3 and vue-i18n 9+
'@intlify/vue-i18n/no-deprecated-tc': 'off',
'vue/require-explicit-emits': 'error',
'vue/no-unused-emit-declarations': 'error',
},
settings: {
'vue-i18n': {
localeDir: `./static/locales/{${activeLocales.join(',')}}.yaml`,
messageSyntaxVersion: '^8.0.0'
}
}
}