My PhpStorm / WebStorm IDE keeps telling, that the class
and constructor
are unused for some classes (not for all). I have already set the JavaScript language version to ECMAScript6
and enabled Node.js support in settings. The code in general works fine too. For example ...
File TestClass.js:
module.exports = class Test {
constructor() {
console.log("Test.constructor");
}
test() {
console.log("Test.test");
}
}
File Test.js:
let Test = require("./TestClass");
let inst = new Test();
inst.test();
With this, code inspections keeps telling me:
Unused class TestClass
Unused method constructor
Is there anything wrong or is there a way to suppress the warning? The IDE in general displays no option to suppress this.
Even another problem seems to be, that anonymous classed causes inspection problems too. If I rewrite module.exports = class Test {
to module.exports = class {
even the method test()
inside the class will be marked as unused
. I haven't found a way to prevent this too ...