/linting-typescript-in-2023

Code samples for linting React and TypeScript in 2023. ✨

Primary LanguageTypeScriptMIT LicenseMIT

Linting TypeScript in 2023 Code

Demo app for linting React and TypeScript with typescript-eslint, formed from my template-typescript-node-package. ✨

All Contributors Code Style: Prettier Contributor Covenant License: MIT Sponsor: On GitHub TypeScript: Strict

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 pnpm lint to enable the rules and see their complaints in source code.

Development

See .github/CONTRIBUTING.md. Thanks! 💖

Contributors

Josh Goldberg
Josh Goldberg

🐛 💻 🖋 💡 🤔 🚇 🚧 📦 📆 👀 🛡️ 🔧 ⚠️