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

SyntaxError: Invalid regular expression flags From 6.6.0 Release #12493

Closed
emilyrohrbough opened this issue Oct 25, 2019 · 9 comments
Closed
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint

Comments

@emilyrohrbough
Copy link

Tell us about your environment

  • ESLint Version: 6.6.0
  • Node Version: lts/carbon
  • npm Version: 5.5.1

What parser (default, Babel-ESLint, etc.) are you using?
default

Please show your full configuration:

Configuration

My eslint-config extends: https://github.com/cerner/eslint-config-terra/blob/master/eslint.config.js

"eslintConfig": {
    "extends": "terra",
    "settings": {
      "polyfills": [
        "Promise"
      ]
    },
    "rules": {
      "import/no-extraneous-dependencies": "off",
      "import/no-unresolved": "off",
      "camelcase": "off",
      "class-methods-use-this": "off"
    },
},

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
The latest eslitn version was pulled in during a CI build and failed lint tests.

I was able to reproduce by removing my node_modules dir locally and running install again. Running eslitn resulting in errors.

> eslint --ext .js,.jsx .

What actually happened? Please include the actual, raw output from ESLint.
This recent change is causing builds to fail with the following error:

> eslint --ext .js,.jsx .

/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/eslint/lib/source-code/source-code.js:426
        return /\s/u.test(text.replace(/\/\*.*?\*\//gus, ""));
                                       ^

SyntaxError: Invalid regular expression flags
    at NativeCompileCache._moduleCompile (/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/v8-compile-cache/v8-compile-cache.js:242:18)
    at Module._compile (/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/v8-compile-cache/v8-compile-cache.js:186:36)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/eslint/lib/source-code/index.js:4:17)
    at Module._compile (/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
@emilyrohrbough emilyrohrbough added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Oct 25, 2019
@mdjermanovic
Copy link
Member

That's the s flag added in #12407

According to this compat-table it should be supported in Node >= 8.10

@mdjermanovic mdjermanovic added the patch candidate This issue may necessitate a patch release in the next few days label Oct 25, 2019
@mdjermanovic
Copy link
Member

Our Node v8.16.2 build is passing, @emilyrohrbough on which Node version is your build failing?

@rajakedia1
Copy link

On node v8.9.4 its failing

@kaicataldo
Copy link
Member

The latest major release line of ESLint currently supports the following engines:

{
    "node": "^8.10.0 || ^10.13.0 || >=11.10.1"
}

@platinumazure
Copy link
Member

Can we just make a change to not require this flag? The s flag just means dots represent newlines, right? Could we use something like [\s\S] instead of dot and then we could remove the s flag?

@mysticatea mysticatea added question This issue asks a question about ESLint and removed bug ESLint is working incorrectly patch candidate This issue may necessitate a patch release in the next few days triage An ESLint team member will look at this issue soon labels Oct 26, 2019
justinnhli added a commit to justinnhli/subitize that referenced this issue Oct 27, 2019
@vanodevium
Copy link

Node: v8.6.0

Same error:

...node_modules/eslint/lib/source-code/source-code.js:426
        return /\s/u.test(text.replace(/\/\*.*?\*\//gus, ""));
SyntaxError: Invalid regular expression flags

@mysticatea
Copy link
Member

mysticatea commented Oct 28, 2019

Yes, ESLint supports only Node.js 8.10.0 or later since ESLint 6.0.0.

You should see the following warning if you installed ESLint with old Node.js:

> npm i eslint
npm WARN notsup Unsupported engine for eslint@6.6.0: wanted: {"node":"^8.10.0 || ^10.13.0 || >=11.10.1"} (current: {"node":"8.0.0","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: eslint@6.6.0

See also Migrating to v6.0.0.

@emilyrohrbough
Copy link
Author

@mdjermanovic & @mysticatea it looks like I am on node 8.9.2 and missed the 8.10 minimum requirement for the upgrade. whoops!! I did just verify my build, and I am not seeing the warning messages in install for the non-supported engines/node verisons:

Log Output:
➜  chart-summary-component git:(add-menu-sass-side) run clean:install

> chart-summary-component@0.0.0 clean:install /Users/er047227/orion/chart-summary/chart-summary-component
> npm run clean && npm install


> chart-summary-component@0.0.0 clean /Users/er047227/orion/chart-summary/chart-summary-component
> rm -f ./package-lock.json && rm -rf node_modules

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()

> fsevents@1.2.9 install /Users/er047227/orion/chart-summary/chart-summary-component/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/er047227/orion/chart-summary/chart-summary-component/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" is installed via remote

> chart-summary-component@0.0.0 prepare /Users/er047227/orion/chart-summary/chart-summary-component
> npm run build


> chart-summary-component@0.0.0 build /Users/er047227/orion/chart-summary/chart-summary-component
> npm run compile


> chart-summary-component@0.0.0 compile /Users/er047227/orion/chart-summary/chart-summary-component
> npm run compile:clean && npm run compile:build


> chart-summary-component@0.0.0 compile:clean /Users/er047227/orion/chart-summary/chart-summary-component
> rm -rf lib


> chart-summary-component@0.0.0 compile:build /Users/er047227/orion/chart-summary/chart-summary-component
> babel src --out-dir lib --copy-files

Successfully compiled 17 files with Babel.
npm WARN eslint-config-airbnb@18.0.1 requires a peer of eslint-plugin-react-hooks@^1.7.0 but none is installed. You must install peer dependencies yourself.

added 779 packages in 22.343s

ignatiusreza added a commit to ignatiusreza/chemical that referenced this issue Nov 4, 2019
newer version of eslint uses a regular expression
flag which are only supported by node >= 8.10

from instrospection, atom came with node v8.9.3,
hence it can't use the latest version of eslint
breaking linter-eslint extension

ref:

- eslint/eslint#12493
@RoCkAs
Copy link

RoCkAs commented Nov 5, 2019

I get the same output error. Tested with node 8.16.0 and 10.15.3. If i refactor
return /\s/u.test(text.replace(/\/\*.*?\*\//gus, ""));
to
return /\s/u.test(text.replace(/\/\*.*?\*\//gu, ""));
or downgrade to eslint@6.0.1 then everything works as expected.

dbbrandt added a commit to dbbrandt/react-myreads-project that referenced this issue Nov 6, 2019
Version 8.9.0 on Udacity workspace fails during npm start. See eslint/eslint#12493
papandreou added a commit to unexpectedjs/unexpected-reaction that referenced this issue Nov 11, 2019
papandreou added a commit to unexpectedjs/unexpected-sinon that referenced this issue Nov 11, 2019
rajsite added a commit to rajsite/VireoSDK that referenced this issue Jan 4, 2020
Updates all the devDependencies except for eslint. eslint requires node >=8.10 but on AppVeyor emscripten overrides the node.js version with 8.9.1.

eslint/eslint#12493
ni#658
rajsite added a commit to ni/VireoSDK that referenced this issue Jan 7, 2020
Updates all the devDependencies except for eslint. eslint requires node >=8.10 but on AppVeyor emscripten overrides the node.js version with 8.9.1.

eslint/eslint#12493
#658
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Apr 27, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint
Projects
None yet
Development

No branches or pull requests

8 participants