Skip to content

Commit

Permalink
fix almost of lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
halsk committed Jan 2, 2024
1 parent c9b00c6 commit 1939d64
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 40 deletions.
7 changes: 1 addition & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,8 @@ module.exports = {
'func-call-spacing': [2, 'never'],
// true/falseを無駄に使うな
'no-unneeded-ternary': 2,
// セミコロンは禁止
semi: [2, 'never'],
// 文字列はシングルクオートのみ
quotes: [2, 'single'],
// varは禁止
'no-var': 2,
// jsのインデントは2
indent: [2, 2],
// かっこの中はスペースなし!違和感
'space-in-parens': [2, 'never'],
// コンソールは許可
Expand All @@ -50,5 +44,6 @@ module.exports = {
'key-spacing': 2,
// キーワードの前後には適切なスペースを
'keyword-spacing': 2,
'camelcase': 0,
},
}
1 change: 1 addition & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ vueIndentScriptAndStyle: true
endOfLine: "lf"
embeddedLanguageFormatting: "off"
singleAttributePerLine: false

4 changes: 2 additions & 2 deletions components/Modal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="pug">
div
.modal(v-bind:class='{open: isOpen}')
p(v-if="map_config") {{map_config.map_description}}
p(v-if="mapConfig") {{mapConfig.map_description}}
p
| このサイトのソースコードはオープンに公開しております。開発にご協力いただける方は、
a(href="https://github.com/codeforjapan/mapprint") Code for Japan の Github リポジトリ
Expand All @@ -17,7 +17,7 @@ export default {
props: ['isOpen'],

Check warning on line 17 in components/Modal.vue

View workflow job for this annotation

GitHub Actions / eslint

Prop "isOpen" should define at least its type
data () {
return {
map_config: this.$nuxt.$route.params.map ? require('~/assets/config/' + (this.$nuxt.$route.params.map)) : ''
mapConfig: this.$nuxt.$route.params.map ? require('~/assets/config/' + (this.$nuxt.$route.params.map)) : ''
}
},
methods: {
Expand Down
40 changes: 20 additions & 20 deletions components/PrintableMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ div
template(slot="marker")
div.marker
span(
:style="{background:map_config.layer_settings[marker.category].color}"
:style="{background:mapConfig.layer_settings[marker.category].color}"
:class="{show: isDisplayAllCategory || activeCategory === marker.category}"
)
i(
:class="[map_config.layer_settings[marker.category].icon_class, map_config.layer_settings[marker.category].class]"
:style="{backgroundColor:map_config.layer_settings[marker.category].color}"
:class="[mapConfig.layer_settings[marker.category].icon_class, mapConfig.layer_settings[marker.category].class]"
:style="{backgroundColor:mapConfig.layer_settings[marker.category].color}"
)
b.number(
:style="{background:map_config.layer_settings[marker.category].bg_color}"
:style="{background:mapConfig.layer_settings[marker.category].bg_color}"
) {{inBoundsMarkers.indexOf(marker) + 1}}
MglPopup
div
div.popup-type
i(
:class="[map_config.layer_settings[marker.category].icon_class, map_config.layer_settings[marker.category].class]"
:style="{backgroundColor:map_config.layer_settings[marker.category].color}"
:class="[mapConfig.layer_settings[marker.category].icon_class, mapConfig.layer_settings[marker.category].class]"
:style="{backgroundColor:mapConfig.layer_settings[marker.category].color}"
)
span.popup-poi-type
| {{getMarkerCategoryText(marker.category, $i18n.locale)}}
Expand All @@ -53,7 +53,7 @@ div
i.fas.fa-arrow-down
.area-list-outer(:class='{open: isOpenAreaSelect}')
ul.area-list.grid
li.area-item.col-12_xs-6(v-for='source in map_config.sources')
li.area-item.col-12_xs-6(v-for='source in mapConfig.sources')
label.area-label
input.area-input(
type='checkbox'
Expand Down Expand Up @@ -92,7 +92,7 @@ div
simplebar(data-simplebar-auto-hide="false")
ul.legend-list
li.legend-item(
v-for='(setting, category) in map_config.layer_settings'
v-for='(setting, category) in mapConfig.layer_settings'
v-if="displayMarkersGroupByCategory.some((elm) => elm.category === category)"
)
span.legend-mark(
Expand All @@ -117,11 +117,11 @@ div
:class='{show: isDisplayAllCategory || activeCategory === getMarkerCategoryText(group.category, $i18n.locale)}'
)
h2.list-title(
:style="{backgroundColor:map_config.layer_settings[group.category].color}"
:style="{backgroundColor:mapConfig.layer_settings[group.category].color}"
)
span.list-title-mark
i(
:class="map_config.layer_settings[group.category].icon_class"
:class="mapConfig.layer_settings[group.category].icon_class"
)
span {{getMarkerCategoryText(group.category, $i18n.locale)}}
ul.list-items.grid-noGutter
Expand Down Expand Up @@ -150,7 +150,7 @@ import { getNowYMD } from "~/lib/displayHelper";
const crc16 = require("js-crc").crc16;
let helper;
export default {
props: ["map_config"],
props: ["mapConfig"],

Check warning on line 153 in components/PrintableMap.vue

View workflow job for this annotation

GitHub Actions / eslint

Prop "mapConfig" should define at least its type
data() {
let locale = "en";
if (this.$i18n.locale === "ja") {
Expand All @@ -174,7 +174,7 @@ export default {
},
computed: {
center() {
return this.map_config.center;
return this.mapConfig.center;
},
inBoundsMarkers() {
const inBoundsMarkers = [];
Expand Down Expand Up @@ -225,7 +225,7 @@ export default {
const area = [];
const categories = {};
const self = this;
this.map_config.sources.forEach((source) => {
this.mapConfig.sources.forEach((source) => {
(async () => {
if (source.show) {
area.push(source.title);
Expand All @@ -236,15 +236,15 @@ export default {
const [markers, updated_at] = helper.parse(
source.type,
data,
self.map_config.layer_settings,
self.mapConfig.layer_settings,
source.updated_search_key
);
markers.map((marker) => {
categories[marker.category] = true;
});
source.updated_at = updated_at;
Object.keys(categories).map((category) => {
const categoryExists = self.map_config.layer_settings[category];
const categoryExists = self.mapConfig.layer_settings[category];
if (!categoryExists) {
let color = "#";
Expand All @@ -256,7 +256,7 @@ export default {
bg_color += ((parseInt(crc16(category.substr(0)), 16) % 32) + 128).toString(16);
bg_color += ((parseInt(crc16(category.substr(1)), 16) % 32) + 128).toString(16);
bg_color += ((parseInt(crc16(category.substr(2)), 16) % 32) + 128).toString(16);
self.map_config.layer_settings[category] = {
self.mapConfig.layer_settings[category] = {

Check failure on line 259 in components/PrintableMap.vue

View workflow job for this annotation

GitHub Actions / eslint

Unexpected mutation of "mapConfig" prop
name: category,
color,
bg_color,
Expand All @@ -275,11 +275,11 @@ export default {
const locationhash = window.location.hash.substr(1);
let initbounds = helper.deserializeBounds(locationhash);
this.map = this.$refs.map_obj;
if (initbounds != undefined) {
if (initbounds !== undefined) {
this.map.map.fitBounds(initbounds, { linear: false });
} else {
initbounds = helper.deserializeBounds(this.map_config.default_hash);
if (initbounds != undefined) {
initbounds = helper.deserializeBounds(this.mapConfig.default_hash);
if (initbounds !== undefined) {
this.map.map.fitBounds(initbounds, { linear: false });
}
}
Expand All @@ -295,7 +295,7 @@ export default {
setHash(bounds) {
const s = helper.serializeBounds(bounds);
const path = location.pathname;
if (s != this.previous_hash) {
if (s !== this.previous_hash) {
window.history.pushState("", "", path + "#" + s);
}
this.previous_hash = s;
Expand Down
24 changes: 12 additions & 12 deletions pages/map/_map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ div.layout-map
option(v-for="locale in $i18n.locales" :value="switchLocalePath(locale.code)")
| {{ locale.name }}
.title-outer
h1.title(v-if="map_config && $i18n.locale === 'ja'")
| {{map_config.map_title}}
h1.title(v-if="mapConfig && $i18n.locale === 'ja'")
| {{mapConfig.map_title}}
h1.title(v-else)
| {{map_config.map_title_en}}
| {{mapConfig.map_title_en}}
.datetime
| {{$t('map.printed_at')}} {{updated_at}}
.qrcode
vue-qrcode(v-bind:value='fullURL' tag="img")
printable-map(:map_config='map_config', v-if="map_config", @bounds-changed="updateQRCode")
printable-map(:mapConfig='mapConfig', v-if="mapConfig", @bounds-changed="updateQRCode")
footer.footer
.footer-logo
img(src="~/assets/images/logo.png" width="895" height="160" :alt='$t("common.title")')
Expand All @@ -93,7 +93,7 @@ export default {
},
data () {
return {
map_config: require('~/assets/config/' + (this.$nuxt.$route.params.map)),
mapConfig: require('~/assets/config/' + (this.$nuxt.$route.params.map)),
locale: null,
isOpenExplain: false,
fullURL: null,
Expand All @@ -102,19 +102,19 @@ export default {
},
head () {
let title, description
const image = this.map_config.map_image ? this.map_config.map_image : 'logo.png'
const image = this.mapConfig.map_image ? this.mapConfig.map_image : 'logo.png'
switch (this.$i18n.locale) {
case 'ja':
title = this.map_config.map_title
description = this.map_config.map_description
title = this.mapConfig.map_title
description = this.mapConfig.map_description
break
case 'en':
title = this.map_config.map_title_en
description = this.map_config.map_description_en
title = this.mapConfig.map_title_en
description = this.mapConfig.map_description_en
break
default:
title = this.map_config.map_title_en
description = this.map_config.map_description_en
title = this.mapConfig.map_title_en
description = this.mapConfig.map_description_en
break
}
return {
Expand Down

0 comments on commit 1939d64

Please sign in to comment.