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

fix(index): consider paths relative to git root - #118, #120 #121

Merged
merged 1 commit into from Jan 18, 2017

Conversation

rodneyrehm
Copy link
Contributor

@rodneyrehm rodneyrehm commented Jan 15, 2017

this PR is following up on the question in #120 regarding its possible fix for issue #118. It does not contain the suggested removal of the matchBase option, but makes clear that this option effectively makes *.js works like **/.js, which is not necessarily expected behavior.

  • changing lint-staged to run minimatch patterns against paths relative to the directory .git is in, while passing absolute paths to the linters
  • removing obsolete src/resolveFiles.js and test
  • adding note to README about how directories and patterns work
  • improving generateTasks tests to be simpler to read

Copy link
Collaborator

@okonet okonet left a comment

Choose a reason for hiding this comment

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

LGTM!

@okonet
Copy link
Collaborator

okonet commented Jan 17, 2017

@rodneyrehm is the #118 closed by this? Can you point me to the exact test case?

@rodneyrehm
Copy link
Contributor Author

Yes, #118 is closed by this. There is no specific test case as generateTasks() now simply matches agains a relative path and returning the corresponding absolute path. That the relative paths are in fact relative to the git directory is not covered by any test. The static files map you see in test/generateTasks.spec.js It's generated by the following part in src/index.js:

const resolvedFiles = {}
files.forEach((file) => {
  const absolute = path.resolve(gitDir, file.filename)
  const relative = path.relative(gitDir, absolute)
  resolvedFiles[relative] = absolute
})

@okonet okonet merged commit 41ae0cb into lint-staged:master Jan 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants