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

173
Views
I'm getting ESLINT warnings when declaring more than one private class method in JS, why?

If I declare just one private method in a class then ESLINT compiles with no warnings, but... ESLINT emits one extra warning for each new private method I declare in that same class.

For instance, ESLINT emits 2 warnings for a classe declared like this:

class Clazz {
  #methodOne() { /*...*/ }
  #methodTwo() { /*...*/ }
  #methodThree() { /*...*/ }
}

ESLINT output:

WARNING  Compiled with 1 warning                                                                                                                                   10:14:26 PM

Module Warning (from ./node_modules/eslint-loader/index.js):

/Users/***/Clazz.js
  3:3  error  Duplicate name ''  no-dupe-class-members
  4:3  error  Duplicate name ''  no-dupe-class-members

✖ 2 problems (2 errors, 0 warnings)

I wonder if I'm doing something wrong or should I just ignore these warnings.


package.json:

{
  //...
  "eslint": "^6.7.2",
  "eslint-plugin-vue": "^6.2.2",
  "babel-eslint": "^10.1.0",
  "@vue/cli-plugin-eslint": "^3.1.1",
  //...
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I had the same problem and found a workaround. Define your private methods like this:

class Clazz {
  #methodOne = function() { /*...*/ }
  #methodTwo = function() { /*...*/ }
  #methodThree = function() { /*...*/ }
}

and the linter warnings/errors will go away.

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!