Skip to content

Commit

Permalink
Configure ESLint & Prettier to be more forgiving
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
paulschwoerer committed Feb 5, 2020
1 parent 110e7ef commit 76e5224
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 101 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
js/
l10n/
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
},
extends: [
"plugin:prettier/recommended",
"plugin:vue/recommended"
"plugin:vue/essential"
],
rules: {
"vue/component-name-in-template-casing": ["error", "PascalCase"],
Expand All @@ -20,7 +20,8 @@ module.exports = {
$: false // TODO: remove once jQuery has been removed
},
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
parser: "babel-eslint"
},
}
};
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
js/
l10n/
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
css/
5 changes: 1 addition & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ export default {
state[PUBLIC_FAVORITES_NAMESPACE].shareInfo
? state[PUBLIC_FAVORITES_NAMESPACE].shareInfo.allowEdits
: false
}),
allowFavoriteEdits() {
}
})
},
mounted() {
Expand Down
82 changes: 36 additions & 46 deletions src/components/MapContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,32 @@ import VueTypes from "vue-types";
import "leaflet.markercluster";
import "leaflet.featuregroup.subgroup";
import {
LMap,
LTileLayer,
LMarker,
LPopup,
LFeatureGroup,
LControlAttribution,
LControlLayers
} from "vue2-leaflet";
import { LMap, LTileLayer, LMarker, LPopup, LFeatureGroup } from "vue2-leaflet";
import LMarkerCluster from "vue2-leaflet-markercluster";
import { latLngBounds, latLng } from "leaflet";
import { mapActions, mapMutations, mapState } from "vuex";
import ClickPopup from "./map/ClickPopup";
import FavoritePopup from "./map/FavoritePopup";
import { isPublicShare } from "../utils/common";
import { PUBLIC_FAVORITES_NAMESPACE } from "../store/modules/publicFavorites";
import {LayerIds, Layers} from "../data/mapLayers";
import { LayerIds, Layers } from "../data/mapLayers";
const CLUSTER_MARKER_VIEW_SIZE = 27;
export default {
name: "MapContainer",
components: {
ClickPopup,
LMap,
LFeatureGroup,
LMarker,
LMarkerCluster,
LTileLayer,
LPopup,
FavoritePopup
},
props: {
favoriteCategories: VueTypes.object.isRequired,
isPublicShare: VueTypes.bool.isRequired,
Expand Down Expand Up @@ -131,6 +134,29 @@ export default {
};
},
computed: {
...mapState({
selectedFavoriteId: state =>
isPublicShare()
? state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
: null,
selectedFavorite: state =>
isPublicShare()
? state[PUBLIC_FAVORITES_NAMESPACE].favorites.find(
favorite =>
favorite.id ===
state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
)
: null
}),
layers() {
return Layers;
},
activeLayer() {
return this.layers.find(layer => layer.id === this.activeLayerId);
}
},
watch: {
selectedFavoriteId(val) {
if (val !== null) {
Expand All @@ -155,29 +181,6 @@ export default {
this.markerMap = [];
},
computed: {
...mapState({
selectedFavoriteId: state =>
isPublicShare()
? state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
: null,
selectedFavorite: state =>
isPublicShare()
? state[PUBLIC_FAVORITES_NAMESPACE].favorites.find(
favorite =>
favorite.id ===
state[PUBLIC_FAVORITES_NAMESPACE].selectedFavoriteId
)
: null
}),
layers() {
return Layers;
},
activeLayer() {
return this.layers.find(layer => layer.id === this.activeLayerId);
}
},
methods: {
...mapActions({
selectFavorite: `${PUBLIC_FAVORITES_NAMESPACE}/selectFavorite`
Expand Down Expand Up @@ -299,19 +302,6 @@ export default {
this.featureGroup = featureGroup;
}
},
components: {
ClickPopup,
LMap,
LFeatureGroup,
LMarker,
LMarkerCluster,
LTileLayer,
LPopup,
FavoritePopup,
LControlLayers,
LControlAttribution
}
};
</script>
Expand Down
52 changes: 25 additions & 27 deletions src/components/PublicFavoriteShareSideBar.vue
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<template>
<AppNavigation>
<ul v-if="favorites.length">
<AppNavigationNew
v-if="allowFavoriteEdits"
:text="newFavoriteButtonLabel"
@click="handleAddFavoriteClick"
/>
<AppNavigationItem
v-for="favorite in favorites"
:key="favorite.id"
:title="favorite.name || t('maps', '(No name)')"
@click="handleFavoriteClick(favorite.id)"
/>
<AppNavigationSpacer />
</ul>
<AppNavigation>
<ul v-if="favorites.length">
<AppNavigationNew
v-if="allowFavoriteEdits"
:text="newFavoriteButtonLabel"
@click="handleAddFavoriteClick"
/>
<AppNavigationItem
v-for="favorite in favorites"
:key="favorite.id"
:title="favorite.name || t('maps', '(No name)')"
@click="handleFavoriteClick(favorite.id)"
/>
<AppNavigationSpacer />
</ul>

<div class="no-favorites" v-else>
{{t('maps', 'No favorites to display')}}
</div>
</AppNavigation>
<div v-else class="no-favorites">
{{ t("maps", "No favorites to display") }}
</div>
</AppNavigation>
</template>

<script>
import AppNavigation from "@nextcloud/vue/dist/Components/AppNavigation";
import AppNavigationSettings from "@nextcloud/vue/dist/Components/AppNavigationSettings";
import AppNavigationItem from "@nextcloud/vue/dist/Components/AppNavigationItem";
import AppNavigationNew from "@nextcloud/vue/dist/Components/AppNavigationNew";
import AppNavigationSpacer from "@nextcloud/vue/dist/Components/AppNavigationSpacer";
Expand All @@ -37,7 +36,6 @@ export default {
components: {
AppNavigation,
AppNavigationSettings,
AppNavigationItem,
AppNavigationNew,
AppNavigationSpacer
Expand All @@ -47,7 +45,7 @@ export default {
...mapState({
favorites: state => state[PUBLIC_FAVORITES_NAMESPACE].favorites,
mapMode: state => state[MAP_NAMESPACE].mode,
shareInfo: state => state[PUBLIC_FAVORITES_NAMESPACE].shareInfo,
shareInfo: state => state[PUBLIC_FAVORITES_NAMESPACE].shareInfo
}),
allowFavoriteEdits() {
Expand Down Expand Up @@ -88,9 +86,9 @@ export default {
</script>

<style scoped lang="scss">
.no-favorites {
padding: 2em;
text-align: center;
color: var(--color-text-light);
}
.no-favorites {
padding: 2em;
text-align: center;
color: var(--color-text-light);
}
</style>
6 changes: 1 addition & 5 deletions src/components/map/FavoritePopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@
<div class="no-edits">
<p>
{{
favorite.comment.length
? favorite.comment
: t("maps", "No comment")
favorite.comment.length ? favorite.comment : t("maps", "No comment")
}}
</p>
</div>
Expand Down Expand Up @@ -123,5 +121,3 @@ export default {
}
};
</script>

<style scoped></style>
3 changes: 1 addition & 2 deletions src/components/map/Popup.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div class="popup">
<h2 v-if="title"
class="popup-title">
<h2 v-if="title" class="popup-title">
{{ title }}
</h2>

Expand Down
5 changes: 2 additions & 3 deletions src/components/map/PopupFormItem.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div class="form-item">
<span class="icon"
:class="icon" />
<span class="icon" :class="icon" />
<div class="input-wrapper">
<template v-if="allowEdits">
<textarea
Expand All @@ -18,7 +17,7 @@
:placeholder="placeholder"
:value="value"
@input="$emit('input', $event.target.value)"
>
/>
</template>
<template v-else>
<span>{{ value }}</span>
Expand Down
10 changes: 1 addition & 9 deletions src/components/map/SimpleOSMAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
<div class="osm-address-text">
<p v-html="textContents" />
</div>
<!--<textarea
:value="textContents"
@input="$emit('input', $event.target.value)"
class="osm-address-text"
rows="6"
></textarea>-->
<div class="loading" :class="{ visible: loading }" />
</div>
</template>
Expand All @@ -20,7 +14,7 @@ export default {
name: "SimpleOSMAddress",
props: {
geocodeObject: Types.OSMGeoCodeResult
geocodeObject: Types.OSMGeoCodeResult.def(null)
},
computed: {
Expand Down Expand Up @@ -98,8 +92,6 @@ $transitionDuration: 0.3s;
.osm-address-text {
width: 100%;
min-height: 8em;
/*border: 1px solid rgba(#000, 0.05);*/
/*resize: vertical;*/
}
.loading {
Expand Down
4 changes: 2 additions & 2 deletions src/data/mapLayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const LayerTypes = {
};

export const LayerIds = {
OSM: "osm",
OSM: "osm"
// RoadsOverlay: "roads-overlay",
// ESRI: "esri",
// ESRITopo: "esri-topo",
Expand Down Expand Up @@ -43,7 +43,7 @@ export const Layers = [
detectRetina: false,
maxZoom: 19
}
},
}
/*{
id: LayerIds.ESRI,
name: "ESRI",
Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/publicFavorites.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const mutations = {
},
setSelectedFavoriteId(state, favoriteId) {
state.selectedFavoriteId = favoriteId;
},
}
};

export default {
Expand Down

0 comments on commit 76e5224

Please sign in to comment.