Skip to content

Commit

Permalink
eslint - enforce single quotes (#285)
Browse files Browse the repository at this point in the history
Turn on @typescript-eslint/quotes rule to standardize on single quotes for all strings.
  • Loading branch information
drwestco authored Aug 31, 2021
1 parent fa05f55 commit b6ac656
Show file tree
Hide file tree
Showing 135 changed files with 991 additions and 989 deletions.
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
"prefer-arrow-callback": "error",
"prefer-const": ["error", {"destructuring": "all"}],
"prefer-template": "error",
// @typescript-eslint/quotes requires standard quotes rule to be turned off
"quotes": "off",
"@typescript-eslint/quotes": ["error", "single"],
"space-before-function-paren": "off",
"template-curly-spacing": "error",
"no-useless-escape": "off",
Expand Down
2 changes: 1 addition & 1 deletion build/test/build-tape.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from 'fs';
export default function() {
return new Promise((resolve, reject) => {
browserify('./test/util/tape_config.js', { standalone: 'tape' })
.transform("babelify", {presets: ["@babel/preset-env"], global: true})
.transform('babelify', {presets: ['@babel/preset-env'], global: true})
.bundle((err, buff) => {
if (err) { throw err; }

Expand Down
34 changes: 17 additions & 17 deletions debug/2762.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@
var map = new maplibregl.Map({
container: 'map',
style: {
"version": 8,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Point",
"coordinates": [0, 0]
'version': 8,
'sources': {
'geojson': {
'type': 'geojson',
'data': {
'type': 'Point',
'coordinates': [0, 0]
}
}
},
"transition": {
"duration": 1000
'transition': {
'duration': 1000
},
"layers": [
'layers': [
{
"id": "circle",
"type": "circle",
"source": "geojson",
"paint": {
"circle-translate": [-50, -50]
'id': 'circle',
'type': 'circle',
'source': 'geojson',
'paint': {
'circle-translate': [-50, -50]
}
}
]
}
});

map.on('click', function(_) {
map.setPaintProperty("circle", "circle-color", "red");
map.setPaintProperty("circle", "circle-translate", [50, 50]);
map.setPaintProperty('circle', 'circle-color', 'red');
map.setPaintProperty('circle', 'circle-translate', [50, 50]);
});

</script>
Expand Down
10 changes: 5 additions & 5 deletions debug/7517.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
];

const maineBBoxPolygon = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
'type': 'Feature',
'properties': {},
'geometry': {
'type': 'Polygon',
'coordinates': [
[
[-71.08482, 43.08003225358635],
[-66.96466, 43.08003225358635],
Expand Down
40 changes: 20 additions & 20 deletions debug/animate.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@

function line(angle, radius) {
return {
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
'type': 'Feature',
'geometry': {
'type': 'LineString',
'coordinates': [
[-Math.cos(angle) * radius, -Math.sin(angle) * radius + 1],
[Math.cos(angle) * radius, Math.sin(angle) * radius + 1],
]
Expand All @@ -40,8 +40,8 @@

function crossWithAngle(angle) {
return {
"type": "FeatureCollection",
"features": [
'type': 'FeatureCollection',
'features': [
line(angle - Math.PI / 4, radius),
line(angle + Math.PI / 4, radius)
]
Expand All @@ -51,27 +51,27 @@
map.on('load', function () {
// Add a source and layer displaying a point which will be animated in a circle.
map.addSource('lines', {
"type": "geojson",
"data": crossWithAngle(0)
'type': 'geojson',
'data': crossWithAngle(0)
});

map.addLayer({
"id": "lines",
"source": "lines",
"type": "line",
"paint": {
"line-width": 4,
"line-color": "#007cbf"
'id': 'lines',
'source': 'lines',
'type': 'line',
'paint': {
'line-width': 4,
'line-color': '#007cbf'
}
});

map.addLayer({
"id": "dot",
"source": "lines",
"type": "circle",
"paint": {
"circle-radius": 10,
"circle-color": "#007cbf"
'id': 'dot',
'source': 'lines',
'type': 'circle',
'paint': {
'circle-radius': 10,
'circle-color': '#007cbf'
}
});

Expand Down
2 changes: 1 addition & 1 deletion debug/bounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
type: 'fill',
source: 'bounds',
paint: {
'fill-color': "rgba(255,0,0,0.2)"
'fill-color': 'rgba(255,0,0,0.2)'
}
});

Expand Down
86 changes: 43 additions & 43 deletions debug/cache_api.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,38 +111,38 @@
map.on('style.load', function() {
// add traffic layer that shouldn't be cached because of short expiry
map.addLayer({
"id": "traffic",
"source": {
"url": "mapbox://mapbox.mapbox-traffic-v1",
"type": "vector"
'id': 'traffic',
'source': {
'url': 'mapbox://mapbox.mapbox-traffic-v1',
'type': 'vector'
},
"source-layer": "traffic",
"type": "line",
"paint": {
"line-width": 1.5,
"line-color": "red"
'source-layer': 'traffic',
'type': 'line',
'paint': {
'line-width': 1.5,
'line-color': 'red'
}
});

// add third party source that shouldn't be cached
map.addLayer({
"id": "mapillary",
"type": "line",
"source": {
"type": "vector",
"tiles": ["https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt"],
"minzoom": 6,
"maxzoom": 14
'id': 'mapillary',
'type': 'line',
'source': {
'type': 'vector',
'tiles': ['https://d25uarhxywzl1j.cloudfront.net/v0.1/{z}/{x}/{y}.mvt'],
'minzoom': 6,
'maxzoom': 14
},
"source-layer": "mapillary-sequences",
"layout": {
"line-cap": "round",
"line-join": "round"
'source-layer': 'mapillary-sequences',
'layout': {
'line-cap': 'round',
'line-join': 'round'
},
"paint": {
"line-opacity": 0.6,
"line-color": "rgb(53, 175, 109)",
"line-width": 2
'paint': {
'line-opacity': 0.6,
'line-color': 'rgb(53, 175, 109)',
'line-width': 2
}
});

Expand All @@ -155,25 +155,25 @@
const dontCache = ['traffic', 'style', 'fonts', 'd25uarhxywzl1j.cloudfront.net'];

for (const urlSubstring of dontCache) {
log(!matchURL(keys, urlSubstring), "Does not cache wrong resource: " + urlSubstring);
log(!matchURL(keys, urlSubstring), 'Does not cache wrong resource: ' + urlSubstring);
}
}

function testFirstView(done) {
cache.keys().catch(catchError).then(keys => {
log(keys.length === 4, "keys.length = 4");
log(keys.length === 4, 'keys.length = 4');

// check for expected cache entries

const expected = [
"mapbox.mapbox-streets-v7/12/1171/1566.vector.pbf",
"mapbox.mapbox-streets-v7/12/1171/1567.vector.pbf",
"mapbox.mapbox-streets-v7/12/1172/1566.vector.pbf",
"mapbox.mapbox-streets-v7/12/1172/1567.vector.pbf",
'mapbox.mapbox-streets-v7/12/1171/1566.vector.pbf',
'mapbox.mapbox-streets-v7/12/1171/1567.vector.pbf',
'mapbox.mapbox-streets-v7/12/1172/1566.vector.pbf',
'mapbox.mapbox-streets-v7/12/1172/1567.vector.pbf',
];

for (const expect of expected) {
log(matchURL(keys, expect), "Caches correct resource: " + expect);
log(matchURL(keys, expect), 'Caches correct resource: ' + expect);
}

checkNotCached(keys);
Expand All @@ -191,18 +191,18 @@
cache.keys().catch(catchError).then(keys => {

// some tiles were evicted!
log(keys.length === 6, "Enforces cache size limit: keys.length = 6");
log(keys.length === 6, 'Enforces cache size limit: keys.length = 6');

// all the most recent tiles are in the cache
const expected = [
"mapbox.mapbox-streets-v7/13/2342/3133.vector.pbf",
"mapbox.mapbox-streets-v7/13/2342/3134.vector.pbf",
"mapbox.mapbox-streets-v7/13/2343/3133.vector.pbf",
"mapbox.mapbox-streets-v7/13/2343/3134.vector.pbf",
'mapbox.mapbox-streets-v7/13/2342/3133.vector.pbf',
'mapbox.mapbox-streets-v7/13/2342/3134.vector.pbf',
'mapbox.mapbox-streets-v7/13/2343/3133.vector.pbf',
'mapbox.mapbox-streets-v7/13/2343/3134.vector.pbf',
];

for (const expect of expected) {
log(matchURL(keys, expect), "Evicts correct tiles: still has " + expect);
log(matchURL(keys, expect), 'Evicts correct tiles: still has ' + expect);
}

checkNotCached(keys);
Expand All @@ -220,7 +220,7 @@
cache.keys().catch(catchError).then(keys => {

// some tiles were evicted!
log(keys.length === 6, "Enforces cache size limit: keys.length = 6");
log(keys.length === 6, 'Enforces cache size limit: keys.length = 6');

// check that the cache entries are ordered in order of most least use

Expand All @@ -231,14 +231,14 @@

// all the most recent tiles are in the cache
const expected = [
"mapbox.mapbox-streets-v7/12/1171/1566.vector.pbf",
"mapbox.mapbox-streets-v7/12/1171/1567.vector.pbf",
"mapbox.mapbox-streets-v7/12/1172/1566.vector.pbf",
"mapbox.mapbox-streets-v7/12/1172/1567.vector.pbf",
'mapbox.mapbox-streets-v7/12/1171/1566.vector.pbf',
'mapbox.mapbox-streets-v7/12/1171/1567.vector.pbf',
'mapbox.mapbox-streets-v7/12/1172/1566.vector.pbf',
'mapbox.mapbox-streets-v7/12/1172/1567.vector.pbf',
];

for (const expect of expected) {
log(matchURL(keys, expect), "Evicts correct tiles: still has " + expect);
log(matchURL(keys, expect), 'Evicts correct tiles: still has ' + expect);
}

checkNotCached(keys);
Expand Down
30 changes: 15 additions & 15 deletions debug/canvas.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,30 @@
}

var canvasStyle = {
"version": 8,
"sources": {
"canvas": {
"type": "canvas",
"canvas": "testCanvasID",
"animate": false,
"coordinates": [
'version': 8,
'sources': {
'canvas': {
'type': 'canvas',
'canvas': 'testCanvasID',
'animate': false,
'coordinates': [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
[-122.51309394836426, 37.563391708549425],
[-122.51423120498657, 37.56161849366671]
]
}
},
"layers": [{
"id": "background",
"type": "background",
"paint": {
"background-color": "rgb(4,7,14)"
'layers': [{
'id': 'background',
'type': 'background',
'paint': {
'background-color': 'rgb(4,7,14)'
}
}, {
"id": "canvas",
"type": "raster",
"source": "canvas"
'id': 'canvas',
'type': 'raster',
'source': 'canvas'
}]
};

Expand Down
28 changes: 14 additions & 14 deletions debug/chinese.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@
map.addControl(new maplibregl.NavigationControl());

map.on('load', function () {
map.addSource("points", {
"type": "geojson",
"data": '/test/integration/data/chinese.geojson'
map.addSource('points', {
'type': 'geojson',
'data': '/test/integration/data/chinese.geojson'
});

map.addLayer({
"id": "points",
"type": "symbol",
"source": "points",
"layout": {
"icon-image": "{icon}-15",
"text-field": "{name}",
"text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"],
"text-offset": [0, 0.6],
"text-anchor": "top",
"text-allow-overlap": true,
"icon-allow-overlap": true
'id': 'points',
'type': 'symbol',
'source': 'points',
'layout': {
'icon-image': '{icon}-15',
'text-field': '{name}',
'text-font': ['Open Sans Semibold', 'Arial Unicode MS Bold'],
'text-offset': [0, 0.6],
'text-anchor': 'top',
'text-allow-overlap': true,
'icon-allow-overlap': true
}
});
});
Expand Down
Loading

0 comments on commit b6ac656

Please sign in to comment.