Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby's .eslintignore being ignored #837

Closed
NMinhNguyen opened this issue Apr 22, 2017 · 8 comments
Closed

Gatsby's .eslintignore being ignored #837

NMinhNguyen opened this issue Apr 22, 2017 · 8 comments

Comments

@NMinhNguyen
Copy link
Contributor

Gatsby version: 0.12.45

Hi, I noticed that npm test on master fails due to some linting problems in interfaces folder, however this folder is actually specified in .eslintignore. But because linting is configured with --ignore-path .gitignore in package.json, .eslintignore is ignored in favour of .gitignore.

{
  "scripts": {
    "lint": "eslint --ext .js,.jsx --ignore-path .gitignore ."
  }
}

From ESLint docs:

Keep in mind that specifying --ignore-path means that any existing .eslintignore file will not be used.

Short of copying the contents of .gitignore into .eslintignore, I'm not sure what the best way to combine .eslintignore and .gitignore is.

You can scroll to the bottom of this recent build log to see the exact error

@KyleAMathews
Copy link
Contributor

So it turns out you can add multiple --ignore-path! bd068fd :-)

https://travis-ci.org/gatsbyjs/gatsby/builds/224775750

Thanks for doing the background research on this!

@NMinhNguyen
Copy link
Contributor Author

NMinhNguyen commented Apr 22, 2017

I'm afraid that's not true 😔 I had a dist folder on my machine, and it tried to lint it, with your changes. I think the last --ignore-path wins - try swapping .eslintignore and .gitignore, and you'll see that the interfaces folder isn't being ignored again.

$ DEBUG=eslint:* npm run lint

> gatsby@0.12.45 lint /path/to/gatsby
> eslint --ext .js,.jsx --ignore-path .gitignore --ignore-path .eslintignore .

  eslint:cli Running on files +0ms
  eslint:glob-util Creating list of files to process. +20ms
  eslint:ignored-paths Using specific ignore file +4ms
  eslint:ignored-paths Adding .eslintignore +0ms

@KyleAMathews
Copy link
Contributor

Oh hmmm...

@KyleAMathews KyleAMathews reopened this Apr 23, 2017
@NMinhNguyen
Copy link
Contributor Author

An easy (but not very scalable/optimal) solution would be to perhaps use --ignore-pattern interfaces?

@KyleAMathews
Copy link
Contributor

I guess we could just ignore the interfaces directory directly in the command. Trying that 06a4b45

@KyleAMathews
Copy link
Contributor

Heh, our brain waves connected!

@NMinhNguyen
Copy link
Contributor Author

It worked! Works locally as well, with an existing dist folder :)

@KyleAMathews
Copy link
Contributor

💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants