-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
Throw an error if run on an ignored file #366
Throw an error if run on an ignored file #366
Conversation
bf50b0c
to
51dcdda
Compare
@sindresorhus should it throw an error or a console.error with a process.exit |
This change needs tests. |
You're missing #238 (comment) |
The |
cli-main.js
Outdated
@@ -138,6 +139,22 @@ const log = report => { | |||
process.exit(report.errorCount === 0 ? 0 : 1); | |||
}; | |||
|
|||
const throwIfFileIsIgnored = file => { | |||
if (input.includes(file)) { | |||
throw new Error('You cannot run xo on an ignored file'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error should mention the file path.
|
@sindresorhus I had to modify a test to get this to work because this pr changes the behaviour of that test. Also i think #238 (comment) has already been taken care of because the input array holds all files that match the |
9bbe1bf
to
2ab0a69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit
Given the age I'm going to close this PR, but it's definitely still a welcome change. Please open a new PR if you intend to work on it again |
This PR fixes #238 and it throws an error if you call xo on a single file which is ignored.