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

543
Views
Parsing error: Unexpected character '#' while declaring priavate member in JavaScript class

When using '#' to declare a private member in a javascript class, eslint throws an error Parsing error: Unexpected character '#'.

For eg.

class Test{
  #priavteMember; //Parsing error: Unexpected character '#'
}

eslint configuration: .eslintrc.json

{
    "env": {
        "browser": true,
        "es2021": true,
        "node": true
    },
    "extends": [
        "airbnb-base"
    ],
    "rules": {
        "no-use-before-define": "off",
        "no-param-reassign": "off",
        "no-plusplus": "off",
        "no-nested-ternary": "off",
        "lines-between-class-members": "off"
    },
    "globals": {
        "root": "readonly",
        "app": "readonly",
        "db": "readonly"
    }
}
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Use the es2022 environment, which will automatically set the ecmaVersion parser option to 13, as indicated in the documentation:

    "env": {
        "browser": true,
        "es2022": true,
        "node": true
    },
about 4 years ago · Juan Pablo Isaza Report

0

Add this to .eslintrc.json

{
  ...
  "parserOptions": {
      "ecmaVersion": 13,
  },
  ...
}

Private member specifier was introduced in ECMA version 13.

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!