Allow debugger; statements in certain files, using ESLint

后端 未结 5 898
故里飘歌
故里飘歌 2021-02-08 10:30

Say I want to use this rule:

https://eslint.org/docs/rules/no-debugger

however, I have about 15 files where I want to keep debugger; statements.

Is there

相关标签:
5条回答
  • 2021-02-08 10:56

    Probably your IDE can help. If you are using VS Code, you can mouse over debugger, click Quick Fix..., and select Disable no-debugger for the entire file, as shown as below:

    Then the IDE will add the following comment at the top of the file to disable the rule for you:

    /* eslint-disable no-debugger */
    

    See more on the eslint no-debugger rule.

    0 讨论(0)
  • 2021-02-08 10:57

    You can do that like this:

    /* eslint-disable no-debugger */
    ... code that violates rule ...
    /* eslint-enable no-debugger */
    
    0 讨论(0)
  • 2021-02-08 11:04

    OR, add:

    "no-debugger": false
    

    to the bottom of tslint.json, to disable this warning for all files.

    0 讨论(0)
  • 2021-02-08 11:11

    Update your eslint configuration file (.eslintrc etc) with such rule:

    "rules": {
        "no-debugger":"off"
    }
    
    0 讨论(0)
  • 2021-02-08 11:13

    You can also disable ESLint in the same line:

    debugger; // eslint-disable-line no-debugger
    
    0 讨论(0)
提交回复
热议问题