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

feat: read config from stdin #918

Merged
merged 1 commit into from
Oct 26, 2020
Merged

feat: read config from stdin #918

merged 1 commit into from
Oct 26, 2020

Conversation

dsanders11
Copy link
Contributor

Went back and forth on whether to put the functionality in bin/lint-staged.js or lib/index.js. Decided on bin/lint-staged.js since it doesn't make full sense to include in the programmatic API since the library user can read the config from wherever they'd like and provide it as an object.

@codecov
Copy link

codecov bot commented Oct 19, 2020

Codecov Report

Merging #918 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #918   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines          608       609    +1     
  Branches       143       143           
=========================================
+ Hits           608       609    +1     
Impacted Files Coverage Δ
lib/messages.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78782f9...78f746b. Read the comment docs.

Copy link
Member

@iiroj iiroj left a comment

Choose a reason for hiding this comment

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

What's your use-case for this feature? I'm fine with it, but the PR still needs some work. 👍

bin/lint-staged.js Show resolved Hide resolved
bin/lint-staged.js Show resolved Hide resolved
bin/lint-staged.js Outdated Show resolved Hide resolved
@dsanders11
Copy link
Contributor Author

What's your use-case for this feature?

I'd like to be able to pipe in a config from the output of a previous command.

So, the simplest example: ./generate-lint-staged-config.py | lint-staged --config -

@dsanders11
Copy link
Contributor Author

@iiroj, made your requested changes. Also scoped the new error message more tightly to just a read error on stdin and let JSON.parse silently fail until the config is validated in order to provide a more uniform experience.

lib/messages.js Show resolved Hide resolved
@iiroj
Copy link
Member

iiroj commented Oct 22, 2020

Thoughts, @okonet? Ready to merge, IMO.

@iiroj iiroj merged commit 969713d into lint-staged:master Oct 26, 2020
@iiroj
Copy link
Member

iiroj commented Oct 26, 2020

Thanks for the PR, @dsanders11!

@github-actions
Copy link
Contributor

🎉 This PR is included in version 10.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants