DEV Community

Cover image for Just My Type: Rolling a fresh TypeScript project with Jest, ESLint and Prettier in 2019

Just My Type: Rolling a fresh TypeScript project with Jest, ESLint and Prettier in 2019

Martin Gaston on July 06, 2019

TypeScript's motto is that it's JavaScript that scales, and one area where that's definitely true is in the extra work you have to do in order to s...
Collapse
 
rcoundon profile image
Ross Coundon • Edited

Thanks Martin, nicely put together. Do you happen to know how to deal with errors from eslint when linting files in folders beginning/ending with double underscores? like __ mocks __ (spaces added to avoid markdown formatting) ? I see errors like these and can't see a way around it:

ESLint: 6.1.0.

No files matching the pattern "./src/mocks" were found.
Please check for typing mistakes in the pattern.

Collapse
 
tkdmzq profile image
TKDMzq

Im not martin but maybe your shell treats it like special characters. Try escape those.

Collapse
 
rcoundon profile image
Ross Coundon

Ah ha - changing from

"lint": "eslint --fix ./src/*"

to

"lint": "eslint --fix './src/*/'"

sorted it. Cheers

(I use zsh)

Thread Thread
 
martingaston profile image
Martin Gaston

Hey Ross! Really sorry I missed your comment but glad you got it sorted out - I think escaping it is definitely the way to go, apologies for missing that out in my post.

I will update accordingly, I massively appreciate you letting me know!

Collapse
 
zhuangya profile image
zhuangya

I think you also need to install @types/node.

Collapse
 
hotcher2 profile image
Al Hotchkiss

Excellent post! I'm just getting started with Typescript and web components so this was a great first step.

Collapse
 
martingaston profile image
Martin Gaston

Thanks Al! I'm so sorry it took me so long to reply to your comment but thanks for taking the time to say that. I hope you're having a great time with TypeScript 👍