From 9aa1fdca62733543d2c26a755ad14dbc02926f27 Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Sun, 1 Mar 2020 18:33:32 -0500 Subject: [PATCH] Chore: Use ES2018 object spread syntax (#141) This syntax first shipped in Node.js v8.6.0 and removes a dependency on `object-assign`. --- .eslintrc.js | 4 ++++ lib/processor.js | 8 ++++---- package.json | 1 - 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1f34f7c8..c94813be 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,10 @@ if (!fs.existsSync(SYMLINK_LOCATION)) { module.exports = { "root": true, + "parserOptions": { + "ecmaVersion": 2018 + }, + "plugins": [ PACKAGE_NAME ], diff --git a/lib/processor.js b/lib/processor.js index 594efc80..09eb4aaa 100644 --- a/lib/processor.js +++ b/lib/processor.js @@ -5,7 +5,6 @@ "use strict"; -const assign = require("object-assign"); const unified = require("unified"); const remarkParse = require("remark-parse"); @@ -244,11 +243,12 @@ function preprocess(text) { previousNode = parent.children[index]; } - blocks.push(assign({}, node, { + blocks.push({ + ...node, baseIndentText: getIndentText(text, node), comments, rangeMap: getBlockRangeMap(text, node, comments) - })); + }); } } }); @@ -312,7 +312,7 @@ function adjustBlock(block) { }; } - return assign({}, message, out, adjustedFix); + return { ...message, ...out, ...adjustedFix }; }; } diff --git a/package.json b/package.json index 81ce405b..010cf6e2 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "nyc": "^14.1.1" }, "dependencies": { - "object-assign": "^4.0.1", "remark-parse": "^5.0.0", "unified": "^6.1.2" },