prettier

TSLint not working with CRA and TypeScript

自古美人都是妖i 提交于 2019-12-05 03:59:15
I'm banging my head for hours trying to enable linting for a TypeScript project created with create-react-app. The wmonk/create-react-app-typescript repo is now deprecated Therefore, I followed these instructions from the CRA documentation The issue is that the suggested implementation above doesn't add any linting to the newly created project. So far I've tried: Installing TypeScript TSLint Plugin as an extension to my VSCode Creating a tslint.json file on my project with the following config: { "rules": { "no-debugger": false, "no-console": false, "interface-name": false }, "linterOptions":

Why do I keep getting Delete 'cr' [prettier/prettier]?

笑着哭i 提交于 2019-12-04 08:05:05
问题 I am using vscode with Prettier 1.7.2 and Eslint 1.7.0. After every newline I get: [eslint] Delete 'cr' [prettier/prettier] This is the .eslintrc.json: { "extends": ["airbnb", "plugin:prettier/recommended"], "env": { "jest": true, "browser": true }, "rules": { "import/no-extraneous-dependencies": "off", "import/prefer-default-export": "off", "no-confusing-arrow": "off", "linebreak-style": "off", "arrow-parens": ["error", "as-needed"], "comma-dangle": [ "error", { "arrays": "always-multiline",

Prettier + Airbnb's ESLint config

别来无恙 提交于 2019-12-04 08:03:12
问题 Recently, I've started using Visual Studio Code for my editor and found the Prettier - JavaScript formatter. I think it's a great plugin because it helps me keep my code looking nice. I set up Airbnb's ESLint config and have found that to be super helpful. Here's the catch. The Airbnb ESLint config I'm currently running doesn't play nice with Prettier. For example, for JavaScript string, Prettier is formatted to include double ticks and Airbnb's ESLint like single ticks. When I format the

Prettier + Airbnb's ESLint config

你。 提交于 2019-12-02 20:21:00
Recently, I've started using Visual Studio Code for my editor and found the Prettier - JavaScript formatter. I think it's a great plugin because it helps me keep my code looking nice. I set up Airbnb's ESLint config and have found that to be super helpful. Here's the catch. The Airbnb ESLint config I'm currently running doesn't play nice with Prettier. For example, for JavaScript string, Prettier is formatted to include double ticks and Airbnb's ESLint like single ticks. When I format the code using Prettier, then Airbnb's ESLint doesn't agree. I know Kent Dodds has done some work with ESLint

Can't get correct autoformat on save in Visual Studio Code with ESLint and Prettier

↘锁芯ラ 提交于 2019-12-02 15:38:19
in Visual Studio Code with ESLint and Prettier when working on .vue files, it seems I can't get vue/max-attributes-per-line to auto-fix correctly. For example, with vue/max-attributes-per-line set to 'off', and I try to add line breaks manually it corrects it to always have every element on no more than one line, no matter if it is 81, 120, 200, or more characters wide. How can I figure out what is forcing my markup elements onto exactly one line? I am using ESLint version 5.1.0 and Visual Studio Code (without the Prettier Extension), with Prettier 1.14.2. Here's the example in a .vue file-- I

Closing > in new line

穿精又带淫゛_ 提交于 2019-12-01 20:26:15
问题 I have problem with '>' in tags. I got: <label class="custom-control-label" for="building{{building.Id}}" > {{ building.City }}, {{ building.Name }} </label> How to make label starting tag '>' in the same line as last attribute? I use Prettier, but I neither couldn't find solution in their config nor in code settings. <label class="custom-control-label" for="building{{building.Id}}"> {{ building.City }}, {{ building.Name }} </label> Solution: I've used built-in VS Code formatter. 回答1: That

Closing > in new line

狂风中的少年 提交于 2019-12-01 19:27:46
I have problem with '>' in tags. I got: <label class="custom-control-label" for="building{{building.Id}}" > {{ building.City }}, {{ building.Name }} </label> How to make label starting tag '>' in the same line as last attribute? I use Prettier, but I neither couldn't find solution in their config nor in code settings. <label class="custom-control-label" for="building{{building.Id}}"> {{ building.City }}, {{ building.Name }} </label> Solution: I've used built-in VS Code formatter. That setting in prettier is called jsxBracketSameLine and needs to be set to true Documentation https://prettier.io

Prettier/VSCode Eslint weird format/syntax breaking bug

雨燕双飞 提交于 2019-12-01 16:59:24
Sometimes when I startup VSCode and I save an JS file, everything gets messed up. example From: To: On save What I found out: When I change a VSCode User setting (something related to the prettier plugin | anything (I normally change the prettier.eslintIntegration but it could be that any change in the setting resolves it)) it stops breaking on save. Possible related environment details // Part of .eslintrc { parser: 'babel-eslint', extends: ['airbnb', 'prettier'], plugins: ['prettier'], rules: { 'prettier/prettier': 'error' } ... } // .prettierrc.yml printWidth: 80 tabWidth: 4 useTabs: false

How do I run a code formatter over my source without modifying git history?

心不动则不痛 提交于 2019-11-29 16:05:02
I am trying to format an entire repo using a code formatter tool. In doing so, I want to keep information about who committed which line, so that commands like git blame still show the correct information. By this, I mean it should show the author that previously edited each line (before it was formatted). There is the git filter-branch command which allows you to run a command against each revision of the repo starting from the beginning of time. git filter-branch --tree-filter '\ npx prettier --write "src/main/web/app/**/**.{js, jsx}" || \ echo "Error: no JS files found or invalid syntax"' \

vscode 中的 vue 格式化(一)

ε祈祈猫儿з 提交于 2019-11-29 05:28:24
使用 vscode 开发 vue, 必不可少的插件包括 vetur , prettier vetur 提供了下面一系列的功能: Features Syntax-highlighting 高亮 Snippet 代码片段 Emmet 缩写语法 Linting / Error Checking 代码格式检查 Formatting 代码格式化 Auto Completion 自动补全 Debugging debug 这些功能挺齐全了,但是 vetur 使用的代码格式化工具是 prettier ,所以如果不安装 prettier 的话也是不能正常完成格式化的。 不过 prettier 的默认是 tab 占两个空格,不符合我的习惯,所以要改成 4 个空格。 另外 vscode 自身的 html 和 js 的格式化就已经挺符合我的习惯了,因此也改为使用 vscode 的。 最终的设置如下: "vetur.format.defaultFormatter.js": "vscode-typescript", "vetur.format.defaultFormatter.html": "js-beautify-html", "vetur.format.defaultFormatter.ts": "vscode-typescript", "vetur.format.defaultFormatter.css