DEV Community

Cover image for What kind of tslint config you use for your React project?
Evaldas Buinauskas
Evaldas Buinauskas

Posted on

6 2

What kind of tslint config you use for your React project?

I've just started looking at TypeScript, React and wanted to prepare a nice working environment for it.

I've began with

create-react-app my-app --scripts-version=react-scripts-ts
Enter fullscreen mode Exit fullscreen mode

Added following dependencies

yarn add -D prettier tslint-config-prettier tslint-plugin-prettier husky pretty-quick
Enter fullscreen mode Exit fullscreen mode

Let Prettier know that I want single quotes, not doubles:

{
  "singleQuote": true
}
Enter fullscreen mode Exit fullscreen mode

Have added the following to my tslint.json:

{
  "extends": [
    "tslint-react",
    "tslint-plugin-prettier",
    "tslint-config-prettier"
  ],
  "rules": {
    ...,
    "prettier": true

  }
}

Enter fullscreen mode Exit fullscreen mode

And then added following line to my package.json:

{
  "scripts": {
    ...,
    "precommit": "pretty-quick staged"
  }
}
Enter fullscreen mode Exit fullscreen mode

It does seem to work nice for myself. Formatting is left for prettier and linting is done by tslint. What kind of setup do you use?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay