{"id":14630,"library":"import-sort-parser-typescript","title":"Import Sort Parser for TypeScript","description":"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.","status":"maintenance","version":"6.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/renke/import-sort","tags":["javascript","typescript"],"install":[{"cmd":"npm install import-sort-parser-typescript","lang":"bash","label":"npm"},{"cmd":"yarn add import-sort-parser-typescript","lang":"bash","label":"yarn"},{"cmd":"pnpm add import-sort-parser-typescript","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for parsing TypeScript syntax. The parser directly uses the TypeScript compiler API.","package":"typescript","optional":false}],"imports":[{"note":"The package exports a default `parser` object, which is then passed to the main `import-sort` library for processing.","wrong":"import { parser } from 'import-sort-parser-typescript';","symbol":"parser","correct":"import parser from 'import-sort-parser-typescript';"},{"note":"When configuring `import-sort` in `package.json` or `.importsortrc.json`, you specify the parser name ('typescript'), not the package name directly.","wrong":"\"parser\": \"import-sort-parser-typescript\"","symbol":"Parser Configuration","correct":"{\n  \"importSort\": {\n    \"parser\": \"typescript\"\n  }\n}"}],"quickstart":{"code":"{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Example project using import-sort with TypeScript\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"sort-imports\": \"import-sort -l\"\n  },\n  \"devDependencies\": {\n    \"import-sort\": \"^5.0.0\",\n    \"import-sort-cli\": \"^6.0.0\",\n    \"import-sort-config\": \"^6.0.0\",\n    \"import-sort-parser-typescript\": \"^6.0.0\",\n    \"import-sort-style-renke\": \"^6.0.0\",\n    \"typescript\": \"^4.0.0\" \n  },\n  \"importSort\": {\n    \"\\.ts$\": {\n      \"parser\": \"typescript\",\n      \"style\": \"renke\"\n    },\n    \"\\.tsx?$\": {\n      \"parser\": \"typescript\",\n      \"style\": \"renke\"\n    }\n  }\n}\n\n// To use this, save the above as package.json, then run:\n// npm install\n// npm run sort-imports","lang":"json","description":"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."},"warnings":[{"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`.","message":"The 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.","severity":"breaking","affected_versions":">=6.0.0"},{"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.","message":"This 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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"Given 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.","severity":"deprecated","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"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.","cause":"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.","error":"SyntaxError: Unexpected token '...', '...' expected (or similar parsing errors for new TS syntax)"},{"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\"`.","cause":"Incorrectly specifying the parser in your `import-sort` configuration by using the full package name instead of the designated alias.","error":"Error: Unknown parser: \"import-sort-parser-typescript\""}],"ecosystem":"npm"}