Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Added stylelint package & .stylelinrc + basic rules for css linting #425 - Added stylelint npm package - Added grunt-stylelint npm package - Added grunt-stylelint to gruntfile (and cleaned up some inconsistency in file) - Ordered initConfig rules in npm package alphabetically - Added .stylelintrc file + 2 starter rules ("color-no-invalid-hex": true, "max-empty-lines": 1,) - Run `grunt stylelint` to run css linting or `grunt lint` to run js + css linting

ZachTRice50bd6d74aecc
diff --git a/.stylelintrc b/.stylelintrc
new file mode 100644
index 000000000..47473b815
--- /dev/null
+++ b/.stylelintrc
@@ -0,0 +1,6 @@
+{
+ "rules": {
+ "color-no-invalid-hex": true,
+ "max-empty-lines": 1,
+ }
+}
diff --git a/Gruntfile.js b/Gruntfile.js
index 1d4903fa5..57e0a9c3a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -85,6 +85,18 @@ module.exports = function(grunt) {
opt: options,
apache_version: grunt.option("apache-version") || "22",
+ autoprefix: {
+ options: {
+ map: false,
+ processors: [
+ require('autoprefixer')
+ ]
+ },
+ dist: {
+ src: 'web/css/*.css'
+ }
+ },
+
buster: {
console: {},
report: {
@@ -93,40 +105,7 @@ module.exports = function(grunt) {
}
}
},
- nightwatch: {
- options: {
- // task options
- src_folders: ["./e2e/tests"],
- standalone: true,
- // download settings
- jar_version: '3.0.1',
- globals_path: "./e2e/globals.js",
- selenium_port: 4444,
- server_path: "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.0.1.jar",
- test_settings: {
- firefox: {
- "desiredCapabilities": {
- "browserName": "firefox",
- // "marionette": false, - Windows users
- "marionette": true,
- "javascriptEnabled": true
- },
- "cli_args" : {
- "webdriver.gecko.driver" : "node_modules/geckodriver/bin/geckodriver"
- }
- },
- chrome: {
- "desiredCapabilities": {
- "browserName": "chrome"
- },
- "cli_args" : {
- // "webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver.exe" - Windows users
- "webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver"
- }
- }
- }
- }
- },
+
coffee: {
build: {
expand: true,
@@ -137,18 +116,6 @@ module.exports = function(grunt) {
}
},
- autoprefix: {
- options: {
- map: false,
- processors: [
- require('autoprefixer')
- ]
- },
- dist: {
- src: 'web/css/*.css'
- }
- },
-
concat: {
// Combine all the Worldview JavaScript files into one file.
js: {
@@ -355,6 +322,17 @@ module.exports = function(grunt) {
}
},
+ eslint: {
+ options: {
+ configFile: ".eslintrc",
+ format: "stylish"
+ },
+ src: [
+ "web/js/**/wv.*.js",
+ "test/**/*.js",
+ ]
+ },
+
exec: {
config: {
command:"bash -c \"PATH=" + pythonPath + ":\"${PATH}\" bin/wv-options-build \"" + env
@@ -481,6 +459,41 @@ module.exports = function(grunt) {
}
},
+ nightwatch: {
+ options: {
+ // task options
+ src_folders: ["./e2e/tests"],
+ standalone: true,
+ // download settings
+ jar_version: '3.0.1',
+ globals_path: "./e2e/globals.js",
+ selenium_port: 4444,
+ server_path: "node_modules/selenium-server-standalone-jar/jar/selenium-server-standalone-3.0.1.jar",
+ test_settings: {
+ firefox: {
+ "desiredCapabilities": {
+ "browserName": "firefox",
+ // "marionette": false, - Windows users
+ "marionette": true,
+ "javascriptEnabled": true
+ },
+ "cli_args" : {
+ "webdriver.gecko.driver" : "node_modules/geckodriver/bin/geckodriver"
+ }
+ },
+ chrome: {
+ "desiredCapabilities": {
+ "browserName": "chrome"
+ },
+ "cli_args" : {
+ // "webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver.exe" - Windows users
+ "webdriver.chrome.driver" : "node_modules/chromedriver/lib/chromedriver/chromedriver"
+ }
+ }
+ }
+ }
+ },
+
remove: {
build: ["build"],
dist: ["dist"],
@@ -492,7 +505,7 @@ module.exports = function(grunt) {
"build/worldview-debug/web/**/*.js",
"!build/worldview-debug/web/css/wv.css",
"!build/worldview-debug/web/js/wv.js",
- "!build/worldview-debug/web/js/ol.js",
+ "!build/worldview-debug/web/js/ol.js",
"!build/worldview-debug/web/css/bulkDownload.css",
"!build/worldview-debug/web/ext/**/*"
],
@@ -608,22 +621,27 @@ module.exports = function(grunt) {
}]
},
},
+
+ stylelint: {
+ options: {
+ configFile: '.stylelintrc',
+ formatter: 'string',
+ ignoreDisables: false,
+ failOnError: true,
+ outputFile: '',
+ reportNeedlessDisables: false,
+ syntax: ''
+ },
+ src: 'web/css/*.css'
+ },
+
watch: {
scripts: {
files: nodeModuleFiles,
tasks: ['update'],
},
},
- eslint: {
- options: {
- configFile: ".eslintrc",
- format: "stylish"
- },
- src: [
- "web/js/**/wv.*.js",
- "test/**/*.js",
- ]
- },
+
uglify: {
// Minifiy the concatenated Worldview JavaScript file.
options: {
@@ -659,7 +677,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-copy");
- grunt.loadNpmTasks("grunt-contrib-csslint");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("gruntify-eslint");
grunt.loadNpmTasks("grunt-contrib-uglify");
@@ -670,10 +687,11 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-markdown");
grunt.loadNpmTasks("grunt-minjson");
grunt.loadNpmTasks("grunt-mkdir");
- grunt.loadNpmTasks('grunt-postcss');
+ grunt.loadNpmTasks("grunt-postcss");
+ grunt.loadNpmTasks("grunt-stylelint");
grunt.loadNpmTasks("grunt-text-replace");
grunt.loadNpmTasks("grunt-rename");
- grunt.loadNpmTasks('grunt-nightwatch');
+ grunt.loadNpmTasks("grunt-nightwatch");
// Lets use "clean" as a target instead of the name of the task
@@ -769,7 +787,7 @@ module.exports = function(grunt) {
grunt.registerTask("check", ["lint", "test"]);
grunt.registerTask("clean", ["remove:build"]);
grunt.registerTask("distclean", ["remove:build", "remove:dist"]);
- grunt.registerTask("lint", ["eslint"]);
+ grunt.registerTask("lint", ["eslint"], ["stylelint"]);
grunt.registerTask("test", ["buster:console"]);
grunt.registerTask("chrome-tests", ["nightwatch:chrome"]);
grunt.registerTask("firefox-tests", ["nightwatch:firefox"]);
diff --git a/package.json b/package.json
index 1464ce6c2..f370352b1 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,6 @@
"grunt-contrib-compress": "0.5.x",
"grunt-contrib-concat": "1.0.x",
"grunt-contrib-copy": "1.0.x",
- "grunt-contrib-csslint": "0.2.x",
"grunt-contrib-cssmin": "1.0.x",
"grunt-contrib-uglify": "2.0.x",
"grunt-contrib-watch": "^1.0.0",
@@ -42,6 +41,7 @@
"grunt-nightwatch": "^0.5.4",
"grunt-postcss": "^0.8.0",
"grunt-rename": "0.1.x",
+ "grunt-stylelint": "^0.8.0",
"grunt-text-replace": "0.4.x",
"gruntify-eslint": "^4.0.0",
"lodash": "4.15.0",
@@ -53,6 +53,7 @@
"promise-queue": "2.2.3",
"react": "15.3.1",
"react-dom": "15.3.1",
+ "stylelint": "^8.0.0",
"worldview-components": "1.3.3",
"selenium-server-standalone-jar": "3.0.1"
}
diff --git a/web/css/wv.fonts.css b/web/css/wv.fonts.css
index 2a120f17d..57b4b8553 100644
--- a/web/css/wv.fonts.css
+++ b/web/css/wv.fonts.css
@@ -9,7 +9,6 @@
* All Rights Reserved.
*/
-
/* Open Sans Light */
@font-face {
font-family: 'Open Sans';