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

ignore files in .gitignore #95

Closed
mafintosh opened this issue Mar 28, 2015 · 19 comments

Comments

@mafintosh
Copy link
Contributor

commented Mar 28, 2015

i sometimes have an experimental folder in a project where i try out different things. i usually add that to .gitignore. standard however still checks javascript files inside but since that folder sometimes contains some crazy bad code it usually fails. this makes my tests not run locally because of standard && tape test/*.js.

it would be great it standard just ignored files ignored by .gitignore (similar to how npm works).

@feross

This comment has been minimized.

Copy link
Member

commented Apr 1, 2015

This is a great idea. I'll implement it when I get the time, or accept a PR for it, of course.

@jprichardson

This comment has been minimized.

Copy link
Member

commented Apr 1, 2015

This feels like scope creep. Unless I'm missing something, why not just put the ignore definition in package.json? I guess if npm does it, there's a set precedent, but it doesn't seem right. (I think I understand the case for it though)

@feross

This comment has been minimized.

Copy link
Member

commented Apr 8, 2015

I think it actually makes sense to ignore the files in .gitignore by default.

Anything that's not checked into git (generated files, node_modules, temporary files, etc.) shouldn't be getting linted. I don't see a downside to ignoring them - do you? This should hopefully decrease the need for people to use the "standard" property of package.json.

@feross

This comment has been minimized.

Copy link
Member

commented Apr 8, 2015

Another plus is that it would solve #61. See #66 for more discussion.

feross added a commit that referenced this issue Apr 8, 2015

@feross

This comment has been minimized.

Copy link
Member

commented Apr 8, 2015

PR out: #107

@feross feross closed this in #107 Apr 9, 2015

@feross

This comment has been minimized.

Copy link
Member

commented Apr 9, 2015

Released as 3.4.0.

@karissa

This comment has been minimized.

Copy link

commented Jun 18, 2015

yay

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 20, 2015

instead of this, I think it should defer to git, and ignore everything not being tracked

@feross

This comment has been minimized.

Copy link
Member

commented Jul 20, 2015

@mvayngrib That's what this change does

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 20, 2015

as far as i understand deglob uses the .gitignore file. There may also be plenty of files in the directory that are not in .gitignore and that are untracked, for example all files covered in .git/info/exclude, and all files you didn't add to git yet, and may never do. I mean something like the list git-untracked would give you

the command line equivalent is:

git ls-files --others --exclude-standard
@feross

This comment has been minimized.

Copy link
Member

commented Jul 20, 2015

Hm, my first thought is that this will make it really hard to debug why standard is not checking certain files.

What does npm do? My understanding is that npm only looks for .gitignore when doing npm publish.

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 20, 2015

good point, that is what npm does. But that just makes me think they have it wrong too!

@feross

This comment has been minimized.

Copy link
Member

commented Jul 20, 2015

I wonder if someone's brought this up with npm? It seems likely to have come up for them if we're discussing it here (on a much smaller project). If we find a bug on their tracker about this, it would help illuminate the tradeoffs involved.

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 20, 2015

no luck so far, but judging by the sheer number of issues, they must have it. Anyone else find it?

@Flet

This comment has been minimized.

Copy link
Member

commented Jul 21, 2015

https://docs.npmjs.com/misc/developers#keeping-files-out-of-your-package

From what I can tell, npm will publish everything in the folder. It will also look for .npmignore and fall back to using .gitignore as a convenience.

Perhaps npm is purposely not tied to a specific version control system? It would make sense as it ensures broader support.

I can't think of any CLI tools that I use that take untracked git files into account (other than git itself).

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 21, 2015

@Flet that makes sense, but also throws into doubt the use of .gitignore. I guess it depends on what standard is doing style-enforcement for: modules to be published in npm (a fraction of javascript projects), or all javascript projects. If it's the first, it would be best to defer to npm to see what files it plans to publish (if this is possible). If it's the second, then maybe standard can have options like "standard --git" or "standard --npm". Just an idea.

@karissa

This comment has been minimized.

Copy link

commented Jul 21, 2015

How about keeping it the way it is, but letting you change that default
with

standard --ignore=/path/to/.ignore
Or with an env var.

Would that be a nice compromise?

On Tuesday, July 21, 2015, Mark Vayngrib notifications@github.com wrote:

@Flet https://github.com/Flet that makes sense, but also throws into
doubt the use of .gitignore. I guess it depends on what standard is doing
style-enforcement for: modules to be published in npm (a fraction of
javascript projects), or all javascript projects. If it's the first, it
would be best to defer to the npm module to see what files it plans to
publish (if this is possible). If it's the second, then maybe standard can
have options like "standard --git" or "standard --npm". Just an idea.


Reply to this email directly or view it on GitHub
#95 (comment).

Karissa McKelvey
http://karissa.github.io/ http://karissamck.com

Send me an encrypted message:
https://keybase.io/karissa https://keybase.io/karissa/key.asc

@feross

This comment has been minimized.

Copy link
Member

commented Jul 21, 2015

@mvayngrib Can't you just add your untracked files to the "standard.ignore" property in package.json?

@mvayngrib

This comment has been minimized.

Copy link

commented Jul 21, 2015

@feross it's not a problem for me to just have

"scripts": {
  "style": "standard $(git ls-files '**.js')"
}

this works just fine and does what I want it to. I was just curious what other people thought.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
6 participants
You can’t perform that action at this time.