Registry / type-stubs / import-sort-parser-typescript

import-sort-parser-typescript

JSON →
library6.0.0jsnpmunverified

import-sort-parser-typescript is a specialized parser module designed for the import-sort ecosystem, specifically to handle TypeScript and TSX files. It leverages the native TypeScript compiler for syntax parsing, enabling import sorting based on the TypeScript language rules. As a component, it is typically used in conjunction with `import-sort`, `import-sort-config`, and a chosen sorting style. The package is currently at version 6.0.0, but was last published approximately 7 years ago, suggesting a maintenance or possibly abandoned status rather than active development. Its primary differentiation lies in using the TypeScript parser directly, which historically provided accurate parsing for TypeScript-specific constructs, but its age raises concerns about compatibility with recent TypeScript versions and features. Release cadence is effectively halted given its last update.

npm install import-sort-parser-typescript
INSTALL
IMPORT
SIG · IMPORT-SORT-PARSER
I
import-sort-parser-typescript
type-stubsjavascriptv6.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
import parser from 'import-sort-parser-typescript';
import { parser } from 'import-sort-parser-typescript';
The package exports a default `parser` object, which is then passed to the main `import-sort` library for processing.
Parser Configuration
{ "importSort": { "parser": "typescript" } }
"parser": "import-sort-parser-typescript"
When configuring `import-sort` in `package.json` or `.importsortrc.json`, you specify the parser name ('typescript'), not the package name directly.

Demonstrates how to integrate `import-sort-parser-typescript` into a project's `package.json` for automatic import sorting with the `import-sort` CLI tool. It sets up the necessary dependencies and configures `import-sort` to use the 'typescript' parser for .ts and .tsx files.

{ "name": "my-project", "version": "1.0.0", "description": "Example project using import-sort with TypeScript", "main": "index.js", "scripts": { "sort-imports": "import-sort -l" }, "devDependencies": { "import-sort": "^5.0.0", "import-sort-cli": "^6.0.0", "import-sort-config": "^6.0.0", "import-sort-parser-typescript": "^6.0.0", "import-sort-style-renke": "^6.0.0", "typescript": "^4.0.0" }, "importSort": { "\.ts$": { "parser": "typescript", "style": "renke" }, "\.tsx?$": { "parser": "typescript", "style": "renke" } } } // To use this, save the above as package.json, then run: // npm install // npm run sort-imports
Debug
Known issues
breakingThe package `import-sort-parser-typescript` has not been updated in approximately 7 years (last published Feb 16, 2019). This means it likely does not support newer TypeScript syntax features (e.g., decorators, new module resolutions, syntax additions in TS 4.x and 5.x) which can lead to parsing errors or incorrect sorting for modern TypeScript codebases.
fix
Consider migrating to a more actively maintained import sorting solution that natively supports recent TypeScript versions, such as `@trivago/prettier-plugin-sort-imports`, `eslint-plugin-simple-import-sort`, or configuring ESLint's `sort-imports` rule with `@typescript-eslint/parser`.
affects: >=6.0.0
gotchaThis package is a parser for the `import-sort` ecosystem, not a standalone tool. It must be used with `import-sort` (e.g., via `import-sort-cli` or an editor extension) and configured to specify the 'typescript' parser. Direct programmatic use for parsing outside of the `import-sort` runner is uncommon.
fix
Ensure you have `import-sort` and a runner (like `import-sort-cli`) installed and configured your `package.json` or `.importsortrc.json` to use `"parser": "typescript"` for your TypeScript files.
affects: >=1.0.0
deprecatedGiven its age, the `import-sort` ecosystem itself might be considered deprecated by many modern TypeScript workflows in favor of built-in editor features, Prettier plugins, or ESLint rules for import sorting.
fix
Explore native VS Code features ('Organize Imports'), Prettier plugins (e.g., `@trivago/prettier-plugin-sort-imports`), or ESLint rules (`sort-imports` with `@typescript-eslint/parser`) for potentially more robust and actively maintained import sorting solutions.
affects: >=6.0.0
Errors
Common errors & fixes
SyntaxError: Unexpected token '...', '...' expected (or similar parsing errors for new TS syntax)
Using `import-sort-parser-typescript` (last updated 7 years ago) with a modern TypeScript codebase that utilizes recent language features not understood by the outdated parser.
fix
Downgrade your TypeScript version (not recommended) or, preferably, switch to a more modern import sorting tool or plugin that is actively maintained and supports your current TypeScript version. Refer to the warnings for alternatives.
Error: Unknown parser: "import-sort-parser-typescript"
Incorrectly specifying the parser in your `import-sort` configuration by using the full package name instead of the designated alias.
fix
In your `importSort` configuration (e.g., in `package.json` or `.importsortrc.json`), ensure the parser is specified as `"parser": "typescript"` (the alias) and not `"parser": "import-sort-parser-typescript"`.
Upgrade
Version history
6.0.0latest on npm
Audit
Dependencies
typescriptrequiredRequired for parsing TypeScript syntax. The parser directly uses the TypeScript compiler API.
Agent activity
23 hits · last 30 days
node
21
OpenAI (training)
1
Resources
import-sort-parser-typescript — npm install import-sort-parser-typescript · libregistry