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/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; } 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/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 7bec68c..fa3c13b 100644 --- a/test/index.js +++ b/test/index.js @@ -1,10 +1,10 @@ +/* eslint-env mocha */ import jsonImporter from '../src/index'; 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() { @@ -14,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() { @@ -33,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() { @@ -42,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() { @@ -52,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() { @@ -62,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() {