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