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

[legacy-framework] Fix additional lint rules #366

Merged
merged 1 commit into from
May 4, 2020

Conversation

jportela
Copy link
Collaborator

Type: linting

Closes: blitz-js/legacy-framework#803
Follow-up to: #298

What are the changes and their implications? ⚙️

Uniform linting rules across all subpackages. 0 warnings, 0 errors.

Checklist

  • Tests added for changes
  • Any added terminal logging uses packages/server/src/log.ts

Breaking change: no

Other information

@@ -1,3 +1,4 @@
/* eslint-disable eqeqeq */
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it seems == is being used intentionally here over ===, so I'm disabling this rule for this file only. In general, I think this is a rule we want to promote, so I didn't disable it globally

Copy link
Collaborator

@ryardley ryardley Apr 30, 2020

Choose a reason for hiding this comment

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

Hmm. code is a number so to me that looks like it should be referential equality.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

code can actually be null:
https://nodejs.org/api/child_process.html#child_process_event_exit

If the process exited, code is the final exit code of the process, otherwise null

Looking at this,=== would definitely be what we want here, since we are targeting the success case. I'll remove the disable and fix the equality comparison

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Typescript is also inferring it properly as number | null so I'm removing the type declaration on the argument of the exit event

Copy link
Collaborator

@ryardley ryardley Apr 30, 2020

Choose a reason for hiding this comment

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

I love it when linting solves real world bugs! 😀

Copy link
Collaborator

Choose a reason for hiding this comment

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

I love it when linting solves real world bugs! 😀

@ryardley I saw your tweet before I saw this comment, the tweet makes much more sense now 😂

flybayer
flybayer previously approved these changes May 1, 2020
@@ -1,8 +1,7 @@
import {Command} from '@oclif/command'
import {build} from '@blitzjs/server'

// eslint-disable-next-line import/no-default-export
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just checking, because of the eslint-disable comments, do we intend to export these as default?

Copy link
Collaborator

Choose a reason for hiding this comment

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

nope, that's just legacy. moving forward we'd like everything to be named exports

@flybayer
Copy link
Member

flybayer commented May 4, 2020

Uh oh, lot's of conflicts 😬

@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

no worries, that's to be expected, should be straightforward to solve. If we plan to merge soon, I can do that now

@flybayer
Copy link
Member

flybayer commented May 4, 2020

@jportela yeah I can merge soon

@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

@flybayer how do you feel of upgrading these two linting rules to error instead of warning, to actually fail the build?

@jportela jportela force-pushed the fix-additional-rules branch from 05e2bae to 5bde8dd Compare May 4, 2020 11:18
@flybayer
Copy link
Member

flybayer commented May 4, 2020

@jportela which rules?

@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

the No Default Export and Kebab Case for filenames

@flybayer
Copy link
Member

flybayer commented May 4, 2020

I.e. the current code is all correct and that we can now change those to be an error to ensure new PRs conform? If this is what you are asking, then yes let's error them.

@jportela jportela force-pushed the fix-additional-rules branch from 5bde8dd to 4810d61 Compare May 4, 2020 13:15
@flybayer
Copy link
Member

flybayer commented May 4, 2020

@jportela Good to merge?

@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

@flybayer yes, just need to wait for the build checks to finish :)

@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

@flybayer I actually found a typo on my .eslintrc changes, I'm pushing the fix for it now

@jportela jportela force-pushed the fix-additional-rules branch from 4810d61 to 415db25 Compare May 4, 2020 13:22
@jportela
Copy link
Collaborator Author

jportela commented May 4, 2020

@flybayer done, feel free to merge whenever 👍

@flybayer flybayer changed the title Fix additional rules Fix additional lint rules May 4, 2020
@flybayer flybayer merged commit e12d17b into blitz-js:canary May 4, 2020
@flybayer
Copy link
Member

flybayer commented May 4, 2020

Sweeet, thank you!

@jportela jportela deleted the fix-additional-rules branch May 4, 2020 14:19
@itsdillon itsdillon changed the title Fix additional lint rules [legacy-framework] Fix additional lint rules Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uniform code style in monorepo
6 participants