Eslint Rule Disabling for a Specific Line
In JSHint, linting rules can be disabled for a particular line using the syntax:
/* jshint ignore:start */ $scope.someVar = ConstructorFunction(); /* jshint ignore:end */
For eslint, there are several ways to achieve a similar effect.
Disable Next Line
To disable the next line only, use:
// eslint-disable-next-line no-use-before-define var thing = new Thing();
Disable Single Line
Alternatively, use the single-line syntax:
var thing = new Thing(); // eslint-disable-line no-use-before-define
Disable All Rules for a Line
If you wish to disable all eslint rules for a given line, you can use:
var thing = new Thing() // eslint-disable-line
Refer to the eslint documentation for more details.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3