Import Sort Babylon Parser

6.0.0 · active · verified Sun Apr 19

import-sort-parser-babylon is a specialized parser plugin designed for the `import-sort` ecosystem, enabling the sorting of ECMAScript (ES2015+) imports in JavaScript and TypeScript files. Currently at version 6.0.0, this package integrates with the primary `import-sort` library, which is generally used in conjunction with `import-sort-config` and a chosen sorting style (e.g., `import-sort-style-eslint`). It leverages the capabilities of the Babel parser (formerly known as Babylon) to analyze and manipulate import declarations, offering robust support for modern JavaScript syntax, JSX, and TypeScript features. The `import-sort` project, of which this parser is a component, appears to maintain an active development cadence, providing tools for CLI usage, editor integrations, and programmatic sorting. Its key differentiator lies in its use of the battle-tested Babel parsing engine, ensuring broad compatibility with various language features and proposals.

Common errors

Warnings

Install

Imports

Quickstart

This configuration snippet for `.importsortrc` or `package.json` demonstrates how to instruct `import-sort` to use the `babylon` parser for various file types and configure Babel parser options for modern syntax support.

{
  "importSort": {
    "language": "javascript",
    ".js, .jsx, .ts, .tsx": {
      "parser": "babylon",
      "style": "eslint",
      "options": {
        "parserOptions": {
          "ecmaVersion": "latest",
          "sourceType": "module",
          "plugins": [
            "jsx",
            "typescript",
            "classProperties",
            "decorators-legacy",
            "dynamicImport"
          ]
        }
      }
    }
  }
}

view raw JSON →