Skip to content Skip to sidebar Skip to footer

Disallowtrailingcomma Does Not Work In Jscs

I am using http://jscs.info. I need to get a warning if my app has left trailing comma, example, using: var x = { prop1: 10, prop2: 20, }; I should get a warning. With the

Solution 1:

Your two options contradict each other. At the same time you require that there are trailing commas with "requireTrailingComma": true and forbid the trailing comma with "disallowTrailingComma": true.

To get the warning for trailing commas, remove the "requireTrailingComma": true option and at the same time keep "disallowTrailingComma": true.


UPDATE

I removed the following options that generated errors in console and it worked for your slightly modified example code, that only the trailing comma warning is displayed:

varx={prop1 :10,prop2 :20,};

I removed the following lines (shown together with their errors)

"disallowSpaceAfterLineComment":false

because of

AssertionError: disallowSpaceAfterLineComment option requires the value true

and

"safeContextKeyword":true

because

AssertionError: safeContextKeyword option requires stringorarray value

and

"requireTrailingComma":true

because of the contradiction described above.

Post a Comment for "Disallowtrailingcomma Does Not Work In Jscs"