Turning off eslint rule for a specific file

后端 未结 15 1467
后悔当初
后悔当初 2020-11-30 17:26

Is it possible to turn off the eslint rule for the whole file? Something such as:

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

(Analogous t

15条回答
  •  春和景丽
    2020-11-30 17:51

    you can configure eslint overrides property to turn off specific rules on files which matches glob pattern like below.

    Here, I want to turn off the no-duplicate-string rule for tests all files.

    overrides: [
      {
        files: ["**/__tests__/**/*.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
        rules: {
          'sonarjs/no-duplicate-string': 'off'
        }
      }
    ]
    

提交回复
热议问题