typescript-eslint/tslint-to-eslint-config

Supplying `--prettier` always results in a broken configuration

hyperupcall opened this issue ยท 0 comments

๐Ÿ› Bug Report

  • tslint-to-eslint-config version: 2.11.0
  • ESLint version: 8.10.0
  • Node version: v14.19.0

Actual Behavior

Running tslint-to-eslint-config with the --prettier flag, and subsequently running ESLint runs into the following:

Oops! Something went wrong! :(

ESLint: 8.10.0

Error: Cannot read config file: /tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/eslint-config-prettier@8.4.0_eslint@8.10.0/node_modules/eslint-config-prettier/@typescript-eslint.js
Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21
Referenced from: /tmp/tmp.oUi9YFaB6U/comment-divider/.eslintrc.js
    at Object.<anonymous> (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/eslint-config-prettier@8.4.0_eslint@8.10.0/node_modules/eslint-config-prettier/@typescript-eslint.js:1:69)
    at Module._compile (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/v8-compile-cache@2.3.0/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at Object.module.exports [as default] (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/import-fresh@3.3.0/node_modules/import-fresh/index.js:32:59)
    at loadJSConfigFile (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/@eslint+eslintrc@1.2.0/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2559:47)
    at loadConfigFile (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/@eslint+eslintrc@1.2.0/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2643:20)
    at ConfigArrayFactory._loadConfigData (/tmp/tmp.oUi9YFaB6U/comment-divider/node_modules/.pnpm/@eslint+eslintrc@1.2.0/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2947:42)

Expected Behavior

No errors

Reproduction

$ yarn add tslint-to-eslint-config eslint
$ echo '{}' >| tslint.json
$ yarn run tslint-to-eslint-config --prettier
...
.eslintrc.js
/*
๐Ÿ‘‹ Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config

It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.

We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint. 
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md

Happy linting! ๐Ÿ’–
*/
module.exports = {
    "env": {
        "browser": true,
        "es6": true
    },
    "extends": [
        "prettier",
        "prettier/@typescript-eslint"
    ],
    "parser": "@typescript-eslint/parser",
    "parserOptions": {
        "project": "tsconfig.json",
        "sourceType": "module"
    },
    "plugins": [
        "@typescript-eslint"
    ]
};

The issue wasn't systemic and the fix seemed pretty trivial, so I went ahead and made a PR for this