Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Conversation

@peterflynn
Copy link
Member

Fix Brackets project settings so browser: true is not set (which is how we had it before 834c4e9 in Sprint 37). Fix a few JSLint errors that snuck in because of this, plus some additional errors in ExtensionLoader that seem to have come from the Themes work in 0.42

… how

we had it before 834c4e9 in Sprint 37). Fix a few JSLint errors that snuck
in because of this, plus some additional errors in ExtensionLoader that
seem to have come from the Themes work in 0.42
@dangoor
Copy link
Contributor

dangoor commented Aug 8, 2014

@peterflynn But, with the exception of our node code, most of Brackets runs in a browser environment where window and other common globals can be expected to exist. Why do we not want to assume a browser environment?

@peterflynn
Copy link
Member Author

@dangoor We have it here in the old coding standards: https://github.com/adobe/brackets/wiki/Brackets-Coding-Conventions#globals. I think the main issue is that JSLint's browser option includes too much stuff -- it lets you access top-level vars named event, name, parent, etc., all of which are likely to mask bugs if ever encountered in our code. Even document is an issue since we often use local vars named document to reference Document objects.

I'd be ok with adding window plus setTimeout & friends to the default JSLint globals, though -- if there's an easy way to do it.

@peterflynn
Copy link
Member Author

Looks like we could add "predef": ["window", "setTimeout", "clearTimeout"] to the "jslint.options" pref for our project.

@dangoor How far do you think we should take that? We could also add define & brackets (and maybe even $) to the list, which could let us entirely eliminate the /*global*/ declaration from most of our files. Worth doing?

@marcelgerber
Copy link
Contributor

@peterflynn Mustache too, for the sake of completeness ;)
(there may even be some others)

@dangoor
Copy link
Contributor

dangoor commented Aug 11, 2014

@peterflynn Oh right, document is a particularly good example of a variable that appears in the browser but that we'd rather pretend doesn't exist because we use that name, too.

I like the idea of setting browser: false and adding predefs as you suggest.

@le717 le717 mentioned this pull request Nov 21, 2014
@nethip
Copy link
Contributor

nethip commented Mar 11, 2015

@peterflynn LGTM. Is "predef": ["window", "setTimeout", "clearTimeout"] the only change that is pending for this PR to go to master?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we removing window from this one?

@MiguelCastillo
Copy link
Contributor

@peterflynn I really like this idea... It will remove most the jslint definitions in source files, which I personally think isn't the best place to add those settings.

Why haven't we merged this in yet?

@ficristo
Copy link
Collaborator

In #11693 I am converting Brackets core code to ESLint.
Want to land this patch before it?

@ficristo
Copy link
Collaborator

Fixed in #12661

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants