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",
//...
}
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.