Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid regular expression error on running eslint #10300

Open
tejasbubane opened this issue Aug 5, 2019 · 2 comments

Comments

@tejasbubane
Copy link

commented Aug 5, 2019

Bug Report

Current Behavior
eslint command fails with this error:

➜ npm run lint

> exercism-javascript@ lint /Users/tejas.bubane/opensource/javascript
> eslint .

SyntaxError: Invalid regular expression: /\p{Script_Extensions=Makasar}/u: Invalid property name
Occurred while linting /Users/tejas.bubane/opensource/xjavascript/exercises/change/node_modules/@babel/plugin-proposal-unicode-property-regex/test/fixtures/with-unicode-flag/unicode-11/input.js:1
    at RegExpValidator.raise (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5643:15)
    at RegExpValidator.eatUnicodePropertyValueExpression (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:6295:22)
    at RegExpValidator.eatCharacterClassEscape (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:6277:22)
    at RegExpValidator.eatAtomEscape (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:6056:18)
    at RegExpValidator.eatReverseSolidusAtomEscape (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5882:22)
    at RegExpValidator.eatAtom (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5867:18)
    at RegExpValidator.eatTerm (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5765:32)
    at RegExpValidator.alternative (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5754:53)
    at RegExpValidator.disjunction (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5739:14)
    at RegExpValidator.pattern (/Users/tejas.bubane/opensource/xjavascript/node_modules/regexpp/index.js:5681:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! exercism-javascript@ lint: `eslint .`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the exercism-javascript@ 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/tejas.bubane/.npm/_logs/2019-08-05T05_29_50_677Z-debug.log

Input Code
https://github.com/exercism/javascript/tree/97efba79c021d156e345bdd51ab25dd941b6801f

Expected behavior/code
eslint should run lint over project

Babel Configuration (.babelrc, package.json, cli command)

module.exports = {
  presets: [
    [
      '@babel/env',
      {
        targets: {
          node: 'current',
        },
        useBuiltIns: false,
      },

    ],
  ],
};

Environment

  • Babel version(s): 7.5.5
  • Node/npm version: node = 12.7.0, npm = 6.10.0
  • OS: MacOS 10.14.4 (18E226)
  • Monorepo: yes
  • How you are using Babel: cli

Additional context/Screenshots

  1. Tried scoping eslint command to my code directory (exercises), but still same error.
  2. Other commands like jest test run fine. So I am not really sure what the issue is, but the failing regex seems to be here so I raised an issue in this repo.
  3. Also this fails only on macOS. The CI build is passing with same nodejs version.
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Aug 5, 2019

Hey @tejasbubane! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@JLHwung

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2019

Please specify ecmaVersion: 2019 on your eslint config

"parserOptions": {
    "ecmaVersion": 2019,
    "sourceType": "module"
  },

Makasar was not encoded in Unicode until Unicode 11, released in 2018. The ECMAScript standard conforms to latest Unicode version at the moment it is published, which means the minimum ECMAScript version that will conform to Unicode 11 is ECMAScript 2019.

Therefore, in your cases,

/\p{Script_Extensions=Makasar}/u

is not a valid UnicodeProperty RegExp in every ECMAScript version less or equal to 2018, because these ECMAScript versions targets older version of Unicode when Makasar is not yet encoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.