Skip to content

Commit 593566e

Browse files
committed
Format code with Prettier
1 parent 9ac3d67 commit 593566e

17 files changed

+1240
-6149
lines changed

.eslintrc.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@ module.exports = {
33
env: {
44
node: true
55
},
6-
'extends': [
7-
'plugin:vue/essential',
8-
'@vue/standard'
9-
],
6+
extends: ["plugin:vue/essential", "@vue/prettier"],
107
rules: {
11-
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
12-
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
8+
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9+
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
1310
},
1411
parserOptions: {
15-
parser: 'babel-eslint'
12+
parser: "babel-eslint"
1613
}
17-
}
14+
};

docs_source/guide/layers&sources.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,10 @@ Sources are stored in Mapbox GL JS `Map` object by `sourceId`. If you sure that
5050

5151
By default when Layer components destroing, it removes source from map. If you want to keep source in Map (for e.g. for future using or if other layers use this source), set `clearSource` prop to `false`.
5252

53+
## Layer getters
54+
55+
GeoJSON and Vector layers has getters for they features.
56+
5357
## Layer methods
58+
59+
Layer components has methods `move()`

docs_source/guide/markers&popups.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The Popup component is wrapper around the [Mapbox GL Popup API](https://www.mapb
9292
You can specify content inside popup in default slot. It can be HTML or Vue component.
9393
In this example [Vuetify card component](https://vuetifyjs.com/en/components/cards) used as a content for popup:
9494

95-
```vue
95+
```vue{2}
9696
<template>
9797
<MglMap
9898
:accessToken="mapboxAccessToken"

package-lock.json

Lines changed: 717 additions & 5708 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@
2020
"docs:serve": "vuepress dev docs_source",
2121
"docs:build": "vuepress build docs_source"
2222
},
23+
"husky": {
24+
"hooks": {
25+
"pre-commit": "lint-staged"
26+
}
27+
},
28+
"lint-staged": {
29+
"*.{js,json,css,md}": [
30+
"prettier --write",
31+
"git add"
32+
]
33+
},
2334
"dependencies": {
2435
"map-promisified": "latest"
2536
},
@@ -31,10 +42,13 @@
3142
"@vue/cli-plugin-babel": "^3.2.0",
3243
"@vue/cli-plugin-eslint": "^3.2.1",
3344
"@vue/cli-service": "^3.2.0",
45+
"@vue/eslint-config-prettier": "^4.0.1",
3446
"@vue/eslint-config-standard": "^4.0.0",
3547
"babel-eslint": "^10.0.1",
3648
"eslint": "^5.10.0",
3749
"eslint-loader": "2.1.1",
50+
"husky": "^1.2.0",
51+
"lint-staged": "^8.1.0",
3852
"vue": "^2.5.18",
3953
"vue-template-compiler": "^2.5.18",
4054
"vuepress": "^1.0.0-alpha.27"

src/components/UI/Marker.vue

Lines changed: 53 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<template>
22
<div style="display: none">
33
<!-- slot for custom marker -->
4-
<slot name="marker"/>
4+
<slot name="marker" />
55
<!-- slot for popup -->
66
<slot />
77
</div>
88
</template>
99

1010
<script>
11-
import withRegistration from '../../lib/withRegistration'
12-
import withEvents from '../../lib/withEvents'
13-
import withSelfEvents from './withSelfEvents'
11+
import withRegistration from "../../lib/withRegistration";
12+
import withEvents from "../../lib/withEvents";
13+
import withSelfEvents from "./withSelfEvents";
1414
1515
const markerEvents = {
16-
drag: 'drag',
17-
dragstart: 'dragstart',
18-
dragend: 'dragend'
19-
}
16+
drag: "drag",
17+
dragstart: "dragstart",
18+
dragend: "dragend"
19+
};
2020
2121
export default {
22-
name: 'MapMarker',
22+
name: "MapMarker",
2323
mixins: [withRegistration, withEvents, withSelfEvents],
2424
props: {
2525
// mapbox marker options
@@ -36,95 +36,96 @@ export default {
3636
},
3737
anchor: {
3838
type: String,
39-
default: 'center'
39+
default: "center"
4040
},
4141
draggable: {
4242
type: Boolean,
4343
default: false
4444
}
4545
},
4646
47-
data () {
47+
data() {
4848
return {
4949
initial: true,
5050
marker: undefined
51-
}
51+
};
5252
},
5353
5454
watch: {
55-
coordinates (lngLat) {
56-
if (this.initial) return
57-
this.marker.setLngLat(lngLat)
55+
coordinates(lngLat) {
56+
if (this.initial) return;
57+
this.marker.setLngLat(lngLat);
5858
},
59-
draggable (next, prev) {
60-
if (this.initial) return
61-
this.marker.setDraggable(next)
59+
draggable(next, prev) {
60+
if (this.initial) return;
61+
this.marker.setDraggable(next);
6262
}
6363
},
6464
65-
mounted () {
66-
this.$_checkMapTree()
65+
mounted() {
66+
this.$_checkMapTree();
6767
},
6868
69-
beforeDestroy () {
69+
beforeDestroy() {
7070
if (this.map !== undefined && this.marker !== undefined) {
71-
this.marker.remove()
71+
this.marker.remove();
7272
}
7373
},
7474
7575
methods: {
76-
$_deferredMount (payload) {
76+
$_deferredMount(payload) {
7777
if (!this.marker) {
7878
const markerOptions = {
7979
...this._props
80-
}
80+
};
8181
if (this.$slots.marker) {
82-
markerOptions.element = this.$slots.marker[0].elm
82+
markerOptions.element = this.$slots.marker[0].elm;
8383
}
84-
this.marker = new this.mapbox.Marker(markerOptions)
84+
this.marker = new this.mapbox.Marker(markerOptions);
8585
}
8686
87-
this.map = payload.map
88-
this.$_addMarker()
89-
if (this.$listeners['update:coordinates']) {
90-
this.marker.on('dragend', event => {
91-
let newCoordinates
87+
this.map = payload.map;
88+
this.$_addMarker();
89+
if (this.$listeners["update:coordinates"]) {
90+
this.marker.on("dragend", event => {
91+
let newCoordinates;
9292
if (this.coordinates instanceof Array) {
93-
newCoordinates = [event.target._lngLat.lng, event.target._lngLat.lat]
93+
newCoordinates = [
94+
event.target._lngLat.lng,
95+
event.target._lngLat.lat
96+
];
9497
} else {
95-
newCoordinates = event.target._lngLat
98+
newCoordinates = event.target._lngLat;
9699
}
97-
this.$emit('update:coordinates', newCoordinates)
98-
})
100+
this.$emit("update:coordinates", newCoordinates);
101+
});
99102
}
100103
101-
const eventNames = Object.keys(markerEvents)
102-
this.$_bindSelfEvents(eventNames, this.marker)
104+
const eventNames = Object.keys(markerEvents);
105+
this.$_bindSelfEvents(eventNames, this.marker);
103106
104-
this.initial = false
105-
payload.component.$off('load', this.$_deferredMount)
107+
this.initial = false;
108+
payload.component.$off("load", this.$_deferredMount);
106109
},
107110
108-
$_addMarker () {
109-
this.marker
110-
.setLngLat(this.coordinates)
111-
.addTo(this.map)
111+
$_addMarker() {
112+
this.marker.setLngLat(this.coordinates).addTo(this.map);
112113
113-
this.$_emitEvent('added', { marker: this.marker })
114+
this.$_emitEvent("added", { marker: this.marker });
114115
},
115116
116-
$_emitSelfEvent (event) {
117-
this.$_emitMapEvent(event, { marker: this.marker })
117+
$_emitSelfEvent(event) {
118+
this.$_emitMapEvent(event, { marker: this.marker });
118119
},
119120
120-
remove () {
121-
this.marker.remove()
122-
this.$_emitEvent('removed', { marker: this.marker })
121+
remove() {
122+
this.marker.remove();
123+
this.$_emitEvent("removed", { marker: this.marker });
123124
},
124125
125-
togglePopup () {
126-
return this.marker.togglePopup()
126+
togglePopup() {
127+
return this.marker.togglePopup();
127128
}
128129
}
129-
}
130+
};
130131
</script>

0 commit comments

Comments
 (0)