-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add include syntax #58
Comments
It is easy for us to implement this by extending .gcloudignore
const MATCH_INCLUDE = /#!include\s*:\s*([^\s]+)/
const gcloudignore = fs.readFileSync('.gcloudignore').toString()
const ig = ignore().add(gcloudignore)
gcloudignore
.split(/\r|\n/)
.map(line => {
const match = line.match(MATCH_INCLUDE)
return match && match[1]
})
.filter(Boolean)
.forEach(include => {
ig.add(fs.readFileSync(include).toString())
})
ig.ignores(somePath) It just takes 2 minutes, not tested. |
IMO, Even if I add a new feature of include syntax, I need to set the flag to Maybe we could involve some guys from Prettier or Eslint for further discussion, or open a related issue to the Eslint repo. |
I am closing this. Be free to reopen this issue if necessary |
I would consider such implementation here very benevolent upstream nudging. A feature flag is maybe the right balance. There is a strong need downstream as evidenced by the linked (recent) issues from prettier. @kaelzhang I hope you might reconsider to implement this in order to cut on pointless (and eternal) downstream discussions. If google does it and node-ignore does it, then maybe other language ecosystems will converge, too. The problem is generic enough. |
@blaggacao maybe I could provide another package which depends on Any suggestions? Months ago, I once had a plan to make a ignore parser which supports to handle |
How about an const ig = ignore({
include(filename) {
return fs.readFileSync(filename, 'utf-8');
}
}) If a line is encounted that starts with |
@remcohaszing Great idea 👍 |
This a great contribution for everyone, love this proposal 👍 |
I'll probably make a higher-level package with a EDIT: oh i wasn't actually reading that people have include directives in their files though. Note: you can tell prettier and eslint to use your gitignore with a CLI option. |
This package is used by various tools for parsing an ignore file. Since basically every tool, especially linter, simply needs to ignore files from
.gitignore
, and maybe some other files, it would be nice if they could simply include the file list from.gitignore
.In the Google Cloud SDK, this is solved using the following syntax:
See https://cloud.google.com/sdk/gcloud/reference/topic/gcloudignore
Currently Prettier, ESLint, and Stylelint all use separate ignore, all parsed using this package. All of their ignore files typically contain the same content.
The text was updated successfully, but these errors were encountered: