diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js index af1ae9abe..ffc6f8cdc 100644 --- a/src/cli/expand-patterns.js +++ b/src/cli/expand-patterns.js @@ -2,7 +2,7 @@ import path from "node:path"; import { fastGlob } from "./prettier-internal.js"; import { lstatSafe, normalizeToPosix } from "./utils.js"; -/** @typedef {import('./context').Context} Context */ +/** @import {Context} from './context.js' */ /** * @param {Context} context diff --git a/src/cli/format-results-cache.js b/src/cli/format-results-cache.js index 9dd276989..783285e04 100644 --- a/src/cli/format-results-cache.js +++ b/src/cli/format-results-cache.js @@ -25,10 +25,10 @@ function getHashOfOptions(options) { } /** + * @import {FileDescriptor} from "file-entry-cache" * @typedef {{ hashOfOptions?: string }} OurMeta - * @typedef {import("file-entry-cache").FileDescriptor} FileDescriptor * - * @param {import("file-entry-cache").FileDescriptor} fileDescriptor + * @param {FileDescriptor} fileDescriptor * @returns {FileDescriptor["meta"] & OurMeta} */ function getMetadataFromFileDescriptor(fileDescriptor) { diff --git a/src/cli/utils.js b/src/cli/utils.js index 56f4bf93e..01de5ed48 100644 --- a/src/cli/utils.js +++ b/src/cli/utils.js @@ -50,10 +50,11 @@ function createHash(source) { return String(sdbm(source)); } +/** @import {Stats} from "fs" */ /** * Get stats of a given path. * @param {string} filePath The path to target file. - * @returns {Promise} The stats. + * @returns {Promise} The stats. */ async function statSafe(filePath) { try { @@ -69,7 +70,7 @@ async function statSafe(filePath) { /** * Get stats of a given path without following symbolic links. * @param {string} filePath The path to target file. - * @returns {Promise} The stats. + * @returns {Promise} The stats. */ async function lstatSafe(filePath) { try { diff --git a/src/language-css/print/comma-separated-value-group.js b/src/language-css/print/comma-separated-value-group.js index c52ad4279..f13929014 100644 --- a/src/language-css/print/comma-separated-value-group.js +++ b/src/language-css/print/comma-separated-value-group.js @@ -39,7 +39,7 @@ import { } from "../utils/index.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ function printCommaSeparatedValueGroup(path, options, print) { diff --git a/src/language-handlebars/printer-glimmer.js b/src/language-handlebars/printer-glimmer.js index a5cd01b7f..008a1c8e3 100644 --- a/src/language-handlebars/printer-glimmer.js +++ b/src/language-handlebars/printer-glimmer.js @@ -20,7 +20,7 @@ import { locEnd, locStart } from "./loc.js"; import { hasPrettierIgnore, isVoidElement, isWhitespaceNode } from "./utils.js"; /** - * @typedef {import("../document/builders.js").Doc} Doc + * @import {Doc} from "../document/builders.js" */ const NEWLINES_TO_PRESERVE_MAX = 2; @@ -686,7 +686,7 @@ function generateHardlines(number = 0) { /* StringLiteral print helpers */ -/** @typedef {import("../utils/get-preferred-quote.js").Quote} Quote */ +/** @import {Quote} from "../utils/get-preferred-quote.js" */ /** * Prints a string literal with the correct surrounding quotes based on diff --git a/src/language-html/embed/attribute.js b/src/language-html/embed/attribute.js index 75c771be4..0adbe272b 100644 --- a/src/language-html/embed/attribute.js +++ b/src/language-html/embed/attribute.js @@ -7,8 +7,8 @@ import { printStyleAttribute } from "./style.js"; import printVueAttribute from "./vue-attributes.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js" */ function printAttribute(path, options) { diff --git a/src/language-html/embed/print-vue-script-generic-attribute-value.js b/src/language-html/embed/print-vue-script-generic-attribute-value.js index 8b6115abe..bbaf57e40 100644 --- a/src/language-html/embed/print-vue-script-generic-attribute-value.js +++ b/src/language-html/embed/print-vue-script-generic-attribute-value.js @@ -2,7 +2,7 @@ import { getUnescapedAttributeValue } from "../utils/index.js"; import { formatAttributeValue, shouldHugJsExpression } from "./utils.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ /** diff --git a/src/language-html/embed/srcset.js b/src/language-html/embed/srcset.js index 36f0c9354..f818f7823 100644 --- a/src/language-html/embed/srcset.js +++ b/src/language-html/embed/srcset.js @@ -3,7 +3,7 @@ import { ifBreak, join, line } from "../../document/builders.js"; import { getUnescapedAttributeValue } from "../utils/index.js"; import { printExpand } from "./utils.js"; -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ function printSrcset(path /*, options*/) { if ( diff --git a/src/language-html/embed/utils.js b/src/language-html/embed/utils.js index e4b70e39f..c4b930c7e 100644 --- a/src/language-html/embed/utils.js +++ b/src/language-html/embed/utils.js @@ -1,7 +1,7 @@ import { group, indent, softline } from "../../document/builders.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ function printExpand(doc, canHaveTrailingWhitespace = true) { diff --git a/src/language-html/embed/vue-attributes.js b/src/language-html/embed/vue-attributes.js index 919557177..6867f1e90 100644 --- a/src/language-html/embed/vue-attributes.js +++ b/src/language-html/embed/vue-attributes.js @@ -14,8 +14,8 @@ import { import { printVueVForDirective } from "./vue-v-for-directive.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js" */ function printVueAttribute(path, options) { diff --git a/src/language-html/embed/vue-bindings.js b/src/language-html/embed/vue-bindings.js index 9d5dcd33c..fadba6f0c 100644 --- a/src/language-html/embed/vue-bindings.js +++ b/src/language-html/embed/vue-bindings.js @@ -1,7 +1,7 @@ import { formatAttributeValue } from "./utils.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ /** diff --git a/src/language-html/embed/vue-v-for-directive.js b/src/language-html/embed/vue-v-for-directive.js index b7fa52d11..5ed2f6269 100644 --- a/src/language-html/embed/vue-v-for-directive.js +++ b/src/language-html/embed/vue-v-for-directive.js @@ -4,7 +4,7 @@ import isVueSfcWithTypescriptScript from "../utils/is-vue-sfc-with-typescript-sc import { formatAttributeValue } from "./utils.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ /** diff --git a/src/language-html/parser-html.js b/src/language-html/parser-html.js index 6a90e8424..4e8977ff4 100644 --- a/src/language-html/parser-html.js +++ b/src/language-html/parser-html.js @@ -21,12 +21,13 @@ import HTML_TAGS from "./utils/html-tag-names.evaluate.js"; import isUnknownNamespace from "./utils/is-unknown-namespace.js"; /** - * @typedef {import('angular-html-parser')} AngularHtmlParser - * @typedef {import('angular-html-parser/lib/compiler/src/ml_parser/ast.js').Node} AstNode - * @typedef {import('angular-html-parser/lib/compiler/src/ml_parser/ast.js').Attribute} Attribute - * @typedef {import('angular-html-parser/lib/compiler/src/ml_parser/ast.js').Element} Element - * @typedef {import('angular-html-parser/lib/compiler/src/ml_parser/parser.js').ParseTreeResult} ParserTreeResult - * @typedef {import('angular-html-parser').ParseOptions & { + * @import AngularHtmlParser, {ParseOptions as AngularHtmlParserParseOptions} from "angular-html-parser" + * @import {Node as AstNode, Attribute, Element} from "angular-html-parser/lib/compiler/src/ml_parser/ast.js" + * @import {ParseTreeResult} from "angular-html-parser/lib/compiler/src/ml_parser/parser.js" + */ + +/** + * @typedef {AngularHtmlParserParseOptions & { * name: 'html' | 'angular' | 'vue' | 'lwc'; * normalizeTagName?: boolean; * normalizeAttributeName?: boolean; @@ -135,7 +136,7 @@ function ngHtmlParser(input, parseOptions, options) { return ngHtmlParser(input, HTML_PARSE_OPTIONS, options); } - /** @type {ParserTreeResult | undefined} */ + /** @type {ParseTreeResult | undefined} */ let secondParseResult; const getHtmlParseResult = () => (secondParseResult ??= parseHtml(input, { diff --git a/src/language-html/print/tag.js b/src/language-html/print/tag.js index 2547acd53..7399320c1 100644 --- a/src/language-html/print/tag.js +++ b/src/language-html/print/tag.js @@ -1,5 +1,5 @@ /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ import assert from "node:assert"; diff --git a/src/language-html/printer-html.js b/src/language-html/printer-html.js index c86fefb86..0fe924ad0 100644 --- a/src/language-html/printer-html.js +++ b/src/language-html/printer-html.js @@ -1,5 +1,5 @@ /** - * @typedef {import("../document/builders.js").Doc} Doc + * @import {Doc} from "../document/builders.js" */ import { fill, group, hardline, indent, line } from "../document/builders.js"; diff --git a/src/language-html/utils/index.js b/src/language-html/utils/index.js index 679124397..95e690eda 100644 --- a/src/language-html/utils/index.js +++ b/src/language-html/utils/index.js @@ -1,5 +1,5 @@ /** - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import AstPath from "../../common/ast-path.js" */ import { hardline, join, line } from "../../document/builders.js"; diff --git a/src/language-js/comments/handle-comments.js b/src/language-js/comments/handle-comments.js index ec6bfe4b9..80d2e320a 100644 --- a/src/language-js/comments/handle-comments.js +++ b/src/language-js/comments/handle-comments.js @@ -25,18 +25,17 @@ import { import isBlockComment from "../utils/is-block-comment.js"; import isTypeCastComment from "../utils/is-type-cast-comment.js"; +/** @import * as Estree from "../types/estree.js" */ + /** - * @typedef {import("../types/estree.js").Node} Node - * @typedef {import("../types/estree.js").Comment} Comment - * * @typedef {Object} CommentContext - * @property {Comment} comment - * @property {Node} precedingNode - * @property {Node} enclosingNode - * @property {Node} followingNode + * @property {Estree.Comment} comment + * @property {Estree.Node} precedingNode + * @property {Estree.Node} enclosingNode + * @property {Estree.Node} followingNode * @property {string} text * @property {any} options - * @property {Node} ast + * @property {Estree.Node} ast * @property {boolean} isLastComment */ @@ -116,7 +115,7 @@ function handleRemainingComment(context) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {void} */ function addBlockStatementFirstComment(node, comment) { @@ -132,7 +131,7 @@ function addBlockStatementFirstComment(node, comment) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {void} */ function addBlockOrNotComment(node, comment) { diff --git a/src/language-js/comments/printer-methods.js b/src/language-js/comments/printer-methods.js index b76e6ca70..995fc3a8b 100644 --- a/src/language-js/comments/printer-methods.js +++ b/src/language-js/comments/printer-methods.js @@ -7,8 +7,8 @@ import { } from "../utils/index.js"; /** - * @typedef {import("../types/estree.js").Node} Node - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Node} from "../types/estree.js" + * @import AstPath from "../../common/ast-path.js" */ const nodeTypesCanNotAttachComment = new Set([ diff --git a/src/language-js/loc.js b/src/language-js/loc.js index 96323be8a..1aaf63a9f 100644 --- a/src/language-js/loc.js +++ b/src/language-js/loc.js @@ -1,5 +1,5 @@ /** - * @typedef {import("./types/estree.js").Node} Node + * @import {Node} from "./types/estree.js" */ function locStart(node) { diff --git a/src/language-js/needs-parens.js b/src/language-js/needs-parens.js index 553630bc9..5e001e3f7 100644 --- a/src/language-js/needs-parens.js +++ b/src/language-js/needs-parens.js @@ -19,7 +19,7 @@ import { } from "./utils/index.js"; /** - * @typedef {import("../common/ast-path.js").default} AstPath + * @import AstPath from "../common/ast-path.js" */ /** diff --git a/src/language-js/parse/acorn.js b/src/language-js/parse/acorn.js index 2007397bb..68f260d37 100644 --- a/src/language-js/parse/acorn.js +++ b/src/language-js/parse/acorn.js @@ -6,7 +6,9 @@ import postprocess from "./postprocess/index.js"; import createParser from "./utils/create-parser.js"; import getSourceType from "./utils/get-source-type.js"; -/** @type {import("acorn").Options} */ +/** @import {Options} from "acorn" */ + +/** @type {Options} */ const parseOptions = { ecmaVersion: "latest", // sourceType: "module", diff --git a/src/language-js/parse/babel.js b/src/language-js/parse/babel.js index fbf871dd0..b291a9d2d 100644 --- a/src/language-js/parse/babel.js +++ b/src/language-js/parse/babel.js @@ -10,10 +10,10 @@ import wrapBabelExpression from "./utils/wrap-babel-expression.js"; const createBabelParser = (options) => createParser(createParse(options)); +/** @import {ParserOptions, ParserPlugin} from "@babel/parser" */ + /** - * @typedef {import("@babel/parser").parse | import("@babel/parser").parseExpression} Parse - * @typedef {import("@babel/parser").ParserOptions} ParserOptions - * @typedef {import("@babel/parser").ParserPlugin} ParserPlugin + * @typedef {typeof babelParse | typeof parseExpression} Parse */ /** @type {ParserOptions} */ diff --git a/src/language-js/parse/espree.js b/src/language-js/parse/espree.js index f854ca4ea..5464edb13 100644 --- a/src/language-js/parse/espree.js +++ b/src/language-js/parse/espree.js @@ -5,7 +5,9 @@ import postprocess from "./postprocess/index.js"; import createParser from "./utils/create-parser.js"; import getSourceType from "./utils/get-source-type.js"; -/** @type {import("espree").Options} */ +/** @import {Options} from "espree" */ + +/** @type {Options} */ const parseOptions = { ecmaVersion: "latest", range: true, diff --git a/src/language-js/parse/typescript.js b/src/language-js/parse/typescript.js index 51824c88a..9cbd54e3f 100644 --- a/src/language-js/parse/typescript.js +++ b/src/language-js/parse/typescript.js @@ -5,7 +5,9 @@ import postprocess from "./postprocess/index.js"; import createParser from "./utils/create-parser.js"; import replaceHashbang from "./utils/replace-hashbang.js"; -/** @type {import("@typescript-eslint/typescript-estree").TSESTreeOptions} */ +/** @import {TSESTreeOptions} from "@typescript-eslint/typescript-estree" */ + +/** @type {TSESTreeOptions} */ const baseParseOptions = { // `jest@<=26.4.2` rely on `loc` // https://github.com/facebook/jest/issues/10444 diff --git a/src/language-js/print/angular.js b/src/language-js/print/angular.js index 310bf68b2..cc730d054 100644 --- a/src/language-js/print/angular.js +++ b/src/language-js/print/angular.js @@ -8,7 +8,7 @@ import { } from "../utils/index.js"; import { printBinaryishExpression } from "./binaryish.js"; -/** @typedef {import("../../common/ast-path.js").default} AstPath */ +/** @import AstPath from "../../common/ast-path.js" */ function printAngular(path, options, print) { const { node } = path; diff --git a/src/language-js/print/array.js b/src/language-js/print/array.js index e746ac056..dc2625423 100644 --- a/src/language-js/print/array.js +++ b/src/language-js/print/array.js @@ -25,7 +25,7 @@ import { import { printOptionalToken } from "./misc.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ function printEmptyArrayElements(path, options, openBracket, closeBracket) { const { node } = path; diff --git a/src/language-js/print/arrow-function.js b/src/language-js/print/arrow-function.js index 87805d9a6..61debb2f5 100644 --- a/src/language-js/print/arrow-function.js +++ b/src/language-js/print/arrow-function.js @@ -33,8 +33,8 @@ import { printReturnType, shouldPrintParamsWithoutParens } from "./function.js"; import { printFunctionParameters } from "./function-parameters.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ // In order to avoid confusion between diff --git a/src/language-js/print/assignment.js b/src/language-js/print/assignment.js index c52cb6187..431fef40c 100644 --- a/src/language-js/print/assignment.js +++ b/src/language-js/print/assignment.js @@ -26,7 +26,7 @@ import { shouldInlineLogicalExpression } from "./binaryish.js"; import { printCallExpression } from "./call-expression.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import AstPath from "../../common/ast-path.js" */ function printAssignment( diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js index b04ee3964..511a42c8b 100644 --- a/src/language-js/print/binaryish.js +++ b/src/language-js/print/binaryish.js @@ -24,7 +24,7 @@ import { shouldFlatten, } from "../utils/index.js"; -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ let uid = 0; function printBinaryishExpression(path, options, print) { diff --git a/src/language-js/print/block.js b/src/language-js/print/block.js index 3eca515b4..0eef858b7 100644 --- a/src/language-js/print/block.js +++ b/src/language-js/print/block.js @@ -8,7 +8,7 @@ import { } from "../utils/index.js"; import { printStatementSequence } from "./statement.js"; -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ /* - `Program` diff --git a/src/language-js/print/class.js b/src/language-js/print/class.js index cb50ad1c0..4f40f362a 100644 --- a/src/language-js/print/class.js +++ b/src/language-js/print/class.js @@ -34,7 +34,7 @@ import { printTypeAnnotationProperty } from "./type-annotation.js"; import { getTypeParametersGroupId } from "./type-parameters.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ const isClassProperty = createTypeCheckFunction([ diff --git a/src/language-js/print/component.js b/src/language-js/print/component.js index 93232f8ae..777de08f9 100644 --- a/src/language-js/print/component.js +++ b/src/language-js/print/component.js @@ -13,8 +13,8 @@ import { isNextLineEmpty, shouldPrintComma } from "../utils/index.js"; import { printDeclareToken } from "./misc.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ /* diff --git a/src/language-js/print/estree.js b/src/language-js/print/estree.js index 0843db855..fef5e227f 100644 --- a/src/language-js/print/estree.js +++ b/src/language-js/print/estree.js @@ -74,8 +74,8 @@ import { printTernary } from "./ternary.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ /** diff --git a/src/language-js/print/flow.js b/src/language-js/print/flow.js index a54823660..8fbe07ebf 100644 --- a/src/language-js/print/flow.js +++ b/src/language-js/print/flow.js @@ -1,4 +1,4 @@ -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ import assert from "node:assert"; import { replaceEndOfLine } from "../../document/utils.js"; diff --git a/src/language-js/print/function-parameters.js b/src/language-js/print/function-parameters.js index 420bac78a..a8e7773db 100644 --- a/src/language-js/print/function-parameters.js +++ b/src/language-js/print/function-parameters.js @@ -29,7 +29,7 @@ import { } from "../utils/index.js"; import { printFunctionTypeParameters } from "./misc.js"; -/** @typedef {import("../../common/ast-path.js").default} AstPath */ +/** @import AstPath from "../../common/ast-path.js" */ function printFunctionParameters( path, diff --git a/src/language-js/print/function.js b/src/language-js/print/function.js index 4fefddec3..fe3d72c0a 100644 --- a/src/language-js/print/function.js +++ b/src/language-js/print/function.js @@ -32,8 +32,8 @@ import { printPropertyKey } from "./property.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ const isMethodValue = ({ node, key, parent }) => diff --git a/src/language-js/print/hook.js b/src/language-js/print/hook.js index 1e4f55d82..9da7de100 100644 --- a/src/language-js/print/hook.js +++ b/src/language-js/print/hook.js @@ -7,8 +7,8 @@ import { import { printDeclareToken } from "./misc.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ /* diff --git a/src/language-js/print/index.js b/src/language-js/print/index.js index 70eb85077..1db75c1d1 100644 --- a/src/language-js/print/index.js +++ b/src/language-js/print/index.js @@ -14,8 +14,8 @@ import { shouldPrintLeadingSemicolon } from "./semicolon.js"; import { printTypescript } from "./typescript.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ function printWithoutParentheses(path, options, print, args) { diff --git a/src/language-js/print/interface.js b/src/language-js/print/interface.js index aff74ca4d..0e19cb3dc 100644 --- a/src/language-js/print/interface.js +++ b/src/language-js/print/interface.js @@ -5,7 +5,7 @@ import { printDeclareToken } from "./misc.js"; import { getTypeParametersGroupId } from "./type-parameters.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ /* diff --git a/src/language-js/print/jsx.js b/src/language-js/print/jsx.js index 870fb4fde..eaf544c76 100644 --- a/src/language-js/print/jsx.js +++ b/src/language-js/print/jsx.js @@ -48,10 +48,9 @@ const isEmptyStringOrAnyLine = (doc) => doc === "" || doc === line || doc === hardline || doc === softline; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../types/estree.js").Node} Node - * @typedef {import("../types/estree.js").JSXElement} JSXElement - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Node, JSXElement} from "../types/estree.js" + * @import {Doc} from "../../document/builders.js" */ // JSX expands children from the inside-out, instead of the outside-in. diff --git a/src/language-js/print/literal.js b/src/language-js/print/literal.js index 8758c65f7..0147d7e05 100644 --- a/src/language-js/print/literal.js +++ b/src/language-js/print/literal.js @@ -3,7 +3,7 @@ import printNumber from "../../utils/print-number.js"; import printString from "../../utils/print-string.js"; /** - * @typedef {import("../types/estree.js").Node} Node + * @import {Node} from "../types/estree.js" */ function printLiteral(path, options /*, print*/) { diff --git a/src/language-js/print/member-chain.js b/src/language-js/print/member-chain.js index ef3ba8910..01037a0f0 100644 --- a/src/language-js/print/member-chain.js +++ b/src/language-js/print/member-chain.js @@ -34,7 +34,7 @@ import { } from "./misc.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" * @typedef {{ node: any, printed: Doc, needsParens?: boolean, shouldInline?: boolean, hasTrailingEmptyLine?: boolean }} PrintedNode */ diff --git a/src/language-js/print/misc.js b/src/language-js/print/misc.js index 0ca691331..69d1cda52 100644 --- a/src/language-js/print/misc.js +++ b/src/language-js/print/misc.js @@ -3,8 +3,8 @@ import { isCallExpression, isMemberExpression } from "../utils/index.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ /** diff --git a/src/language-js/print/module.js b/src/language-js/print/module.js index d5495106e..83975ae16 100644 --- a/src/language-js/print/module.js +++ b/src/language-js/print/module.js @@ -25,7 +25,7 @@ import { printDecoratorsBeforeExport } from "./decorators.js"; import { printDeclareToken } from "./misc.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ function printImportDeclaration(path, options, print) { diff --git a/src/language-js/print/object.js b/src/language-js/print/object.js index 0121440c9..3fec95877 100644 --- a/src/language-js/print/object.js +++ b/src/language-js/print/object.js @@ -24,7 +24,7 @@ import { shouldHugTheOnlyFunctionParameter } from "./function-parameters.js"; import { printOptionalToken } from "./misc.js"; import { printTypeAnnotationProperty } from "./type-annotation.js"; -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ function printObject(path, options, print) { const semi = options.semi ? ";" : ""; diff --git a/src/language-js/print/statement.js b/src/language-js/print/statement.js index ac60002df..7c31b9aa9 100644 --- a/src/language-js/print/statement.js +++ b/src/language-js/print/statement.js @@ -2,8 +2,8 @@ import { hardline } from "../../document/builders.js"; import { isNextLineEmpty } from "../utils/index.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js")} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js") */ /* diff --git a/src/language-js/print/ternary-old.js b/src/language-js/print/ternary-old.js index c9f42388f..9fdafefb9 100644 --- a/src/language-js/print/ternary-old.js +++ b/src/language-js/print/ternary-old.js @@ -20,8 +20,8 @@ import { import isBlockComment from "../utils/is-block-comment.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js" * * @typedef {any} Options - Prettier options (TBD ...) */ @@ -278,7 +278,7 @@ function printTernaryOld(path, options, print) { /* This does not mean to indent, but make the doc aligned with the first character after `? ` or `: `, so we use `2` instead of `options.tabWidth` here. - + ```js test ? { @@ -288,7 +288,7 @@ function printTernaryOld(path, options, print) { ``` instead of - + ```js test ? { diff --git a/src/language-js/print/ternary.js b/src/language-js/print/ternary.js index 6e2ee6737..c9480904d 100644 --- a/src/language-js/print/ternary.js +++ b/src/language-js/print/ternary.js @@ -27,8 +27,8 @@ import isBlockComment from "../utils/is-block-comment.js"; import { printTernaryOld } from "./ternary-old.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js" * * @typedef {any} Options - Prettier options (TBD ...) */ diff --git a/src/language-js/print/type-annotation.js b/src/language-js/print/type-annotation.js index d5a9134b9..21e57603c 100644 --- a/src/language-js/print/type-annotation.js +++ b/src/language-js/print/type-annotation.js @@ -32,7 +32,7 @@ import { } from "./misc.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc + * @import {Doc} from "../../document/builders.js" */ const isVoidType = createTypeCheckFunction([ diff --git a/src/language-js/print/type-parameters.js b/src/language-js/print/type-parameters.js index 17248ba97..84aa9f8e7 100644 --- a/src/language-js/print/type-parameters.js +++ b/src/language-js/print/type-parameters.js @@ -27,8 +27,8 @@ import { } from "./type-annotation.js"; /** - * @typedef {import("../../document/builders.js").Doc} Doc - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import {Doc} from "../../document/builders.js" + * @import AstPath from "../../common/ast-path.js" */ const getTypeParametersGroupId = createGroupIdMapper("typeParameters"); diff --git a/src/language-js/utils/create-type-check-function.js b/src/language-js/utils/create-type-check-function.js index 631f90e8e..dbcc243da 100644 --- a/src/language-js/utils/create-type-check-function.js +++ b/src/language-js/utils/create-type-check-function.js @@ -1,5 +1,4 @@ -/** @typedef {import("../types/estree.js").Node} Node */ -/** @typedef {import("../types/estree.js").Comment} Comment */ +/** @import {Node, Comment} from "../types/estree.js" */ /** * @param {string[]} typesArray diff --git a/src/language-js/utils/index.js b/src/language-js/utils/index.js index 54724ec54..8216d6946 100644 --- a/src/language-js/utils/index.js +++ b/src/language-js/utils/index.js @@ -13,25 +13,13 @@ import isNodeMatches from "./is-node-matches.js"; import isTsKeywordType from "./is-ts-keyword-type.js"; /** - * @typedef {import("../types/estree.js").Node} Node - * @typedef {import("../types/estree.js").TemplateLiteral} TemplateLiteral - * @typedef {import("../types/estree.js").Comment} Comment - * @typedef {import("../types/estree.js").MemberExpression} MemberExpression - * @typedef {import("../types/estree.js").OptionalMemberExpression} OptionalMemberExpression - * @typedef {import("../types/estree.js").CallExpression} CallExpression - * @typedef {import("../types/estree.js").OptionalCallExpression} OptionalCallExpression - * @typedef {import("../types/estree.js").Expression} Expression - * @typedef {import("../types/estree.js").Property} Property - * @typedef {import("../types/estree.js").ObjectTypeProperty} ObjectTypeProperty - * @typedef {import("../types/estree.js").TaggedTemplateExpression} TaggedTemplateExpression - * @typedef {import("../types/estree.js").Literal} Literal - * - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import * as Estree from "../types/estree.js" + * @import AstPath from "../../common/ast-path.js" */ /** - * @param {Node} node - * @param {(Node) => boolean} predicate + * @param {Estree.Node} node + * @param {(node: Estree.Node) => boolean} predicate * @returns {boolean} */ function hasNode(node, predicate) { @@ -39,7 +27,7 @@ function hasNode(node, predicate) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function hasNakedLeftSide(node) { @@ -105,7 +93,7 @@ function getLeftSidePathName(node) { } /** - * @param {Comment} comment + * @param {Estree.Comment} comment * @returns {boolean} */ const isLineComment = createTypeCheckFunction([ @@ -141,7 +129,7 @@ const isObjectOrRecordExpression = createTypeCheckFunction([ ]); /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isNullishCoalescing(node) { @@ -149,7 +137,7 @@ function isNullishCoalescing(node) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isNumericLiteral(node) { @@ -168,7 +156,7 @@ function isSignedNumericLiteral(node) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isStringLiteral(node) { @@ -218,7 +206,7 @@ const isFunctionOrArrowExpression = createTypeCheckFunction([ ]); /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isFunctionOrArrowExpressionWithBody(node) { @@ -236,7 +224,7 @@ function isFunctionOrArrowExpressionWithBody(node) { * * example: https://docs.angularjs.org/guide/unit-testing#using-beforeall- * - * @param {CallExpression} node + * @param {Estree.CallExpression} node * @returns {boolean} */ function isAngularTestWrapper(node) { @@ -258,7 +246,7 @@ function isMethod(node) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isFlowObjectTypePropertyAFunction(node) { @@ -294,7 +282,7 @@ const isBinaryish = createTypeCheckFunction([ ]); /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isMemberish(node) { @@ -316,7 +304,7 @@ const isSimpleTypeAnnotation = createTypeCheckFunction([ "TSTemplateLiteralType", ]); /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function isSimpleType(node) { @@ -413,7 +401,7 @@ function isTestCall(node, parent) { return false; } -/** @return {(node: Node) => boolean} */ +/** @return {(node: Estree.Node) => boolean} */ const skipChainExpression = (fn) => (node) => { if (node?.type === "ChainExpression") { node = node.expression; @@ -512,7 +500,7 @@ function isLoneShortArgument(node, options) { /** * @param {string} text - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function hasLeadingOwnLineComment(text, node) { @@ -526,7 +514,7 @@ function hasLeadingOwnLineComment(text, node) { } /** - * @param {TemplateLiteral} template + * @param {Estree.TemplateLiteral} template * @returns {boolean} */ function templateLiteralHasNewLines(template) { @@ -534,7 +522,7 @@ function templateLiteralHasNewLines(template) { } /** - * @param {TemplateLiteral | TaggedTemplateExpression} node + * @param {Estree.TemplateLiteral | Estree.TaggedTemplateExpression} node * @param {string} text * @returns {boolean} */ @@ -548,7 +536,7 @@ function isTemplateOnItsOwnLine(node, text) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ function needsHardlineAfterDanglingComment(node) { @@ -715,8 +703,8 @@ function shouldPrintComma(options, level = "es5") { * * Will be overzealous if there already are necessary grouping parentheses. * - * @param {Node} node - * @param {(leftmostNode: Node) => boolean} predicate + * @param {Estree.Node} node + * @param {(leftmostNode: Estree.Node) => boolean} predicate * @returns {boolean} */ function startsWithNoLookaheadToken(node, predicate) { @@ -1043,7 +1031,7 @@ const getCommentTestFunction = (flags, fn) => { } }; /** - * @param {Node} node + * @param {Estree.Node} node * @param {number | function} [flags] * @param {function} [fn] * @returns {boolean} @@ -1057,10 +1045,10 @@ function hasComment(node, flags, fn) { } /** - * @param {Node} node + * @param {Estree.Node} node * @param {number | function} [flags] * @param {function} [fn] - * @returns {Comment[]} + * @returns {Estree.Comment[]} */ function getComments(node, flags, fn) { if (!Array.isArray(node?.comments)) { @@ -1071,7 +1059,7 @@ function getComments(node, flags, fn) { } /** - * @param {Node} node + * @param {Estree.Node} node * @returns {boolean} */ const isNextLineEmpty = (node, { originalText }) => diff --git a/src/language-js/utils/is-block-comment.js b/src/language-js/utils/is-block-comment.js index 0b8486874..16aeddcb9 100644 --- a/src/language-js/utils/is-block-comment.js +++ b/src/language-js/utils/is-block-comment.js @@ -1,6 +1,6 @@ import createTypeCheckFunction from "./create-type-check-function.js"; /** - * @typedef {import("../types/estree.js").Comment} Comment + * @import {Comment} from "../types/estree.js" */ /** diff --git a/src/language-js/utils/is-node-matches.js b/src/language-js/utils/is-node-matches.js index 5c5ebb1d3..e7136afc5 100644 --- a/src/language-js/utils/is-node-matches.js +++ b/src/language-js/utils/is-node-matches.js @@ -1,7 +1,7 @@ // Copied from https://github.com/sindresorhus/eslint-plugin-unicorn/blob/d53d935951aa815c763fc9441aa452c763294715/rules/utils/is-node-matches.js /** - * @typedef {import("../types/estree.js").Node} Node + * @import {Node} from "../types/estree.js" */ /** diff --git a/src/language-js/utils/is-type-cast-comment.js b/src/language-js/utils/is-type-cast-comment.js index e8157bdb2..89ea3f4f8 100644 --- a/src/language-js/utils/is-type-cast-comment.js +++ b/src/language-js/utils/is-type-cast-comment.js @@ -1,7 +1,7 @@ import isBlockComment from "./is-block-comment.js"; /** - * @typedef {import("../types/estree.js").Comment} Comment + * @import {Comment} from "../types/estree.js" */ /** diff --git a/src/language-markdown/mdx.js b/src/language-markdown/mdx.js index c17b82338..09b5d5bb4 100644 --- a/src/language-markdown/mdx.js +++ b/src/language-markdown/mdx.js @@ -61,8 +61,10 @@ tokenizeEsSyntax.locator = (value /*, fromIndex*/) => tokenizeEsComment.locator = (value, fromIndex) => value.indexOf("{", fromIndex); +/** @import {Plugin, Settings} from "unified" */ + /** - * @type {import('unified').Plugin<[], import('unified').Settings>} + * @type {Plugin<[], Settings>} */ const esSyntax = function () { const { Parser } = this; diff --git a/src/language-markdown/print-paragraph.js b/src/language-markdown/print-paragraph.js index 785e46c3c..15c54cbf2 100644 --- a/src/language-markdown/print-paragraph.js +++ b/src/language-markdown/print-paragraph.js @@ -3,8 +3,8 @@ import { DOC_TYPE_ARRAY, DOC_TYPE_FILL } from "../document/constants.js"; import { getDocType } from "../document/utils.js"; /** - * @typedef {import("../common/ast-path.js").default} AstPath - * @typedef {import("../document/builders.js").Doc} Doc + * @import AstPath from "../common/ast-path.js" + * @import {Doc} from "../document/builders.js" */ /** diff --git a/src/language-markdown/print-sentence.js b/src/language-markdown/print-sentence.js index ef38876c0..70c1abfe2 100644 --- a/src/language-markdown/print-sentence.js +++ b/src/language-markdown/print-sentence.js @@ -1,6 +1,6 @@ /** - * @typedef {import("../common/ast-path.js").default} AstPath - * @typedef {import("../document/builders.js").Doc} Doc + * @import AstPath from "../common/ast-path.js" + * @import {Doc} from "../document/builders.js" */ import { fill } from "../document/builders.js"; diff --git a/src/language-markdown/print-whitespace.js b/src/language-markdown/print-whitespace.js index b57e83bec..c4e68ab3c 100644 --- a/src/language-markdown/print-whitespace.js +++ b/src/language-markdown/print-whitespace.js @@ -7,10 +7,8 @@ import { } from "./utils.js"; /** - * @typedef {import("./utils.js").WordNode} WordNode - * @typedef {import("./utils.js").WhitespaceValue} WhitespaceValue - * @typedef {import("./utils.js").WordKind} WordKind - * @typedef {import("../common/ast-path.js").default} AstPath + * @import {WordNode, WhitespaceValue, WordKind} from "./utils.js" + * @import AstPath from "../common/ast-path.js" * @typedef {"always" | "never" | "preserve"} ProseWrap * @typedef {{ next?: WordNode | null, previous?: WordNode | null }} * AdjacentNodes Nodes adjacent to a `whitespace` node. Are always of type diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js index e2e511a03..811287825 100644 --- a/src/language-markdown/printer-markdown.js +++ b/src/language-markdown/printer-markdown.js @@ -38,7 +38,7 @@ import { } from "./utils.js"; /** - * @typedef {import("../document/builders.js").Doc} Doc + * @import {Doc} from "../document/builders.js" */ const SIBLING_NODE_TYPES = new Set(["listItem", "definition"]); diff --git a/src/language-markdown/unified-plugins/front-matter.js b/src/language-markdown/unified-plugins/front-matter.js index db4ea5e18..49c4a2aa1 100644 --- a/src/language-markdown/unified-plugins/front-matter.js +++ b/src/language-markdown/unified-plugins/front-matter.js @@ -1,7 +1,9 @@ import parseFrontMatter from "../../utils/front-matter/parse.js"; +/** @import {Plugin, Settings} from "unified" */ + /** - * @type {import('unified').Plugin<[], import('unified').Settings>} + * @type {Plugin<[], Settings>} */ const frontMatter = function () { const proto = this.Parser.prototype; diff --git a/src/language-markdown/unified-plugins/liquid.js b/src/language-markdown/unified-plugins/liquid.js index e7f3079a5..4071cfa49 100644 --- a/src/language-markdown/unified-plugins/liquid.js +++ b/src/language-markdown/unified-plugins/liquid.js @@ -1,5 +1,7 @@ +/** @import {Plugin, Settings} from "unified" */ + /** - * @type {import('unified').Plugin<[], import('unified').Settings>} + * @type {Plugin<[], Settings>} */ const liquid = function () { const proto = this.Parser.prototype; diff --git a/src/language-markdown/unified-plugins/wiki-link.js b/src/language-markdown/unified-plugins/wiki-link.js index 1eca36b6c..797b30ed2 100644 --- a/src/language-markdown/unified-plugins/wiki-link.js +++ b/src/language-markdown/unified-plugins/wiki-link.js @@ -1,5 +1,7 @@ +/** @import {Plugin, Settings} from "unified" */ + /** - * @type {import('unified').Plugin<[], import('unified').Settings>} + * @type {Plugin<[], Settings>} */ const wikiLink = function () { const entityType = "wikiLink"; diff --git a/src/language-yaml/print/block.js b/src/language-yaml/print/block.js index 55ad31b4f..7bd988004 100644 --- a/src/language-yaml/print/block.js +++ b/src/language-yaml/print/block.js @@ -1,4 +1,4 @@ -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ import { dedent, diff --git a/src/language-yaml/print/mapping-item.js b/src/language-yaml/print/mapping-item.js index 8a4d874f6..1a5be79ad 100644 --- a/src/language-yaml/print/mapping-item.js +++ b/src/language-yaml/print/mapping-item.js @@ -1,4 +1,4 @@ -/** @typedef {import("../../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../../document/builders.js" */ import { conditionalGroup, diff --git a/src/language-yaml/printer-yaml.js b/src/language-yaml/printer-yaml.js index d7e8dffcf..4f71218ab 100644 --- a/src/language-yaml/printer-yaml.js +++ b/src/language-yaml/printer-yaml.js @@ -1,4 +1,4 @@ -/** @typedef {import("../document/builders.js").Doc} Doc */ +/** @import {Doc} from "../document/builders.js" */ import { breakParent, diff --git a/src/main/comments/attach.js b/src/main/comments/attach.js index 0a945c5b6..c545053f7 100644 --- a/src/main/comments/attach.js +++ b/src/main/comments/attach.js @@ -10,7 +10,7 @@ import { } from "./utils.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath + * @import AstPath from "../../common/ast-path.js" */ const childNodesCache = new WeakMap(); diff --git a/src/main/comments/print.js b/src/main/comments/print.js index 9c491ba54..743e94c7b 100644 --- a/src/main/comments/print.js +++ b/src/main/comments/print.js @@ -14,8 +14,8 @@ import { skipSpaces } from "../../utils/skip.js"; import skipNewline from "../../utils/skip-newline.js"; /** - * @typedef {import("../../common/ast-path.js").default} AstPath - * @typedef {import("../../document/builders.js").Doc} Doc + * @import AstPath from "../../common/ast-path.js" + * @import {Doc} from "../../document/builders.js" */ const returnTrue = () => true; diff --git a/src/main/multiparser.js b/src/main/multiparser.js index a9b768c35..34cb1a217 100644 --- a/src/main/multiparser.js +++ b/src/main/multiparser.js @@ -3,8 +3,10 @@ import createGetVisitorKeysFunction from "./create-get-visitor-keys-function.js" import normalizeFormatOptions from "./normalize-format-options.js"; import parse from "./parse.js"; +/** @import AstPath from "../common/ast-path.js" */ + async function printEmbeddedLanguages( - /** @type {import("../common/ast-path.js").default} */ path, + /** @type {AstPath} */ path, genericPrint, options, printAstToDoc, diff --git a/src/main/normalize-options.js b/src/main/normalize-options.js index 13d6dcb77..cba911d74 100644 --- a/src/main/normalize-options.js +++ b/src/main/normalize-options.js @@ -1,7 +1,7 @@ import * as vnopts from "vnopts"; /** - * @typedef {import("./support.js").NamedOptionInfo} NamedOptionInfo + * @import {NamedOptionInfo} from "./support.js" */ let hasDeprecationWarned; diff --git a/src/main/support.js b/src/main/support.js index 9e1b54ded..d876c2b81 100644 --- a/src/main/support.js +++ b/src/main/support.js @@ -1,7 +1,7 @@ import coreOptions from "./core-options.evaluate.js"; /** - * @typedef {import("./core-options.evaluate.js").OptionInfo} OptionInfo + * @import {OptionInfo} from "./core-options.evaluate.js" * @typedef {{ name: string; pluginDefaults: Array } & OptionInfo} NamedOptionInfo */ diff --git a/src/utils/has-newline.js b/src/utils/has-newline.js index 3e503d4e9..2b0095508 100644 --- a/src/utils/has-newline.js +++ b/src/utils/has-newline.js @@ -1,7 +1,7 @@ import { skipSpaces } from "./skip.js"; import skipNewline from "./skip-newline.js"; -/** @typedef {import("./skip.js").SkipOptions} SkipOptions */ +/** @import {SkipOptions} from "./skip.js" */ /** * @param {string} text diff --git a/src/utils/has-spaces.js b/src/utils/has-spaces.js index 73d2c7da5..187ff802b 100644 --- a/src/utils/has-spaces.js +++ b/src/utils/has-spaces.js @@ -1,6 +1,6 @@ import { skipSpaces } from "./skip.js"; -/** @typedef {import("./skip.js").SkipOptions} SkipOptions */ +/** @import {SkipOptions} from "./skip.js" */ // Not using, but it's public utils /* c8 ignore start */ diff --git a/src/utils/infer-parser.js b/src/utils/infer-parser.js index 463081566..0b1b4a013 100644 --- a/src/utils/infer-parser.js +++ b/src/utils/infer-parser.js @@ -1,5 +1,7 @@ import getInterpreter from "./get-interpreter.js"; +/** @import {Options} from "../index.js" */ + // Didn't use `path.basename` since this module need work in browsers too // And `file` can be a `URL` const getFileBasename = (file) => String(file).split(/[/\\]/u).pop(); @@ -54,7 +56,7 @@ function getLanguageByInterpreter(languages, file) { } /** - * @param {import("../index.js").Options} options + * @param {Options} options * @param {{physicalFile?: string | URL, file?: string | URL, language?: string}} fileInfo * @returns {string | void} matched parser name if found */ diff --git a/src/utils/make-string.js b/src/utils/make-string.js index fe1bbedff..b772707b3 100644 --- a/src/utils/make-string.js +++ b/src/utils/make-string.js @@ -1,4 +1,4 @@ -/** @typedef {import("./get-preferred-quote.js").Quote} Quote */ +/** @import {Quote} from "./get-preferred-quote.js" */ /** * @param {string} rawText diff --git a/src/utils/print-string.js b/src/utils/print-string.js index d29ec1c7d..c69b40263 100644 --- a/src/utils/print-string.js +++ b/src/utils/print-string.js @@ -1,7 +1,7 @@ import getPreferredQuote from "./get-preferred-quote.js"; import makeString from "./make-string.js"; -/** @typedef {import("./get-preferred-quote.js").Quote} Quote */ +/** @import {Quote} from "./get-preferred-quote.js" */ function printString(raw, options) { // `rawContent` is the string exactly like it appeared in the input source diff --git a/src/utils/skip-newline.js b/src/utils/skip-newline.js index bc34ec1db..5d8e38f59 100644 --- a/src/utils/skip-newline.js +++ b/src/utils/skip-newline.js @@ -1,4 +1,4 @@ -/** @typedef {import("./skip.js").SkipOptions} SkipOptions */ +/** @import {SkipOptions} from "./skip.js" */ // This one doesn't use the above helper function because it wants to // test \r\n in order and `skip` doesn't support ordering and we only