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 for Aurelia plugins(and server side rendering): fail when using globals, that don't work with aurelia-pal-nodejs #181

Open
atsu85 opened this issue Nov 9, 2017 · 5 comments

Comments

@atsu85
Copy link
Contributor

atsu85 commented Nov 9, 2017

Motivation

To be able to run Aurelia code on NodeJS (with aurelia-pal-nodejs) in addition to running it in browser, using browser globals (such as window and browser DOM Element) directly should be avoided - instead they should used via Aurelia Platform Abstraction Layer aurelia-pal instead.
It would be great if this project could help Aurelia ecosystem to get ready for running code on NodeJS in addtion to browser.

Example

Instead of Element plugins should use DOM.Element and instead of window.Intl they should use PLATFORM.global.Intl (as You can see in this fix for aurelia-i18n plugin related to this bug report)

@zewa666
Copy link
Member

zewa666 commented Nov 9, 2017

Fully support that, whatever can be automated ist a definitiv win

@gheoan
Copy link

gheoan commented Nov 11, 2017

Maybe this is better suited for the eslint aurelia plugin. https://github.com/bryanrsmith/eslint-plugin-aurelia

@aluanhaddad
Copy link

aluanhaddad commented Nov 11, 2017

@zewa666 indubitably.

@gheoan that plugin lints code outside of templates. Are these functions in some when evaluating template bindings? I didn't think they were.

eslint and tslint both allow banning arbitrary globals

*eslint

*tslint

@gheoan
Copy link

gheoan commented Nov 11, 2017

Global values can be used in templates using view engine hooks, which are implemented in script. So this can be solved by linting the script using eslint or tslint

@aluanhaddad
Copy link

I see I didn't know about those hooks. Thank you for explaining.

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

4 participants