diff --git a/eslint.config.js b/eslint.config.js index 6f0cc84b2..25473fb4b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,5 +1,4 @@ import url from "node:url"; - import eslintPluginJs from "@eslint/js"; import eslintPluginStylisticJs from "@stylistic/eslint-plugin-js"; import eslintPluginTypescriptEslint from "@typescript-eslint/eslint-plugin"; @@ -12,7 +11,6 @@ import eslintPluginRegexp from "eslint-plugin-regexp"; import eslintPluginSimpleImportSort from "eslint-plugin-simple-import-sort"; import eslintPluginUnicorn from "eslint-plugin-unicorn"; import globals from "globals"; - import eslintPluginPrettierInternalRules from "./scripts/tools/eslint-plugin-prettier-internal-rules/index.js"; const toPath = (file) => url.fileURLToPath(new URL(file, import.meta.url)); @@ -198,7 +196,31 @@ export default [ ], /* eslint-plugin-simple-import-sort */ - "simple-import-sort/imports": "error", + "simple-import-sort/imports": [ + "error", + { + groups: [ + // https://github.com/lydell/eslint-plugin-simple-import-sort/blob/20e25f3b83c713825f96b8494e2091e6600954d6/src/imports.js#L5-L19 + // Side effect imports. + [String.raw`^\u0000`], + // Remove blank lines between groups + // https://github.com/lydell/eslint-plugin-simple-import-sort#how-do-i-remove-all-blank-lines-between-imports + [ + // Node.js builtins prefixed with `node:`. + "^node:", + // Packages. + // Things that start with a letter (or digit or underscore), or `@` followed by a letter. + String.raw`^@?\w`, + // Absolute imports and other imports such as Vue-style `@/foo`. + // Anything not matched in another group. + "^", + // Relative imports. + // Anything that starts with a dot. + String.raw`^\.`, + ], + ], + }, + ], "simple-import-sort/exports": "error", /* eslint-plugin-unicorn */ diff --git a/jest.config.js b/jest.config.js index 9eabb8933..2bba31063 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,7 +1,5 @@ import path from "node:path"; - import createEsmUtils from "esm-utils"; - import installPrettier from "./tests/config/install-prettier.js"; const { dirname: PROJECT_ROOT } = createEsmUtils(import.meta); diff --git a/scripts/build-website.js b/scripts/build-website.js index 7221e4b59..35c22a175 100644 --- a/scripts/build-website.js +++ b/scripts/build-website.js @@ -3,11 +3,9 @@ import fs from "node:fs/promises"; import path from "node:path"; import url from "node:url"; - import createEsmUtils from "esm-utils"; import { execa } from "execa"; import fastGlob from "fast-glob"; - import { format } from "../src/index.js"; import { copyFile, diff --git a/scripts/build/build-javascript-module.js b/scripts/build/build-javascript-module.js index f87085270..26a02642f 100644 --- a/scripts/build/build-javascript-module.js +++ b/scripts/build/build-javascript-module.js @@ -1,11 +1,9 @@ import path from "node:path"; import url from "node:url"; - import browserslistToEsbuild from "browserslist-to-esbuild"; import esbuild from "esbuild"; import { nodeModulesPolyfillPlugin as esbuildPluginNodeModulePolyfills } from "esbuild-plugins-node-modules-polyfill"; import createEsmUtils from "esm-utils"; - import { DIST_DIR, PROJECT_ROOT } from "../utils/index.js"; import esbuildPluginAddDefaultExport from "./esbuild-plugins/add-default-export.js"; import esbuildPluginEvaluate from "./esbuild-plugins/evaluate.js"; diff --git a/scripts/build/build-license.js b/scripts/build/build-license.js index c06be9acb..6239194dc 100644 --- a/scripts/build/build-license.js +++ b/scripts/build/build-license.js @@ -1,9 +1,7 @@ import fs from "node:fs/promises"; import path from "node:path"; - import { outdent } from "outdent"; import rollupPluginLicense from "rollup-plugin-license"; - import { DIST_DIR, PROJECT_ROOT } from "../utils/index.js"; const PROJECT_LICENSE_FILE = path.join(PROJECT_ROOT, "LICENSE"); diff --git a/scripts/build/build-package-json.js b/scripts/build/build-package-json.js index 80a3f4c7d..5f35e7c4c 100644 --- a/scripts/build/build-package-json.js +++ b/scripts/build/build-package-json.js @@ -1,5 +1,4 @@ import path from "node:path"; - import { DIST_DIR, PROJECT_ROOT, readJson, writeJson } from "../utils/index.js"; const keysToKeep = [ diff --git a/scripts/build/build-types.js b/scripts/build/build-types.js index 662ee01db..6e6d96991 100644 --- a/scripts/build/build-types.js +++ b/scripts/build/build-types.js @@ -1,10 +1,8 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; - import { isValidIdentifier } from "@babel/types"; import { outdent } from "outdent"; - import { DIST_DIR, PROJECT_ROOT, writeFile } from "../utils/index.js"; async function typesFileBuilder({ file }) { diff --git a/scripts/build/build.js b/scripts/build/build.js index d778c4e39..81da23764 100644 --- a/scripts/build/build.js +++ b/scripts/build/build.js @@ -3,11 +3,9 @@ import fs from "node:fs/promises"; import path from "node:path"; import readline from "node:readline"; - import chalk from "chalk"; import createEsmUtils from "esm-utils"; import prettyBytes from "pretty-bytes"; - import { DIST_DIR } from "../utils/index.js"; import files from "./config.js"; import parseArguments from "./parse-arguments.js"; diff --git a/scripts/build/config.js b/scripts/build/config.js index 1dd2b63f7..a71ae5b79 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -1,10 +1,8 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; - import createEsmUtils from "esm-utils"; import { outdent } from "outdent"; - import { copyFile, DIST_DIR, PROJECT_ROOT } from "../utils/index.js"; import buildJavascriptModule from "./build-javascript-module.js"; import buildLicense from "./build-license.js"; diff --git a/scripts/build/esbuild-plugins/shim-commonjs-objects.js b/scripts/build/esbuild-plugins/shim-commonjs-objects.js index b0aba10f2..47ccfd980 100644 --- a/scripts/build/esbuild-plugins/shim-commonjs-objects.js +++ b/scripts/build/esbuild-plugins/shim-commonjs-objects.js @@ -1,5 +1,4 @@ import fs from "node:fs"; - import { outdent } from "outdent"; export default function esbuildPluginShimCommonjsObjects() { diff --git a/scripts/build/esbuild-plugins/umd.js b/scripts/build/esbuild-plugins/umd.js index d63cfd932..3d309a94e 100644 --- a/scripts/build/esbuild-plugins/umd.js +++ b/scripts/build/esbuild-plugins/umd.js @@ -1,5 +1,4 @@ import fs from "node:fs"; - import camelCase from "camelcase"; import { outdent } from "outdent"; diff --git a/scripts/build/esbuild-plugins/visualizer.js b/scripts/build/esbuild-plugins/visualizer.js index f5a626138..0d66d169e 100644 --- a/scripts/build/esbuild-plugins/visualizer.js +++ b/scripts/build/esbuild-plugins/visualizer.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import { visualizer as esbuildVisualizer } from "esbuild-visualizer/dist/plugin/index.js"; export default function esbuildPluginVisualizer({ formats }) { diff --git a/scripts/build/esmify-typescript-eslint.js b/scripts/build/esmify-typescript-eslint.js index 62a29fe13..ecf9846f8 100644 --- a/scripts/build/esmify-typescript-eslint.js +++ b/scripts/build/esmify-typescript-eslint.js @@ -1,9 +1,7 @@ /* Transform `@typescript-eslint/*` module to ESM */ import * as path from "node:path"; - import { outdent } from "outdent"; - import { PROJECT_ROOT, writeFile } from "../utils/index.js"; function esmifyTypescriptEslint(text) { diff --git a/scripts/build/modify-typescript-module.js b/scripts/build/modify-typescript-module.js index 21fb49851..c6c700514 100644 --- a/scripts/build/modify-typescript-module.js +++ b/scripts/build/modify-typescript-module.js @@ -1,9 +1,7 @@ import path from "node:path"; - import escapeStringRegexp from "escape-string-regexp"; import MagicString from "magic-string"; import { outdent } from "outdent"; - import { PROJECT_ROOT, writeFile } from "../utils/index.js"; import UNUSED_SPECIFIERS from "./typescript-unused-specifiers.js"; diff --git a/scripts/build/parse-arguments.js b/scripts/build/parse-arguments.js index 8f735e834..9be35bd60 100644 --- a/scripts/build/parse-arguments.js +++ b/scripts/build/parse-arguments.js @@ -1,6 +1,5 @@ import path from "node:path"; import { parseArgs } from "node:util"; - import { DIST_DIR } from "../utils/index.js"; function parseArguments() { diff --git a/scripts/build/transform/index.js b/scripts/build/transform/index.js index 7c5527545..f5577e1e2 100644 --- a/scripts/build/transform/index.js +++ b/scripts/build/transform/index.js @@ -1,10 +1,8 @@ import path from "node:path"; - import babelGenerator from "@babel/generator"; import { parse } from "@babel/parser"; import { traverseFast as traverse } from "@babel/types"; import { outdent } from "outdent"; - import { PROJECT_ROOT, SOURCE_DIR } from "../../utils/index.js"; import allTransforms from "./transforms/index.js"; diff --git a/scripts/build/utils.js b/scripts/build/utils.js index b2e9265b6..2493e8d74 100644 --- a/scripts/build/utils.js +++ b/scripts/build/utils.js @@ -1,6 +1,5 @@ import fs from "node:fs"; import path from "node:path"; - import { PROJECT_ROOT } from "../utils/index.js"; function getPackageFile(file) { diff --git a/scripts/bundle-eslint-config.js b/scripts/bundle-eslint-config.js index dfa25bfd6..802e95b6c 100644 --- a/scripts/bundle-eslint-config.js +++ b/scripts/bundle-eslint-config.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import eslintPluginCompat from "eslint-plugin-compat"; const { browserslist: targets } = JSON.parse( diff --git a/scripts/changelog-for-patch.js b/scripts/changelog-for-patch.js index b8b40a382..eca2d3319 100644 --- a/scripts/changelog-for-patch.js +++ b/scripts/changelog-for-patch.js @@ -1,10 +1,8 @@ #!/usr/bin/env node import path from "node:path"; - import minimist from "minimist"; import semver from "semver"; - import { changelogUnreleasedDirPath, changelogUnreleasedDirs, diff --git a/scripts/check-deps.js b/scripts/check-deps.js index e86fbfbdc..097a2867a 100644 --- a/scripts/check-deps.js +++ b/scripts/check-deps.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import chalk from "chalk"; const packageJson = JSON.parse( diff --git a/scripts/clean-cspell.js b/scripts/clean-cspell.js index 861199768..24752b357 100644 --- a/scripts/clean-cspell.js +++ b/scripts/clean-cspell.js @@ -1,7 +1,6 @@ #!/usr/bin/env node import fs from "node:fs/promises"; - import { execa } from "execa"; const CSPELL_CONFIG_FILE = new URL("../cspell.json", import.meta.url); diff --git a/scripts/clean-git-blame-ignore-revs-file.js b/scripts/clean-git-blame-ignore-revs-file.js index fbaaf0033..dcc5f9d9d 100644 --- a/scripts/clean-git-blame-ignore-revs-file.js +++ b/scripts/clean-git-blame-ignore-revs-file.js @@ -7,7 +7,6 @@ Remove revs without actual file change */ import fs from "node:fs/promises"; - import { execa } from "execa"; const FILE = new URL("../.git-blame-ignore-revs", import.meta.url); diff --git a/scripts/draft-blog-post.js b/scripts/draft-blog-post.js index c605b1360..1695477a3 100644 --- a/scripts/draft-blog-post.js +++ b/scripts/draft-blog-post.js @@ -2,11 +2,9 @@ import fs from "node:fs"; import path from "node:path"; - import createEsmUtils from "esm-utils"; import fg from "fast-glob"; import semver from "semver"; - import { changelogUnreleasedDirPath, changelogUnreleasedDirs, diff --git a/scripts/generate-changelog.js b/scripts/generate-changelog.js index d659b3272..36a44f61b 100755 --- a/scripts/generate-changelog.js +++ b/scripts/generate-changelog.js @@ -11,10 +11,8 @@ import fs from "node:fs/promises"; import path from "node:path"; - import enquirer from "enquirer"; import createEsmUtils from "esm-utils"; - import { CHANGELOG_CATEGORIES } from "./utils/changelog-categories.js"; const { __dirname } = createEsmUtils(import.meta); diff --git a/scripts/generate-unused-typescript-specifiers.js b/scripts/generate-unused-typescript-specifiers.js index ace7352ea..808561a1e 100644 --- a/scripts/generate-unused-typescript-specifiers.js +++ b/scripts/generate-unused-typescript-specifiers.js @@ -1,11 +1,9 @@ import fs from "node:fs/promises"; - import esbuild from "esbuild"; import * as importMetaResolve from "import-meta-resolve"; import { outdent } from "outdent"; import * as prettier from "prettier"; import * as typescript from "typescript"; - import { modifyTypescriptModule } from "./build/modify-typescript-module.js"; import UNUSED_SPECIFIERS from "./build/typescript-unused-specifiers.js"; diff --git a/scripts/lint-changelog.js b/scripts/lint-changelog.js index db1050c90..6d02b1dc9 100644 --- a/scripts/lint-changelog.js +++ b/scripts/lint-changelog.js @@ -2,11 +2,9 @@ import fs from "node:fs"; import path from "node:path"; - import createEsmUtils from "esm-utils"; import { LinesAndColumns } from "lines-and-columns"; import { outdent } from "outdent"; - import { CHANGELOG_CATEGORIES } from "./utils/changelog-categories.js"; const { __dirname } = createEsmUtils(import.meta); diff --git a/scripts/release/run.js b/scripts/release/run.js index 4623354ca..78488fda5 100644 --- a/scripts/release/run.js +++ b/scripts/release/run.js @@ -1,5 +1,4 @@ import semver from "semver"; - import parseArguments from "./parse-arguments.js"; import * as steps from "./steps/index.js"; import { logPromise, readJson, runGit } from "./utils.js"; diff --git a/scripts/release/steps/bump-prettier.js b/scripts/release/steps/bump-prettier.js index 5190209f2..c77c89082 100644 --- a/scripts/release/steps/bump-prettier.js +++ b/scripts/release/steps/bump-prettier.js @@ -1,7 +1,5 @@ import fs from "node:fs"; - import semver from "semver"; - import { logPromise, readJson, runGit, runYarn, writeJson } from "../utils.js"; async function format() { diff --git a/scripts/release/steps/clean-changelog.js b/scripts/release/steps/clean-changelog.js index 2e142034e..24482ace1 100644 --- a/scripts/release/steps/clean-changelog.js +++ b/scripts/release/steps/clean-changelog.js @@ -1,8 +1,6 @@ import fs from "node:fs/promises"; import { fileURLToPath } from "node:url"; - import fastGlob from "fast-glob"; - import { runGit } from "../utils.js"; export default async function cleanChangelog({ repo }) { diff --git a/scripts/release/steps/generate-bundles.js b/scripts/release/steps/generate-bundles.js index d6c238d13..5514292ea 100644 --- a/scripts/release/steps/generate-bundles.js +++ b/scripts/release/steps/generate-bundles.js @@ -1,5 +1,4 @@ import chalk from "chalk"; - import { logPromise, readJson, runYarn } from "../utils.js"; export default async function generateBundles({ dry, version, manual }) { diff --git a/scripts/release/steps/install-dependencies.js b/scripts/release/steps/install-dependencies.js index 79a83825d..17d709333 100644 --- a/scripts/release/steps/install-dependencies.js +++ b/scripts/release/steps/install-dependencies.js @@ -1,5 +1,4 @@ import { execa } from "execa"; - import { runGit, runYarn } from "../utils.js"; export default async function installDependencies() { diff --git a/scripts/release/steps/post-publish-steps.js b/scripts/release/steps/post-publish-steps.js index d25283321..518e964c3 100644 --- a/scripts/release/steps/post-publish-steps.js +++ b/scripts/release/steps/post-publish-steps.js @@ -1,6 +1,5 @@ import chalk from "chalk"; import outdent from "outdent"; - import { fetchText, logPromise, writeFile } from "../utils.js"; const SCHEMA_REPO = "SchemaStore/schemastore"; diff --git a/scripts/release/steps/publish-to-npm.js b/scripts/release/steps/publish-to-npm.js index 20fcf24d7..7be546efd 100644 --- a/scripts/release/steps/publish-to-npm.js +++ b/scripts/release/steps/publish-to-npm.js @@ -1,6 +1,5 @@ import enquirer from "enquirer"; import { execa } from "execa"; - import { waitForEnter } from "../utils.js"; export default async function publishToNpm({ dry }) { diff --git a/scripts/release/steps/show-instructions-after-npm-publish.js b/scripts/release/steps/show-instructions-after-npm-publish.js index 70c0b9224..53b70b835 100644 --- a/scripts/release/steps/show-instructions-after-npm-publish.js +++ b/scripts/release/steps/show-instructions-after-npm-publish.js @@ -1,7 +1,6 @@ import chalk from "chalk"; import outdent from "outdent"; import semver from "semver"; - import { getBlogPostInfo, getChangelogContent, diff --git a/scripts/release/steps/update-changelog.js b/scripts/release/steps/update-changelog.js index 591efcb0e..bd4a013a4 100644 --- a/scripts/release/steps/update-changelog.js +++ b/scripts/release/steps/update-changelog.js @@ -1,9 +1,7 @@ import fs from "node:fs"; - import chalk from "chalk"; import { execa } from "execa"; import semver from "semver"; - import { getBlogPostInfo, getChangelogContent, diff --git a/scripts/release/steps/update-dependents-count.js b/scripts/release/steps/update-dependents-count.js index b5f83aa1b..575191dbe 100644 --- a/scripts/release/steps/update-dependents-count.js +++ b/scripts/release/steps/update-dependents-count.js @@ -1,5 +1,4 @@ import chalk from "chalk"; - import { fetchText, logPromise, processFile, runGit } from "../utils.js"; async function update() { diff --git a/scripts/release/steps/wait-for-bot-release.js b/scripts/release/steps/wait-for-bot-release.js index c828e6f91..c76f81b33 100644 --- a/scripts/release/steps/wait-for-bot-release.js +++ b/scripts/release/steps/wait-for-bot-release.js @@ -1,6 +1,5 @@ import chalk from "chalk"; import outdent from "outdent"; - import { logPromise, waitForEnter } from "../utils.js"; export async function isVersionReleased(version) { diff --git a/scripts/release/tests/publish-to-npm.test.js b/scripts/release/tests/publish-to-npm.test.js index 48fde4b53..f0ad4ee2e 100644 --- a/scripts/release/tests/publish-to-npm.test.js +++ b/scripts/release/tests/publish-to-npm.test.js @@ -1,7 +1,6 @@ import assert from "node:assert/strict"; import { describe, it } from "node:test"; import { URLSearchParams } from "node:url"; - import { getReleaseUrl } from "../steps/show-instructions-after-npm-publish.js"; const RELEASE_URL_BASE = "https://github.com/prettier/prettier/releases/new?"; diff --git a/scripts/release/tests/validate-new-version.test.js b/scripts/release/tests/validate-new-version.test.js index 1bb2ecee0..635278f78 100644 --- a/scripts/release/tests/validate-new-version.test.js +++ b/scripts/release/tests/validate-new-version.test.js @@ -1,8 +1,6 @@ import assert from "node:assert/strict"; import { describe, it } from "node:test"; - import chalk from "chalk"; - import validateNewVersion from "../steps/validate-new-version.js"; describe("validate-new-version", () => { diff --git a/scripts/release/tests/version-check.test.js b/scripts/release/tests/version-check.test.js index 590b629b1..d5f7e23cf 100644 --- a/scripts/release/tests/version-check.test.js +++ b/scripts/release/tests/version-check.test.js @@ -1,6 +1,5 @@ import assert from "node:assert/strict"; import { describe, it } from "node:test"; - import { isVersionReleased } from "../steps/wait-for-bot-release.js"; describe("isVersionReleased", () => { diff --git a/scripts/release/utils.js b/scripts/release/utils.js index 4b6c43e8b..9d4b341d5 100644 --- a/scripts/release/utils.js +++ b/scripts/release/utils.js @@ -2,11 +2,9 @@ import fs from "node:fs"; import path from "node:path"; import readline from "node:readline"; import url from "node:url"; - import chalk from "chalk"; import { execa } from "execa"; import outdent from "outdent"; - import getFormattedDate from "./get-formatted-date.js"; readline.emitKeypressEvents(process.stdin); diff --git a/scripts/tools/bundle-test/index.js b/scripts/tools/bundle-test/index.js index 6940afb2a..fdab387f5 100644 --- a/scripts/tools/bundle-test/index.js +++ b/scripts/tools/bundle-test/index.js @@ -1,9 +1,7 @@ import { createRequire } from "node:module"; import path from "node:path"; import url from "node:url"; - import webpack from "webpack"; - import files from "../../build/config.js"; import { DIST_DIR } from "../../utils/index.js"; diff --git a/scripts/utils/changelog.js b/scripts/utils/changelog.js index 9b3f9fe66..3699c02c3 100644 --- a/scripts/utils/changelog.js +++ b/scripts/utils/changelog.js @@ -1,6 +1,5 @@ import fs from "node:fs"; import path from "node:path"; - import createEsmUtils from "esm-utils"; import semver from "semver"; diff --git a/src/cli/cli-options.evaluate.js b/src/cli/cli-options.evaluate.js index d59364737..36475f936 100644 --- a/src/cli/cli-options.evaluate.js +++ b/src/cli/cli-options.evaluate.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import { optionCategories } from "./prettier-internal.js"; /** diff --git a/src/cli/constants.evaluate.js b/src/cli/constants.evaluate.js index 183bc1bcb..863c5a1af 100644 --- a/src/cli/constants.evaluate.js +++ b/src/cli/constants.evaluate.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import { optionCategories } from "./prettier-internal.js"; const categoryOrder = [ diff --git a/src/cli/expand-patterns.js b/src/cli/expand-patterns.js index d53b9aa99..af1ae9abe 100644 --- a/src/cli/expand-patterns.js +++ b/src/cli/expand-patterns.js @@ -1,5 +1,4 @@ import path from "node:path"; - import { fastGlob } from "./prettier-internal.js"; import { lstatSafe, normalizeToPosix } from "./utils.js"; diff --git a/src/cli/file-info.js b/src/cli/file-info.js index c1dea06f1..91d8381f1 100644 --- a/src/cli/file-info.js +++ b/src/cli/file-info.js @@ -1,5 +1,4 @@ import stringify from "fast-json-stable-stringify"; - import { format, getFileInfo } from "../index.js"; import { printToScreen } from "./utils.js"; diff --git a/src/cli/find-cache-file.js b/src/cli/find-cache-file.js index 1eb737c57..db1e09af7 100644 --- a/src/cli/find-cache-file.js +++ b/src/cli/find-cache-file.js @@ -1,9 +1,7 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; - import findCacheDir from "find-cache-dir"; - import { isJson, statSafe } from "./utils.js"; /** diff --git a/src/cli/find-config-path.js b/src/cli/find-config-path.js index 94923cf4c..bc752efbb 100644 --- a/src/cli/find-config-path.js +++ b/src/cli/find-config-path.js @@ -1,5 +1,4 @@ import path from "node:path"; - import { resolveConfigFile } from "../index.js"; import { normalizeToPosix, printToScreen } from "./utils.js"; diff --git a/src/cli/format-results-cache.js b/src/cli/format-results-cache.js index d041067f4..9dd276989 100644 --- a/src/cli/format-results-cache.js +++ b/src/cli/format-results-cache.js @@ -3,7 +3,6 @@ import stringify from "fast-json-stable-stringify"; import fileEntryCache from "file-entry-cache"; - import { version as prettierVersion } from "../index.js"; import { createHash } from "./utils.js"; diff --git a/src/cli/format.js b/src/cli/format.js index 06bd00932..25d0e7aa6 100644 --- a/src/cli/format.js +++ b/src/cli/format.js @@ -1,8 +1,6 @@ import fs from "node:fs/promises"; import path from "node:path"; - import chalk from "chalk"; - import * as prettier from "../index.js"; import { expandPatterns } from "./expand-patterns.js"; import findCacheFile from "./find-cache-file.js"; diff --git a/src/cli/logger.js b/src/cli/logger.js index 8fd5d2c0e..ad1174c98 100644 --- a/src/cli/logger.js +++ b/src/cli/logger.js @@ -1,5 +1,4 @@ import readline from "node:readline"; - import chalk, { chalkStderr } from "chalk"; import stripAnsi from "strip-ansi"; import wcwidth from "wcwidth.js"; diff --git a/src/cli/options/get-context-options.js b/src/cli/options/get-context-options.js index 54144f5d7..b485e3d76 100644 --- a/src/cli/options/get-context-options.js +++ b/src/cli/options/get-context-options.js @@ -1,5 +1,4 @@ import dashify from "dashify"; - import { getSupportInfo } from "../../index.js"; import cliOptions from "../cli-options.evaluate.js"; import { diff --git a/src/cli/options/get-options-for-file.js b/src/cli/options/get-options-for-file.js index 64f0425e7..3f2e668a5 100644 --- a/src/cli/options/get-options-for-file.js +++ b/src/cli/options/get-options-for-file.js @@ -1,5 +1,4 @@ import dashify from "dashify"; - import { resolveConfig } from "../../index.js"; import { normalizeOptions as normalizeApiOptions } from "../prettier-internal.js"; import createMinimistOptions from "./create-minimist-options.js"; diff --git a/src/cli/options/normalize-cli-options.js b/src/cli/options/normalize-cli-options.js index 2cfbe7132..cd2bc0338 100644 --- a/src/cli/options/normalize-cli-options.js +++ b/src/cli/options/normalize-cli-options.js @@ -1,6 +1,5 @@ import chalk from "chalk"; import leven from "leven"; - import { normalizeOptions, vnopts } from "../prettier-internal.js"; const descriptor = { diff --git a/src/cli/options/parse-cli-arguments.js b/src/cli/options/parse-cli-arguments.js index 39c83823d..ba6b69eff 100644 --- a/src/cli/options/parse-cli-arguments.js +++ b/src/cli/options/parse-cli-arguments.js @@ -1,5 +1,4 @@ import camelCase from "camelcase"; - import { pick } from "../utils.js"; import createMinimistOptions from "./create-minimist-options.js"; import { getContextOptionsWithoutPlugins } from "./get-context-options.js"; diff --git a/src/cli/print-support-info.js b/src/cli/print-support-info.js index b5471cf6d..cf4672c29 100644 --- a/src/cli/print-support-info.js +++ b/src/cli/print-support-info.js @@ -1,5 +1,4 @@ import stringify from "fast-json-stable-stringify"; - import { format, getSupportInfo } from "../index.js"; import { omit, printToScreen } from "./utils.js"; diff --git a/src/cli/usage.js b/src/cli/usage.js index b6eb1a43a..f40337c87 100644 --- a/src/cli/usage.js +++ b/src/cli/usage.js @@ -1,5 +1,4 @@ import camelCase from "camelcase"; - import { categoryOrder, usageSummary } from "./constants.evaluate.js"; import { formatOptionsHiddenDefaults } from "./prettier-internal.js"; import { groupBy } from "./utils.js"; diff --git a/src/cli/utils.js b/src/cli/utils.js index c683b416c..56f4bf93e 100644 --- a/src/cli/utils.js +++ b/src/cli/utils.js @@ -1,8 +1,6 @@ import fs from "node:fs/promises"; import path from "node:path"; - import sdbm from "sdbm"; - // @ts-expect-error import { __internal as sharedWithCli } from "../index.js"; diff --git a/src/common/mockable.js b/src/common/mockable.js index 7ce3f1a87..97acb8c6b 100644 --- a/src/common/mockable.js +++ b/src/common/mockable.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import { isCI } from "ci-info"; import getStdin from "get-stdin"; diff --git a/src/config/editorconfig/index.js b/src/config/editorconfig/index.js index 6770be434..7a5384a33 100644 --- a/src/config/editorconfig/index.js +++ b/src/config/editorconfig/index.js @@ -1,7 +1,5 @@ import path from "node:path"; - import editorconfig from "editorconfig"; - import { clearFindProjectRootCache, findProjectRoot, diff --git a/src/config/find-project-root.js b/src/config/find-project-root.js index 0d574a0b9..feefaf0fc 100644 --- a/src/config/find-project-root.js +++ b/src/config/find-project-root.js @@ -2,7 +2,6 @@ // https://github.com/kirstein/find-project-root/blob/master/index.js import * as path from "node:path"; - import isDirectory from "../utils/is-directory.js"; import Searcher from "./searcher.js"; diff --git a/src/config/prettier-config/index.js b/src/config/prettier-config/index.js index 6f4b5dbf7..0e44a5b94 100644 --- a/src/config/prettier-config/index.js +++ b/src/config/prettier-config/index.js @@ -1,5 +1,4 @@ import path from "node:path"; - import mockable from "../../common/mockable.js"; import getConfigSearcher from "./config-searcher.js"; import loadConfig from "./load-config.js"; diff --git a/src/config/prettier-config/load-config.js b/src/config/prettier-config/load-config.js index d248a717b..b0aa7174b 100644 --- a/src/config/prettier-config/load-config.js +++ b/src/config/prettier-config/load-config.js @@ -1,5 +1,4 @@ import path from "node:path"; - import loadExternalConfig from "./load-external-config.js"; import loaders, { loadConfigFromPackageJson, diff --git a/src/config/prettier-config/loaders.js b/src/config/prettier-config/loaders.js index e640c56da..95e9ed3fa 100644 --- a/src/config/prettier-config/loaders.js +++ b/src/config/prettier-config/loaders.js @@ -1,10 +1,10 @@ -import { pathToFileURL } from "node:url"; +import "fast-glob"; +import { pathToFileURL } from "node:url"; import { load as parseYaml } from "js-yaml"; import json5 from "json5"; import parseJson from "parse-json"; import { parse as parseToml } from "smol-toml"; - import readFile from "../../utils/read-file.js"; async function readJson(file) { diff --git a/src/config/resolve-config.js b/src/config/resolve-config.js index 410fc4c7d..801783d21 100644 --- a/src/config/resolve-config.js +++ b/src/config/resolve-config.js @@ -1,8 +1,6 @@ import path from "node:path"; - import micromatch from "micromatch"; import { toPath } from "url-or-path"; - import partition from "../utils/partition.js"; import { clearEditorconfigCache, diff --git a/src/config/searcher.js b/src/config/searcher.js index 6c701525d..5300267bf 100644 --- a/src/config/searcher.js +++ b/src/config/searcher.js @@ -1,5 +1,4 @@ import path from "node:path"; - import iterateDirectoryUp from "iterate-directory-up"; class Searcher { diff --git a/src/index.js b/src/index.js index 62b9884de..4fc4f9130 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,6 @@ import { createTwoFilesPatch } from "diff"; import fastGlob from "fast-glob"; import * as vnopts from "vnopts"; - import * as errors from "./common/errors.js"; import getFileInfoWithoutPlugins from "./common/get-file-info.js"; import mockable from "./common/mockable.js"; diff --git a/src/language-css/languages.evaluate.js b/src/language-css/languages.evaluate.js index b8f9eabd4..e3d1d9e0c 100644 --- a/src/language-css/languages.evaluate.js +++ b/src/language-css/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-css/parse/parse-media-query.js b/src/language-css/parse/parse-media-query.js index aebdd70a9..39fed66a0 100644 --- a/src/language-css/parse/parse-media-query.js +++ b/src/language-css/parse/parse-media-query.js @@ -1,5 +1,4 @@ import postcssMediaQueryParser from "postcss-media-query-parser"; - import { addMissingType, addTypePrefix } from "./utils.js"; const parse = postcssMediaQueryParser.default; diff --git a/src/language-css/parse/parse-selector.js b/src/language-css/parse/parse-selector.js index 68d0d7c2d..ac7416db3 100644 --- a/src/language-css/parse/parse-selector.js +++ b/src/language-css/parse/parse-selector.js @@ -1,5 +1,4 @@ import PostcssSelectorParser from "postcss-selector-parser/dist/processor.js"; - import { addTypePrefix } from "./utils.js"; function parseSelector(selector) { diff --git a/src/language-css/parse/parse-value.js b/src/language-css/parse/parse-value.js index 363f0620a..fa3cc4b35 100644 --- a/src/language-css/parse/parse-value.js +++ b/src/language-css/parse/parse-value.js @@ -1,5 +1,4 @@ import PostcssValuesParser from "postcss-values-parser/lib/parser.js"; - import getFunctionArgumentsText from "../utils/get-function-arguments-text.js"; import getValueRoot from "../utils/get-value-root.js"; import hasSCSSInterpolation from "../utils/has-scss-interpolation.js"; diff --git a/src/language-css/parser-postcss.js b/src/language-css/parser-postcss.js index 86ae71600..e549e48e1 100644 --- a/src/language-css/parser-postcss.js +++ b/src/language-css/parser-postcss.js @@ -1,7 +1,6 @@ import postcssParse from "postcss/lib/parse"; import postcssLess from "postcss-less"; import postcssScssParse from "postcss-scss/lib/scss-parse"; - import createError from "../common/parser-create-error.js"; import parseFrontMatter from "../utils/front-matter/parse.js"; import { diff --git a/src/language-graphql/languages.evaluate.js b/src/language-graphql/languages.evaluate.js index c1027f10f..a9d7aba78 100644 --- a/src/language-graphql/languages.evaluate.js +++ b/src/language-graphql/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-graphql/parser-graphql.js b/src/language-graphql/parser-graphql.js index b20794341..8f35ce61e 100644 --- a/src/language-graphql/parser-graphql.js +++ b/src/language-graphql/parser-graphql.js @@ -1,5 +1,4 @@ import { parse as parseGraphql } from "graphql/language/parser.mjs"; - import createError from "../common/parser-create-error.js"; import { locEnd, locStart } from "./loc.js"; import { hasPragma } from "./pragma.js"; diff --git a/src/language-handlebars/languages.evaluate.js b/src/language-handlebars/languages.evaluate.js index ce23db0d0..cd4478446 100644 --- a/src/language-handlebars/languages.evaluate.js +++ b/src/language-handlebars/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-handlebars/parser-glimmer.js b/src/language-handlebars/parser-glimmer.js index ce46319dc..0e345de9f 100644 --- a/src/language-handlebars/parser-glimmer.js +++ b/src/language-handlebars/parser-glimmer.js @@ -1,6 +1,5 @@ import { preprocess as parseGlimmer } from "@glimmer/syntax"; import { LinesAndColumns } from "lines-and-columns"; - import createError from "../common/parser-create-error.js"; import { locEnd, locStart } from "./loc.js"; diff --git a/src/language-html/embed/srcset.js b/src/language-html/embed/srcset.js index 626288f56..36f0c9354 100644 --- a/src/language-html/embed/srcset.js +++ b/src/language-html/embed/srcset.js @@ -1,5 +1,4 @@ import parseSrcset from "@prettier/parse-srcset"; - import { ifBreak, join, line } from "../../document/builders.js"; import { getUnescapedAttributeValue } from "../utils/index.js"; import { printExpand } from "./utils.js"; diff --git a/src/language-html/languages.evaluate.js b/src/language-html/languages.evaluate.js index d6a748df2..130f2743e 100644 --- a/src/language-html/languages.evaluate.js +++ b/src/language-html/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-html/parser-html.js b/src/language-html/parser-html.js index 53bb4b3e2..6a90e8424 100644 --- a/src/language-html/parser-html.js +++ b/src/language-html/parser-html.js @@ -8,7 +8,6 @@ import { TagContentType, visitAll, } from "angular-html-parser"; - import createError from "../common/parser-create-error.js"; import parseFrontMatter from "../utils/front-matter/parse.js"; import inferParser from "../utils/infer-parser.js"; diff --git a/src/language-html/print-preprocess.js b/src/language-html/print-preprocess.js index fbe630634..9e6dc9300 100644 --- a/src/language-html/print-preprocess.js +++ b/src/language-html/print-preprocess.js @@ -1,5 +1,4 @@ import { ParseSourceSpan } from "angular-html-parser/lib/compiler/src/parse_util.js"; - import htmlWhitespaceUtils from "../utils/html-whitespace-utils.js"; import { canHaveInterpolation, diff --git a/src/language-html/print/tag.js b/src/language-html/print/tag.js index 8ccbf5153..2547acd53 100644 --- a/src/language-html/print/tag.js +++ b/src/language-html/print/tag.js @@ -3,7 +3,6 @@ */ import assert from "node:assert"; - import { hardline, indent, diff --git a/src/language-js/languages.evaluate.js b/src/language-js/languages.evaluate.js index 2ca80bc10..8b32bb0cd 100644 --- a/src/language-js/languages.evaluate.js +++ b/src/language-js/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-js/parse/acorn.js b/src/language-js/parse/acorn.js index 8f2257c73..2007397bb 100644 --- a/src/language-js/parse/acorn.js +++ b/src/language-js/parse/acorn.js @@ -1,6 +1,5 @@ import { Parser as AcornParser } from "acorn"; import acornJsx from "acorn-jsx"; - import createError from "../../common/parser-create-error.js"; import tryCombinations from "../../utils/try-combinations.js"; import postprocess from "./postprocess/index.js"; diff --git a/src/language-js/parse/angular.js b/src/language-js/parse/angular.js index 8ff3946dd..f4e2c9e65 100644 --- a/src/language-js/parse/angular.js +++ b/src/language-js/parse/angular.js @@ -4,7 +4,6 @@ import { parseInterpolationExpression, parseTemplateBindings, } from "angular-estree-parser"; - import { locEnd, locStart } from "../loc.js"; /** diff --git a/src/language-js/parse/babel.js b/src/language-js/parse/babel.js index bf53f1d77..bb29daab6 100644 --- a/src/language-js/parse/babel.js +++ b/src/language-js/parse/babel.js @@ -1,5 +1,4 @@ import { parse as babelParse, parseExpression } from "@babel/parser"; - import getNextNonSpaceNonCommentCharacterIndex from "../../utils/get-next-non-space-non-comment-character-index.js"; import tryCombinations from "../../utils/try-combinations.js"; import getShebang from "../utils/get-shebang.js"; diff --git a/src/language-js/parse/espree.js b/src/language-js/parse/espree.js index 7ac959e3d..f854ca4ea 100644 --- a/src/language-js/parse/espree.js +++ b/src/language-js/parse/espree.js @@ -1,5 +1,4 @@ import { parse as espreeParse } from "espree"; - import createError from "../../common/parser-create-error.js"; import tryCombinations from "../../utils/try-combinations.js"; import postprocess from "./postprocess/index.js"; diff --git a/src/language-js/parse/flow.js b/src/language-js/parse/flow.js index 0664a00cf..0063695a2 100644 --- a/src/language-js/parse/flow.js +++ b/src/language-js/parse/flow.js @@ -1,5 +1,4 @@ import flowParser from "flow-parser"; - import createError from "../../common/parser-create-error.js"; import postprocess from "./postprocess/index.js"; import createParser from "./utils/create-parser.js"; diff --git a/src/language-js/parse/meriyah.js b/src/language-js/parse/meriyah.js index c710a3d64..7faf50f64 100644 --- a/src/language-js/parse/meriyah.js +++ b/src/language-js/parse/meriyah.js @@ -1,5 +1,4 @@ import { parse as meriyahParse } from "meriyah"; - import createError from "../../common/parser-create-error.js"; import tryCombinations from "../../utils/try-combinations.js"; import postprocess from "./postprocess/index.js"; diff --git a/src/language-js/parse/typescript.js b/src/language-js/parse/typescript.js index 13cf2c887..51824c88a 100644 --- a/src/language-js/parse/typescript.js +++ b/src/language-js/parse/typescript.js @@ -1,5 +1,4 @@ import { parse as parseTypeScript } from "@typescript-eslint/typescript-estree"; - import createError from "../../common/parser-create-error.js"; import tryCombinations from "../../utils/try-combinations.js"; import postprocess from "./postprocess/index.js"; diff --git a/src/language-js/pragma.js b/src/language-js/pragma.js index 8b2d5d9ff..c10f707fc 100644 --- a/src/language-js/pragma.js +++ b/src/language-js/pragma.js @@ -1,5 +1,4 @@ import { extract, parseWithComments, print, strip } from "jest-docblock"; - import { normalizeEndOfLine } from "../common/end-of-line.js"; import getShebang from "./utils/get-shebang.js"; diff --git a/src/language-js/print/flow.js b/src/language-js/print/flow.js index 4565c5261..a54823660 100644 --- a/src/language-js/print/flow.js +++ b/src/language-js/print/flow.js @@ -1,7 +1,6 @@ /** @typedef {import("../../document/builders.js").Doc} Doc */ import assert from "node:assert"; - import { replaceEndOfLine } from "../../document/utils.js"; import printNumber from "../../utils/print-number.js"; import printString from "../../utils/print-string.js"; diff --git a/src/language-js/print/function.js b/src/language-js/print/function.js index 1b122d21e..4fefddec3 100644 --- a/src/language-js/print/function.js +++ b/src/language-js/print/function.js @@ -1,5 +1,4 @@ import assert from "node:assert"; - import { group, hardline, diff --git a/src/language-js/print/property.js b/src/language-js/print/property.js index a5fc7444e..1af4fcba5 100644 --- a/src/language-js/print/property.js +++ b/src/language-js/print/property.js @@ -1,5 +1,4 @@ import isEs5IdentifierName from "@prettier/is-es5-identifier-name"; - import { printComments } from "../../main/comments/print.js"; import printNumber from "../../utils/print-number.js"; import printString from "../../utils/print-string.js"; diff --git a/src/language-js/traverse/visitor-keys.evaluate.js b/src/language-js/traverse/visitor-keys.evaluate.js index 34165f309..27690f8d0 100644 --- a/src/language-js/traverse/visitor-keys.evaluate.js +++ b/src/language-js/traverse/visitor-keys.evaluate.js @@ -1,7 +1,6 @@ import { VISITOR_KEYS as babelVisitorKeys } from "@babel/types"; import { visitorKeys as tsVisitorKeys } from "@typescript-eslint/visitor-keys"; import flowVisitorKeys from "hermes-parser/dist/generated/ESTreeVisitorKeys.js"; - import unionVisitorKeys from "./union-visitor-keys.js"; const angularVisitorKeys = { diff --git a/src/language-js/utils/get-text-without-comments.js b/src/language-js/utils/get-text-without-comments.js index 4d7d12aa6..75aaa3b0f 100644 --- a/src/language-js/utils/get-text-without-comments.js +++ b/src/language-js/utils/get-text-without-comments.js @@ -1,5 +1,4 @@ import assert from "node:assert"; - import { locEnd, locStart } from "../loc.js"; function getTextWithoutComments(options, start, end) { diff --git a/src/language-json/languages.evaluate.js b/src/language-json/languages.evaluate.js index 61acb4158..02a88eb00 100644 --- a/src/language-json/languages.evaluate.js +++ b/src/language-json/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-json/parser-json.js b/src/language-json/parser-json.js index d2e123429..c4673438e 100644 --- a/src/language-json/parser-json.js +++ b/src/language-json/parser-json.js @@ -1,5 +1,4 @@ import { parseExpression } from "@babel/parser"; - import createError from "../common/parser-create-error.js"; import createBabelParseError from "../language-js/parse/utils/create-babel-parse-error.js"; import createParser from "../language-js/parse/utils/create-parser.js"; diff --git a/src/language-markdown/clean.js b/src/language-markdown/clean.js index 320dad37f..b2a5da084 100644 --- a/src/language-markdown/clean.js +++ b/src/language-markdown/clean.js @@ -1,5 +1,4 @@ import collapseWhiteSpace from "collapse-white-space"; - import isFrontMatter from "../utils/front-matter/is-front-matter.js"; import { startWithPragma } from "./pragma.js"; diff --git a/src/language-markdown/languages.evaluate.js b/src/language-markdown/languages.evaluate.js index 91246d039..bde9b14e9 100644 --- a/src/language-markdown/languages.evaluate.js +++ b/src/language-markdown/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-markdown/parser-markdown.js b/src/language-markdown/parser-markdown.js index fe0233411..2522c06a0 100644 --- a/src/language-markdown/parser-markdown.js +++ b/src/language-markdown/parser-markdown.js @@ -2,7 +2,6 @@ import footnotes from "remark-footnotes"; import remarkMath from "remark-math"; import remarkParse from "remark-parse"; import unified from "unified"; - import { locEnd, locStart } from "./loc.js"; import { BLOCKS_REGEX, esSyntax } from "./mdx.js"; import { hasPragma } from "./pragma.js"; diff --git a/src/language-markdown/printer-markdown.js b/src/language-markdown/printer-markdown.js index 697469221..e2e511a03 100644 --- a/src/language-markdown/printer-markdown.js +++ b/src/language-markdown/printer-markdown.js @@ -1,6 +1,5 @@ import collapseWhiteSpace from "collapse-white-space"; import escapeStringRegexp from "escape-string-regexp"; - import { align, fill, diff --git a/src/language-markdown/utils.js b/src/language-markdown/utils.js index 8e4f984f4..c71b4be2b 100644 --- a/src/language-markdown/utils.js +++ b/src/language-markdown/utils.js @@ -1,5 +1,4 @@ import assert from "node:assert"; - import { CJK_REGEXP, PUNCTUATION_REGEXP } from "./constants.evaluate.js"; import { locEnd, locStart } from "./loc.js"; diff --git a/src/language-yaml/languages.evaluate.js b/src/language-yaml/languages.evaluate.js index 729b36833..9ba81cd76 100644 --- a/src/language-yaml/languages.evaluate.js +++ b/src/language-yaml/languages.evaluate.js @@ -1,5 +1,4 @@ import linguistLanguages from "linguist-languages"; - import createLanguage from "../utils/create-language.js"; const languages = [ diff --git a/src/language-yaml/parser-yaml.js b/src/language-yaml/parser-yaml.js index 2aaa89dc9..e97d35d93 100644 --- a/src/language-yaml/parser-yaml.js +++ b/src/language-yaml/parser-yaml.js @@ -1,5 +1,4 @@ import { parse as parseYaml } from "yaml-unist-parser/lib/parse.js"; - import createError from "../common/parser-create-error.js"; import { locEnd, locStart } from "./loc.js"; import { hasPragma } from "./pragma.js"; diff --git a/src/main/comments/attach.js b/src/main/comments/attach.js index 65b20c632..0a945c5b6 100644 --- a/src/main/comments/attach.js +++ b/src/main/comments/attach.js @@ -1,5 +1,4 @@ import assert from "node:assert"; - import { getChildren } from "../../utils/ast-utils.js"; import hasNewline from "../../utils/has-newline.js"; import isNonEmptyArray from "../../utils/is-non-empty-array.js"; diff --git a/src/main/core-options.evaluate.js b/src/main/core-options.evaluate.js index 3f8c6f1bb..b1b8ae5e7 100644 --- a/src/main/core-options.evaluate.js +++ b/src/main/core-options.evaluate.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import { CATEGORY_CONFIG, CATEGORY_EDITOR, diff --git a/src/main/core.js b/src/main/core.js index fffebf096..2fe5a543b 100644 --- a/src/main/core.js +++ b/src/main/core.js @@ -1,5 +1,4 @@ import { diffArrays } from "diff"; - import { convertEndOfLineToChars, countEndOfLineChars, diff --git a/src/main/parse.js b/src/main/parse.js index a8517d217..faef62ebf 100644 --- a/src/main/parse.js +++ b/src/main/parse.js @@ -1,5 +1,4 @@ import { codeFrameColumns } from "@babel/code-frame"; - import { resolveParser } from "./parser-and-printer.js"; async function parse(originalText, options) { diff --git a/src/main/plugins/load-plugin.js b/src/main/plugins/load-plugin.js index a13308d25..fb189c62f 100644 --- a/src/main/plugins/load-plugin.js +++ b/src/main/plugins/load-plugin.js @@ -1,6 +1,5 @@ import path from "node:path"; import { pathToFileURL } from "node:url"; - import importFromDirectory from "../../utils/import-from-directory.js"; async function importPlugin(name, cwd) { diff --git a/src/main/range-util.js b/src/main/range-util.js index a3a2e250b..97c9ae8f4 100644 --- a/src/main/range-util.js +++ b/src/main/range-util.js @@ -1,5 +1,4 @@ import assert from "node:assert"; - import { getSortedChildNodes } from "./comments/attach.js"; const isJsonParser = ({ parser }) => diff --git a/src/utils/get-interpreter.js b/src/utils/get-interpreter.js index a2c0f315e..36aac44ae 100644 --- a/src/utils/get-interpreter.js +++ b/src/utils/get-interpreter.js @@ -1,5 +1,4 @@ import fs from "node:fs"; - import readlines from "n-readlines"; /** diff --git a/src/utils/ignore.js b/src/utils/ignore.js index ba7d43752..4e1dc023d 100644 --- a/src/utils/ignore.js +++ b/src/utils/ignore.js @@ -1,9 +1,7 @@ import path from "node:path"; import url from "node:url"; - import ignoreModule from "ignore"; import { isUrl, toPath } from "url-or-path"; - import readFile from "../utils/read-file.js"; const createIgnore = ignoreModule.default; diff --git a/src/utils/import-from-directory.js b/src/utils/import-from-directory.js index 0bc7aa310..b8b851884 100644 --- a/src/utils/import-from-directory.js +++ b/src/utils/import-from-directory.js @@ -1,5 +1,4 @@ import path from "node:path"; - import importFromFile from "./import-from-file.js"; function importFromDirectory(specifier, directory) { diff --git a/src/utils/import-from-file.js b/src/utils/import-from-file.js index 477c37542..513f89bc9 100644 --- a/src/utils/import-from-file.js +++ b/src/utils/import-from-file.js @@ -1,5 +1,4 @@ import { pathToFileURL } from "node:url"; - // TODO: Use `import.meta.resolve` when it's available import { resolve } from "import-meta-resolve"; diff --git a/src/utils/is-directory.js b/src/utils/is-directory.js index c87c05e53..d9bec460c 100644 --- a/src/utils/is-directory.js +++ b/src/utils/is-directory.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import { toPath } from "url-or-path"; /** diff --git a/src/utils/is-file.js b/src/utils/is-file.js index 0d072748c..d9526826a 100644 --- a/src/utils/is-file.js +++ b/src/utils/is-file.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import { toPath } from "url-or-path"; /** diff --git a/src/utils/read-file.js b/src/utils/read-file.js index 6e1e24e26..fdb061370 100644 --- a/src/utils/read-file.js +++ b/src/utils/read-file.js @@ -1,5 +1,4 @@ import fs from "node:fs/promises"; - import { isUrlString } from "url-or-path"; /** diff --git a/tests/config/install-prettier.js b/tests/config/install-prettier.js index 908b6256a..fc5ceaccd 100644 --- a/tests/config/install-prettier.js +++ b/tests/config/install-prettier.js @@ -1,6 +1,5 @@ import fs from "node:fs"; import path from "node:path"; - import chalk from "chalk"; import { execaSync } from "execa"; import { outdent } from "outdent"; diff --git a/tests/config/run-format-test.js b/tests/config/run-format-test.js index 3a4865477..d2ee72ec8 100644 --- a/tests/config/run-format-test.js +++ b/tests/config/run-format-test.js @@ -1,9 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; - import createEsmUtils from "esm-utils"; - import getPrettier from "./get-prettier.js"; import checkParsers from "./utils/check-parsers.js"; import consistentEndOfLine from "./utils/consistent-end-of-line.js"; diff --git a/tests/config/utils/check-parsers.js b/tests/config/utils/check-parsers.js index bf8665a44..238898b84 100644 --- a/tests/config/utils/check-parsers.js +++ b/tests/config/utils/check-parsers.js @@ -1,5 +1,4 @@ import path from "node:path"; - import createEsmUtils from "esm-utils"; import { outdent } from "outdent"; diff --git a/tests/config/utils/create-snapshot.js b/tests/config/utils/create-snapshot.js index 1a898837f..7b0a79ef0 100644 --- a/tests/config/utils/create-snapshot.js +++ b/tests/config/utils/create-snapshot.js @@ -1,5 +1,4 @@ import { wrap as raw } from "jest-snapshot-serializer-raw"; - import visualizeEndOfLine from "./visualize-end-of-line.js"; import visualizeRange from "./visualize-range.js"; diff --git a/tests/dts/unit/run.js b/tests/dts/unit/run.js index 81d2a6569..6f1b92ca9 100644 --- a/tests/dts/unit/run.js +++ b/tests/dts/unit/run.js @@ -1,7 +1,6 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; - import { default as ts } from "typescript"; const isProduction = process.env.NODE_ENV === "production"; diff --git a/tests/format/js/cursor/format.test.js b/tests/format/js/cursor/format.test.js index 7402a8f48..37a3eec0c 100644 --- a/tests/format/js/cursor/format.test.js +++ b/tests/format/js/cursor/format.test.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import getPrettier from "../../../config/get-prettier.js"; runFormatTest(import.meta, ["babel", "typescript", "flow"]); diff --git a/tests/integration/__tests__/bundle.js b/tests/integration/__tests__/bundle.js index 1ab6f05b9..f10cca8a2 100644 --- a/tests/integration/__tests__/bundle.js +++ b/tests/integration/__tests__/bundle.js @@ -1,9 +1,7 @@ import fs from "node:fs/promises"; import path from "node:path"; - import createEsmUtils from "esm-utils"; import fastGlob from "fast-glob"; - import coreOptions from "../../../src/main/core-options.evaluate.js"; import codeSamples from "../../../website/playground/codeSamples.mjs"; import prettier from "../../config/prettier-entry.js"; diff --git a/tests/integration/__tests__/cli.js b/tests/integration/__tests__/cli.js index 05c77ca02..c60790b54 100644 --- a/tests/integration/__tests__/cli.js +++ b/tests/integration/__tests__/cli.js @@ -1,5 +1,4 @@ import fs from "node:fs"; - import { prettierCli } from "../env.js"; describe("CLI", () => { diff --git a/tests/integration/__tests__/config-invalid.js b/tests/integration/__tests__/config-invalid.js index 8d7aa2f6f..c198f2d37 100644 --- a/tests/integration/__tests__/config-invalid.js +++ b/tests/integration/__tests__/config-invalid.js @@ -1,7 +1,5 @@ import fs from "node:fs/promises"; - import outdent from "outdent"; - import jestPathSerializer from "../path-serializer.js"; expect.addSnapshotSerializer(jestPathSerializer); diff --git a/tests/integration/__tests__/config-resolution.js b/tests/integration/__tests__/config-resolution.js index 2689e4b72..f6396d1e5 100644 --- a/tests/integration/__tests__/config-resolution.js +++ b/tests/integration/__tests__/config-resolution.js @@ -1,6 +1,5 @@ import path from "node:path"; import url from "node:url"; - import prettier from "../../config/prettier-entry.js"; test("resolves configuration from external files and overrides by extname", async () => { diff --git a/tests/integration/__tests__/debug-api.js b/tests/integration/__tests__/debug-api.js index d2145a7f8..6007f28fb 100644 --- a/tests/integration/__tests__/debug-api.js +++ b/tests/integration/__tests__/debug-api.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import prettier from "../../config/prettier-entry.js"; const { diff --git a/tests/integration/__tests__/doc-trim.js b/tests/integration/__tests__/doc-trim.js index 9ab3574fc..d3e1ab45f 100644 --- a/tests/integration/__tests__/doc-trim.js +++ b/tests/integration/__tests__/doc-trim.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import prettier from "../../config/prettier-entry.js"; const docPrinter = prettier.doc.printer; diff --git a/tests/integration/__tests__/file-info.js b/tests/integration/__tests__/file-info.js index 370eecd60..2fe76dbe1 100644 --- a/tests/integration/__tests__/file-info.js +++ b/tests/integration/__tests__/file-info.js @@ -1,10 +1,8 @@ import fs from "node:fs"; import path from "node:path"; import url from "node:url"; - import createEsmUtils from "esm-utils"; import { temporaryDirectory as getTemporaryDirectory } from "tempy"; - import prettier from "../../config/prettier-entry.js"; const { __dirname } = createEsmUtils(import.meta); diff --git a/tests/integration/__tests__/format.js b/tests/integration/__tests__/format.js index 2bbd0b63c..8608c0cdd 100644 --- a/tests/integration/__tests__/format.js +++ b/tests/integration/__tests__/format.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import prettier from "../../config/prettier-entry.js"; import fooPlugin from "../plugins/defaultOptions/plugin.cjs"; diff --git a/tests/integration/__tests__/ignore-absolute-path.js b/tests/integration/__tests__/ignore-absolute-path.js index 735710814..2209aa764 100644 --- a/tests/integration/__tests__/ignore-absolute-path.js +++ b/tests/integration/__tests__/ignore-absolute-path.js @@ -1,5 +1,4 @@ import path from "node:path"; - import createEsmUtils from "esm-utils"; const { __dirname } = createEsmUtils(import.meta); diff --git a/tests/integration/__tests__/invalid-ignore.js b/tests/integration/__tests__/invalid-ignore.js index dc6a1d471..7df8708f7 100644 --- a/tests/integration/__tests__/invalid-ignore.js +++ b/tests/integration/__tests__/invalid-ignore.js @@ -1,7 +1,5 @@ import path from "node:path"; - import createEsmUtils from "esm-utils"; - import prettier from "../../config/prettier-entry.js"; const { __dirname } = createEsmUtils(import.meta); diff --git a/tests/integration/__tests__/line-suffix-boundary.js b/tests/integration/__tests__/line-suffix-boundary.js index 0ba1cc614..15ba37663 100644 --- a/tests/integration/__tests__/line-suffix-boundary.js +++ b/tests/integration/__tests__/line-suffix-boundary.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - /** @type {import('prettier')} */ import prettier from "../../config/prettier-entry.js"; import printDoc from "../print-doc.js"; diff --git a/tests/integration/__tests__/patterns-dirs.js b/tests/integration/__tests__/patterns-dirs.js index 489e31da3..2a31ef1f1 100644 --- a/tests/integration/__tests__/patterns-dirs.js +++ b/tests/integration/__tests__/patterns-dirs.js @@ -1,8 +1,6 @@ import fs from "node:fs"; import path from "node:path"; - import createEsmUtils from "esm-utils"; - import { projectRoot } from "../env.js"; import jestPathSerializer from "../path-serializer.js"; diff --git a/tests/integration/__tests__/resolve-config-file.js b/tests/integration/__tests__/resolve-config-file.js index ac1698bdf..aa3d922ca 100644 --- a/tests/integration/__tests__/resolve-config-file.js +++ b/tests/integration/__tests__/resolve-config-file.js @@ -1,5 +1,4 @@ import url from "node:url"; - import prettier from "../../config/prettier-entry.js"; test("API resolveConfigFile", async () => { diff --git a/tests/integration/__tests__/with-parser-inference.js b/tests/integration/__tests__/with-parser-inference.js index 3c99d1f44..c85c83401 100644 --- a/tests/integration/__tests__/with-parser-inference.js +++ b/tests/integration/__tests__/with-parser-inference.js @@ -1,5 +1,4 @@ import { outdent } from "outdent"; - import prettier from "../../config/prettier-entry.js"; describe("infers postcss parser", () => { diff --git a/tests/integration/cli-worker.js b/tests/integration/cli-worker.js index da0d47117..79d7cff75 100644 --- a/tests/integration/cli-worker.js +++ b/tests/integration/cli-worker.js @@ -3,7 +3,6 @@ import path from "node:path"; import readline from "node:readline"; import url from "node:url"; import { parentPort, workerData } from "node:worker_threads"; - import { prettierCli, prettierMainEntry } from "./env.js"; const normalizeToPosix = diff --git a/tests/integration/env.js b/tests/integration/env.js index 943e6b4e9..fd9cc5036 100644 --- a/tests/integration/env.js +++ b/tests/integration/env.js @@ -1,5 +1,4 @@ import path from "node:path"; - import createEsmUtils from "esm-utils"; const { __dirname, require } = createEsmUtils(import.meta); diff --git a/tests/unit/html-elements.js b/tests/unit/html-elements.js index 069338f22..2d7e957f3 100644 --- a/tests/unit/html-elements.js +++ b/tests/unit/html-elements.js @@ -1,5 +1,4 @@ import { htmlTagNames } from "html-tag-names"; - import { CSS_DISPLAY_DEFAULT, CSS_DISPLAY_TAGS, diff --git a/tests/unit/syntax-transform.js b/tests/unit/syntax-transform.js index 8d2cb8479..87f8cb7b4 100644 --- a/tests/unit/syntax-transform.js +++ b/tests/unit/syntax-transform.js @@ -1,6 +1,5 @@ import path from "node:path"; import url from "node:url"; - import transformCode from "../../scripts/build/transform/index.js"; const file = url.fileURLToPath( diff --git a/website/playground/EditorState.js b/website/playground/EditorState.js index 476d9ba6d..982cb19d9 100644 --- a/website/playground/EditorState.js +++ b/website/playground/EditorState.js @@ -1,5 +1,4 @@ import * as React from "react"; - import { shallowEqual, stateToggler } from "./helpers.js"; import * as storage from "./storage.js"; diff --git a/website/playground/Playground.js b/website/playground/Playground.js index f1bc7cdf6..6571354ec 100644 --- a/website/playground/Playground.js +++ b/website/playground/Playground.js @@ -1,5 +1,4 @@ import * as React from "react"; - import { Button, ClipboardButton } from "./buttons.js"; import getCodeSample from "./codeSamples.mjs"; import generateDummyId from "./dummyId.js"; diff --git a/website/playground/index.js b/website/playground/index.js index 87d5b7d21..d6fe5bdde 100644 --- a/website/playground/index.js +++ b/website/playground/index.js @@ -2,7 +2,6 @@ import "codemirror-graphql/mode"; import * as React from "react"; import * as ReactDOM from "react-dom"; - import Playground from "./Playground.js"; import { fixPrettierVersion } from "./util.js"; import VersionLink from "./VersionLink.js"; diff --git a/website/playground/sidebar/SidebarOptions.js b/website/playground/sidebar/SidebarOptions.js index 721973bde..e328cae72 100644 --- a/website/playground/sidebar/SidebarOptions.js +++ b/website/playground/sidebar/SidebarOptions.js @@ -1,5 +1,4 @@ import * as React from "react"; - import { SidebarCategory } from "./components.js"; import Option from "./options.js"; diff --git a/website/playground/sidebar/options.js b/website/playground/sidebar/options.js index c759f155c..f62c886b3 100644 --- a/website/playground/sidebar/options.js +++ b/website/playground/sidebar/options.js @@ -1,5 +1,4 @@ import * as React from "react"; - import { Checkbox, NumberInput, Select } from "./inputs.js"; function BooleanOption({ option, value, onChange }) {