File tree 1 file changed +36
-0
lines changed 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,42 @@ module.exports = (api) => {
13
13
prune : true
14
14
} )
15
15
16
+ if ( api . hasPlugin ( 'eslint' ) ) {
17
+ api . extendPackage ( {
18
+ devDependencies : {
19
+ 'eslint-plugin-vue' : '^7.0.0-alpha.0'
20
+ }
21
+ } )
22
+
23
+ // `plugin:vue/essential` -> `plugin:vue/vue3-essential`, etc.
24
+ const updateConfig = cfg =>
25
+ cfg . replace (
26
+ / p l u g i n : v u e \/ ( e s s e n t i a l | r e c o m m e n d e d | s t r o n g l y - r e c o m m e n d e d ) / gi,
27
+ 'plugin:vue/vue3-$1'
28
+ )
29
+
30
+ // if the config is placed in `package.json`
31
+ const eslintConfigInPkg = api . generator . pkg . eslintConfig
32
+ if ( eslintConfigInPkg && eslintConfigInPkg . extends ) {
33
+ eslintConfigInPkg . extends = eslintConfigInPkg . extends . map ( cfg => updateConfig ( cfg ) )
34
+ }
35
+ // if the config has been extracted to a standalone file
36
+ api . render ( ( files ) => {
37
+ for ( const filename of [
38
+ '.eslintrc.js' ,
39
+ '.eslintrc.cjs' ,
40
+ '.eslintrc.yaml' ,
41
+ '.eslintrc.yml' ,
42
+ '.eslinrc.json' ,
43
+ '.eslintrc'
44
+ ] ) {
45
+ if ( files [ filename ] ) {
46
+ files [ filename ] = updateConfig ( files [ filename ] )
47
+ }
48
+ }
49
+ } )
50
+ }
51
+
16
52
if ( api . hasPlugin ( 'vuex' ) || api . generator . pkg . dependencies [ 'vuex' ] ) {
17
53
api . extendPackage ( {
18
54
dependencies : {
You can’t perform that action at this time.
0 commit comments