tslint-to-eslint-config icon indicating copy to clipboard operation
tslint-to-eslint-config copied to clipboard

Auto-detect original ESLint file in any form

Open JoshuaKGoldberg opened this issue 5 years ago • 1 comments

🚀 Feature Request

Following #58, https://eslint.org/docs/user-guide/configuring states:

Configuration Files - use a JavaScript, JSON or YAML file to specify configuration information for an entire directory and all of its subdirectories. This can be in the form of an .eslintrc.* file or an eslintConfig field in a package.json file, both of which ESLint will look for and read automatically, or you can specify a configuration file on the command line.

Existing Behavior

tslint-to-eslint-config will only look at .eslintrc.js by default if not explicitly told a path.

https://github.com/typescript-eslint/tslint-to-eslint-config/blob/2b48234f58b2fd75f3baf5017692c79d79a70942/src/cli/runCli.ts#L44

Change Proposal

Add a function dependency to runCli that determines the initial script path for ESLint, such as .eslintrc.js, .eslintrc.yml.

The tricky part here will be supporting package.json eslintConfig...

JoshuaKGoldberg avatar Sep 20 '20 21:09 JoshuaKGoldberg

Not so tricky part, just read the package.json file and check if it has the key eslintConfig using the resolveJsonModule compiler option to read json files.

This read should be the fallback behaviour in case of missing .eslintrc.* file, otherwise, throw an error.

KingDarBoja avatar Sep 20 '20 22:09 KingDarBoja