eslint
差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン | |||
| eslint [2024/04/13 09:28] – nullpon | eslint [2025/06/08 14:53] (現在) – nullpon | ||
|---|---|---|---|
| 行 28: | 行 28: | ||
| - | ## 特定のファイルで特定のルールを無効化 | + | ## 一時的にルールを無効化 |
| - | 例えば、特定のファイルでのみconsole.logを許可するには、ファイルの先頭に以下を追加 | + | 特定の範囲でno-consoleを許可するには以下のように記述。 |
| - | ``` | + | ```javascript |
| /* eslint-disable no-console */ | /* eslint-disable no-console */ | ||
| + | |||
| + | console.log(' | ||
| + | |||
| + | /* eslint-disable no-console */ | ||
| + | |||
| + | console.log(' | ||
| ``` | ``` | ||
| + | 次の行のみno-consoleのチェックを無効化する | ||
| + | |||
| + | ```javascript | ||
| + | // eslint-disable-next-line no-console | ||
| + | console.log(' | ||
| + | |||
| + | |||
| + | console.log(' | ||
| + | ``` | ||
| + | |||
| + | いずれの方法でも無効化したいルールが複数ある場合は、ルールをカンマ区切りで複数記述する | ||
| + | |||
| + | ## Configの確認 | ||
| + | |||
| + | ``` | ||
| + | npx eslint --inspect-config | ||
| + | ``` | ||
| </ | </ | ||
eslint.1713000528.txt.gz · 最終更新: by nullpon