News for hackers. Stuff that matters.
Re:Using Prettier to format your JavaScript code by swyx on Friday March 09, 2018 @01:50AM (#16550181)
ah a perfect chance to get some Prettier+Typescript help! I am using Prettier+Typescript+React and when I do methods within classes, Prettier adds a semicolon for me at the end of each class which `tslint` doesnt like. As far as I can tell, there is no setting for Prettier to ignore ONLY semicolons WITHIN classes, its just a blanket on or off. And its somehow not respecting tslint's semicolon preference. Any idea how to fix this?

```

class Demo extends React.Component<{}, {}> {

    someStuff() {
      // some code
    }; // prettier adds this ; for me, i have to tslint:disable-line every time
}

```

Re:Using Prettier to format your JavaScript code by b-glad on Friday March 09, 2018 @02:29AM (#16550287)
Npm install tslint-config-prettier and add it to the extends array in tslint.json to switch tslint rules to be compatible with prettier
Re:Using Prettier to format your JavaScript code by swyx on Monday March 12, 2018 @12:47PM (#16569432)
appreciate the tip, have an upvote
Re:Using Prettier to format your JavaScript code by saranshk on Friday March 09, 2018 @02:26AM (#16550279)
I don't think they will add them. They are very opinionated and skeptical about adding configuration options. If there is more of those, then again everyone will try and have an opinion of their own and it will end up being like ESLint. Also that will lead to a lot of time spent on understanding the configuration file which will be a disadvantage as well since currently prettier just works!
Re:Using Prettier to format your JavaScript code by seepel on Friday March 09, 2018 @02:08AM (#16550224)
We just turn off tslint formatting rules. There isn’t really a need for them if you are using prettier.
Re:Using Prettier to format your JavaScript code by swyx on Friday March 09, 2018 @02:12AM (#16550233)
oh. unfortunately my team lead insists on having them. thanks anyway.
Re:Using Prettier to format your JavaScript code by mceachen on Friday March 09, 2018 @11:56AM (#16553040)
tslint, while quite useful last year, still had (and has) known bugs with unused variables, missing/incorrect type assertions, and other annoyances.

Most new versions of TypeScript expand on their `strict` rules, and just enabling `strict` in your tsconfig, as well as using prettier, is arguably a more robust superset of seatbelts than tslint offered. I deleted tslint from all my TS projects several months ago and don't miss it at all.

Re:Using Prettier to format your JavaScript code by NegativeLatency on Friday March 09, 2018 @11:12AM (#16552725)
I don’t use semicolons ;)