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

Codemod mistakes computed.equal for a modifier #429

Open
elwayman02 opened this issue Apr 2, 2021 · 2 comments
Open

Codemod mistakes computed.equal for a modifier #429

elwayman02 opened this issue Apr 2, 2021 · 2 comments

Comments

@elwayman02
Copy link

When encountering code where the computed namespace has been imported rather than the individual methods (e.g. computed.equal), the codemod outputs the following error:

Transform not supported - value has modifiers like 'property' or 'meta'

Presumably, it thinks computed.equal is the same thing as computed().volatile() or computed().meta(), and thus is erroring out instead of codemodding the file. Changing uses of the computed namespace to their equivalent imports is an existing workaround, but we should fix the codemod bug instead of requiring people to work around it!

@elwayman02
Copy link
Author

The error comes from hasModifierWithArgs having the incorrect value: https://github.com/ember-codemods/ember-native-class-codemod/search?q=hasModifierWithArgs

@pzuraq
Copy link
Collaborator

pzuraq commented Apr 3, 2021

Importing computed and invoking values like computed.equal was not part of the module API, and was a quirk of the fact that the module API was polyfilled via the global API. This functionality has been deprecated along with using the Ember global, and you should take this opportunity to rewrite the class in question to use the proper import path.

I don't think this is necessarily a case the codemod has to handle, given it's unusual and can be fixed before the codemod is run, but will accept a PR to add the functionality.

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

No branches or pull requests

2 participants