Skip to content

Commit 09e45cd

Browse files
Change eslint rules to use vue recommended
Resubmitting after reverted–original commit here https://gerrit.openbmc-project.xyz/c/openbmc/webui-vue/+/28763/7 - Ran npm run lint - Resolved eslint issues Signed-off-by: Derick Montague <[email protected]> Change-Id: I2b8b9244acddd483d0a72f9a5d156a79de9869a0
1 parent 4b0fc1d commit 09e45cd

File tree

16 files changed

+94
-68
lines changed

16 files changed

+94
-68
lines changed

.eslintrc.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
env: {
44
node: true
55
},
6-
extends: ['plugin:vue/essential', '@vue/prettier'],
6+
extends: ['plugin:vue/recommended', '@vue/prettier'],
77
rules: {
88
'no-console': 'off',
99
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
@@ -12,7 +12,8 @@ module.exports = {
1212
{
1313
singleQuote: true
1414
}
15-
]
15+
],
16+
'vue/component-name-in-template-casing': ['error', 'kebab-case']
1617
},
1718
parserOptions: {
1819
parser: 'babel-eslint'

src/components/AppHeader/AppHeader.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ import StatusIcon from '../Global/StatusIcon';
4242
export default {
4343
name: 'AppHeader',
4444
components: { IconAvatar, IconRenew, StatusIcon },
45-
created() {
46-
this.getHostInfo();
47-
},
4845
computed: {
4946
hostStatus() {
5047
return this.$store.getters['global/hostStatus'];
@@ -61,6 +58,9 @@ export default {
6158
}
6259
}
6360
},
61+
created() {
62+
this.getHostInfo();
63+
},
6464
methods: {
6565
getHostInfo() {
6666
this.$store.dispatch('global/getHostStatus');

src/components/AppNavigation/AppNavigation.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<icon-health />Health
88
<icon-expand class="icon-expand" />
99
</b-button>
10-
<b-collapse tag="ul" id="health-menu" class="nav-item__nav">
10+
<b-collapse id="health-menu" tag="ul" class="nav-item__nav">
1111
<b-nav-item href="javascript:void(0)">Event Log</b-nav-item>
1212
<b-nav-item href="javascript:void(0)">Hardware Status</b-nav-item>
1313
<b-nav-item href="javascript:void(0)">Sensors</b-nav-item>
@@ -19,7 +19,7 @@
1919
<icon-control />Control
2020
<icon-expand class="icon-expand" />
2121
</b-button>
22-
<b-collapse tag="ul" id="control-menu" class="nav-item__nav">
22+
<b-collapse id="control-menu" tag="ul" class="nav-item__nav">
2323
<b-nav-item href="javascript:void(0)">
2424
Server power operations
2525
</b-nav-item>
@@ -33,7 +33,7 @@
3333
<icon-configuration />Configuration
3434
<icon-expand class="icon-expand" />
3535
</b-button>
36-
<b-collapse tag="ul" id="configuration-menu" class="nav-item__nav">
36+
<b-collapse id="configuration-menu" tag="ul" class="nav-item__nav">
3737
<b-nav-item href="javascript:void(0)">Network settings</b-nav-item>
3838
<b-nav-item href="javascript:void(0)">SNMP settings</b-nav-item>
3939
<b-nav-item href="javascript:void(0)">Firmware</b-nav-item>
@@ -45,7 +45,7 @@
4545
<icon-access-control />Access Control
4646
<icon-expand class="icon-expand" />
4747
</b-button>
48-
<b-collapse tag="ul" id="access-control-menu" class="nav-item__nav">
48+
<b-collapse id="access-control-menu" tag="ul" class="nav-item__nav">
4949
<b-nav-item href="javascript:void(0)">LDAP</b-nav-item>
5050
<b-nav-item to="/access-control/local-user-management">
5151
Local user management

src/components/Global/PageSection.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
<script>
99
export default {
1010
name: 'PageSection',
11-
props: ['sectionTitle']
11+
props: {
12+
sectionTitle: {
13+
type: String,
14+
required: true
15+
}
16+
}
1217
};
1318
</script>
1419

src/components/Global/PageTitle.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
<script>
99
export default {
1010
name: 'PageTitle',
11-
props: ['description'],
11+
props: {
12+
description: {
13+
type: String,
14+
default: ''
15+
}
16+
},
1217
data() {
1318
return {
1419
title: this.$route.meta.title

src/components/Global/StatusIcon.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ import IconError from '@carbon/icons-vue/es/error--filled/20';
1313
1414
export default {
1515
name: 'StatusIcon',
16-
props: ['status'],
1716
components: {
1817
iconSuccess: IconCheckmark,
1918
iconDanger: IconWarning,
2019
iconSecondary: IconError
20+
},
21+
props: {
22+
status: {
23+
type: String,
24+
default: ''
25+
}
2126
}
2227
};
2328
</script>

src/layouts/AppLayout.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<div>
3-
<AppHeader ref="focusTarget" />
3+
<app-header ref="focusTarget" />
44
<b-container fluid class="page-container">
55
<b-row no-gutters>
66
<b-col tag="nav" cols="12" md="3" lg="2">
7-
<AppNavigation />
7+
<app-navigation />
88
</b-col>
99
<b-col cols="12" md="9" lg="10">
10-
<PageContainer>
10+
<page-container>
1111
<router-view ref="routerView" />
12-
</PageContainer>
12+
</page-container>
1313
</b-col>
1414
</b-row>
1515
</b-container>

src/views/AccessControl/LocalUserManagement/LocalUserManagement.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<template>
22
<b-container class="ml-0">
3-
<PageTitle />
3+
<page-title />
44
<b-row>
55
<b-col lg="10" class="text-right">
66
<b-button variant="link" @click="initModalSettings">
77
Account policy settings
88
<icon-settings />
99
</b-button>
10-
<b-button @click="initModalUser(null)" variant="primary">
10+
<b-button variant="primary" @click="initModalUser(null)">
1111
Add user
1212
<icon-add />
1313
</b-button>
@@ -69,7 +69,7 @@ import ModalSettings from './ModalSettings';
6969
import PageTitle from '../../../components/Global/PageTitle';
7070
7171
export default {
72-
name: 'local-users',
72+
name: 'LocalUsers',
7373
components: {
7474
IconAdd,
7575
IconChevron,
@@ -97,9 +97,6 @@ export default {
9797
]
9898
};
9999
},
100-
created() {
101-
this.getUsers();
102-
},
103100
computed: {
104101
allUsers() {
105102
return this.$store.getters['localUsers/allUsers'];
@@ -124,6 +121,9 @@ export default {
124121
});
125122
}
126123
},
124+
created() {
125+
this.getUsers();
126+
},
127127
methods: {
128128
getUsers() {
129129
this.$store.dispatch('localUsers/getUsers');

src/views/AccessControl/LocalUserManagement/ModalSettings.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
<script>
66
export default {
7-
props: ['settings']
7+
props: {
8+
settings: {
9+
type: String,
10+
default: ''
11+
}
12+
}
813
};
914
</script>

src/views/AccessControl/LocalUserManagement/ModalUser.vue

+9-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
No special characters except underscore
3838
</b-form-text>
3939
<b-form-input
40+
id="username"
4041
v-model="form.username"
4142
type="text"
42-
id="username"
4343
aria-describedby="username-help-block"
4444
:state="getValidationState($v.form.username)"
4545
:disabled="!newUser && originalUsername === 'root'"
@@ -78,9 +78,9 @@
7878
Password must between 8 – 20 characters
7979
</b-form-text>
8080
<b-form-input
81+
id="password"
8182
v-model="form.password"
8283
type="password"
83-
id="password"
8484
aria-describedby="password-help-block"
8585
:state="getValidationState($v.form.password)"
8686
@input="$v.form.password.$touch()"
@@ -103,9 +103,9 @@
103103
label-for="password-confirmation"
104104
>
105105
<b-form-input
106+
id="password-confirmation"
106107
v-model="form.passwordConfirmation"
107108
type="password"
108-
id="password-confirmation"
109109
:state="getValidationState($v.form.passwordConfirmation)"
110110
@input="$v.form.passwordConfirmation.$touch()"
111111
/>
@@ -147,8 +147,13 @@ import {
147147
import VuelidateMixin from '../../../components/Mixins/VuelidateMixin.js';
148148
149149
export default {
150-
props: ['user'],
151150
mixins: [VuelidateMixin],
151+
props: {
152+
user: {
153+
type: Object,
154+
default: null
155+
}
156+
},
152157
data() {
153158
return {
154159
privilegeTypes: ['Administrator', 'Operator', 'ReadOnly', 'NoAccess'],

src/views/AccessControl/LocalUserManagement/TableRoles.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
<b-table small :items="items" :fields="fields">
33
<template v-slot:cell(administrator)="data">
44
<template v-if="data.value">
5-
<Checkmark20 />
5+
<checkmark20 />
66
</template>
77
</template>
88
<template v-slot:cell(operator)="data">
99
<template v-if="data.value">
10-
<Checkmark20 />
10+
<checkmark20 />
1111
</template>
1212
</template>
1313
<template v-slot:cell(readonly)="data">
1414
<template v-if="data.value">
15-
<Checkmark20 />
15+
<checkmark20 />
1616
</template>
1717
</template>
1818
<template v-slot:cell(noaccess)="data">
1919
<template v-if="data.value">
20-
<Checkmark20 />
20+
<checkmark20 />
2121
</template>
2222
</template>
2323
</b-table>

src/views/Login/Login.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</b-col>
1616

1717
<b-col md="6">
18-
<b-form class="login-form" @submit.prevent="login" novalidate>
18+
<b-form class="login-form" novalidate @submit.prevent="login">
1919
<b-alert class="login-error" :show="authError" variant="danger">
2020
<p id="login-error-alert">
2121
<strong>{{ errorMsg.title }}</strong>
@@ -81,11 +81,6 @@ import VuelidateMixin from '../../components/Mixins/VuelidateMixin.js';
8181
export default {
8282
name: 'Login',
8383
mixins: [VuelidateMixin],
84-
computed: {
85-
authError() {
86-
return this.$store.getters['authentication/authError'];
87-
}
88-
},
8984
data() {
9085
return {
9186
errorMsg: {
@@ -99,6 +94,11 @@ export default {
9994
disableSubmitButton: false
10095
};
10196
},
97+
computed: {
98+
authError() {
99+
return this.$store.getters['authentication/authError'];
100+
}
101+
},
102102
validations: {
103103
userInfo: {
104104
username: {

src/views/Overview/Overview.vue

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<b-container fluid>
3-
<PageTitle />
3+
<page-title />
44
<b-row>
55
<b-col lg="8" sm="12">
6-
<PageSection sectionTitle="Server information">
6+
<page-section section-title="Server information">
77
<b-row>
88
<b-col sm="6">
99
<dl>
@@ -30,8 +30,8 @@
3030
</dl>
3131
</b-col>
3232
</b-row>
33-
</PageSection>
34-
<PageSection sectionTitle="BMC information">
33+
</page-section>
34+
<page-section section-title="BMC information">
3535
<b-row>
3636
<b-col sm="6">
3737
<dl>
@@ -48,7 +48,7 @@
4848
<b-col sm="6">
4949
<dl>
5050
<dt>IP address</dt>
51-
<dd v-for="ip in ipAddress" v-bind:key="ip.id">{{ ip }}</dd>
51+
<dd v-for="ip in ipAddress" :key="ip.id">{{ ip }}</dd>
5252
</dl>
5353
</b-col>
5454
<b-col sm="6">
@@ -58,8 +58,8 @@
5858
</dl>
5959
</b-col>
6060
</b-row>
61-
</PageSection>
62-
<PageSection sectionTitle="Power consumption">
61+
</page-section>
62+
<page-section section-title="Power consumption">
6363
<b-row>
6464
<b-col sm="6">
6565
<dl>
@@ -74,15 +74,15 @@
7474
</dl>
7575
</b-col>
7676
</b-row>
77-
</PageSection>
77+
</page-section>
7878
</b-col>
7979
<b-col lg="4" sm="12">
80-
<OverviewQuickLinks />
80+
<overview-quick-links />
8181
</b-col>
8282
</b-row>
83-
<PageSection sectionTitle="High priority events">
84-
<OverviewEvents />
85-
</PageSection>
83+
<page-section section-title="High priority events">
84+
<overview-events />
85+
</page-section>
8686
</b-container>
8787
</template>
8888

@@ -100,9 +100,6 @@ export default {
100100
PageTitle,
101101
PageSection
102102
},
103-
created() {
104-
this.getOverviewInfo();
105-
},
106103
computed: mapState({
107104
serverModel: state => state.overview.serverModel,
108105
serverManufacturer: state => state.overview.serverManufacturer,
@@ -115,6 +112,9 @@ export default {
115112
ipAddress: state => state.networkSettings.ipAddress,
116113
macAddress: state => state.networkSettings.macAddress
117114
}),
115+
created() {
116+
this.getOverviewInfo();
117+
},
118118
methods: {
119119
getOverviewInfo() {
120120
this.$store.dispatch('overview/getServerInfo');

0 commit comments

Comments
 (0)