3
3
const DOMGlobals = [ 'window' , 'document' ]
4
4
const NodeGlobals = [ 'module' , 'require' ]
5
5
6
+ const banConstEnum = {
7
+ selector : 'TSEnumDeclaration[const=true]' ,
8
+ message : 'Please use enums, instead' ,
9
+ }
10
+
11
+ /**
12
+ * @type {import('eslint-define-config').ESLintConfig }
13
+ */
6
14
module . exports = {
7
15
parser : '@typescript-eslint/parser' ,
8
16
parserOptions : {
@@ -16,6 +24,7 @@ module.exports = {
16
24
17
25
'no-restricted-syntax' : [
18
26
'error' ,
27
+ banConstEnum ,
19
28
// since we target ES2015 for baseline support, we need to forbid object
20
29
// rest spread usage in destructure as it compiles into a verbose helper.
21
30
'ObjectPattern > RestElement' ,
@@ -57,15 +66,21 @@ module.exports = {
57
66
] ,
58
67
rules : {
59
68
'no-restricted-globals' : [ 'error' , ...DOMGlobals ] ,
60
- 'no-restricted-syntax' : 'off'
69
+ 'no-restricted-syntax' : [
70
+ 'error' ,
71
+ banConstEnum ,
72
+ ]
61
73
}
62
74
} ,
63
75
// Private package, browser only + no syntax restrictions
64
76
{
65
77
files : [ 'packages/template-explorer/**' , 'packages/sfc-playground/**' ] ,
66
78
rules : {
67
79
'no-restricted-globals' : [ 'error' , ...NodeGlobals ] ,
68
- 'no-restricted-syntax' : 'off'
80
+ 'no-restricted-syntax' : [
81
+ 'error' ,
82
+ banConstEnum ,
83
+ ]
69
84
}
70
85
} ,
71
86
// JavaScript files
@@ -81,7 +96,10 @@ module.exports = {
81
96
files : [ 'scripts/**' , '*.{js,ts}' , 'packages/**/index.js' ] ,
82
97
rules : {
83
98
'no-restricted-globals' : 'off' ,
84
- 'no-restricted-syntax' : 'off'
99
+ 'no-restricted-syntax' : [
100
+ 'error' ,
101
+ banConstEnum ,
102
+ ]
85
103
}
86
104
}
87
105
]
0 commit comments