An open API service indexing awesome lists of open source software.

https://github.com/phts/eslint-config

My config for ESLint
https://github.com/phts/eslint-config

eslint eslint-config npm-package

Last synced: 3 months ago
JSON representation

My config for ESLint

Awesome Lists containing this project

README

        

# @phts/eslint-config

[![GitHub Actions](https://github.com/phts/eslint-config/workflows/workflow/badge.svg)](https://github.com/phts/eslint-config)
[![npm](https://img.shields.io/npm/v/@phts/eslint-config.svg)](https://www.npmjs.com/package/@phts/eslint-config)

My config for ESLint.

## Install

```
$ npm i -D @phts/eslint-config
```

## Usage

### Basic rules

`.eslintrc.json`:

```json
{
"extends": "@phts"
}
```

### Prettier

```json
{
"extends": ["@phts", "@phts/eslint-config/addons/prettier"]
}
```

Enable support for Prettier via [eslint-config-prettier](https://www.npmjs.com/package/eslint-config-prettier) and [eslint-plugin-prettier](https://www.npmjs.com/package/eslint-plugin-prettier) for all `.js`, `.jsx`, `.ts`, `.tsx` files in the project.

Prettier must be installed manually:

```
$ npm i -D prettier
```

Make sure to put this addon **last**, so it gets the chance to override other configs.

### TypeScript

[@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/parser)
and [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin) are used under the hood.

`.eslintrc.json`:

```json
{
"extends": ["@phts", "@phts/eslint-config/addons/typescript"]
}
```

`package.json`:

```json
{
"scripts": {
"lint": "eslint --ext .js,.ts,.tsx ."
}
}
```

SublimeText project:

```json
{
"folders": [
{
"path": "."
}
],
"settings": {
"SublimeLinter.linters.eslint.selector": "source.js, source.ts, source.tsx",
"SublimeLinter.linters.tslint.disable": true
}
}
```

VS Code workspace:

```json
{
"settings": {
// ...
"eslint.validate": ["typescript", "typescriptreact"]
}
}
```

### Other addons


configs
Enable Node.js environment for all combinations of config files


jest
Enable jest environment for test files


module
Enable ES-modules for .js files in src/ folder


node
Enable Node.js environment for all .js files


react
Enable support for react for .js and .jsx files in src/ folder


typescript/configs
Enable Node.js environment for all combinations of config files written in TypeScript


typescript/jest
Enable jest environment for test files


typescript/node
Enable Node.js environment for all .ts files


typescript/react
Enable support for react for .ts and .tsx files in src/ folder