1,700 questions
1
vote
1
answer
38
views
CSS single property auto-indent in VSCODE [closed]
How to configure VScode to keep CSS rules with only one property on a single line when autoformatting? Here is the expected result :
.p-auto { padding: auto !important; }
.px-0 {
padding-left: 0 !...
2
votes
1
answer
163
views
How to use Prettier as beautifier of user's code? [closed]
In my project Prettier is already connected for the project code formatting. I'm trying to use Prettier for user's code formatting in Ace Editor:
import * as prettier from 'prettier';
import * as ...
1
vote
0
answers
49
views
Configure Prettier to indent HTML attributes
What prettier does (Angular):
<button
class="drop-down"
(click)="showMenuPopup()"
tabindex="-1">
<img src="assets/dots.svg" alt="↓" /&...
3
votes
1
answer
572
views
How to migrate my CRA .eslintrc.js config to eslint.config.js in a new Vite + React 19 app
I'm trying to set up the same ESLint configuration in my new React 19 + Vite app using the modern eslint.config.js format. However, it's not working — the linter doesn’t show any errors or warnings in ...
0
votes
0
answers
31
views
Several prettier plugins for same language
We are using prettier with the following config:
{
"attributeGroups": [
"$ANGULAR_ELEMENT_REF",
"$ANGULAR_STRUCTURAL_DIRECTIVE",
"$...
-1
votes
2
answers
51
views
aligned variable declaration (js) [closed]
Is there a formatter similar to Prettier that can format Node.js code with aligned variable declarations like this?
const PRICE_BUTTER = 1.00;
const PRICE_MILK=3.00;
const PRICE_EGGS=6.95;
To:
const ...
1
vote
0
answers
191
views
how to use prettier recommended rules with eslint's defineConfig API?
I have a folder with this structure:
root
|- folderA
|- folderB
|- folderC
I want to apply two sets of rules to eslint to each folderA and folderB and completely skip folderC. so I have this:
export ...
1
vote
1
answer
139
views
Prettier. Right new line transition for closing html tag
Please help me to configure prettier for correct new line transition of closing tag for all cases.
Prettier config:
{
"bracketSameLine": true,
"singleAttributePerLine": true,
...
0
votes
0
answers
104
views
ESLint: enforce curly braces with backticks for all JSX string props in React Native SDK 52
Goal:
I’m using React Native SDK 52 with a flat‑config ESLint setup. I want every JSX prop that’s currently a plain string:
<View className="flex gap-5 p-3" />
to be auto‑fixed into a ...
0
votes
0
answers
44
views
prettier/prettier Replace single quote with double quote to remove escape character
How do I turn this off in prettier?
error Replace `'foo \'n bar'` with `"foo 'n bar"`
prettier/prettier
In my eslint.config.ts, I already have this line:
'prettier/prettier': ['error', { ...
-1
votes
1
answer
98
views
Why Does Prettier Break `return foo(` onto a New Line Even with `printWidth = 200`?
When I format the file, Prettier breaks the line and moves return foo( to a new line.
Why is that? I’ve set printWidth = 200, and there's plenty of space to keep it on one line.
How can I stop ...
0
votes
1
answer
70
views
How the use plugins with global configuration?
I would like to use the tailwind sorter plugin with prettier. But to specify "plugins", I have to use a local configuration file.
If I do use it, it will ignore my global prettier settings - ...
1
vote
1
answer
400
views
Prettier from within Spotless Maven plugin can't find node executable
I'm trying to use Prettier inside the Maven Spotless plugin.
The relevant config is similar to this:
<plugin>
<groupId>com.diffplug.spotless</groupId>
<...
0
votes
1
answer
170
views
How to Prevent Prettier from Breaking Angular Template Object Bindings?
I'm encountering a formatting issue between Prettier and Angular's template parser. Specifically, Prettier reformats my inline Angular template in a way that introduces an NG5002 parser error during ...
0
votes
1
answer
115
views
SQL formatting inside an XML not working in Spotless using Prettier
I am trying to use Spotless formatter to format XML that have SQL in it. Like this
<?xml version="1.0" encoding="UTF-8" ?>
<databaseChangeLog
xmlns:xsi="http://...
0
votes
0
answers
115
views
How to force eslint/prettier to not touch class member modifiers order?
Here is the problem:
When I run fixer then this
export class Test {
public declare id: number;
}
transforms into this
export class Test {
declare public id: number;
}
It is a problem for me ...
0
votes
0
answers
40
views
Parse vscode code snippets files as jsonc (with prettier)
Using prettier , the code snippets files in vscode end upp having red lines because those files are json with comments.
The language mode for those files in vscode is set to "Code snippets", ...
0
votes
0
answers
33
views
How to automatically wrap markdown paragraphs on save in VS Code [duplicate]
As a bit of a code neat-freak, I find myself formatting my README.mds and other various markdown files too much. Often this results in me spending time reformatting an entire paragraph in order to ...
1
vote
1
answer
780
views
Prettier plugin not resolved when using GitHub package with pnpm, but works with npm
I’ve got a GitHub package for my Prettier config that I use across a bunch of my projects. The config uses a plugin, and when I install the package using pnpm, it puts the plugin inside the .pnpm ...
-1
votes
2
answers
376
views
How can I configure eslint/prettier to not put HTML tags on new lines in React components?
I've been battling Prettier for a week and I cannot find an answer that solves my issue. My issue is the opinionated way Prettier puts all HTML opening and closing tags in JSX/TSX onto new lines. For ...
0
votes
0
answers
61
views
Use prettier to format Javascript code blocks in a FunnelWeb file
I have a FunnelWeb file whose @{...@} code blocks are tangled into a Javascript program. I want to use prettier to format these code blocks while leaving the non-code FunnelWeb source unchanged.
Here ...
0
votes
0
answers
86
views
Eslint Plugin for Prettier Conflicting Rules
I'm using the eslint-plugin-prettier in a Next.js project.
This is what my eslint config looks like:
import { FlatCompat } from "@eslint/eslintrc";
import eslintPluginPrettierRecommended ...
4
votes
1
answer
934
views
ESLint Not Working Properly in Vite + React + TypeScript
I'm working on a Vite + React + TypeScript project and using ESLint with the following configuration:
Relevant ESLint Config (.eslintrc.json)
{
"extends": [
"eslint:recommended&...
0
votes
2
answers
220
views
How to set up formatting to remove newlines between imports?
Given a code like this
import foo from 'foo';
import bar from 'bar';
Does anyone know a way of configuring either Prettier or ESLint to remove the space between imports with auto-formatting?
Thank ...
0
votes
0
answers
69
views
Prettier plugin for formatting enums removes comments — how to preserve the original printer?
I created a custom printer for Prettier to format enum declarations in a specific way. However, when using my custom printer, all comments inside the enum are removed.
I want my printer to only modify ...
2
votes
1
answer
262
views
prettier-ignore inside mdx + storybook + github
I have an .mdx file that includes a section I don't want prettier to modify:
> [!CAUTION]
> A word of caution
(Relevant issue ticket on why I need to do this in the first place)
I can add a ...
0
votes
0
answers
21
views
Extending default prettier printers [postcss]
What is the correct way of extending default printers with some extra logic?
My current approach is to write custom plugin which extends the current postcss printer, but it outputs error "...
1
vote
2
answers
966
views
Prettier @trivago/prettier-plugin-sort-imports fails to place .css imports at the bottom
I'm using @trivago/prettier-plugin-sort-imports to automatically sort imports in my React project. The sorting works for most cases, but I'm having issues getting .css and .scss imports that doesn't ...
-2
votes
2
answers
2k
views
ESLint Prettier: Parsing error: Unexpected token with
I am fairly new to ESLint, Prettier, and Babel; still learning how they work together. I am using Visual Studio Code 1.96.4, with ESLint and Prettier extensions.
In one of my javascript files, I have ...
0
votes
0
answers
47
views
How to change Prettier indentation?
errors being thrown
only 6 spaces
Below are the settings I currently have for Prettier:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnType&...
0
votes
0
answers
144
views
Prettier-plugin-tailwindcss's sorting is not useful
I first tried Tailwind CSS about a years ago. Recently, I got back into Next.js development and noticed that pretty much everyone is using Tailwind now, so I figured I’d give it another shot. My issue ...
0
votes
0
answers
507
views
Java Prettier with maven and Intellij
I want to use com.hubspot.maven.plugins:prettier-maven-plugin with maven project and integrate Prettier Java with Intellij.
Below is the maven plugin configuration:
<plugin>
<groupId>...
0
votes
0
answers
54
views
Howto overwrite the printers.html.print method in a prettier plugin
I'm trying to create a prettier plugin, that will ignore inline TYPO3 script code. When it's included within a start en end marker.
<!-- prettier-ignore-fluid-start -->
<!-- prettier-ignore-...
3
votes
0
answers
146
views
Prettier in Vue - disable a new line after html tag
I have this example in the Vue SFC:
<template>
<div>
<span if=false>
Feedback for the event was already sent before.
<span v-else>
Feedback for the event, <b&...
0
votes
1
answer
62
views
VS Code indention and prettier
I just have one question, currently I am using prettier and it formats on save but there are just things I don't understand that when I format the spaces or indetion are not equal. Is there a setting ...
1
vote
0
answers
450
views
Eslint: why eslint-config-prettier needed only to skip formatting?
I was going through https://vueschool.io/articles/vuejs-tutorials/upgrading-eslint-from-v8-to-v9-in-vue-js/ and I am wondering why the final example configuration in the tutorial looks like this:
...
0
votes
1
answer
149
views
How to properly setup prettier with husky and lint-staged in vue2 project?
In my Vue project, I want to run prettier on my staged files before each commit. To do this I
Installed prettier, husky and lint-staged and initialized husky with npx husky-init.
Added the following ...
0
votes
0
answers
21
views
Set DatePicker to null when getting ESLint and Prettier errors for null and undefined?
I am trying to give my custom DatePicker an initial value of null/make the date empty. I've tried setting the initial state to both null and undefined, but I get either a ESLint or Prettier error that ...
0
votes
1
answer
427
views
Eslint, Prettier and VSCode config not wokring
I am trying to convert my old eslint configuration file into the new eslint configuration, however I can't get it to work.
I am suing VScode and my old setup works that it underlines the wrongly ...
1
vote
1
answer
46
views
Vue @click="show = true" error Replace `show·=·true` with `(show·=·true)` eslint(prettier/perttier)
error
@click="show = true"
fix
@click="(show = true)"
.eslintrc.js
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:vue/strongly-recommended',
...
2
votes
1
answer
119
views
VScode Prettier Extension Not Formatting on Save
When saving a file that has Prettier configured as the default formatter, nothing happens and the file is not formatted.
I have looked at all the similar questions related to this issue, but they all ...
1
vote
1
answer
1k
views
Getting Prettier and ES Lint working on save with Nuxt 3
I've been having the hardest time getting linting setup in a Nuxt 3 boiler plate.
My requirements:
Prettier for formatting and stylistic rules
ES Lint for fixing problematic patterns and code
Vue ...
3
votes
1
answer
320
views
Formatting JSON with Prettier via ESLint (@eslint/json)
How can I fix JSON formatting issues with Prettier via ESLint.
I'm trying to use @eslint/json, rather than say eslint-plugin-json, it being the official supported plugin, and in an ideal world I'd ...
1
vote
0
answers
176
views
How to Install plugins and Configure Micro for Consistent Formatting with VSCode?
I want to have autoformatting upon save on my Micro text editor that is compatible with my Visual Studio Code formatting. Here is my settings.json file for my C# .NET and WPF XAML profile:
{
"...
0
votes
1
answer
79
views
Removed comma in rgba when I run Prettier
This is very weird to me. But I face this problem when I ever I run prettier (yarn run prettier -- write) and commit the code.
We are using Prettier check before running the write command.
Before ...
5
votes
1
answer
3k
views
How to configure Prettier and ESLint to format TypeScript/JavaScript imports into multiple lines?
I'm working on a TypeScript project and I want to configure Prettier and ESLint to automatically format my import statements when the line width exceeds the predefined printWidth rule of prettier. ...
0
votes
0
answers
665
views
Why ESLint and Prettier stopped working in a VScode?
I have a Vite+React project and everything was working fine. I haven't opened it for a month and now when I do open it, I see an error like this in all the components. Also, Prettier doesn't fix or ...
2
votes
0
answers
216
views
syntax highlighting breaks in vue 3 (typescript) when specify type of prop inside template
I am playing with prettier on my vue.ts project. (composition API)
I have one file where I have to specify the type of the prop using type assertion inside template tag. Without brackets around ...
1
vote
1
answer
967
views
ignoring files for prettier doesn't work I tried placing it in many different directories
I am trying to ignore one specific file from prettier because it messes up the format but it is not working.
First I put a .prettierignore file in the directory the file is in and added * to the ...
1
vote
3
answers
157
views
Using VSCode and Prettier, how to have files automatically formatted upon creation?
In my Angular project, when I create new components, the files aren't automatically formatted. I have to manually save each file to apply formatting. Is there a way to configure this so that the files ...