Options
All
  • Public
  • Public/Protected
  • All
Menu

These are all the comparator functions for separating two Imports. They all implement SeparateByFunction.

You can read the filenames as "separate imports by..."

Index

Functions

  • unequalNamespaceUse(leadingImport: Import, followingImport: Import): boolean
  • Place a separator between two imports if one of them is using a namespace import and the other one is not.

    Example:

    // unseparated
    import everything from "stuff";
    import everyone from "people";
    import * as everywhere from "places";
    import * as everyway from "ways";
    import everybody from "persons";

    // separated
    import everything from "stuff";
    import everyone from "people";

    import * as everywhere from "places";
    import * as everyway from "ways";

    import everybody from "persons";
    see

    Import#isNamespace

    Parameters

    Returns boolean

  • unequalPackageState(leadingImport: Import, followingImport: Import): boolean
  • Place a separator between two imports if one of them is imported from a package and the other one from a relative path.

    Example:

    // unseparated
    import a from "alpha";
    import b from "beta";
    import c from "./gamma";
    import d from "./delta";
    import e from "epsilon";

    // separated
    import a from "alpha";
    import b from "beta";

    import c from "./gamma";
    import d from "./delta";

    import e from "epsilon";
    see

    ImportElement#isPackage

    see

    ImportElement#isRelative

    Parameters

    Returns boolean

  • unequalSideEffectUse(leadingImport: Import, followingImport: Import): boolean
  • Place a separator between two imports if one of them is importing only for side effects.

    Example:

    // unseparated
    import a from "alpha";
    import b from "bravo";
    import "charlie";
    import "delta";
    import e from "echo";

    // separated
    import a from "alpha";
    import b from "bravo";

    import "charlie";
    import "delta";

    import e from "echo";
    see

    Import#isSideEffectOnly

    Parameters

    Returns boolean

Generated using TypeDoc