prettierd
prettier-plugin-sort-imports
Our great sponsors
prettierd | prettier-plugin-sort-imports | |
---|---|---|
5 | 9 | |
698 | 2,973 | |
- | 5.9% | |
9.0 | 5.9 | |
6 days ago | 2 months ago | |
TypeScript | TypeScript | |
ISC License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
prettierd
-
My Neovim setup for React, TypeScript, Tailwind CSS, etc
First, you need prettierd:
-
This j/k mappings should be default (for wrap) at least in Plugins like vim-pencil
Besides remapping keys, auto-format with prettier (null-ls, ALE, etc) will wrap your code on line break. This might not be desirable for txt files, but it's transparent and fully supported by markdown. It'll also fix things like aligning your markdown tables. There's also prettierd and prettier_d_slim to keep it running as a daemon in the background, which makes the buffer reformatting really snappy.
-
I'm searching for nvim configs of react/js developers
For react you will need the one for typescript and the eslint lsp is also used in the config to auto fix errors on save. Also this relies on prettierd to be installed globally: https://github.com/fsouza/prettierd
- Anyone know how to make prettier run faster when run on save? It takes about 2 seconds every time I write my buffer to desk for Neovim to become responsive again.
-
Speed-up your Prettier formatting using prettierd
But today I discovered this tool: https://github.com/fsouza/prettierd. This completely solves the issue: the slowness of prettier is due to the overhead of launching the program. This package leaves prettier running as a daemon, which removes the launch overhead (kind of similar to the already famous `eslint_d`).
prettier-plugin-sort-imports
-
Tailwind CSS: Automatic Class Sorting with Prettier
In a similar vein, you can sort imports with Prettier using Trivago’s plugin.
https://github.com/trivago/prettier-plugin-sort-imports
-
How to auto sort imports in frontend, example with typescript & nextjs
I went with my configuration you can go with one you like more. Find out more by clicking here
-
Looking to improve... Review my code??
For most conventions regarding file structure, I would use tools like ESLint / Prettier instead of trying to enforce it with comments. For example this Prettier plugin allows you to enforce a specific import order without any extra effort.
-
Starting React Native Project in 2023
Unsorted imports look ugly. Also, it could be hard to read and add new imports. So why not sort them automatically? We can do it with trivago/prettier-plugin-sort-imports.
-
React Best Practices - The Complete List
Your suggestion to sort imports is valid, but depends on VSCode as an IDE. It would be better to use Prettier with this plugin that sorts imports for you.
-
Fastest Frontend Tools in 2022
Despite the existence of Prettier, arguments about code style such as how to sort ES module imports still exist. Manually sorting ES modules wastes time, and usually leads to losing context when you are writing code and then have to navigate to the top of a file to modify your import statements. I love using the @trivago/prettier-plugin-sort-imports plugin which automatically sorts new imports, and works perfectly together with TypeScript's auto-import feature. Similarly, prettier-plugin-tailwindcss automatically sorts Tailwind classes in your code.
-
How do you enforce the order of imports?
If you are using prettier, you can use https://github.com/trivago/prettier-plugin-sort-imports
-
How to quickly sort imports with Prettier
In this GitHub repo, you can find a list of the other rules that are available.
-
React Best Practices – Tips for Writing Better React Code in 2022
For imports I like to use https://github.com/trivago/prettier-plugin-sort-imports so I don't have to think about it. Also, I think it's cleaner to have an index in your components folder that exports all of the named functions do you can import them into your files like:
What are some alternatives?
dotfiles
biome - A toolchain for web projects, aimed to provide functionalities to maintain them. Biome offers formatter and linter, usable via CLI and LSP.
prettier_d_slim
livecodes - Code Playground That Just Works!
dotfiles - All of my dotfiles are here.
node-typescript-boilerplate - Minimalistic project template to jump start a Node.js back-end application in TypeScript. ESLint, Jest and type definitions included.
CNvim - A lightweight Neovim config for web development
XToolSet - Typed import, and export XLSX spreadsheet to JS / TS. Template-based create, render, and export data into excel files.
dotfiles - My dotfiles
prettier-plugin-astro - Prettier plugin for Astro
gts - ☂️ TypeScript style guide, formatter, and linter.
easy-filter - EasyFilter is a lightweight ☁️, just one dependency 🚢, minimal setup 😮, intuitive 😃 and powerful 💪 filter for all your filter needs.