LoginSignup
1

More than 3 years have passed since last update.

create-react-appで.eslintignore を有効にする

Last updated at Posted at 2020-05-23

WHY?

.eslintignore に定義されたファイルとディレクトリはESLintの検査対象外となります。
通常はrootディレクトリに配置するだけでOKですが、
create-react-appで作成した場合はrootディレクトリに配置しただけでは有効になりません。

手順

package.jsonと同じところに.envファイルを用意して以下を定義ます。

.env
EXTEND_ESLINT=true

以上です。

こちらに載ってました。
Enable .eslintignore with extend flag (#7562)

おまけ

create-react-appの中はこんな感じです。

packages/react-scripts/config/webpack.config.js
{
  ignore: process.env.EXTEND_ESLINT === 'true',
}

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