Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use travis to run eslint #52

Merged
merged 1 commit into from May 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions .editorconfig
Expand Up @@ -9,6 +9,4 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4


indent_size = 2
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
dist/
8 changes: 7 additions & 1 deletion .eslintrc
@@ -1 +1,7 @@
{"extends": ["standard"]}
{"extends": ["standard"],
"globals": {
"L": true,
"module": true,
"define": true
}
}
6 changes: 6 additions & 0 deletions .travis.yml
@@ -0,0 +1,6 @@
language: node_js
node_js:
- "10"

script:
- npm run lint
120 changes: 60 additions & 60 deletions Gruntfile.js
@@ -1,68 +1,68 @@
module.exports = function(grunt) {
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/javascript/Leaflet.StyleEditor.min.js': 'dist/javascript/Leaflet.StyleEditor.min.js'
}
}
},
concat: {
dist: {
src: [
'src/javascript/Leaflet.StyleEditor.js',
'src/javascript/Util.js',
module.exports = function (grunt) {
grunt.initConfig({
uglify: {
dist: {
files: {
'dist/javascript/Leaflet.StyleEditor.min.js': 'dist/javascript/Leaflet.StyleEditor.min.js'
}
}
},
concat: {
dist: {
src: [
'src/javascript/Leaflet.StyleEditor.js',
'src/javascript/Util.js',

'src/javascript/FormElements/FormElement.js',
'src/javascript/FormElements/IconElement.js',
'src/javascript/FormElements/ColorElement.js',
'src/javascript/FormElements/OpacityElement.js',
'src/javascript/FormElements/SizeElement.js',
'src/javascript/FormElements/DashElement.js',
'src/javascript/FormElements/WeightElement.js',
'src/javascript/FormElements/FormElement.js',
'src/javascript/FormElements/IconElement.js',
'src/javascript/FormElements/ColorElement.js',
'src/javascript/FormElements/OpacityElement.js',
'src/javascript/FormElements/SizeElement.js',
'src/javascript/FormElements/DashElement.js',
'src/javascript/FormElements/WeightElement.js',

'src/javascript/Form/Form.js',
'src/javascript/Form/GeometryForm.js',
'src/javascript/Form/MarkerForm.js',
'src/javascript/Form/Form.js',
'src/javascript/Form/GeometryForm.js',
'src/javascript/Form/MarkerForm.js',

'src/javascript/Marker/Marker.js',
'src/javascript/Marker/DefaultMarker.js',
'src/javascript/Marker/GlyphiconMarker.js',
'src/javascript/Marker/Marker.js',
'src/javascript/Marker/DefaultMarker.js',
'src/javascript/Marker/GlyphiconMarker.js',

'src/javascript/StyleForm.js',
'src/javascript/StyleForm.js',

'src/javascript/Control.js'
],
dest: 'dist/javascript/Leaflet.StyleEditor.min.js'
}
},
'src/javascript/Control.js'
],
dest: 'dist/javascript/Leaflet.StyleEditor.min.js'
}
},

cssmin: {
combine: {
files: {
'dist/css/Leaflet.StyleEditor.min.css': ['src/css/Leaflet.StyleEditor.css']
}
}
},
cssmin: {
combine: {
files: {
'dist/css/Leaflet.StyleEditor.min.css': ['src/css/Leaflet.StyleEditor.css']
}
}
},

'gh-pages': {
options: {
base: 'dist',
only: [
'javascript/Leaflet.StyleEditor.min.js',
'css/Leaflet.StyleEditor.min.css'
]
},
src: [
'javascript/Leaflet.StyleEditor.min.js',
'css/Leaflet.StyleEditor.min.css'
]
},
});
grunt.loadNpmTasks('grunt-contrib-uglify-es');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-gh-pages');
'gh-pages': {
options: {
base: 'dist',
only: [
'javascript/Leaflet.StyleEditor.min.js',
'css/Leaflet.StyleEditor.min.css'
]
},
src: [
'javascript/Leaflet.StyleEditor.min.js',
'css/Leaflet.StyleEditor.min.css'
]
}
})
grunt.loadNpmTasks('grunt-contrib-uglify-es')
grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-cssmin')
grunt.loadNpmTasks('grunt-gh-pages')

grunt.registerTask('default', ['concat', 'uglify', 'cssmin']);
};
grunt.registerTask('default', ['concat', 'uglify', 'cssmin'])
}
2 changes: 1 addition & 1 deletion dist/javascript/Leaflet.StyleEditor.min.js

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "Leaflet.StyleEditor",
"author": "Dennis Wilhelm",
"version": "0.1.6",
"version": "0.1.9",
"description": "Edit the style of features drawn within Leaflet.",
"license": "MIT",
"main": "dist/javascript/Leaflet.StyleEditor.min.js",
Expand All @@ -16,7 +16,8 @@
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-cssmin": "^2.2.1",
"grunt-contrib-uglify-es": "^3.3.0",
"grunt-gh-pages": "~2.x"
"grunt-gh-pages": "~2.x",
"lint": "^1.1.2"
},
"repository": {
"type": "git",
Expand All @@ -31,5 +32,9 @@
"editor",
"StyleEditor"
],
"dependencies": {}
"dependencies": {},
"scripts": {
"lint": "./node_modules/.bin/eslint . ./**/*.js",
"test": "./node_modules/.bin/eslint . ./**/*.js"
}
}
164 changes: 80 additions & 84 deletions src/StyleEditorWithLeafletDraw.html
Expand Up @@ -2,112 +2,108 @@
<html>

<head>
<meta charset=utf-8 />
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta charset=utf-8/>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>


<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/leaflet.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/leaflet.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/leaflet.css"/>

<!--[if lte IE 8]>
<link rel="stylesheet" href="lib/leaflet/leaflet.ie.css" />
<link rel="stylesheet" href="leaflet.draw.ie.css" />
<![endif]-->
<!--[if lte IE 8]>
<link rel="stylesheet" href="lib/leaflet/leaflet.ie.css"/>
<link rel="stylesheet" href="leaflet.draw.ie.css"/>
<![endif]-->

<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/0.4.12/leaflet.draw.css"/>

<script src="../dist/javascript/Leaflet.StyleEditor.min.js"></script>
<link rel="stylesheet" href="../dist/css/Leaflet.StyleEditor.min.css" />
<script src="../dist/javascript/Leaflet.StyleEditor.min.js"></script>
<link rel="stylesheet" href="../dist/css/Leaflet.StyleEditor.min.css"/>




<style type="text/css">
<style type="text/css">

body {
margin:0;
padding:0;
margin: 0;
padding: 0;
}

#map {
position:absolute;
top:0;
bottom:0;
width:100%;
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}

</style>
</style>

</head>

<body>
<div id="map"></div>
<script>
let map = L.map('map').setView([20, -40], 3)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map)

//Initialize the StyleEditor
let styleEditor = L.control.styleEditor({
position: "topleft",
useGrouping: false
})
map.addControl(styleEditor)




//Leaflet.draw

let drawnItems = new L.FeatureGroup()
map.addLayer(drawnItems)

let drawControl = new L.Control.Draw({
draw: {
position: 'topleft',
polygon: {
title: 'Draw a sexy polygon!',
allowIntersection: false,
drawError: {
color: '#b00b00',
timeout: 1000
},
shapeOptions: {
color: '#bada55'
},
showArea: true
},
polyline: {
metric: false
},
circle: {
shapeOptions: {
color: '#662d91'
}
},
marker: {
icon: styleEditor.getDefaultIcon()
}
<div id="map"></div>
<script>
let map = L.map('map').setView([20, -40], 3)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map)

//Initialize the StyleEditor
let styleEditor = L.control.styleEditor({
position: 'topleft',
useGrouping: false
})
map.addControl(styleEditor)

//Leaflet.draw

let drawnItems = new L.FeatureGroup()
map.addLayer(drawnItems)

let drawControl = new L.Control.Draw({
draw: {
position: 'topleft',
polygon: {
title: 'Draw a sexy polygon!',
allowIntersection: false,
drawError: {
color: '#b00b00',
timeout: 1000
},
shapeOptions: {
color: '#bada55'
},
edit: {
featureGroup: drawnItems
showArea: true
},
polyline: {
metric: false
},
circle: {
shapeOptions: {
color: '#662d91'
}
})
map.addControl(drawControl)
},
marker: {
icon: styleEditor.getDefaultIcon()
}
},
edit: {
featureGroup: drawnItems
}
})
map.addControl(drawControl)

map.on('draw:created', function(e) {
let type = e.layerType,
layer = e.layer
map.on('draw:created', function (e) {
let type = e.layerType,
layer = e.layer

if (type === 'marker') {
layer.bindPopup('A popup!')
}
if (type === 'marker') {
layer.bindPopup('A popup!')
}

drawnItems.addLayer(layer)
})
</script>
drawnItems.addLayer(layer)
})
</script>
</body>

</html>