wesaynih / infrastructure

© 2016 The Knights Who Say NIH — Do NOT fork this repository without permission.
http://frameless.io/
Other
0 stars 1 forks source link

Add lint test to prevent misinterpreting array literals as array index lookup due to missing semicolon #38

Closed Yolijn closed 8 years ago

Yolijn commented 8 years ago

While fixing a no-sequences eslint error, I saw the issue was raised due to a misinterpreted array. We should be thorough and try to always find these mistakes, for example by preventing whitespace before array lookups.

unlessStates.forEach(function (name) {
    this.generator.optimizeUnlessCharList(this.generator.getState(name));
}, this); // This semicolon was missing!

['ForwardAxis', 'ReverseAxis', 'Wildcard', 'SequenceType', 'ItemType', 'AnyKindTest', 'DocumentTest', 'TextTest', 'CommentTest', 'PITest', 'AttributeTest', 'SchemaAttributeTest', 'ElementTest', 'SchemaElementTest'].forEach(function (name) {
    this.generator.optimizeStringSequences(this.generator.getState(name));
}, this);