Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
gulp-eslint fails to parse optional chaining syntax

I'm trying to lint JavaScript code with optional chaining syntax like:

let foo = bar?.property;

When parsing my JS files with eslint explicitly, it passes.

When parsing with gulp-eslint using the same configuration, linting fails with:

Parsing error: Unexpected token .

My .eslintrc.json file contains:

{
    "parserOptions": {
      "ecmaVersion": 2020
    }
}

My Gulp task looks like:

const eslint = require('gulp-eslint');

return gulp.src(['src/**/*.js'])
    .pipe(eslint({ configFile: '.eslintrc.json' }))
    .pipe(eslint.formatEach('compact', process.stderr))
    .pipe(eslint.failAfterError());

I'm using the following packages:

"devDependencies": {
    "eslint": "^8.2.0",
    "gulp": "4.0.2",
    "gulp-eslint": "^6.0.0",
  }

Am I missing something, or is there a viable workaround?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The ecmaVersion parser option can't be used like that, see https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments. Changing it from 2020 to 11 or 12 or "latest" should work.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!