All Projects → simonhaenisch → Prettier Plugin Organize Imports

simonhaenisch / Prettier Plugin Organize Imports

Licence: mit
Make Prettier organize your imports using the TypeScript language service API.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Labels

Projects that are alternatives of or similar to Prettier Plugin Organize Imports

Spotless
Keep your code spotless
Stars: ✭ 2,285 (+929.28%)
Mutual labels:  prettier
Doctorpretty
Wadler's "A prettier printer" embedded pretty-printer DSL for Swift
Stars: ✭ 186 (-16.22%)
Mutual labels:  prettier
Prettier Chrome
🎨 An extension that can run Prettier in the browser
Stars: ✭ 207 (-6.76%)
Mutual labels:  prettier
Eslint Plugin Prettier
ESLint plugin for Prettier formatting
Stars: ✭ 2,228 (+903.6%)
Mutual labels:  prettier
Eslint Config Wesbos
No-Sweat™ Eslint and Prettier Setup - with or without VS Code
Stars: ✭ 2,293 (+932.88%)
Mutual labels:  prettier
Init.nvim
An Opinionated Neovim Config for the Minimalists
Stars: ✭ 194 (-12.61%)
Mutual labels:  prettier
Gatsby V2 Tutorial Starter
Gatsby V2 Starter - product of step by step tutorial
Stars: ✭ 139 (-37.39%)
Mutual labels:  prettier
Modern Node
All-in-one development toolkit for creating node modules with Jest, Prettier, ESLint, and Standard
Stars: ✭ 216 (-2.7%)
Mutual labels:  prettier
React Conf 17 Videos
Find that one presentation you missed!
Stars: ✭ 182 (-18.02%)
Mutual labels:  prettier
Prettier Ruby
Prettier for ruby
Stars: ✭ 196 (-11.71%)
Mutual labels:  prettier
Prettier Stylelint
code > prettier > stylelint > formatted code
Stars: ✭ 162 (-27.03%)
Mutual labels:  prettier
Lad
👦 Lad is the best Node.js framework. Made by a former Express TC and Koa team member.
Stars: ✭ 2,112 (+851.35%)
Mutual labels:  prettier
Mullet
Mullet Stack: Facebook in the front. Walmart in the back. (React, Hapijs, Node)
Stars: ✭ 194 (-12.61%)
Mutual labels:  prettier
Prettier Plugin Solidity
Prettier plugin for Solidity
Stars: ✭ 156 (-29.73%)
Mutual labels:  prettier
Prettier Plugin Sort Imports
A prettier plugin to sort imports in typescript and javascript files by the provided RegEx order.
Stars: ✭ 205 (-7.66%)
Mutual labels:  prettier
Pettier
Prettier config that randomizes options and arbitrarily switches between spaces and tabs 🙄
Stars: ✭ 149 (-32.88%)
Mutual labels:  prettier
Stylelint Prettier
Stylelint plugin for Prettier formatting
Stars: ✭ 188 (-15.32%)
Mutual labels:  prettier
Prettier Tslint
Code ➡️ prettier ➡️ tslint --fix ➡️ Formatted Code ✨
Stars: ✭ 221 (-0.45%)
Mutual labels:  prettier
React Luo
React Automatically - 保持最新技术 react17 hooks router5 webpack5 babel7 antd4
Stars: ✭ 211 (-4.95%)
Mutual labels:  prettier
Prettier Plugin Tailwind
Sort tailwind classes in HTML with Prettier.
Stars: ✭ 192 (-13.51%)
Mutual labels:  prettier

Tests

Prettier Plugin: Organize Imports

Make sure that your import statements stay consistent no matter who writes them and what their preferences are.

A plugin that makes Prettier organize your imports (i. e. sort and remove unused imports) using the organizeImports feature of the TypeScript language service API. This is the same as using the "Organize Imports" action in VS Code.

Installation

npm install --save-dev prettier-plugin-organize-imports

prettier and typescript are peer dependencies, so make sure you have those installed in your project.

Usage

The plugin will be loaded by Prettier automatically. No configuration needed.

Files containing the substring // organize-imports-ignore or // tslint:disable:ordered-imports are skipped.

Rationale

This plugin acts outside of Prettier's scope because "Prettier only prints code. It does not transform it.", and technically sorting is a code transformation because it changes the AST (this plugin even removes code, i. e. unused imports). In my opinion however, the import statements are not really part of the code, they are merely directives that instruct the module system where to find the code (only true as long as your imports are side-effects free regarding the global scope, i. e. import order doesn't matter), comparable with using directives in C# or #include preprocessing directives in C. Therefore the practical benefits outweigh sticking with the philosophy in this case.

License

MIT.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].