Skip to content

Commit 2bfdd3e

Browse files
committedApr 16, 2020
Add eslint
1 parent 46e35cc commit 2bfdd3e

File tree

19 files changed

+222
-186
lines changed

19 files changed

+222
-186
lines changed
 

‎.eslintrc.js

+24-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
module.exports = {
2-
root: true,
3-
env: {
4-
node: true
5-
},
6-
extends: ["plugin:vue/essential", "@vue/prettier"],
7-
rules: {
8-
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9-
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
10-
},
11-
parserOptions: {
12-
parser: "babel-eslint"
13-
}
14-
};
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": [
7+
"eslint:recommended",
8+
"plugin:vue/essential",
9+
"plugin:vue/strongly-recommended"
10+
],
11+
"globals": {
12+
"Atomics": "readonly",
13+
"SharedArrayBuffer": "readonly"
14+
},
15+
"parserOptions": {
16+
"ecmaVersion": 2018,
17+
"sourceType": "module"
18+
},
19+
"plugins": [
20+
"vue"
21+
],
22+
"rules": {
23+
"quotes": ["error", "single"],
24+
}
25+
};

‎package-lock.json

+44-21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@
1111
"private": false,
1212
"scripts": {
1313
"serve": "vue-cli-service serve",
14-
"lint": "vue-cli-service lint",
14+
"lint": "eslint --fix 'src/**/*.vue'",
1515
"build": "npm run build:umd & npm run build:es & npm run build:unpkg",
1616
"build-bundle": "vue-cli-service build --target lib --name mew-components ./src/wrapper.js",
1717
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/mew-components.umd.js",
1818
"build:es": "rollup --config build/rollup.config.js --format es --file dist/mew-components.esm.js",
1919
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/mew-components.min.js",
2020
"storybook": "start-storybook -p 6006 -c .storybook watch-css -s ./src",
2121
"build-storybook": "build-storybook -c .storybook -o .out",
22-
"deploy-storybook": "storybook-to-ghpages"
22+
"deploy-storybook": "storybook-to-ghpages",
23+
"eslint": "eslint --ignore-path .gitignore ."
2324
},
2425
"dependencies": {
2526
"all": "0.0.0",
2627
"core-js": "^2.6.5",
28+
"eslint-config-eslint": "^6.0.0",
2729
"fibers": "^4.0.2",
2830
"git-url-parse": "^11.1.2",
2931
"material-design-icons-iconfont": "^5.0.1",
@@ -55,7 +57,7 @@
5557
"babel-preset-vue": "^2.0.2",
5658
"eslint": "^5.16.0",
5759
"eslint-plugin-prettier": "^3.1.0",
58-
"eslint-plugin-vue": "^5.0.0",
60+
"eslint-plugin-vue": "^6.2.2",
5961
"file-loader": "^6.0.0",
6062
"prettier": "^1.18.2",
6163
"rollup": "^1.17.0",

‎src/components/AddressSelect/AddressSelect.vue

+11-11
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@
7070
</template>
7171

7272
<script>
73-
import Blockie from "@/components/Blockie/Blockie.vue";
73+
import Blockie from '@/components/Blockie/Blockie.vue';
7474
7575
export default {
76-
name: "AddressSelector",
76+
name: 'AddressSelector',
7777
props: {
7878
/**
7979
* Enables save address button.
@@ -94,7 +94,7 @@ export default {
9494
*/
9595
label: {
9696
type: String,
97-
default: "To Address"
97+
default: 'To Address'
9898
},
9999
/**
100100
* The saved addresses in address book.
@@ -110,7 +110,7 @@ export default {
110110
*/
111111
placeholder: {
112112
type: String,
113-
default: "Please enter an address"
113+
default: 'Please enter an address'
114114
},
115115
/**
116116
* The function applied to save the address.
@@ -125,33 +125,33 @@ export default {
125125
},
126126
data() {
127127
return {
128-
addressValue: "",
128+
addressValue: '',
129129
autoSelectMenu: false
130130
};
131131
},
132132
watch: {
133133
addressValue(newValue) {
134-
console.log("address value:", newValue);
134+
console.log('address value:', newValue);
135135
}
136136
},
137137
methods: {
138138
toggle() {
139139
this.autoSelectMenu = !this.autoSelectMenu;
140140
},
141141
copyToClipboard() {
142-
this.$refs.addressInput.$el.querySelector("input").select();
143-
document.execCommand("copy");
144-
console.log("copied");
142+
this.$refs.addressInput.$el.querySelector('input').select();
143+
document.execCommand('copy');
144+
console.log('copied');
145145
// Toast.responseHandler(this.$t('common.copied'), Toast.INFO);
146146
},
147147
selectAddress(data) {
148148
this.autoSelectMenu = false;
149149
this.addressValue = data.address;
150-
this.$emit("emitSelectedValue", data);
150+
this.$emit('emitSelectedValue', data);
151151
},
152152
getSaveBtnClasses() {
153153
if (!this.enableSaveAddress) {
154-
return "disable-icon";
154+
return 'disable-icon';
155155
}
156156
}
157157
}

‎src/components/Blockie/Blockie.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
<div ref="identicon" class="address-identicon" />
33
</template>
44
<script>
5-
import Blockies from "@/helpers/blockies.js";
5+
import Blockies from '@/helpers/blockies.js';
66
export default {
7-
name: "Blockie",
7+
name: 'Blockie',
88
props: {
99
/**
1010
* Valid address
1111
*/
1212
address: {
1313
type: String,
14-
default: ""
14+
default: ''
1515
},
1616
/**
1717
* Blockie width
1818
*/
1919
width: {
2020
type: String,
21-
default: "64px"
21+
default: '64px'
2222
},
2323
/**
2424
* Blockie height
2525
*/
2626
height: {
2727
type: String,
28-
default: "64px"
28+
default: '64px'
2929
},
3030
/**
3131
* Blockie size
@@ -69,7 +69,7 @@ export default {
6969
setBlockie() {
7070
console.error('this', this.address)
7171
const data = Blockies({
72-
seed: this.address ? this.address.toLowerCase() : "",
72+
seed: this.address ? this.address.toLowerCase() : '',
7373
size: this.size,
7474
scale: this.scale
7575
}).toDataURL();

‎src/components/MewButton/MewButton.vue

+17-17
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
<script>
3030
export default {
31-
name: "MewButton",
31+
name: 'MewButton',
3232
props: {
3333
/**
3434
* The text that will go in the button.
@@ -43,22 +43,22 @@ export default {
4343
*/
4444
iconAlign: {
4545
type: String,
46-
description: "Hello",
47-
default: "none"
46+
description: 'Hello',
47+
default: 'none'
4848
},
4949
/**
5050
* Applies the button color theme: basic, primary, error, white, or secondary.
5151
*/
5252
colorTheme: {
5353
type: String,
54-
default: ""
54+
default: ''
5555
},
5656
/**
5757
* Applies the button style: background, transparent, or outline.
5858
*/
5959
btnStyle: {
6060
type: String,
61-
default: ""
61+
default: ''
6262
},
6363
/**
6464
* Removes the ability to click or target the component.
@@ -71,17 +71,17 @@ export default {
7171
data() {
7272
return {
7373
btnStyles: {
74-
background: "background",
75-
transparent: "transparent",
76-
outline: "outline"
74+
background: 'background',
75+
transparent: 'transparent',
76+
outline: 'outline'
7777
},
7878
colorThemes: {
79-
white: "white",
80-
primary: "primary"
79+
white: 'white',
80+
primary: 'primary'
8181
},
8282
iconAlignments: {
83-
left: "left",
84-
right: "right"
83+
left: 'left',
84+
right: 'right'
8585
},
8686
active: false
8787
};
@@ -97,18 +97,18 @@ export default {
9797
this.btnStyle.toLowerCase() === this.btnStyles.background &&
9898
this.colorTheme.toLowerCase() !== this.colorThemes.white
9999
) {
100-
classes.push("white--text");
100+
classes.push('white--text');
101101
}
102102
103103
if (
104104
this.btnStyle.toLowerCase() === this.btnStyles.background &&
105105
this.colorTheme.toLowerCase() === this.colorThemes.white
106106
) {
107-
classes.push("primary--text");
107+
classes.push('primary--text');
108108
}
109109
110110
if (this.disabled) {
111-
classes.push("disabled-btn");
111+
classes.push('disabled-btn');
112112
}
113113
114114
if (
@@ -117,15 +117,15 @@ export default {
117117
this.btnStyle.toLowerCase() === this.btnStyles.background &&
118118
this.colorTheme.toLowerCase() === this.colorThemes.primary
119119
) {
120-
classes.push("primary-active");
120+
classes.push('primary-active');
121121
}
122122
123123
if (
124124
this.active &&
125125
!this.disabled &&
126126
this.btnStyle.toLowerCase() === this.btnStyles.outline
127127
) {
128-
classes.push("bg-white");
128+
classes.push('bg-white');
129129
}
130130
131131
return classes;

0 commit comments

Comments
 (0)
Please sign in to comment.