azat-io / eslint-plugin-perfectionist

☂️ ESLint plugin for sorting various data such as objects, imports, types, enums, JSX props, etc.
https://perfectionist.dev
MIT License
1.89k stars 37 forks source link

Bug: Error with typescript eslint and yarn pnp. #182

Closed agarwalvaibhav0211 closed 2 months ago

agarwalvaibhav0211 commented 2 months ago

Describe the bug

Facing the following error in ESLint logs

Error: ENOENT: no such file or directory, open '.yarn/__virtual__/@typescript-eslint-utils-virtual-c778032589/0/cache/@typescript-eslint-utils-npm-7.17.0-defa19d607-44d6bfcda4.zip/node_modules/@typescript-eslint/utils/dist/ts-estree.js'
    at readFileSync (node:fs:455:20)
    at cjsPreparseModuleExports (node:internal/modules/esm/translators:434:24)
    at createCJSModuleWrap (node:internal/modules/esm/translators:292:35)
    at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:369:10)
    at callTranslator (node:internal/modules/esm/loader:285:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:291:30)

Code example

export enum CountryCode {
  AF = "AF", // Afghanistan
  AX = "AX", // Åland Islands
  AL = "AL", // Albania
  DZ = "DZ", // Algeria
  AS = "AS", // American Samoa
  AD = "AD", // Andorra
  AO = "AO", // Angola
  EH = "EH", // Western Sahara
  YE = "YE", // Yemen
  ZM = "ZM", // Zambia
  ZW = "ZW", // Zimbabwe
}

ESLint version

v9

ESLint Plugin Perfectionist version

v3

Additional comments

The same error is being displayed with node-modules installation strategy with yarn or on console with eslint cmd utility. The error is only coming when pnp is used in VSCode ESLint extension.

A potential reason may be that the @typescript-eslint/utils package being used is v7 which does not yet support eslint v9.

Validations

azat-io commented 2 months ago

Thank you for your issue!

I don't work with Yarn PnP and have not tested using the plugin with it.

I will look into this problem and think how to solve it.

azat-io commented 2 months ago

I am currently unable to reproduce the problem. I have tried using Perfectionist with Yarn 4.

Could you please show your eslint config?

Or better yet, create a repository to reproduce the problem.

azat-io commented 2 months ago

I tried reproducing the problem. And it seems to be okay. Please write back if the problem is still relevant.