JoshuaKGoldberg / JoshuaKGoldberg/TypeStat

Feature: also find & convert ESLint file to use typescript-eslint

Open
#1,041 0 comments 0 reactions 0 assignees View on GitHub
area: eslint status: accepting prs type: enhancement
Dominant language
TypeScript
Stars
2.3k
Forks
47
Avg merge
15h 55m
Merged PRs (30d)
21

Description

### 🚀 Feature Request

Projects converting from JS to TS that use ESLint will need to migrate their ESLint configs. Let's do that for them.

#### Existing Behavior

Nothing is done right now.

#### Change Proposal

Add a new fixer that converts an ESLint config file to the [typescript-eslint](https://typescript-eslint.io) equivalent. It'll have to:

* For any base rule that has a typescript-eslint extension rule, use the extension rule instead
* If the original config uses `eslint:recommended`, replace it based on https://typescript-eslint.io/docs/linting/configs
* Add in the right `parser` and `parserOptions`
* [Typed linting](https://typescript-eslint.io/docs/linting/typed-linting) will only be needed if an extension rule requires it

Let's give it a `configs.eslint` opt-in property that defaults to `false`, but can be set to:

* Any string: to use that path to an ESLint configuration file
* `true`: auto-detect an ESLint configuration file

Input:

```js
module.exports = {
rules: {
"no-control-regex": "error",
"return-await": "error",
},
};
```

Output:

```js
module.exports = {
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
rules: {
"@typescript-eslint/no-return-await": "error",
"no-control-regex": "error",
},
};
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.