diff --git a/.jshintrc b/.jshintrc index b199491a..1d2b6d52 100644 --- a/.jshintrc +++ b/.jshintrc @@ -6,7 +6,7 @@ "it": false }, "node": true, - "strict": false, + "globalstrict": true, "expr": true, "curly": false, "camelcase": true, diff --git a/examples/fromFile.js b/examples/fromFile.js index c9595eb1..1565afe1 100644 --- a/examples/fromFile.js +++ b/examples/fromFile.js @@ -1,3 +1,5 @@ +'use strict'; + var SVGO = require('../lib/svgo'), svgo = new SVGO(/*{ custom config object }*/); diff --git a/examples/fromStream.js b/examples/fromStream.js index 13d88508..4840163e 100644 --- a/examples/fromStream.js +++ b/examples/fromStream.js @@ -1,3 +1,5 @@ +'use strict'; + var FS = require('fs'), PATH = require('path'), path = PATH.resolve(__dirname, '../examples/test.svg'), diff --git a/examples/fromString.js b/examples/fromString.js index 4a8f45cc..1c371090 100644 --- a/examples/fromString.js +++ b/examples/fromString.js @@ -1,3 +1,5 @@ +'use strict'; + var SVGO = require('../lib/svgo'), svgo = new SVGO(/*{ custom config object }*/); diff --git a/lib/svgo.js b/lib/svgo.js index ec7e8e53..8a9db98b 100644 --- a/lib/svgo.js +++ b/lib/svgo.js @@ -1,3 +1,5 @@ +'use strict'; + /** * SVGO is a Nodejs-based tool for optimizing SVG vector graphics files. * diff --git a/lib/svgo/coa.js b/lib/svgo/coa.js index 4cd730ea..6cc5a677 100644 --- a/lib/svgo/coa.js +++ b/lib/svgo/coa.js @@ -1,3 +1,5 @@ +'use strict'; + var FS = require('fs'), QFS = require('q-fs'), PATH = require('path'), diff --git a/lib/svgo/config.js b/lib/svgo/config.js index 426b3df4..b5e85421 100644 --- a/lib/svgo/config.js +++ b/lib/svgo/config.js @@ -1,3 +1,5 @@ +'use strict'; + var QFS = require('q-fs'), PATH = require('path'), YAML = require('yamljs'), diff --git a/lib/svgo/js2svg.js b/lib/svgo/js2svg.js index f161cace..c10371e3 100644 --- a/lib/svgo/js2svg.js +++ b/lib/svgo/js2svg.js @@ -1,3 +1,5 @@ +'use strict'; + var INHERIT = require('inherit'), extend = require('./tools').extend; diff --git a/lib/svgo/jsAPI.js b/lib/svgo/jsAPI.js index 0f0046ef..ac18de31 100644 --- a/lib/svgo/jsAPI.js +++ b/lib/svgo/jsAPI.js @@ -1,3 +1,5 @@ +'use strict'; + var INHERIT = require('inherit'), extend = require('./tools').extend; diff --git a/lib/svgo/plugins.js b/lib/svgo/plugins.js index 2a937410..7098e766 100644 --- a/lib/svgo/plugins.js +++ b/lib/svgo/plugins.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Plugins engine. * diff --git a/lib/svgo/svg2js.js b/lib/svgo/svg2js.js index 9367ea18..14c66ec8 100644 --- a/lib/svgo/svg2js.js +++ b/lib/svgo/svg2js.js @@ -1,3 +1,5 @@ +'use strict'; + var Q = require('q'), SAX = require('sax'), JSAPI = require('./jsAPI'); diff --git a/lib/svgo/tools.js b/lib/svgo/tools.js index 4242084c..76fe5240 100644 --- a/lib/svgo/tools.js +++ b/lib/svgo/tools.js @@ -1,3 +1,5 @@ +'use strict'; + var datauriSVGPrefix = exports.datauriSVGPrefix = 'data:image/svg+xml;base64,'; /** diff --git a/plugins/_collections.js b/plugins/_collections.js index f0f5ab20..5911cdf5 100644 --- a/plugins/_collections.js +++ b/plugins/_collections.js @@ -1,3 +1,5 @@ +'use strict'; + // http://www.w3.org/TR/SVG/intro.html#Definitions var elemsGroups = exports.elemsGroups = { animation: ['animate', 'animateColor', 'animateMotion', 'animateTransform', 'set'], diff --git a/plugins/cleanupAttrs.js b/plugins/cleanupAttrs.js index 096c1d83..09d34ae1 100644 --- a/plugins/cleanupAttrs.js +++ b/plugins/cleanupAttrs.js @@ -1,3 +1,5 @@ +'use strict'; + var regNewlines = /\n/g, regSpaces = /\s{2,}/g; diff --git a/plugins/cleanupEnableBackground.js b/plugins/cleanupEnableBackground.js index b206ffa1..07c0519a 100644 --- a/plugins/cleanupEnableBackground.js +++ b/plugins/cleanupEnableBackground.js @@ -1,3 +1,5 @@ +'use strict'; + var regEnableBackground = /^new\s0\s0\s(\d+)\s(\d+)$/, elems = ['svg', 'mask', 'pattern']; diff --git a/plugins/cleanupSVGElem.js b/plugins/cleanupSVGElem.js index ff51b1c3..677f3b3a 100644 --- a/plugins/cleanupSVGElem.js +++ b/plugins/cleanupSVGElem.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove some useless svg element attributes. * diff --git a/plugins/collapseGroups.js b/plugins/collapseGroups.js index 429c93de..a32a2d83 100644 --- a/plugins/collapseGroups.js +++ b/plugins/collapseGroups.js @@ -1,3 +1,5 @@ +'use strict'; + var flattenOneLevel = require('../lib/svgo/tools').flattenOneLevel; /* diff --git a/plugins/convertColors.js b/plugins/convertColors.js index 955a1dfb..bba7f4ee 100644 --- a/plugins/convertColors.js +++ b/plugins/convertColors.js @@ -1,3 +1,5 @@ +'use strict'; + var collections = require('./_collections'), regRGB = /^rgb\((\d+%?),\s*(\d+%?),\s*(\d+%?)\)$/, regHEX = /^\#(([a-fA-F0-9])\2){3}$/; diff --git a/plugins/convertPathData.js b/plugins/convertPathData.js index 861115c1..a08530c8 100644 --- a/plugins/convertPathData.js +++ b/plugins/convertPathData.js @@ -1,3 +1,5 @@ +'use strict'; + var cleanupOutData = require('../lib/svgo/tools').cleanupOutData, regPathInstructions = /([MmLlHhVvCcSsQqTtAaZz])\s*/, regPathData = /(?=-)|[\s,]+/, diff --git a/plugins/convertStyleToAttrs.js b/plugins/convertStyleToAttrs.js index 4cb8fcef..d634bbdd 100644 --- a/plugins/convertStyleToAttrs.js +++ b/plugins/convertStyleToAttrs.js @@ -1,3 +1,5 @@ +'use strict'; + var extend = require('../lib/svgo/tools').extend, stylingProps = require('./_collections').stylingProps, regCleanupStyle = /(:|;)\s+/g; diff --git a/plugins/convertTransform.js b/plugins/convertTransform.js index c9773f1c..5530dc8b 100644 --- a/plugins/convertTransform.js +++ b/plugins/convertTransform.js @@ -1,3 +1,5 @@ +'use strict'; + var cleanupOutData = require('../lib/svgo/tools').cleanupOutData, regTransformTypes = /matrix|translate|scale|rotate|skewX|skewY/, regTransformSplit = /(matrix|translate|scale|rotate|skewX|skewY)\s*\((.+?)\)[\s,]*/, diff --git a/plugins/moveElemsAttrsToGroup.js b/plugins/moveElemsAttrsToGroup.js index e521f43b..9fda50c4 100644 --- a/plugins/moveElemsAttrsToGroup.js +++ b/plugins/moveElemsAttrsToGroup.js @@ -1,3 +1,5 @@ +'use strict'; + var inheritableAttrs = require('./_collections').inheritableAttrs; /** diff --git a/plugins/removeComments.js b/plugins/removeComments.js index 86912ab5..5bc2699f 100644 --- a/plugins/removeComments.js +++ b/plugins/removeComments.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove comments. * diff --git a/plugins/removeDefaultPx.js b/plugins/removeDefaultPx.js index 76484b08..489172a2 100644 --- a/plugins/removeDefaultPx.js +++ b/plugins/removeDefaultPx.js @@ -1,3 +1,5 @@ +'use strict'; + var regValPx = /^(-?(?:[0-9]+|[0-9]*\.[0-9]+))px$/; /** diff --git a/plugins/removeDoctype.js b/plugins/removeDoctype.js index c26e4feb..a3c21816 100644 --- a/plugins/removeDoctype.js +++ b/plugins/removeDoctype.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove DOCTYPE declaration. * diff --git a/plugins/removeEditorsNSData.js b/plugins/removeEditorsNSData.js index 3c0e3db7..7e2ad4cd 100644 --- a/plugins/removeEditorsNSData.js +++ b/plugins/removeEditorsNSData.js @@ -1,3 +1,5 @@ +'use strict'; + var editorNamespaces = require('./_collections').editorNamespaces, prefixes = []; diff --git a/plugins/removeEmptyAttrs.js b/plugins/removeEmptyAttrs.js index 56d18c57..519762fd 100644 --- a/plugins/removeEmptyAttrs.js +++ b/plugins/removeEmptyAttrs.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove attributes with empty values. * diff --git a/plugins/removeEmptyContainers.js b/plugins/removeEmptyContainers.js index af86b644..ddf1c791 100644 --- a/plugins/removeEmptyContainers.js +++ b/plugins/removeEmptyContainers.js @@ -1,3 +1,5 @@ +'use strict'; + var container = require('./_collections').elemsGroups.container; /** diff --git a/plugins/removeEmptyText.js b/plugins/removeEmptyText.js index a05de73b..9439332e 100644 --- a/plugins/removeEmptyText.js +++ b/plugins/removeEmptyText.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove empty Text elements. * diff --git a/plugins/removeHiddenElems.js b/plugins/removeHiddenElems.js index 4ce0acb9..1ba4d730 100644 --- a/plugins/removeHiddenElems.js +++ b/plugins/removeHiddenElems.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove hidden elements with disabled rendering: * - display="none" diff --git a/plugins/removeMetadata.js b/plugins/removeMetadata.js index 18365e9b..28f3d04b 100644 --- a/plugins/removeMetadata.js +++ b/plugins/removeMetadata.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove . * diff --git a/plugins/removeUnknownsAndDefaults.js b/plugins/removeUnknownsAndDefaults.js index 9d45c40b..b0998b09 100644 --- a/plugins/removeUnknownsAndDefaults.js +++ b/plugins/removeUnknownsAndDefaults.js @@ -1,3 +1,5 @@ +'use strict'; + var flattenOneLevel = require('../lib/svgo/tools').flattenOneLevel, elems = require('./_collections').elems; diff --git a/plugins/removeUnusedNS.js b/plugins/removeUnusedNS.js index 075a2d74..72306d3a 100644 --- a/plugins/removeUnusedNS.js +++ b/plugins/removeUnusedNS.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove unused namespaces declaration. * diff --git a/plugins/removeViewBox.js b/plugins/removeViewBox.js index d6cae64c..99a3c285 100644 --- a/plugins/removeViewBox.js +++ b/plugins/removeViewBox.js @@ -1,3 +1,5 @@ +'use strict'; + var regViewBox = /^0\s0\s(\d+)\s(\d+)$/, viewBoxElems = ['svg', 'pattern']; diff --git a/plugins/removeXMLProcInst.js b/plugins/removeXMLProcInst.js index ad0d8a8f..83b867ae 100644 --- a/plugins/removeXMLProcInst.js +++ b/plugins/removeXMLProcInst.js @@ -1,3 +1,5 @@ +'use strict'; + /** * Remove XML Processing Instruction. * diff --git a/test/config/_index.js b/test/config/_index.js index a93b5a7c..cc2f857d 100644 --- a/test/config/_index.js +++ b/test/config/_index.js @@ -1,3 +1,5 @@ +'use strict'; + var cover = process.argv[3] === 'mocha-istanbul', config = require(cover ? '../../lib-cov/svgo/config' : '../../lib/svgo/config'); diff --git a/test/plugins/_index.js b/test/plugins/_index.js index 6d09fc7c..c9366e4e 100644 --- a/test/plugins/_index.js +++ b/test/plugins/_index.js @@ -1,3 +1,5 @@ +'use strict'; + var INHERIT = require('inherit'), QFS = require('q-fs'), FS = require('fs'), diff --git a/test/svg2js/_index.js b/test/svg2js/_index.js index 0154ac2e..a6771b37 100644 --- a/test/svg2js/_index.js +++ b/test/svg2js/_index.js @@ -1,3 +1,5 @@ +'use strict'; + var cover = process.argv[3] === 'mocha-istanbul', svg2js = require(cover ? '../../lib-cov/svgo/svg2js' : '../../lib/svgo/svg2js');