azz / prettier-tslint

Code ➡️ prettier ➡️ tslint --fix ➡️ Formatted Code ✨
https://npm.im/prettier-tslint
MIT License
225 stars 13 forks source link

Print Width is not respected #30

Closed CyberMew closed 5 years ago

CyberMew commented 5 years ago

Prettier in VSCode settings is set to 80. Tslint Integration has been set. tslint.json has "max-line-length": [true, 80]

I tried creating a .prettierrc.json file with "printWidth": 80 but it also doesn't work.

Is this a bug or am I missing something?

aleclarson commented 5 years ago

Can you reproduce with prettier-tslint in command line?

What is happening instead?

ahmedkamalio commented 5 years ago

Hi, @aleclarson I'm facing the same issue here, this is the rule in tslint.json

"max-line-length": [
            true,
            {
                "limit": 100,
                "ignore-pattern": "^import |^export {(.*?)}"
            }
        ]

using npm "pretty": "prettier-tslint fix **/*.ts" the rule seems to be ignored and lines wrap at 80 columns, but for me adding .prettierrc file with "printWidth": 100 fixed the issue.

@CyberMew please try to rename .prettierrc.json to .prettierrc and check if it's going to solve the problem.

aleclarson commented 5 years ago

@AhmedMKamal That's not the same. You're looking for #25.

@CyberMew is claiming that neither Prettier's printWidth nor TSLint's max-line-length are being respected, even when they're equal.

CyberMew commented 5 years ago

Can you reproduce with prettier-tslint in command line?

What is happening instead?

Sorry for the late reply. Nothing happens to the file when I run the command, no output either. I wonder whose issue this belongs to.

mac:react-native username$ npx prettier-tslint fix ./src/Components/SelectionRow.ts 
./src/Components/SelectionRow.ts

There are several situations where it will just flatout exceed 80 characters even when I have formatted it manually nicely. You can also reproduce this easily by having a long line like this:

import { SelectionRow as Template } from "Some/Very/Long/Name/That/Just/Exceeds80/SelectionRow";

I think by right it should format it to:

import {
  SelectionRow as Template
 } from "Some/Very/Long/Name/That/Just/Exceeds80/SelectionRow";
aleclarson commented 5 years ago

Prettier leaves that import statement alone. See here.

Closing this until you provide a sample repository.