From a3c0ffa5d696c7efe0adf6b08dc025a75e15875c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Tue, 30 Jan 2024 12:20:34 -0800 Subject: [PATCH] [Refactor] remove `object.fromentries` node 12+ has a working version --- __mocks__/genInteractives.js | 3 ++- __tests__/__util__/ruleOptionsMapperFactory.js | 4 ++-- package.json | 1 - src/util/getSuggestion.js | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/__mocks__/genInteractives.js b/__mocks__/genInteractives.js index 5d941432c..e6e4a3767 100644 --- a/__mocks__/genInteractives.js +++ b/__mocks__/genInteractives.js @@ -3,7 +3,6 @@ */ import { dom, roles } from 'aria-query'; -import fromEntries from 'object.fromentries'; import JSXAttributeMock from './JSXAttributeMock'; import JSXElementMock from './JSXElementMock'; @@ -11,6 +10,8 @@ import JSXElementMock from './JSXElementMock'; import type { JSXAttributeMockType } from './JSXAttributeMock'; import type { JSXElementMockType } from './JSXElementMock'; +const { fromEntries } = Object; + const domElements = [...dom.keys()]; const roleNames = [...roles.keys()]; diff --git a/__tests__/__util__/ruleOptionsMapperFactory.js b/__tests__/__util__/ruleOptionsMapperFactory.js index 5e223d94f..0bdd26069 100644 --- a/__tests__/__util__/ruleOptionsMapperFactory.js +++ b/__tests__/__util__/ruleOptionsMapperFactory.js @@ -2,9 +2,9 @@ * @flow */ -import entries from 'object.entries'; import flatMap from 'array.prototype.flatmap'; -import fromEntries from 'object.fromentries'; + +const { fromEntries, entries } = Object; type ESLintTestRunnerTestCase = { code: string, diff --git a/package.json b/package.json index 06050f5e5..19590a1c7 100644 --- a/package.json +++ b/package.json @@ -86,7 +86,6 @@ "jsx-ast-utils": "^3.3.5", "language-tags": "^1.0.9", "minimatch": "^3.1.2", - "object.fromentries": "^2.0.8", "safe-regex-test": "^1.0.3" }, "peerDependencies": { diff --git a/src/util/getSuggestion.js b/src/util/getSuggestion.js index 2dd8d3c5e..b7ce6b3f1 100644 --- a/src/util/getSuggestion.js +++ b/src/util/getSuggestion.js @@ -1,5 +1,6 @@ import editDistance from 'damerau-levenshtein'; -import fromEntries from 'object.fromentries'; + +const { fromEntries } = Object; // Minimum edit distance to be considered a good suggestion. const THRESHOLD = 2;