Closed Bug 921398 Opened 8 years ago Closed 8 years ago

Relax the jshint rules about non-IIFE function literals to avoid clashes with the current style

Categories

(Firefox OS Graveyard :: Gaia, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: gsvelto, Assigned: julienw)

References

Details

Attachments

(1 file)

I've noticed a minor inconsistency between 'make lint' and 'make hint', if I write something like this:

var foo = (function bar() {}).bind(this);

hint will complain:

Wrapping non-IIFE function literals in parens is unnecessary

However our current style mandates that type of notation, changing to this:

var foo = function bar() {}.bind(this);

Causes jslint to complain:

Missing semicolon after function assigned to a variable

We should probably relax the jshint rule to accommodate our current style.
filed https://github.com/jshint/jshint/issues/1288 to implement this option.

If this does not happen quickly, I'll remove "immed" from our .jshintrc until it is implemented.
Note that "Missing semicolon after function assigned to a variable" is obviously a bug in gjslint, so I reported a bug there too: http://code.google.com/p/closure-linter/issues/detail?id=77

Hopefully at least one of these will get fixed soon !
Duplicate of this bug: 910722
Attached patch patch v1Splinter Review
This removes the "immed" and "newcap" rules.

The "immed" rule will be added back once gjslint bug 77 will be fixed or when
jshint adds another separate rule to warn about non-IIFE wrapped in parens.
---
 .jshintrc |    2 --
 1 file changed, 2 deletions(-)

The "newcap" rule won't likely be put back, I think this was a mistake to have it in the first place.

I'll file a bug to put "immed" back when we'll be able to.
Assignee: nobody → felash
Attachment #812588 - Flags: review?(anthony)
Blocks: 922588
Comment on attachment 812588 [details] [diff] [review]
patch v1

Review of attachment 812588 [details] [diff] [review]:
-----------------------------------------------------------------

Good for me!
Attachment #812588 - Flags: review?(anthony) → review+
master: 701fbdb8ef6095e702ec418c686217c2ccf2aed3
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Blocks: 923456
You need to log in before you can comment on or make changes to this bug.