# @wang1212/eslint-config

> Community-recommended best practices for [ESLint](https://eslint.org/) rule configuration.(Use with [Prettier](https://prettier.io/))

Latest version **0.4.0** (published 2024-01-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wang1212/eslint-config
pnpm add @wang1212/eslint-config
yarn add @wang1212/eslint-config
bun add @wang1212/eslint-config
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2024-01-13 |
| First published | 2022-04-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 15 |
| Unpacked size | 21.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | wang1212 |
| Maintainers | wang1212 |
| Keywords | eslint-config, prettier, typescript, react.js, node.js |

## Links

- npm: https://www.npmjs.com/package/@wang1212/eslint-config
- Repository: https://github.com/wang1212/eslint-config
- Homepage: https://github.com/wang1212/eslint-config#readme
- Issues: https://github.com/wang1212/eslint-config/issues
- npm.io page: https://npm.io/package/@wang1212/eslint-config

## Dependencies (15)

- [eslint-plugin-n](https://npm.io/package/eslint-plugin-n.md) ^16.0.1
- [eslint-plugin-jsdoc](https://npm.io/package/eslint-plugin-jsdoc.md) ^48.0.0
- [eslint-plugin-react](https://npm.io/package/eslint-plugin-react.md) ^7.33.0
- [eslint-plugin-tsdoc](https://npm.io/package/eslint-plugin-tsdoc.md) ^0.2.17
- [eslint-config-airbnb](https://npm.io/package/eslint-config-airbnb.md) ^19.0.4
- [eslint-plugin-compat](https://npm.io/package/eslint-plugin-compat.md) ^4.1.4
- [eslint-plugin-import](https://npm.io/package/eslint-plugin-import.md) ^2.28.0
- [eslint-plugin-promise](https://npm.io/package/eslint-plugin-promise.md) ^6.1.1
- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) ^0.23.0
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^9.0.0
- [eslint-plugin-jsx-a11y](https://npm.io/package/eslint-plugin-jsx-a11y.md) ^6.7.1
- [eslint-plugin-prettier](https://npm.io/package/eslint-plugin-prettier.md) ^5.0.0
- [eslint-config-airbnb-base](https://npm.io/package/eslint-config-airbnb-base.md) ^15.0.0
- [eslint-plugin-react-hooks](https://npm.io/package/eslint-plugin-react-hooks.md) ^4.6.0
- [eslint-config-airbnb-typescript](https://npm.io/package/eslint-config-airbnb-typescript.md) ^17.1.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@inrupt/eslint-config-base](https://npm.io/package/@inrupt/eslint-config-base.md) — 4.5K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2024-01-13
- 0.3.1 — 2023-09-27
- 0.3.0 — 2023-07-28
- 0.2.1 — 2022-05-22
- 0.2.0 — 2022-05-08
- 0.1.5 — 2022-05-03
- 0.1.4 — 2022-04-21
- 0.1.3 — 2022-04-20
- 0.1.2 — 2022-04-19
- 0.1.1 — 2022-04-18
- 0.1.0 — 2022-04-17

## README

# ESLint Config

<!-- ![MINZIPPED SIZE](https://badgen.net/bundlephobia/minzip/@wang1212/eslint-config) -->

![LICENSE](https://badgen.net/github/license/wang1212/eslint-config)
[![NPM VERSION](https://badgen.net/npm/v/@wang1212/eslint-config)](https://www.npmjs.com/package/@wang1212/eslint-config)
![DOWNLOAD](https://badgen.net/npm/dt/@wang1212/eslint-config)
![LAST COMMIT](https://badgen.net/github/last-commit/wang1212/eslint-config)
![GITHUB PACKAGE CI](https://img.shields.io/github/workflow/status/wang1212/eslint-config/Node.js%20Package?label=ci/package%20publish)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/a9b9c06027ba47788617123cf84d3912)](https://www.codacy.com/gh/wang1212/eslint-config/dashboard?utm_source=github.com&utm_medium=referral&utm_content=wang1212/eslint-config&utm_campaign=Badge_Grade)

English | [简体中文](./README.zh-CN.md)

🔧 This package provides community-recommended [ESLint](https://eslint.org/) rules configuration as an extensible shared configuration. (Use with [Prettier](https://prettier.io/))

_Support [ESLint V8](https://eslint.org/blog/2021/10/eslint-v8.0.0-released), Node.js requires version >=16._

## Usage

```bash
npm install --save-dev @wang1212/eslint-config
```

1. Install `peerDependencies`:

   ```bash
   npm install --save-dev eslint
   npm install --save-dev --save-exact prettier
   ```

2. Create a **.prettierrc.yml** file in the project root directory and configure the following:

   ```yaml
   # see docs: https://prettier.io/docs/en/configuration.html

   # prettier config
   printWidth: 80
   tabWidth: 2
   useTabs: false
   singleQuote: true
   semi: true
   endOfLine: 'auto'
   ```

   _This is just a recommended configuration and can be adjusted to your liking._

3. Then you need to add `@wang1212/eslint-config` in your **.eslintrc.json**:

   ```diff
   {
   + "extends": ["@wang1212/eslint-config"]
   }
   ```

   _The rule configuration of ESLint can be configured and covered according to your own requirements, please refer to the [official documentation](https://eslint.org/docs/user-guide/configuring/rules)._

## Configuration Details

### `@wang1212/eslint-config`

This configuration is for basic JavaScript, based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), [JSDoc](https://jsdoc.app/), and [check API compatibility](https://github.com/amilajack/eslint-plugin-compat) with [Browserslist](https://github.com/browserslist/browserslist). (See [Source](./src/javascript.cjs))

### `@wang1212/eslint-config/typescript`

This configuration is for basic [TypeScript](https://www.typescriptlang.org/), based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), [TSDoc](https://tsdoc.org/), and [check API compatibility](https://github.com/amilajack/eslint-plugin-compat) with [Browserslist](https://github.com/browserslist/browserslist). (See [Source](./src/typescript.cjs))

_This config also has an alias `@wang1212/eslint-config/ts`._

Using this configuration also requires some extra work.

1. Install additional `peerDependencies`:

   ```bash
   npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
   ```

   _**Note:** according to the official maintenance policy, the above dependencies should always be installed with the same version number._

2. Then you need to add `@wang1212/eslint-config/typescript` in your **.eslintrc.json**:

   ```diff
   {
   - "extends": ["@wang1212/eslint-config"],
   + "extends": ["@wang1212/eslint-config/typescript"],
   + "parser": "@typescript-eslint/parser",
   + "parserOptions": {
   +   "project": './tsconfig.json'
   + },
   }
   ```

### `@wang1212/eslint-config/react`

This configuration is for [react.js](https://reactjs.org/) applications written in JavaScript, based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), [Hooks](https://reactjs.org/docs/hooks-intro.html), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), [JSDoc](https://jsdoc.app/), and [check API compatibility](https://github.com/amilajack/eslint-plugin-compat) with [Browserslist](https://github.com/browserslist/browserslist). (See [Source](./src/react.cjs))

Using this configuration also requires some extra work.

- You need to add `@wang1212/eslint-config/react` in your **.eslintrc.json**:

  ```diff
  {
  - "extends": ["@wang1212/eslint-config"],
  + "extends": ["@wang1212/eslint-config/react"],
  }
  ```

### `@wang1212/eslint-config/react-typescript`

This configuration is for [react.js](https://reactjs.org/) applications written in [TypeScript](https://www.typescriptlang.org/), based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), [Hooks](https://reactjs.org/docs/hooks-intro.html), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), [TSDoc](https://tsdoc.org/), and [check API compatibility](https://github.com/amilajack/eslint-plugin-compat) with [Browserslist](https://github.com/browserslist/browserslist). (See [Source](./src/react-ts.cjs))

_This config also has an alias `@wang1212/eslint-config/react-ts`._

Using this configuration also requires some extra work.

1. Install additional `peerDependencies`:

   ```bash
   npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
   ```

   _**Note:** according to the official maintenance policy, the above dependencies should always be installed with the same version number._

2. Then you need to add `@wang1212/eslint-config/react-typescript` in your **.eslintrc.json**:

   ```diff
   {
   - "extends": ["@wang1212/eslint-config"],
   + "extends": ["@wang1212/eslint-config/react-typescript"],
   + "parser": "@typescript-eslint/parser",
   + "parserOptions": {
   +   "project": './tsconfig.json'
   + },
   }
   ```

### `@wang1212/eslint-config/node`

This configuration is for [Node.js](https://nodejs.dev/) programs written in JavaScript, based on the [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript), [SonarJS](https://github.com/SonarSource/eslint-plugin-sonarjs), [JSDoc](https://jsdoc.app/). (See [Source](./src/node.cjs))

Using this configuration also requires some extra work.

- You need to add `@wang1212/eslint-config/node` in your **.eslintrc.json**:

  ```diff
  {
  - "extends": ["@wang1212/eslint-config"],
  + "extends": ["@wang1212/eslint-config/node"],
  }
  ```

## Development Guidelines

### Git Commit Message Format

Adopt [community commit format best practices](https://www.conventionalcommits.org/):

```bash
# Before
git commit

# Now
npm run commit
```

_This constraint relies on tools [commitizen](http://commitizen.github.io/cz-cli/) and [commitlint](https://commitlint.js.org/) provided by the community._

### npm publish

The version management of this module adopts the specifications recommended by the community [Semantic Versioning](https://semver.org/). Follow version changes and maintain a **CHANGELOG.md**([Learn why](https://keepachangelog.com/)).

```bash
# Update version and generate changelog before publishing to npm repository
npm run release
# Or, preview
npm run release -- --dry-run

# Then publish to npm, if yes is not selected when auto-publishing to npm
npm publish # npm publish --access public
```

_These jobs are done with the help of [release-it](https://github.com/release-it/release-it) tool provided by the community._

## License

[MIT](./LICENSE).

---
_Source: https://npm.io/package/@wang1212/eslint-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
