linting-typescript-in-2023

Code samples for linting React and TypeScript in 2023. ✨

MIT License

Stars
107

Usage

First make sure you have Node installed and Yarn installed. Then, after forking the repo from GitHub:

git clone https://github.com/<your-name-here>/linting-typescript-in-2023
cd linting-typescript-in-2023
yarn

React Site Demo

To start a Next dev server, yarn dev. It displays a page with four buttons, each of which is meant to set the page background to a random color.

  1. "Violate await-thenable": Shows what happens when code violates @typescript-eslint/await-thenable
  2. "Violate no-floating-promises": Shows what happens when code violates @typescript-eslint/no-floating-promises
  3. "Violate no-misused-promises": Shows what happens when code violates @typescript-eslint/no-misused-promises
  4. "This may fail, safely": It works, no issues!

Each of those lint rules are disabled in .eslintrc.cjs. Uncomment those disables and run yarn lint to enable the rules and see their complaints in source code.

Development

See .github/CONTRIBUTING.md. Thanks! 💖

Contributors