1
+ const path = require ( 'path' )
2
+ const { readFileSync } = require ( 'fs' )
3
+
4
+ const activeLocales = JSON . parse ( readFileSync ( path . join ( __dirname , './static/locales/activeLocales.json' ) ) )
5
+
1
6
module . exports = {
2
7
// https://eslint.org/docs/user-guide/configuring#using-configuration-files-1
3
8
root : true ,
@@ -48,11 +53,12 @@ module.exports = {
48
53
'plugin:vue/recommended' ,
49
54
'standard' ,
50
55
'plugin:jsonc/recommended-with-json' ,
51
- 'plugin:vuejs-accessibility/recommended'
56
+ 'plugin:vuejs-accessibility/recommended' ,
57
+ 'plugin:@intlify/vue-i18n/recommended'
52
58
] ,
53
59
54
60
// https://eslint.org/docs/user-guide/configuring#configuring-plugins
55
- plugins : [ 'vue' , 'vuejs-accessibility' , 'n' , 'unicorn' ] ,
61
+ plugins : [ 'vue' , 'vuejs-accessibility' , 'n' , 'unicorn' , '@intlify/vue-i18n' ] ,
56
62
57
63
rules : {
58
64
'space-before-function-paren' : 'off' ,
@@ -78,6 +84,45 @@ module.exports = {
78
84
'unicorn/no-array-push-push' : 'error' ,
79
85
'unicorn/prefer-keyboard-event-key' : 'error' ,
80
86
'unicorn/prefer-regexp-test' : 'error' ,
81
- 'unicorn/prefer-string-replace-all' : 'error'
87
+ 'unicorn/prefer-string-replace-all' : 'error' ,
88
+ '@intlify/vue-i18n/no-dynamic-keys' : 'error' ,
89
+ // TODO: enable at a later date. currently disabled to prevent massive conflicts for initial PR
90
+ // '@intlify/vue-i18n/no-unused-keys': [
91
+ // 'error',
92
+ // {
93
+ // extensions: ['.js', '.vue', 'yaml']
94
+ // }
95
+ // ],
96
+ '@intlify/vue-i18n/no-duplicate-keys-in-locale' : 'error' ,
97
+ '@intlify/vue-i18n/no-raw-text' : [
98
+ 'error' ,
99
+ {
100
+ attributes : {
101
+ '/.+/' : [
102
+ 'title' ,
103
+ 'aria-label' ,
104
+ 'aria-placeholder' ,
105
+ 'aria-roledescription' ,
106
+ 'aria-valuetext' ,
107
+ 'tooltip' ,
108
+ 'message'
109
+ ] ,
110
+ input : [ 'placeholder' , 'value' ] ,
111
+ img : [ 'alt' ]
112
+ } ,
113
+ ignoreText : [ '-' , '•' , '/' , 'YouTube' , 'Invidious' , 'FreeTube' ]
114
+ }
115
+ ] ,
116
+ // Only applicable when we upgrade to Vue 3 and vue-i18n 9+
117
+ '@intlify/vue-i18n/no-deprecated-tc' : 'off' ,
118
+
119
+ 'vue/require-explicit-emits' : 'error' ,
120
+ 'vue/no-unused-emit-declarations' : 'error' ,
121
+ } ,
122
+ settings : {
123
+ 'vue-i18n' : {
124
+ localeDir : `./static/locales/{${ activeLocales . join ( ',' ) } }.yaml` ,
125
+ messageSyntaxVersion : '^8.0.0'
126
+ }
82
127
}
83
128
}
0 commit comments