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

New rule options allowDecorators in require-optimization #669

Merged
merged 1 commit into from
Jul 23, 2016
Merged

New rule options allowDecorators in require-optimization #669

merged 1 commit into from
Jul 23, 2016

Conversation

Tom910
Copy link
Contributor

@Tom910 Tom910 commented Jul 7, 2016

I like this require-optimization rule, but it is not suitable for our implementation. I think a lot of people use https://www.npmjs.com/package/pure-render-decorator or similar solutions. It is the reason I made an additional option. Now it will be possible to register a list of names of decorators, which allow to pass validation.

I hope my change will be useful and will get in release =)

@ljharb
Copy link
Member

ljharb commented Jul 7, 2016

How does this handle that decorators are actually in-scope bindings, and not string names? In other words, the name "foo" might mean different things in different files.

@Tom910
Copy link
Contributor Author

Tom910 commented Jul 8, 2016

In other words, the name "foo" might mean different things in different files.

Yes, the name of the decorator may vary. It's up to the developer to make up some convention and to name imports conveniently and in the same way.

There is no need to perform any deep checks. This addition allows the developer to use any optimization decorator, not only pure mixin, but any other, including his own utilities. The only purpose of allowDecorators option is to provide names of this tools to the rule.

How can this be made in a different way? Analyze the decorator? Or check imports? There can be too many variations.

@ljharb
Copy link
Member

ljharb commented Jul 8, 2016

That's totally a fair point - just wanted to make sure it was considered.

@yannickcr yannickcr merged commit f7a9dcc into jsx-eslint:master Jul 23, 2016
@yannickcr
Copy link
Member

Merged, thanks!

@Tom910
Copy link
Contributor Author

Tom910 commented Jul 23, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants