Ignore lines from linting and formating - VSC EsLint + Prettier

Viewed 1322
some.JS.Code;

//ignore this line from linting etc.
##Software will do some stuff here, but for JS it's an Error##

hereGoesJs();

Is there a possibility to exlude a line from linting and formatting in Visual Studio Code? Because I need the line, but also need Linting and Formatting for the other part of the Code...

// I Tried

// eslint-disable-next-line no-use-before-define

// eslint-disable-line no-use-before-define

/*eslint-disable */

//suppress all warnings between comments
alert('foo');

/*eslint-enable */

// @ts-ignore
        
1 Answers

Yes you have a couple of options available to you.



Option #1 Disabling Specific Rules:


  /* eslint-disable no-var */
  
  var x = 'apple sauce'; 
  
  /* eslint-enable no-var */



Option #2 Disabling Entire Files:


// Anything up here will still be affected by the linter.

/* eslint-disable */  // Disables everything from this point down




Option #3 Disabling a Single Line:



    // eslint-disable-next-line 
    var x = 'apple sauce';
    
    //  or you can do this:

    var y = 'apple sauce'; // eslint-disable-line

  



The official ESLint page that covers the topic, "Disabling ESLint", is located at the link below
https://eslint.org/docs/user-guide/configuring/rules#disabling-rules
Related