Skip to content

Feature request: Add option to keep the import statement always on one line #84

Description

@Waterstraal

Describe the feature
I would like to have an option that forces imports to be on 1 line.

So this:

import huffman from "n-ary-huffman";
import { repr } from "tiny-decoders";

import iconsChecksum from "../icons/checksum";
import type {
  ElementReport,
  ElementTypes,
  ElementWithHint,
  ExtendedElementReport,
  HintMeasurements,
  HintUpdate,
} from "../shared/hints";
import {
  type HintsMode,
  type KeyboardAction,
  type NormalizedKeypress,
} from "../shared/keyboard";
import {
  Resets,
  addListener,
  bind,
  isMixedCase,
  log,
  makeRandomToken,
  partition,
  splitEnteredText,
  unreachable,
} from "../shared/main";
import type {
  FromBackground,
  FromOptions,
  FromPopup,
  FromRenderer,
  FromWorker,
  ToBackground,
  ToOptions,
  ToPopup,
  ToRenderer,
  ToWorker,
} from "../shared/messages";
import {
  type OptionsData,
  type PartialOptions,
  flattenOptions,
  getDefaults,
  makeOptionsDecoder,
  unflattenOptions,
} from "../shared/options";
import { type Durations, type Perf, TimeTracker } from "../shared/perf";

Would be printed as:

import huffman from "n-ary-huffman";
import { repr } from "tiny-decoders";

import iconsChecksum from "../icons/checksum";
import type { ElementReport, ElementTypes, ElementWithHint, ExtendedElementReport, HintMeasurements, HintUpdate } from "../shared/hints";
import { type HintsMode, type KeyboardAction, type NormalizedKeypress } from "../shared/keyboard";
import { Resets, addListener, bind, isMixedCase, log, makeRandomToken, partition, splitEnteredText, unreachable } from "../shared/main";
import type { FromBackground, FromOptions, FromPopup, FromRenderer, FromWorker, ToBackground, ToOptions, ToPopup, ToRenderer, ToWorker } from "../shared/messages";
import { type OptionsData, type PartialOptions, flattenOptions, getDefaults, makeOptionsDecoder, unflattenOptions } from "../shared/options";
import { type Durations, type Perf, TimeTracker } from "../shared/perf";

(example taken from the prettier discussion on this topic)

Describe the use case you need it for
IMHO single line imports are much cleaner and take up less space. I would like to run import-conductor after prettier, to make my imports consistent and on a single line.

Other
Note: dprint added this: dprint/dprint-plugin-typescript#365

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions