LoginSignup
1
1

More than 3 years have passed since last update.

【Angular】TSLintで特定の拡張子(.jsonなど)のファイルを検査対象外にする

Posted at

概要

TSLintで特定の拡張子(.jsonなど)のファイルを検査対象外にする。

方法

ネットでよく出てくるのは以下の方法であるが、こちらを試行したところ、検査対象外にすることはできなかった。
※.jsonファイルを検査対象外にする例

tslint.json

{
  "linterOptions": {
    "exclude": [
      "*.json",
      "**/*.json"
    ]
  }
}

以下の方法だと、検査対象外にすることができた。

# ng lint project_name --exclude src/**/*.json

ng lint コマンド実行の際にオプションで除外ファイルを指定した。
こちらの例では、Angular環境なので、 ng lint で実行しているが、
tslint コマンドでも同様かと思われる。こちらは未確認。

npm scripts で実行するのなら、以下のように定義する。

package.json
{
  "scripts": {
    "lint": "ng lint project_name --exclude src/**/*.json"
  }
}
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1