Nuxt.js: Failed to load plugin 'unicorn'

Created on 12 Feb 2020  路  7Comments  路  Source: nuxt/nuxt.js

Version

v2.11.0

Reproduction link

https://jsfiddle.net/6rhqk2jz/

Steps to reproduce

  1. Create a Nuxt project using the npx create-nuxt-app.
  2. Choose ESlint under linting tools
  3. Fails on initial build.

What is expected ?

ESLint is an option in Nuxt project creation; should work without errors.

What is actually happening?

Fails on compile.

SyntaxError: Failed to load plugin 'unicorn' declared in '.eslintrc.js 禄 @nuxtjs/eslint-config': Invalid regular expression: /(?<before>(?:^|[^\\])(?:\\\\)*)\\(?<data>x[\da-f]{2}|u[\da-f]{4}|u{[\da-f]+})/: Invalid group
    at Object.<anonymous> (/Users/user/nuxt-lint-error/node_modules/eslint-plugin-unicorn/rules/escape-case.js:10:29)
    at Module._compile (/Users/user/nuxt-lint-error/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (/Users/user/nuxt-lint-error/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at module.exports (/Users/user/nuxt-lint-error/node_modules/import-modules/index.js:47:29)
    at Object.<anonymous> (/Users/user/nuxt-lint-error/node_modules/eslint-plugin-unicorn/index.js:6:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] lint: `eslint --ext .js,.vue --ignore-path .gitignore . "--fix"`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2020-02-12T22_40_57_944Z-debug.log
bug-report

Most helpful comment

Ok, found solution if you're using built in IDE linter.

It's IDE error if you're using JetBrains.

You need to manually set ESLint configuration node interpreter to 10+

image

All 7 comments

Can't reproduce on my end 馃

Which node version are you using?

Can't reproduce on my end

Which node version are you using?

10.16

Weird! Just installed a sample application generate via npx create-nuxt-app and changed node version but can't reproduce that issue at all w/ the latest Node 10.X. Maybe another/an older node version is used?

Upgrading Node should help.

Related issue: https://github.com/sindresorhus/eslint-plugin-unicorn/issues/557

Ok, found solution if you're using built in IDE linter.

It's IDE error if you're using JetBrains.

You need to manually set ESLint configuration node interpreter to 10+

image

Was using node 8.12.0; switched to 10.16.0 and issue appears to be resolved.

Appreciate the PHPStorm tip as well.

Downgrading from node version ^13 to ^10 solved it for me.

Can we please get a fix for this? Downgrading node to 10.16.0 didnt solved it for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maicong picture maicong  路  3Comments

o-alexandrov picture o-alexandrov  路  3Comments

gary149 picture gary149  路  3Comments

vadimsg picture vadimsg  路  3Comments

danieloprado picture danieloprado  路  3Comments