From eda01129ee18e5851449eef6951c1acb3adffcc2 Mon Sep 17 00:00:00 2001 From: Patrick Mowrer Date: Tue, 10 Nov 2015 17:28:00 -0500 Subject: [PATCH 1/3] Replace jshint with eslint. --- .eslintignore | 1 + .eslintrc | 18 ++++++++++++++++++ .jshintrc | 9 --------- test/.jshintrc | 4 ---- test/index.js | 1 + 5 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc delete mode 100644 .jshintrc delete mode 100644 test/.jshintrc diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +dist/ diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..2fae984 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,18 @@ +rules: + indent: + - 2 + - 2 + quotes: + - 2 + - single + linebreak-style: + - 2 + - unix + semi: + - 2 + - always +env: + es6: true + node: true +extends: 'eslint:recommended' +parser: 'babel-eslint' diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index 6c57ade..0000000 --- a/.jshintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "quotmark": "single", - "esnext": true, - "undef": true, - "unused": true, - "devel": true, - "maxlen": 120, - "node": true -} diff --git a/test/.jshintrc b/test/.jshintrc deleted file mode 100644 index e26f0d4..0000000 --- a/test/.jshintrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../.jshintrc", - "mocha": true -} diff --git a/test/index.js b/test/index.js index 7bec68c..b46b110 100644 --- a/test/index.js +++ b/test/index.js @@ -1,3 +1,4 @@ +/* eslint-env mocha */ import jsonImporter from '../src/index'; import sass from 'node-sass'; import {expect} from 'chai'; From 36031f58be10e7769601cdc0a26fb18b910d7cc2 Mon Sep 17 00:00:00 2001 From: Patrick Mowrer Date: Mon, 16 Nov 2015 12:48:20 -0500 Subject: [PATCH 2/3] Revert "Add failing test for strings w/ spaces/commas" This reverts commit b47edaef4e8ba77e0777298cb039c6ecab3d5706. --- test/fixtures/strings/content.scss | 5 ----- test/fixtures/strings/variables.json | 3 +-- test/index.js | 23 ++++++----------------- 3 files changed, 7 insertions(+), 24 deletions(-) delete mode 100644 test/fixtures/strings/content.scss diff --git a/test/fixtures/strings/content.scss b/test/fixtures/strings/content.scss deleted file mode 100644 index 261c2b3..0000000 --- a/test/fixtures/strings/content.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import 'variables.json'; - -p::after { - content: $alt; -} diff --git a/test/fixtures/strings/variables.json b/test/fixtures/strings/variables.json index 5bced8c..e5407e6 100644 --- a/test/fixtures/strings/variables.json +++ b/test/fixtures/strings/variables.json @@ -1,5 +1,4 @@ { "color-red": "#c33", - "color-blue": "#33c", - "alt": "Ashness Pier, Derwentwater, Lake District, Cumbria, UK." + "color-blue": "#33c" } diff --git a/test/index.js b/test/index.js index b46b110..fa3c13b 100644 --- a/test/index.js +++ b/test/index.js @@ -4,8 +4,7 @@ import sass from 'node-sass'; import {expect} from 'chai'; import {resolve} from 'path'; -const EXPECTATION1 = 'body {\n color: #c33; }\n'; -const EXPECTATION2 = 'p::after {\n content: "Ashness Pier, Derwentwater, Lake District, Cumbria, UK."; }\n'; +const EXPECTATION = 'body {\n color: #c33; }\n'; describe('Import type test', function() { @@ -15,17 +14,7 @@ describe('Import type test', function() { importer: jsonImporter }); - expect(result.css.toString()).to.eql(EXPECTATION1); - }); - - // Added as failing test for: https://github.com/Updater/node-sass-json-importer/pull/5 - it('imports strings with spaces and/or commas', function() { - let result = sass.renderSync({ - file: './test/fixtures/strings/content.scss', - importer: jsonImporter - }); - - expect(result.css.toString()).to.eql(EXPECTATION2); + expect(result.css.toString()).to.eql(EXPECTATION); }); it('imports lists', function() { @@ -34,7 +23,7 @@ describe('Import type test', function() { importer: jsonImporter }); - expect(result.css.toString()).to.eql(EXPECTATION1); + expect(result.css.toString()).to.eql(EXPECTATION); }); it('imports maps', function() { @@ -43,7 +32,7 @@ describe('Import type test', function() { importer: jsonImporter }); - expect(result.css.toString()).to.eql(EXPECTATION1); + expect(result.css.toString()).to.eql(EXPECTATION); }); it('finds imports via includePaths', function() { @@ -53,7 +42,7 @@ describe('Import type test', function() { importer: jsonImporter }); - expect(result.css.toString()).to.eql(EXPECTATION1); + expect(result.css.toString()).to.eql(EXPECTATION); }); it('finds imports via multiple includePaths', function() { @@ -63,7 +52,7 @@ describe('Import type test', function() { importer: jsonImporter }); - expect(result.css.toString()).to.eql(EXPECTATION1); + expect(result.css.toString()).to.eql(EXPECTATION); }); it(`throws when an import doesn't exist`, function() { From f203f2244d157ccce88194d31740d3b54e39128f Mon Sep 17 00:00:00 2001 From: Patrick Mowrer Date: Mon, 16 Nov 2015 12:49:28 -0500 Subject: [PATCH 3/3] Revert "Strings with Spaces or Commas" This reverts commit 78f7e82510653188f70fa2243a433c9293924134. --- src/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/index.js b/src/index.js index 4b84a45..026e150 100644 --- a/src/index.js +++ b/src/index.js @@ -38,8 +38,6 @@ function parseValue(value) { return parseList(value); } else if (_.isPlainObject(value)) { return parseMap(value); - } else if (_.isString(value) && value.match(/[\s,]/)) { - return `"${value}"`; } else { return value; }