Turning off eslint rule for a specific line
To disable next line:
// eslint-disable-next-line no-use-before-define
var thing = new Thing();
Or use the single line syntax:
var thing = new Thing(); // eslint-disable-line no-use-before-define
See the eslint docs
Turning off eslint rule for a specific file
You can turn off/change a particular rule for a file by putting the configurations at the top of the file.
/* eslint no-use-before-define: 0 */ // --> OFF
or
/* eslint no-use-before-define: 2 */ // --> ON
More info
eslint: How to disable certain eslint-disable- syntax?
Plugin eslint-plugin-eslint-comments is what you want.
ESlint: Turning off a specific rule across a project
In you .eslintrc you have two rules
keys. The second will overwrite the first. Here's the file with the rules merged together:
{
"rules": {
"wrap-iife": [
2,
"inside"
],
"max-len": [
2,
120
],
"indent": [
2,
2
],
"no-with": 2,
"no-implicit-coercion": [
2, {
"string": true
}
],
"camelcase": [
2, {
"properties": "never"
}
],
"quotes": [
2,
"single"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
],
"angular/controller-as-vm": "off",
"angular/document-service": "off",
"angular/window-service": "off"
},
"env": {
"es6": true,
"browser": true,
"node": true
},
"ecmaFeatures": {
"modules": true
},
"globals": {
"angular": true
},
"extends": "angular"
}
ESLint disable specific rule for line break
This triggers the "object-curly-spacing" lint, so ignore it:
"rules": {
"object-curly-spacing": "off",
}
Related Topics
How to Calculate Md5 Hash of a File Using JavaScript
When Does Js Interpret {} as an Empty Block Instead of an Empty Object
How to Set Time Delay in JavaScript
What Is Returned from a Constructor
Difference Between Using Bracket ('[]') and Dot ('.') Notation
How to Split a String into Segments of N Characters
Palindrome Check in JavaScript
Best Way to Add Page Specific JavaScript in a Rails 3 App
Generate PDF from HTML Using PDFmake in Angularjs
Detecting When a Div's Height Changes Using Jquery
Javascript: Which Browsers Support Parsing of Iso-8601 Date String with Date.Parse
How to Find Out Which JavaScript Events Fired
Create Svg Tag with JavaScript
How to Limit Google Autocomplete Results to City and Country Only
JSON.Stringify Doesn't Work with Normal JavaScript Array
Failed to Execute 'Postmessage' on 'Domwindow': Https://Www.Youtube.Com !== Http://Localhost:9000