Skip to content

Commit 76e5224

Browse files
committed
Configure ESLint & Prettier to be more forgiving
- Ignore js and l10n folders - Use vue/essential instead of vue/recommended rules - fix linter errors - Add .stylelintignore file to exclude css/ folder Signed-off-by: Paul Schwörer <[email protected]>
1 parent 110e7ef commit 76e5224

13 files changed

+78
-101
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
js/
2+
l10n/

.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
},
66
extends: [
77
"plugin:prettier/recommended",
8-
"plugin:vue/recommended"
8+
"plugin:vue/essential"
99
],
1010
rules: {
1111
"vue/component-name-in-template-casing": ["error", "PascalCase"],
@@ -20,7 +20,8 @@ module.exports = {
2020
$: false // TODO: remove once jQuery has been removed
2121
},
2222
parserOptions: {
23+
ecmaVersion: 6,
2324
sourceType: "module",
2425
parser: "babel-eslint"
25-
},
26+
}
2627
};

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
js/
2+
l10n/

.stylelintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
css/

src/App.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ export default {
4343
state[PUBLIC_FAVORITES_NAMESPACE].shareInfo
4444
? state[PUBLIC_FAVORITES_NAMESPACE].shareInfo.allowEdits
4545
: false
46-
}),
47-
allowFavoriteEdits() {
48-
49-
}
46+
})
5047
},
5148
5249
mounted() {

src/components/MapContainer.vue

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -73,29 +73,32 @@ import VueTypes from "vue-types";
7373
import "leaflet.markercluster";
7474
import "leaflet.featuregroup.subgroup";
7575
76-
import {
77-
LMap,
78-
LTileLayer,
79-
LMarker,
80-
LPopup,
81-
LFeatureGroup,
82-
LControlAttribution,
83-
LControlLayers
84-
} from "vue2-leaflet";
76+
import { LMap, LTileLayer, LMarker, LPopup, LFeatureGroup } from "vue2-leaflet";
8577
import LMarkerCluster from "vue2-leaflet-markercluster";
8678
import { latLngBounds, latLng } from "leaflet";
8779
import { mapActions, mapMutations, mapState } from "vuex";
8880
import ClickPopup from "./map/ClickPopup";
8981
import FavoritePopup from "./map/FavoritePopup";
9082
import { isPublicShare } from "../utils/common";
9183
import { PUBLIC_FAVORITES_NAMESPACE } from "../store/modules/publicFavorites";
92-
import {LayerIds, Layers} from "../data/mapLayers";
84+
import { LayerIds, Layers } from "../data/mapLayers";
9385
9486
const CLUSTER_MARKER_VIEW_SIZE = 27;
9587
9688
export default {
9789
name: "MapContainer",
9890
91+
components: {
92+
ClickPopup,
93+
LMap,
94+
LFeatureGroup,
95+
LMarker,
96+
LMarkerCluster,
97+
LTileLayer,
98+
LPopup,
99+
FavoritePopup
100+
},
101+
99102
props: {
100103
favoriteCategories: VueTypes.object.isRequired,
101104
isPublicShare: VueTypes.bool.isRequired,
@@ -131,6 +134,29 @@ export default {
131134
};
132135
},
133136
137+
computed: {
138+
...mapState({
139+
selectedFavoriteId: state =>
140+
isPublicShare()
141+
? state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
142+
: null,
143+
selectedFavorite: state =>
144+
isPublicShare()
145+
? state[PUBLIC_FAVORITES_NAMESPACE].favorites.find(
146+
favorite =>
147+
favorite.id ===
148+
state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
149+
)
150+
: null
151+
}),
152+
layers() {
153+
return Layers;
154+
},
155+
activeLayer() {
156+
return this.layers.find(layer => layer.id === this.activeLayerId);
157+
}
158+
},
159+
134160
watch: {
135161
selectedFavoriteId(val) {
136162
if (val !== null) {
@@ -155,29 +181,6 @@ export default {
155181
this.markerMap = [];
156182
},
157183
158-
computed: {
159-
...mapState({
160-
selectedFavoriteId: state =>
161-
isPublicShare()
162-
? state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
163-
: null,
164-
selectedFavorite: state =>
165-
isPublicShare()
166-
? state[PUBLIC_FAVORITES_NAMESPACE].favorites.find(
167-
favorite =>
168-
favorite.id ===
169-
state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
170-
)
171-
: null
172-
}),
173-
layers() {
174-
return Layers;
175-
},
176-
activeLayer() {
177-
return this.layers.find(layer => layer.id === this.activeLayerId);
178-
}
179-
},
180-
181184
methods: {
182185
...mapActions({
183186
selectFavorite: `${PUBLIC_FAVORITES_NAMESPACE}/selectFavorite`
@@ -299,19 +302,6 @@ export default {
299302
300303
this.featureGroup = featureGroup;
301304
}
302-
},
303-
304-
components: {
305-
ClickPopup,
306-
LMap,
307-
LFeatureGroup,
308-
LMarker,
309-
LMarkerCluster,
310-
LTileLayer,
311-
LPopup,
312-
FavoritePopup,
313-
LControlLayers,
314-
LControlAttribution
315305
}
316306
};
317307
</script>

src/components/PublicFavoriteShareSideBar.vue

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,28 @@
11
<template>
2-
<AppNavigation>
3-
<ul v-if="favorites.length">
4-
<AppNavigationNew
5-
v-if="allowFavoriteEdits"
6-
:text="newFavoriteButtonLabel"
7-
@click="handleAddFavoriteClick"
8-
/>
9-
<AppNavigationItem
10-
v-for="favorite in favorites"
11-
:key="favorite.id"
12-
:title="favorite.name || t('maps', '(No name)')"
13-
@click="handleFavoriteClick(favorite.id)"
14-
/>
15-
<AppNavigationSpacer />
16-
</ul>
2+
<AppNavigation>
3+
<ul v-if="favorites.length">
4+
<AppNavigationNew
5+
v-if="allowFavoriteEdits"
6+
:text="newFavoriteButtonLabel"
7+
@click="handleAddFavoriteClick"
8+
/>
9+
<AppNavigationItem
10+
v-for="favorite in favorites"
11+
:key="favorite.id"
12+
:title="favorite.name || t('maps', '(No name)')"
13+
@click="handleFavoriteClick(favorite.id)"
14+
/>
15+
<AppNavigationSpacer />
16+
</ul>
1717

18-
<div class="no-favorites" v-else>
19-
{{t('maps', 'No favorites to display')}}
20-
</div>
21-
</AppNavigation>
18+
<div v-else class="no-favorites">
19+
{{ t("maps", "No favorites to display") }}
20+
</div>
21+
</AppNavigation>
2222
</template>
2323

2424
<script>
2525
import AppNavigation from "@nextcloud/vue/dist/Components/AppNavigation";
26-
import AppNavigationSettings from "@nextcloud/vue/dist/Components/AppNavigationSettings";
2726
import AppNavigationItem from "@nextcloud/vue/dist/Components/AppNavigationItem";
2827
import AppNavigationNew from "@nextcloud/vue/dist/Components/AppNavigationNew";
2928
import AppNavigationSpacer from "@nextcloud/vue/dist/Components/AppNavigationSpacer";
@@ -37,7 +36,6 @@ export default {
3736
3837
components: {
3938
AppNavigation,
40-
AppNavigationSettings,
4139
AppNavigationItem,
4240
AppNavigationNew,
4341
AppNavigationSpacer
@@ -47,7 +45,7 @@ export default {
4745
...mapState({
4846
favorites: state => state[PUBLIC_FAVORITES_NAMESPACE].favorites,
4947
mapMode: state => state[MAP_NAMESPACE].mode,
50-
shareInfo: state => state[PUBLIC_FAVORITES_NAMESPACE].shareInfo,
48+
shareInfo: state => state[PUBLIC_FAVORITES_NAMESPACE].shareInfo
5149
}),
5250
5351
allowFavoriteEdits() {
@@ -88,9 +86,9 @@ export default {
8886
</script>
8987

9088
<style scoped lang="scss">
91-
.no-favorites {
92-
padding: 2em;
93-
text-align: center;
94-
color: var(--color-text-light);
95-
}
89+
.no-favorites {
90+
padding: 2em;
91+
text-align: center;
92+
color: var(--color-text-light);
93+
}
9694
</style>

src/components/map/FavoritePopup.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
<div class="no-edits">
4242
<p>
4343
{{
44-
favorite.comment.length
45-
? favorite.comment
46-
: t("maps", "No comment")
44+
favorite.comment.length ? favorite.comment : t("maps", "No comment")
4745
}}
4846
</p>
4947
</div>
@@ -123,5 +121,3 @@ export default {
123121
}
124122
};
125123
</script>
126-
127-
<style scoped></style>

src/components/map/Popup.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div class="popup">
3-
<h2 v-if="title"
4-
class="popup-title">
3+
<h2 v-if="title" class="popup-title">
54
{{ title }}
65
</h2>
76

src/components/map/PopupFormItem.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<template>
22
<div class="form-item">
3-
<span class="icon"
4-
:class="icon" />
3+
<span class="icon" :class="icon" />
54
<div class="input-wrapper">
65
<template v-if="allowEdits">
76
<textarea
@@ -18,7 +17,7 @@
1817
:placeholder="placeholder"
1918
:value="value"
2019
@input="$emit('input', $event.target.value)"
21-
>
20+
/>
2221
</template>
2322
<template v-else>
2423
<span>{{ value }}</span>

0 commit comments

Comments
 (0)