Skip to content

Commit 57e04a0

Browse files
author
Guillaume Chau
committed
chore: eslint refactoring, now with standard + vue/recommended configs
1 parent 7868342 commit 57e04a0

22 files changed

+650
-331
lines changed

.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@ module.exports = {
44
'browser': true
55
},
66
'extends': [
7-
'plugin:vue-libs/recommended'
7+
'standard',
8+
'plugin:vue/recommended'
89
],
910
'globals': {
1011
'bridge': true,
1112
'chrome': true,
1213
'localStorage': true,
1314
'HTMLDocument': true
15+
},
16+
'rules': {
17+
'vue/html-closing-bracket-newline': ['error', {
18+
'singleline': 'never',
19+
'multiline': 'always'
20+
}]
1421
}
1522
}

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@
5050
"css-loader": "^0.28.7",
5151
"cypress": "^3.0.2",
5252
"eslint": "^4.13.1",
53+
"eslint-config-standard": "^11.0.0",
5354
"eslint-plugin-cypress": "^2.0.1",
54-
"eslint-plugin-vue-libs": "^2.0.1",
55+
"eslint-plugin-import": "^2.13.0",
56+
"eslint-plugin-node": "^7.0.1",
57+
"eslint-plugin-promise": "^3.8.0",
58+
"eslint-plugin-standard": "^3.1.0",
59+
"eslint-plugin-vue": "^4.7.1",
5560
"file-loader": "^1.1.6",
5661
"friendly-errors-webpack-plugin": "^1.6.1",
5762
"inquirer": "^5.0.0",

src/backend/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function connect () {
8383

8484
bridge.on('leave-instance', unHighlight)
8585

86+
// eslint-disable-next-line no-new
8687
new ComponentSelector(bridge, instanceMap)
8788

8889
// Get the instance id that is targeted by context menu
@@ -488,7 +489,7 @@ const fnTypeRE = /^(?:function|class) (\w+)/
488489
function getPropType (type) {
489490
const match = type.toString().match(fnTypeRE)
490491
return typeof type === 'function'
491-
? match && match[1] || 'any'
492+
? (match && match[1]) || 'any'
492493
: 'any'
493494
}
494495

src/devtools/App.vue

Lines changed: 96 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,91 @@
11
<template>
2-
<div id="app" class="app">
3-
<datalist id="special-tokens">
4-
<option v-for="(value, key) of specialTokens" :key="key" :value="key"></option>
5-
</datalist>
6-
<div class="header">
7-
<img class="logo" src="./assets/logo.png" alt="Vue">
8-
<span class="message-container">
9-
<transition name="slide-up">
10-
<span class="message" :key="message">{{ message }}</span>
11-
</transition>
12-
</span>
13-
14-
<div class="actions">
15-
<VueGroup
16-
v-model="routeModel"
17-
class="primary inline"
18-
indicator
2+
<div
3+
id="app"
4+
class="app"
5+
>
6+
<datalist id="special-tokens">
7+
<option
8+
v-for="(value, key) of specialTokens"
9+
:key="key"
10+
:value="key"
11+
/>
12+
</datalist>
13+
<div class="header">
14+
<img
15+
class="logo"
16+
src="./assets/logo.png"
17+
alt="Vue"
1918
>
20-
<VueGroupButton
21-
:class="{
22-
'icon-button': !$responsive.wide
23-
}"
24-
value="components"
25-
icon-left="device_hub"
26-
class="components-tab flat"
27-
v-tooltip="$t('App.components.tooltip')"
28-
>
29-
Components
30-
</VueGroupButton>
31-
<VueGroupButton
32-
:class="{
33-
'icon-button': !$responsive.wide
34-
}"
35-
value="vuex"
36-
icon-left="restore"
37-
class="vuex-tab flat"
38-
v-tooltip="$t('App.vuex.tooltip')"
19+
<span class="message-container">
20+
<transition name="slide-up">
21+
<span
22+
:key="message"
23+
class="message"
24+
>
25+
{{ message }}
26+
</span>
27+
</transition>
28+
</span>
29+
30+
<div class="actions">
31+
<VueGroup
32+
v-model="routeModel"
33+
class="primary inline"
34+
indicator
3935
>
40-
Vuex
41-
</VueGroupButton>
42-
<VueGroupButton
43-
:tag="newEventCount > 0 ? newEventCount : null"
36+
<VueGroupButton
37+
v-tooltip="$t('App.components.tooltip')"
38+
:class="{
39+
'icon-button': !$responsive.wide
40+
}"
41+
value="components"
42+
icon-left="device_hub"
43+
class="components-tab flat"
44+
>
45+
Components
46+
</VueGroupButton>
47+
<VueGroupButton
48+
v-tooltip="$t('App.vuex.tooltip')"
49+
:class="{
50+
'icon-button': !$responsive.wide
51+
}"
52+
value="vuex"
53+
icon-left="restore"
54+
class="vuex-tab flat"
55+
>
56+
Vuex
57+
</VueGroupButton>
58+
<VueGroupButton
59+
v-tooltip="$t('App.events.tooltip')"
60+
:tag="newEventCount > 0 ? newEventCount : null"
61+
:class="{
62+
'icon-button': !$responsive.wide
63+
}"
64+
value="events"
65+
icon-left="grain"
66+
class="events-tab flat big-tag"
67+
>
68+
Events
69+
</VueGroupButton>
70+
</VueGroup>
71+
72+
<VueButton
73+
v-tooltip="$t('App.refresh.tooltip')"
74+
ref="refresh"
4475
:class="{
4576
'icon-button': !$responsive.wide
4677
}"
47-
value="events"
48-
icon-left="grain"
49-
class="events-tab flat big-tag"
50-
v-tooltip="$t('App.events.tooltip')"
78+
icon-left="refresh"
79+
class="refresh-button flat"
80+
@click="refresh"
5181
>
52-
Events
53-
</VueGroupButton>
54-
</VueGroup>
55-
56-
<VueButton
57-
ref="refresh"
58-
:class="{
59-
'icon-button': !$responsive.wide
60-
}"
61-
icon-left="refresh"
62-
v-tooltip="$t('App.refresh.tooltip')"
63-
class="refresh-button flat"
64-
@click="refresh"
65-
>
66-
Refresh
67-
</VueButton>
82+
Refresh
83+
</VueButton>
84+
</div>
6885
</div>
69-
</div>
7086

71-
<router-view class="container"/>
72-
</div>
87+
<router-view class="container"/>
88+
</div>
7389
</template>
7490

7591
<script>
@@ -82,7 +98,13 @@ import Keyboard from './mixins/keyboard'
8298
import { mapState } from 'vuex'
8399
84100
export default {
85-
name: 'app',
101+
name: 'App',
102+
103+
components: {
104+
components: ComponentsTab,
105+
vuex: VuexTab,
106+
events: EventsTab
107+
},
86108
87109
mixins: [
88110
Keyboard({
@@ -110,12 +132,6 @@ export default {
110132
})
111133
],
112134
113-
components: {
114-
components: ComponentsTab,
115-
vuex: VuexTab,
116-
events: EventsTab
117-
},
118-
119135
computed: {
120136
...mapState({
121137
message: state => state.message,
@@ -144,6 +160,16 @@ export default {
144160
}
145161
},
146162
163+
mounted () {
164+
this.mediaQuery = window.matchMedia('(min-width: 685px)')
165+
this.switchView(this.mediaQuery)
166+
this.mediaQuery.addListener(this.switchView)
167+
},
168+
169+
destroyed () {
170+
this.mediaQuery.removeListener(this.switchView)
171+
},
172+
147173
methods: {
148174
refresh () {
149175
const refreshIcon = this.$refs.refresh.$el.querySelector('.vue-ui-icon')
@@ -161,16 +187,6 @@ export default {
161187
mediaQueryEvent.matches ? 'vertical' : 'horizontal'
162188
)
163189
}
164-
},
165-
166-
mounted () {
167-
this.mediaQuery = window.matchMedia('(min-width: 685px)')
168-
this.switchView(this.mediaQuery)
169-
this.mediaQuery.addListener(this.switchView)
170-
},
171-
172-
destroyed () {
173-
this.mediaQuery.removeListener(this.switchView)
174190
}
175191
}
176192
</script>

src/devtools/components/ActionHeader.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="action-header">
3-
<slot></slot>
3+
<slot/>
44
</div>
55
</template>
66

0 commit comments

Comments
 (0)