Skip to content

Commit

Permalink
Enable .eslintignore with extend flag (#7562)
Browse files Browse the repository at this point in the history
  • Loading branch information
igtm authored and mrmckeb committed Sep 24, 2019
1 parent b1e6155 commit 6f5221c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-scripts/config/webpack.config.js
Expand Up @@ -342,6 +342,7 @@ module.exports = function(webpackEnv) {
eslintPath: require.resolve('eslint'),
resolvePluginsRelativeTo: __dirname,
// @remove-on-eject-begin
ignore: process.env.EXTEND_ESLINT === 'true',
baseConfig: (() => {
const eslintCli = new eslint.CLIEngine();
let eslintConfig;
Expand All @@ -360,7 +361,6 @@ module.exports = function(webpackEnv) {
};
}
})(),
ignore: false,
useEslintrc: false,
// @remove-on-eject-end
},
Expand Down

5 comments on commit 6f5221c

@ajhool
Copy link

@ajhool ajhool commented on 6f5221c Oct 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're having difficulty getting this to work, could a quick example file be provided, please?

Currently, we've tried injecting env variables in the command line and with a .env file:

# .env
EXTEND_ESLINT=true
PORT=3003

and we have a .eslintignore file in the root dir with a few potential paths:

src/generated/**.ts
./src/generated/graphql.ts
generated/graphql.ts

And does this commit allow us to actually extend the .eslint config/rules or does it just allow us to ignore files? Currently attempting to migrate from react-scripts-ts and not being able to customize eslint is a difficult surprise

@mblaze
Copy link

@mblaze mblaze commented on 6f5221c Nov 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work and it is not ok that problems with a linter cause so much trouble.

@seanf
Copy link

@seanf seanf commented on 6f5221c Dec 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth, I was able to use it by adding these files to my project root (with react-scripts 3.3.0):

.env:

# This allows the use of .eslintignore
# https://github.com/facebook/create-react-app/blob/master/docusaurus/docs/advanced-configuration.md
EXTEND_ESLINT=true

.eslintignore:

src/gen/**
src/generated/**

@seanf
Copy link

@seanf seanf commented on 6f5221c Dec 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@franciscop-sc
Copy link

@franciscop-sc franciscop-sc commented on 6f5221c Jan 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got it working, had to restart the npm start both after the change in .env (as usual) and after adding the .eslintignore. I'm running react-scripts@3.3.0 FWIW.

Please sign in to comment.