Get eslinting working again

This commit is contained in:
Jonny Barnes 2017-03-20 19:45:46 +00:00
parent 963baee25f
commit ff1b767f0f
7 changed files with 55 additions and 53 deletions

View file

@ -1,7 +1,9 @@
parserOptions:
sourceType: 'module'
extends: 'eslint:recommended'
env:
browser: true
es6: true
extends: 'eslint:recommended'
rules:
indent:
- error

View file

@ -15,7 +15,7 @@ for (let note of notes) {
ytiframe.setAttribute('src', 'https://www.youtube.com/embed/' + ytid[1]);
ytiframe.setAttribute('frameborder', 0);
ytiframe.setAttribute('allowfullscreen', 'true');
ytcontainer.appendChild(ytiframe)
ytcontainer.appendChild(ytiframe);
note.appendChild(ytcontainer);
}
let spotifyid = note.textContent.match(spotifyRegex);

View file

@ -7,7 +7,7 @@ mapboxgl.accessToken = 'pk.eyJ1Ijoiam9ubnliYXJuZXMiLCJhIjoiY2l2cDhjYW04MDAwcjJ0c
//define some functions to be used in the default function.
const titlecase = (string) => {
return string.split('-').map(([first,...rest]) => first.toUpperCase() + rest.join('').toLowerCase()).join(' ')
return string.split('-').map(([first,...rest]) => first.toUpperCase() + rest.join('').toLowerCase()).join(' ');
};
const addMapTypeOption = (map, menu, option, checked = false) => {
@ -27,7 +27,7 @@ const addMapTypeOption = (map, menu, option, checked = false) => {
label.appendChild(document.createTextNode(titlecase(option)));
menu.appendChild(input);
menu.appendChild(label);
}
};
const makeMapMenu = (map) => {
let mapMenu = document.createElement('div');
@ -35,7 +35,7 @@ const makeMapMenu = (map) => {
addMapTypeOption(map, mapMenu, 'streets', true);
addMapTypeOption(map, mapMenu, 'satellite-streets');
return mapMenu;
}
};
//the main function
export default function addMap(div, position = null, places = null) {
@ -45,17 +45,17 @@ export default function addMap(div, position = null, places = null) {
let data = window['geojson'+dataId];
if (data == null) {
data = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [dataLongitude, dataLatitude]
'type': 'FeatureCollection',
'features': [{
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [dataLongitude, dataLatitude]
},
"properties": {
"title": "Current Location",
"icon": "circle-stroked",
"uri": "current-location"
'properties': {
'title': 'Current Location',
'icon': 'circle-stroked',
'uri': 'current-location'
}
}]
};
@ -65,22 +65,22 @@ export default function addMap(div, position = null, places = null) {
let placeLongitude = parseLocation(place.location).longitude;
let placeLatitude = parseLocation(place.location).latitude;
data.features.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [placeLongitude, placeLatitude]
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [placeLongitude, placeLatitude]
},
"properties": {
"title": place.name,
"icon": "circle",
"uri": place.slug
'properties': {
'title': place.name,
'icon': 'circle',
'uri': place.slug
}
});
}
}
if (position != null) {
let dataLongitude = position.coords.longitude;
let dataLatitude = position.coords.latitude;
dataLongitude = position.coords.longitude;
dataLatitude = position.coords.latitude;
}
let map = new mapboxgl.Map({
container: div,
@ -95,18 +95,18 @@ export default function addMap(div, position = null, places = null) {
div.appendChild(makeMapMenu(map));
map.on('load', function () {
map.addSource('points', {
"type": "geojson",
"data": data
'type': 'geojson',
'data': data
});
map.addLayer({
"id": "points",
"interactive": true,
"type": "symbol",
"source": "points",
"layout": {
"icon-image": "{icon}-15",
"text-field": "{title}",
"text-offset": [0, 1]
'id': 'points',
'interactive': true,
'type': 'symbol',
'source': 'points',
'layout': {
'icon-image': '{icon}-15',
'text-field': '{title}',
'text-offset': [0, 1]
}
});
});

View file

@ -41,8 +41,8 @@ const makeOptionsForForm = (map, position, places = null) => {
}
});
return selectElement
}
return selectElement;
};
//position is output of navigator.geolocation call
export default function addMapWithPlaces(div, position) {

View file

@ -8,7 +8,7 @@ const loadData = () => {
replyTo.value = webStorage.getItem('replyTo');
let content = document.querySelector('#content');
content.value = webStorage.getItem('content');
}
};
const saveData = () => {
let replyTo = document.querySelector('#in-reply-to');
@ -16,12 +16,12 @@ const saveData = () => {
webStorage.setItem('replyTo', replyTo.value);
webStorage.setItem('content', content.value);
alertify.success('Auto-saved data');
}
};
const clearData = () => {
webStorage.removeItem('replyTo');
webStorage.removeItem('content');
}
};
export default function persistFormData()
{

View file

@ -3,9 +3,9 @@
export default function selectPlaceInForm(uri) {
if (document.querySelector('select')) {
if (uri == 'current-location') {
document.querySelector('select [id="option-coords"]').selected = true
document.querySelector('select [id="option-coords"]').selected = true;
} else {
document.querySelector('select [value="' + uri + '"]').selected = true
document.querySelector('select [value="' + uri + '"]').selected = true;
}
}
}

View file

@ -39,21 +39,21 @@ export default function submitNewPlace(map) {
});
//add new place to map
newFeatures.push({
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [placeJson.longitude, placeJson.latitude]
'type': 'Feature',
'geometry': {
'type': 'Point',
'coordinates': [placeJson.longitude, placeJson.latitude]
},
"properties": {
"title": placeJson.name,
"icon": "circle",
"uri": placeJson.uri
'properties': {
'title': placeJson.name,
'icon': 'circle',
'uri': placeJson.uri
}
});
let newSource = {
"type": "FeatureCollection",
"features": newFeatures
}
'type': 'FeatureCollection',
'features': newFeatures
};
map.getSource('points').setData(newSource);
//add new place to select menu
let selectElement = document.querySelector('select');