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

chore(lint): Add jest & node eslint plugins #1642

Merged
merged 5 commits into from Jan 4, 2021
Merged

chore(lint): Add jest & node eslint plugins #1642

merged 5 commits into from Jan 4, 2021

Conversation

fb55
Copy link
Member

@fb55 fb55 commented Jan 4, 2021

And fixes all reported issues.

And fixes all reported issues.
@@ -1,13 +1,10 @@
#!/usr/bin/env node
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd keep the shebang since the script is a CLI script

Copy link
Member Author

Choose a reason for hiding this comment

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

eslint-plugin-node's recommended config only allows a shebang when the script is actually a part of the package.json's bins. There isn't too much of a point for exposing this externally, so removing it seems reasonable. We always call this with node anyway, so nothing should change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, exactly why the shebang should stay :)

IMO this is wrong, and the file should be treated as a CLI script since that's what it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

See also mysticatea/eslint-plugin-node#96

and https://github.com/xojs/xo/blob/master/config/plugins.js#L309-L310

Personally, I'd disable the rule and keep the shebang.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks a lot for the references. This was super helpful, I'm convinced 😄

.eslintrc.json Outdated
"globals": { "Set": true, "Symbol": true },
"rules": {
// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth renaming .eslintrc.json to .eslintrc.js later so that the file is valid, but that's nitpicking since ESLint works with comments in JSON too.

BTW you could set it to 4.5.0 so that it works, but the discrepancy between the engines version and the current code will still exist.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah — we really need to find a solution for this. I've disabled the rule for now and will revisit it soon.

@fb55 fb55 merged commit 075cc5d into main Jan 4, 2021
@fb55 fb55 deleted the test/lint branch January 4, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants