Questions tagged [prettier]

Prettier stands as a definitive code formatter for various programming languages, including JavaScript, CSS, HTML, Markdown, and more. For better comprehension of your question, I kindly request you to utilize Prettier's Playground by clicking on the "Copy link" and "Copy markdown" buttons located at the bottom right corner of the Playground.

What are some ways to adjust ESlint's strictness when using Prettier in a React project that utilizes Material-UI?

Update I made some changes to the .eslintc file in my client app's root directory. I added a JS Object with an "extends" attribute defined as "react-app" and included the "prettier" plugin in the "plugins" array. { "extends": "react-app", "plugi ...

Enhancing the Aesthetics of Your Online Experience

I am attempting to format an input text using a react app. The goal is for this component to receive a text input from props, undergo the necessary "translator" functions, and display the translated code on the right side. I want the new text const newInpu ...

Different methods for organizing an array of strings based on eslint/prettier

I possess an assortment of keys that I desire to sort in alphabetical order whenever I execute eslint --fix/prettier. My inference is that such a feature does not exist by default due to its potential impact on the code's behavior. Therefore, my query per ...

Parentheses are automatically wrapped around the implicit return of arrow functions

Currently, I am utilizing Visual Studio Code along with Prettier, and I have noticed that the function: (token: string) => this.token = token is being transformed into: (token: string) => (this.token = token) This modification seems to decrease r ...

Pretty print error: The specified file or directory does not exist

I recently incorporated eslint and prettier into my existing CSR react project, but when I ran 'npm run prettier' I encountered the following errors. How can I resolve this error? Just so you know, there is a src/App.tsx file contrary to the err ...

VSCode - when indenting, spaces are added around strings

Currently, I am utilizing Vue 3 along with Prettier in VS Code. One issue I am encountering is that when a string is on its own line, it is formatted correctly to my liking. However, the problem arises when my browser in Dev Tools renders strings with extr ...

Tips for maintaining the 'client use' code snippet at the beginning of your Vs Code script

In my quest to utilize the NextJs app directory, I've come across a dilemma. To implement client-side components, it mandates the usage of 'use client' at the beginning of the file. However, Vs Code has a tendency to relocate this statement ...

What steps do I need to take to ensure NextJS stores my edits in VSCode?

I have attempted various troubleshooting steps such as changing file extensions from .js to .jsx, turning on Prettier for formatting upon saving, setting it as the default formatter, reloading and restarting the editor. However, the issue with not being ...

Exploring the compatibility of Husky with Typicode using Yarn

Currently, I have implemented the use of husky to configure git hooks for prettier. However, I am facing a persistent issue whenever I attempt to commit or push: > husky - Can't find npm in PATH. Skipping precommit script in package.json My curre ...

Error: Prettier is expecting a semi-colon in .css files, but encountering an unexpected token

I'm currently attempting to implement Prettier with eslint and TypeScript. Upon running npm run prettier -- --list-different, I encountered an error in all of my css files stating SyntaxError: Unexpected token, expected ";". It seems like there might be an ...

In Visual Studio Code, beautification feature splits HTML attributes onto separate lines, improving readability and code organization. Unfortunately, the print width setting does not apply

I have done extensive research and tried numerous solutions, When using Angular and formatting HTML with Prettier, it appears quite messy as it wraps each attribute to a new line, for example: <button pButton class="btn" ...

Is there a way to set up custom rules in eslint and prettier to specifically exclude the usage of 'of =>' and 'returns =>' in the decorators of a resolver? Let's find out how to implement this

Overview I am currently working with NestJS and @nestjs/graphql, using default eslint and prettier settings. However, I encountered some issues when creating a graphql resolver. Challenge Prettier is showing the following error: Replace returns with (r ...

Is there a way to determine which version of ESLint is currently running on Visual Studio 2019?

While attempting to run ESLint on Visual Studio 2019, everything goes smoothly until I add eslint-plugin-prettier to my package.json file. At that point, an error arises. internal-error | (ESLint) Failed to load plugin prettier: Cannot find module 'esli ...

Is it possible for prettier to substitute var with let?

One of the tools I utilize to automatically format my Typescript code is prettier. My goal is to find out if there is a way to have prettier replace all instances of 'var' with 'let' during the formatting process. Below is the script I currently use to fo ...

In what ways can I align the ESLint rules of my Node.js server with those of my Vue.js frontend?

I am looking to ensure that my Node.js server-side files follow the same ESLint rules as my Vue.js frontend. The .eslintrc.js file in my Vue project is structured as follows: module.exports = { root: true, env: { node: true }, extends: ["plugin ...

Is there a way to prevent prettier from automatically adding a new line when formatting HTML tags with ">"?

While navigating through the Prettier extension in Vscode, I am struggling to find a way to disable a specific scenario. In particular, I am having trouble with the formatting of an html tag. Below is a snippet of code that requires some adjustments whene ...

ESLint and Prettier are butting heads when trying to run their commands consecutively

My package.json file includes two commands: "format": "prettier --write \"{src,{tests,mocks}}/**/*.{js,ts,vue}\"", "lint": "eslint . -c .eslintrc.js --rulesdir eslint-internal-rules/ --ext .ts,.js,.vue ...