From 44a81c6151c58a3f4c1f6bb2927b0996f81c2daa Mon Sep 17 00:00:00 2001 From: Lars Kappert Date: Fri, 5 Apr 2024 09:24:39 +0200 Subject: [PATCH] chore: upgrade knip (#18272) * chore: upgrade knip * chore: refactor default vs named exports/imports --- lib/source-code/token-store/backward-token-cursor.js | 6 +++--- lib/source-code/token-store/cursors.js | 6 ++++-- lib/source-code/token-store/forward-token-comment-cursor.js | 6 +++--- lib/source-code/token-store/forward-token-cursor.js | 6 +++--- package.json | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/source-code/token-store/backward-token-cursor.js b/lib/source-code/token-store/backward-token-cursor.js index 454a2449701..d3469c99b14 100644 --- a/lib/source-code/token-store/backward-token-cursor.js +++ b/lib/source-code/token-store/backward-token-cursor.js @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ const Cursor = require("./cursor"); -const utils = require("./utils"); +const { getLastIndex, getFirstIndex } = require("./utils"); //------------------------------------------------------------------------------ // Exports @@ -31,8 +31,8 @@ module.exports = class BackwardTokenCursor extends Cursor { constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; - this.index = utils.getLastIndex(tokens, indexMap, endLoc); - this.indexEnd = utils.getFirstIndex(tokens, indexMap, startLoc); + this.index = getLastIndex(tokens, indexMap, endLoc); + this.indexEnd = getFirstIndex(tokens, indexMap, startLoc); } /** @inheritdoc */ diff --git a/lib/source-code/token-store/cursors.js b/lib/source-code/token-store/cursors.js index 30c72b69b8f..f2676f13da6 100644 --- a/lib/source-code/token-store/cursors.js +++ b/lib/source-code/token-store/cursors.js @@ -86,5 +86,7 @@ class CursorFactory { // Exports //------------------------------------------------------------------------------ -exports.forward = new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor); -exports.backward = new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor); +module.exports = { + forward: new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor), + backward: new CursorFactory(BackwardTokenCursor, BackwardTokenCommentCursor) +}; diff --git a/lib/source-code/token-store/forward-token-comment-cursor.js b/lib/source-code/token-store/forward-token-comment-cursor.js index 50c7a394f38..8aa46c27b74 100644 --- a/lib/source-code/token-store/forward-token-comment-cursor.js +++ b/lib/source-code/token-store/forward-token-comment-cursor.js @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ const Cursor = require("./cursor"); -const utils = require("./utils"); +const { getFirstIndex, search } = require("./utils"); //------------------------------------------------------------------------------ // Exports @@ -32,8 +32,8 @@ module.exports = class ForwardTokenCommentCursor extends Cursor { super(); this.tokens = tokens; this.comments = comments; - this.tokenIndex = utils.getFirstIndex(tokens, indexMap, startLoc); - this.commentIndex = utils.search(comments, startLoc); + this.tokenIndex = getFirstIndex(tokens, indexMap, startLoc); + this.commentIndex = search(comments, startLoc); this.border = endLoc; } diff --git a/lib/source-code/token-store/forward-token-cursor.js b/lib/source-code/token-store/forward-token-cursor.js index e8c18609621..9305cbef683 100644 --- a/lib/source-code/token-store/forward-token-cursor.js +++ b/lib/source-code/token-store/forward-token-cursor.js @@ -9,7 +9,7 @@ //------------------------------------------------------------------------------ const Cursor = require("./cursor"); -const utils = require("./utils"); +const { getFirstIndex, getLastIndex } = require("./utils"); //------------------------------------------------------------------------------ // Exports @@ -31,8 +31,8 @@ module.exports = class ForwardTokenCursor extends Cursor { constructor(tokens, comments, indexMap, startLoc, endLoc) { super(); this.tokens = tokens; - this.index = utils.getFirstIndex(tokens, indexMap, startLoc); - this.indexEnd = utils.getLastIndex(tokens, indexMap, endLoc); + this.index = getFirstIndex(tokens, indexMap, startLoc); + this.indexEnd = getLastIndex(tokens, indexMap, endLoc); } /** @inheritdoc */ diff --git a/package.json b/package.json index f5e600a1f71..a0c03a35a8f 100644 --- a/package.json +++ b/package.json @@ -135,7 +135,7 @@ "got": "^11.8.3", "gray-matter": "^4.0.3", "js-yaml": "^4.1.0", - "knip": "^5.0.1", + "knip": "^5.8.0", "lint-staged": "^11.0.0", "load-perf": "^0.2.0", "markdown-it": "^12.2.0",