I’ve got an Unexpected dangling '_' in '_origin' no-underscore-dangle error when I used _ as the beginning of a variable because of naming conventions for identifiers in JavaScript.

This error comes from a rule 'no-underscore-dangle': ['error', { allow: ['_store'] }] which set up in a setting file .eslintrc.js. This rule means disallow all variables’ name start or end with _ except for the variable '_store'.

As the variable which I want to use is a “private” member of an object so I want to continue using _ as the beginning of that variable. Of course, the easiest way to solve this problem is to cancel that rules in .eslintrc.js but I don’t really need to allow all variables can start with _.

There is an easy way to solve this little error that is adding this ignore comment /* eslint no-underscore-dangle:0 */ at the top of that variable. For example

 /* eslint no-underscore-dangle:0 */
 const origin = item[0]._origin;  

In this way it will just ignore the error shows on that line.

Any feedback is welcome! :-)