Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tophat/eslint-config
:shark: Top Hat's shareable eslint configuration
https://github.com/tophat/eslint-config
eslint eslint-config jest prettier react
Last synced: about 1 month ago
JSON representation
:shark: Top Hat's shareable eslint configuration
- Host: GitHub
- URL: https://github.com/tophat/eslint-config
- Owner: tophat
- License: apache-2.0
- Created: 2018-11-21T20:54:52.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T13:14:16.000Z (about 2 months ago)
- Last Synced: 2024-09-16T15:27:59.336Z (about 2 months ago)
- Topics: eslint, eslint-config, jest, prettier, react
- Language: TypeScript
- Size: 6.37 MB
- Stars: 9
- Watchers: 6
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# @tophat/eslint-config
[![npm](https://img.shields.io/npm/v/@tophat/eslint-config.svg)](https://www.npmjs.com/package/@tophat/eslint-config)
[![npm downloads](https://img.shields.io/npm/dm/@tophat/eslint-config.svg)](https://npm-stat.com/charts.html?package=%40tophat%2Feslint-config)[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
:shark: Top Hat's shareable eslint configuration
## Usage
The default config includes the following:
- A set of base eslint rules for all JavaScript/TypeScript projects
- Rules for Jest tests
- Rules for web appsExtend the default config by first installing all the required dependencies:
```bash
yarn add --dev \
@tophat/eslint-config \
eslint \
prettier \
eslint-config-prettier \
eslint-plugin-prettier \
eslint-plugin-jest \
eslint-plugin-import \
eslint-import-resolver-typescript \
@typescript-eslint/eslint-plugin \
@typescript-eslint/parser \
@tophat/eslint-import-resolver-require```
If you wish to install lint rules for react apps, you can also optionally install:
```bash
yarn add --dev \
eslint-plugin-react \
eslint-plugin-react-hooks \
eslint-plugin-jsx-a11y \
```If your app uses react-query, you can also install:
```bash
yarn add --dev @tanstack/eslint-plugin-query
```or
```bash
npm install --save-dev # etc ...
```Then update your eslint config (for example, .eslintrc.js):
```javascript
module.exports = {
extends: '@tophat/eslint-config'
}
```Note: `@tophat/eslint-import-resolver-require` is an optional peer dependency and helps with Yarn Berry projects.
Note that Typescript is required.
## Picking and choosing certain configs
You can extend each of the configs separately by specifying them in your eslint config:
```javascript
module.exports = {
extends: [
// Pick and choose from the following list of configs
'@tophat/eslint-config/base',
'@tophat/eslint-config/react',
'@tophat/eslint-config/jest',
'@tophat/eslint-config/web',
]
}
```## Peer dependencies per config
Each config requires certain peer dependencies:
- **base**: eslint, prettier, eslint-config-prettier, eslint-plugin-import, eslint-plugin-prettier
- **react**: eslint-plugin-react, eslint-plugin-react-hooks, eslint-plugin-jsx-a11y, @tanstack/eslint-plugin-query
- **jest**: eslint-plugin-jest
- **web**: (none)You only have to install the dependencies for the configs which you are using. Also note that all dependencies in the react package are optional, to support using this config in non-react apps.
## Upgrading this package
See the [CHANGELOG](./CHANGELOG.md).
## Making changes to this package
See the [CONTRIBUTING](./CONTRIBUTING.md) guide.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Noah
💻 🚇
Daniel Basilio
💻
Marc Cataford
🚇
Add your contributions
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!