eslint-config-xo-vue icon indicating copy to clipboard operation
eslint-config-xo-vue copied to clipboard

can't use with XO; Named export 'ESLint' not found

Open vaaski opened this issue 3 years ago • 0 comments

Hey, I was looking to switch my vue project from eslint to XO, but this config doesn't seem to work.

The vscode XO extension throws the following error:

error pop-up
Cannot read config file: eslint-config-xo-vue-repro/node_modules/eslint-config-prettier/index.js
Error: ENOENT: no such file or directory, open 'eslint-config-xo-vue-repro/node_modules/eslint-config-prettier/index.js'
Referenced from: eslint-config-xo-vue-repro/node_modules/eslint-plugin-prettier/eslint-plugin-prettier.js

While npx xo errors with:

npx xo error
file://eslint-config-xo-vue-repro/node_modules/xo/lib/report.js:2
import {ESLint} from 'eslint';
        ^^^^^^
SyntaxError: Named export 'ESLint' not found. The requested module 'eslint' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'eslint';
const {ESLint} = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:128:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:194:5)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

I've spun up a repo for repro here. Just clone, npm ci and npx xo

I am on MacOS Ventura on a M2 MacBook Air, but I doubt it's relevant for this issue.

vaaski avatar Oct 08 '22 08:10 vaaski