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

make shouldUseOverrideKeyword ignore initialize method #176

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export const shouldOnlyInheritFromMixin = error<Mixin>(node => node.supertypes.e
}))

export const shouldUseOverrideKeyword = warning<Method>(node =>
node.isOverride || !superclassMethod(node)
!(!node.isOverride && superclassMethod(node) && !['initialize'].includes(node.name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
!(!node.isOverride && superclassMethod(node) && !['initialize'].includes(node.name))
node.isOverride || !superclassMethod(node) || ['initialize'].includes(node.name))

prefiero que haya menos negación y más aserción

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree con vos Fer.

Igual para mí las validations se están declarando mal: afirman cuando el programa es correcto, y para mí debería afirmar cuándo quiero que aparezca el error.... no sé, siempre queda incómodo pensar el booleano.

Otra cosa es que nombre del método debe ser initialize (no incluir), y ese string ya debería estar en algún lado (la VM llama al método cada vez que instancia un objeto), tratemos de usar esa.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh ahí vi que el includes es sobre una lista, okkk!

Por qué no usar ==? Igual yo esperaría que ya haya una función isInitialize 🤔

)

export const possiblyReturningBlock = warning<Method>(node => {
Expand Down
Loading