xojs/xo

Error: Failed to load plugin 'prettier' declared in 'BaseConfig'

younho9 opened this issue · 3 comments

When I run yarn xo command, encounter following error message.

TypeError [ERR_INVALID_ARG_VALUE]: Failed to load plugin 'prettier' declared in 'BaseConfig': The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received ''
Referenced from: BaseConfig
    at new NodeError (node:internal/errors:371:5)
    at createRequire (node:internal/modules/cjs/loader:1214:13)

My XO Configuration.

"xo": {
    "prettier": true,
    "extends": [
      "next/core-web-vitals"
    ]
  },

To reproduce,

  1. yarn create next-app
  2. remove default eslintrc.json
  3. add xo field to package.json and add above xo configuration.

Related with

#546
#483

Try following these instructions.

I'm able to reproduce the error when I extend next/core-web-vitals like you posted but using the config from Usage With Other Tools seems to work.

Thanks. Using config of next plugin as you commented works.

module.exports = {
  extends: [
    //...
    'plugin:@next/next/recommended',
  ],
}

But, eslint-config-next is using several plugins internally, if I extend it directly from xo config, it seems to cause error.

I'm still wondering if there are any restrictions on extending other configs.

Duplicate of #546