Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@thoughtbot/eslint-config

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thoughtbot/eslint-config

Batteries-included sharable [ESLint][eslint] configurations for React, React Native, TypeScript, and Node.js that enforce [thoughtbot’s JavaScript guides][thoughtbot-js-guides]. These configurations are largely based off of and compatible with [AirBnb’s E

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by8.97%
Maintainers
4
Weekly downloads
 
Created
Source

thoughtbot ESLint Config

Batteries-included sharable ESLint configurations for React, React Native, TypeScript, and Node.js that enforce thoughtbot’s JavaScript guides. These configurations are largely based off of and compatible with AirBnb’s ESLint config.

Installation

If using npm, run:

npm install @thoughtbot/eslint-config --save-dev

If using Yarn, run:

yarn add @thoughtbot/eslint-config --dev

Usage

This package includes configurations for most common tech stacks. Update your ESLint configuration to extend the appropriate setup:

  • @thoughtbot/eslint-config - React web, Jest, Testing Library, Prettier
  • @thoughtbot/eslint-config/react - React web (same as above)
  • @thoughtbot/eslint-config/base - base web config, no React or Prettier
  • @thoughtbot/eslint-config/native - React Native, Jest, RN Testing Library, Prettier
  • @thoughtbot/eslint-config/prettier - Prettier, automatically used when using React or Native config
  • @thoughtbot/eslint-config/typescript - TypeScript config, add this if using Typescript

The configurations that include Prettier turn off all formatting rules that are also handled by Prettier to reduce conflicts between the two tools. It is recommended to add Prettier to your project and ensure that your CI environment also runs Prettier to verify code formatting.

Example usage:

Following are some example usages of this config (eg. in .eslintrc.js).

React with TypeScript:

{
  "extends": [
    "@thoughtbot/eslint-config",
    "@thoughtbot/eslint-config/typescript"
  ]
}

React Native with TypeScript:

{
  "extends": [
    "@thoughtbot/eslint-config/native",
    "@thoughtbot/eslint-config/typescript"
  ]
}

Base web without React or TypeScript

{
  "extends": ["@thoughtbot/eslint-config/base"]
}

You can override rules from the shared configuration, by setting your own values within the rules property:

{
  "extends": "@thoughtbot/eslint-config",
  "rules": {
    "react/jsx-newline": "warn"
  }
}

You might also need to add the following to your ESLint config if you get an error about Jest not being able to detect the version:

{
  "settings": {
    "jest": { "version": "detect" }
  }
}

Consult the ESLint documentation for more information about configuring ESLint, and take a look at the config files in this repo for more information about the rules and plugins they include.

License

thoughtbot ESLint Config is copyright (c) 2023 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

thoughtbot

thoughtbot ESLint Config is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.

Keywords

FAQs

Package last updated on 21 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc