diff --git a/package.json b/package.json index 4b3acc0a..cef295c6 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "homepage": "https://github.com/babel/babel-eslint", "devDependencies": { "babel-eslint": "^7.0.0", + "dedent": "^0.7.0", "eslint": "^3.18.0", "eslint-config-babel": "^6.0.0", "eslint-plugin-flowtype": "^2.30.3", diff --git a/test/babel-eslint.js b/test/babel-eslint.js index 41586c09..540170df 100644 --- a/test/babel-eslint.js +++ b/test/babel-eslint.js @@ -2,7 +2,7 @@ var assert = require("assert"); var babelEslint = require(".."); var espree = require("espree"); var util = require("util"); -var unpad = require("../utils/unpad"); +var unpad = require("dedent"); // Checks if the source ast implements the target ast. Ignores extra keys on source ast function assertImplementsAST(target, source, path) { diff --git a/test/non-regression.js b/test/non-regression.js index 711aa25e..015b0fd3 100644 --- a/test/non-regression.js +++ b/test/non-regression.js @@ -1,7 +1,7 @@ /*eslint-env mocha*/ "use strict"; var eslint = require("eslint"); -var unpad = require("../utils/unpad"); +var unpad = require("dedent"); function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { var config = { diff --git a/utils/unpad.js b/utils/unpad.js deleted file mode 100644 index bf91100e..00000000 --- a/utils/unpad.js +++ /dev/null @@ -1,14 +0,0 @@ -// Remove padding from a string. -function unpad(str) { - const lines = str.split("\n"); - const m = lines[1] && lines[1].match(/^\s+/); - if (!m) { - return str; - } - const spaces = m[0].length; - return lines.map( - (line) => line.slice(spaces) - ).join("\n").trim(); -} - -module.exports = unpad; diff --git a/yarn.lock b/yarn.lock index afb72f46..c81f8409 100644 --- a/yarn.lock +++ b/yarn.lock @@ -222,6 +222,10 @@ debug@^2.1.1, debug@^2.2.0: dependencies: ms "0.7.2" +dedent@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" + deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"