@@ -11,159 +11,156 @@ module.exports = api => {
11
11
js : [ '.eslintrc.js' ] ,
12
12
package : 'eslintConfig'
13
13
} ,
14
- onRead : ( { data } ) => {
15
- console . log ( 'rules' , data . rules )
16
- return {
17
- prompts : [
18
- {
19
- name : 'vue/attribute-hyphenation' ,
20
- type : 'list' ,
21
- message : 'Attribute hyphenation' ,
22
- group : 'Strongly recommended' ,
23
- description : 'Enforce attribute naming style in template (`my-prop` or `myProp`)' ,
24
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/attribute-hyphenation.md' ,
25
- default : JSON . stringify ( 'off' ) ,
26
- choices : [
27
- {
28
- name : 'Off' ,
29
- value : JSON . stringify ( 'off' )
30
- } ,
31
- {
32
- name : 'Never' ,
33
- value : JSON . stringify ( [ 'error' , 'never' ] )
34
- } ,
35
- {
36
- name : 'Always' ,
37
- value : JSON . stringify ( [ 'error' , 'always' ] )
38
- }
39
- ] ,
40
- value : data . rules && JSON . stringify ( data . rules [ 'vue/attribute-hyphenation' ] )
41
- } ,
42
- {
43
- name : 'vue/html-end-tags' ,
44
- type : 'confirm' ,
45
- message : 'Template end tags style' ,
46
- group : 'Strongly recommended' ,
47
- description : 'End tag on Void elements, end tags and self-closing opening tags' ,
48
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-end-tags.md' ,
49
- default : false ,
50
- value : data . rules && data . rules [ 'vue/html-end-tags' ] === 'error' ,
51
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
52
- } ,
53
- {
54
- name : 'vue/html-indent' ,
55
- type : 'list' ,
56
- message : 'Template indentation' ,
57
- group : 'Strongly recommended' ,
58
- description : 'Enforce indentation in template' ,
59
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-indent.md' ,
60
- default : JSON . stringify ( 'off' ) ,
61
- choices : [
62
- {
63
- name : 'Off' ,
64
- value : JSON . stringify ( 'off' )
65
- } ,
66
- {
67
- name : 'Tabs' ,
68
- value : JSON . stringify ( [ 'error' , 'tabs' ] )
69
- } ,
70
- {
71
- name : '2 spaces' ,
72
- value : JSON . stringify ( [ 'error' , 2 ] )
73
- } ,
74
- {
75
- name : '4 spaces' ,
76
- value : JSON . stringify ( [ 'error' , 4 ] )
77
- } ,
78
- {
79
- name : '8 spaces' ,
80
- value : JSON . stringify ( [ 'error' , 8 ] )
81
- }
82
- ] ,
83
- value : data . rules && JSON . stringify ( data . rules [ 'vue/html-indent' ] )
84
- } ,
85
- {
86
- name : 'vue/html-self-closing' ,
87
- type : 'confirm' ,
88
- message : 'Template tag self-closing style' ,
89
- group : 'Strongly recommended' ,
90
- description : 'Self-close any component or non-Void element tags' ,
91
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md' ,
92
- default : false ,
93
- value : data . rules && data . rules [ 'vue/html-self-closing' ] === 'error' ,
94
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
95
- } ,
96
- {
97
- name : 'vue/require-default-prop' ,
98
- type : 'confirm' ,
99
- message : 'Require default in required props' ,
100
- group : 'Strongly recommended' ,
101
- description : 'This rule requires default value to be set for each props that are not marked as `required`' ,
102
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md' ,
103
- default : false ,
104
- value : data . rules && data . rules [ 'vue/require-default-prop' ] === 'error' ,
105
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
106
- } ,
107
- {
108
- name : 'vue/require-prop-types' ,
109
- type : 'confirm' ,
110
- message : 'Require types for props' ,
111
- group : 'Strongly recommended' ,
112
- description : 'In committed code, prop definitions should always be as detailed as possible, specifying at least type(s)' ,
113
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-prop-types.md' ,
114
- default : false ,
115
- value : data . rules && data . rules [ 'vue/require-prop-types' ] === 'error' ,
116
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
117
- } ,
118
- {
119
- name : 'vue/attributes-order' ,
120
- type : 'confirm' ,
121
- message : 'Attribute order' ,
122
- group : 'Recommended' ,
123
- description : 'This rule aims to enforce ordering of component attributes (the default order is specified in the Vue style guide)' ,
124
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/attributes-order.md' ,
125
- default : false ,
126
- value : data . rules && data . rules [ 'vue/attributes-order' ] === 'error' ,
127
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
128
- } ,
129
- {
130
- name : 'vue/html-quotes' ,
131
- type : 'list' ,
132
- message : 'Attribute quote style' ,
133
- group : 'Recommended' ,
134
- description : 'Enforce style of the attribute quotes in templates' ,
135
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-quotes.md' ,
136
- default : JSON . stringify ( 'off' ) ,
137
- choices : [
138
- {
139
- name : 'Off' ,
140
- value : JSON . stringify ( 'off' )
141
- } ,
142
- {
143
- name : 'Double quotes' ,
144
- value : JSON . stringify ( [ 'error' , 'double' ] )
145
- } ,
146
- {
147
- name : 'Single quotes' ,
148
- value : JSON . stringify ( [ 'error' , 'single' ] )
149
- }
150
- ] ,
151
- value : data . rules && JSON . stringify ( data . rules [ 'vue/html-quotes' ] )
152
- } ,
153
- {
154
- name : 'vue/order-in-components' ,
155
- type : 'confirm' ,
156
- message : 'Component options order' ,
157
- group : 'Recommended' ,
158
- description : 'This rule aims to enforce ordering of component options (the default order is specified in the Vue style guide)' ,
159
- link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md' ,
160
- default : false ,
161
- value : data . rules && data . rules [ 'vue/order-in-components' ] === 'error' ,
162
- filter : input => JSON . stringify ( input ? 'error' : 'off' )
163
- }
164
- ]
165
- }
166
- } ,
14
+ onRead : ( { data } ) => ( {
15
+ prompts : [
16
+ {
17
+ name : 'vue/attribute-hyphenation' ,
18
+ type : 'list' ,
19
+ message : 'Attribute hyphenation' ,
20
+ group : 'Strongly recommended' ,
21
+ description : 'Enforce attribute naming style in template (`my-prop` or `myProp`)' ,
22
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/attribute-hyphenation.md' ,
23
+ default : JSON . stringify ( 'off' ) ,
24
+ choices : [
25
+ {
26
+ name : 'Off' ,
27
+ value : JSON . stringify ( 'off' )
28
+ } ,
29
+ {
30
+ name : 'Never' ,
31
+ value : JSON . stringify ( [ 'error' , 'never' ] )
32
+ } ,
33
+ {
34
+ name : 'Always' ,
35
+ value : JSON . stringify ( [ 'error' , 'always' ] )
36
+ }
37
+ ] ,
38
+ value : data . rules && JSON . stringify ( data . rules [ 'vue/attribute-hyphenation' ] )
39
+ } ,
40
+ {
41
+ name : 'vue/html-end-tags' ,
42
+ type : 'confirm' ,
43
+ message : 'Template end tags style' ,
44
+ group : 'Strongly recommended' ,
45
+ description : 'End tag on Void elements, end tags and self-closing opening tags' ,
46
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-end-tags.md' ,
47
+ default : false ,
48
+ value : data . rules && data . rules [ 'vue/html-end-tags' ] === 'error' ,
49
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
50
+ } ,
51
+ {
52
+ name : 'vue/html-indent' ,
53
+ type : 'list' ,
54
+ message : 'Template indentation' ,
55
+ group : 'Strongly recommended' ,
56
+ description : 'Enforce indentation in template' ,
57
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-indent.md' ,
58
+ default : JSON . stringify ( 'off' ) ,
59
+ choices : [
60
+ {
61
+ name : 'Off' ,
62
+ value : JSON . stringify ( 'off' )
63
+ } ,
64
+ {
65
+ name : 'Tabs' ,
66
+ value : JSON . stringify ( [ 'error' , 'tabs' ] )
67
+ } ,
68
+ {
69
+ name : '2 spaces' ,
70
+ value : JSON . stringify ( [ 'error' , 2 ] )
71
+ } ,
72
+ {
73
+ name : '4 spaces' ,
74
+ value : JSON . stringify ( [ 'error' , 4 ] )
75
+ } ,
76
+ {
77
+ name : '8 spaces' ,
78
+ value : JSON . stringify ( [ 'error' , 8 ] )
79
+ }
80
+ ] ,
81
+ value : data . rules && JSON . stringify ( data . rules [ 'vue/html-indent' ] )
82
+ } ,
83
+ {
84
+ name : 'vue/html-self-closing' ,
85
+ type : 'confirm' ,
86
+ message : 'Template tag self-closing style' ,
87
+ group : 'Strongly recommended' ,
88
+ description : 'Self-close any component or non-Void element tags' ,
89
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-self-closing.md' ,
90
+ default : false ,
91
+ value : data . rules && data . rules [ 'vue/html-self-closing' ] === 'error' ,
92
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
93
+ } ,
94
+ {
95
+ name : 'vue/require-default-prop' ,
96
+ type : 'confirm' ,
97
+ message : 'Require default in required props' ,
98
+ group : 'Strongly recommended' ,
99
+ description : 'This rule requires default value to be set for each props that are not marked as `required`' ,
100
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md' ,
101
+ default : false ,
102
+ value : data . rules && data . rules [ 'vue/require-default-prop' ] === 'error' ,
103
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
104
+ } ,
105
+ {
106
+ name : 'vue/require-prop-types' ,
107
+ type : 'confirm' ,
108
+ message : 'Require types for props' ,
109
+ group : 'Strongly recommended' ,
110
+ description : 'In committed code, prop definitions should always be as detailed as possible, specifying at least type(s)' ,
111
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-prop-types.md' ,
112
+ default : false ,
113
+ value : data . rules && data . rules [ 'vue/require-prop-types' ] === 'error' ,
114
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
115
+ } ,
116
+ {
117
+ name : 'vue/attributes-order' ,
118
+ type : 'confirm' ,
119
+ message : 'Attribute order' ,
120
+ group : 'Recommended' ,
121
+ description : 'This rule aims to enforce ordering of component attributes (the default order is specified in the Vue style guide)' ,
122
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/attributes-order.md' ,
123
+ default : false ,
124
+ value : data . rules && data . rules [ 'vue/attributes-order' ] === 'error' ,
125
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
126
+ } ,
127
+ {
128
+ name : 'vue/html-quotes' ,
129
+ type : 'list' ,
130
+ message : 'Attribute quote style' ,
131
+ group : 'Recommended' ,
132
+ description : 'Enforce style of the attribute quotes in templates' ,
133
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-quotes.md' ,
134
+ default : JSON . stringify ( 'off' ) ,
135
+ choices : [
136
+ {
137
+ name : 'Off' ,
138
+ value : JSON . stringify ( 'off' )
139
+ } ,
140
+ {
141
+ name : 'Double quotes' ,
142
+ value : JSON . stringify ( [ 'error' , 'double' ] )
143
+ } ,
144
+ {
145
+ name : 'Single quotes' ,
146
+ value : JSON . stringify ( [ 'error' , 'single' ] )
147
+ }
148
+ ] ,
149
+ value : data . rules && JSON . stringify ( data . rules [ 'vue/html-quotes' ] )
150
+ } ,
151
+ {
152
+ name : 'vue/order-in-components' ,
153
+ type : 'confirm' ,
154
+ message : 'Component options order' ,
155
+ group : 'Recommended' ,
156
+ description : 'This rule aims to enforce ordering of component options (the default order is specified in the Vue style guide)' ,
157
+ link : 'https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md' ,
158
+ default : false ,
159
+ value : data . rules && data . rules [ 'vue/order-in-components' ] === 'error' ,
160
+ filter : input => JSON . stringify ( input ? 'error' : 'off' )
161
+ }
162
+ ]
163
+ } ) ,
167
164
onWrite : ( { api, prompts } ) => {
168
165
api . setData ( prompts . reduce ( ( obj , prompt ) => {
169
166
obj [ `rules.${ prompt . id } ` ] = api . getAnswer ( prompt . id , JSON . parse )
0 commit comments