douglascrockford/JSLint — pull request #134 by kevinoid (2012-07-06 05:34:45+00:00)
Title: Allow read-only properties in ES5 object literals

I didn't find any previous objection to read-only properties as bad style, so I am hoping that you would consider supporting read-only properties (getter without setter) in the ES5 object literal syntax.

The attached commits are one possible implementation, feel free to change/rework as you see fit (or I can rework them based on your feedback). They maintain the requirement that if both a getter and setter are specified that the setter appear immediately after the getter and add a new warning if this is not the case. It also allows write-only properties, although if this is considered bad style (it is certainly unusual) it can be easily adjusted to forbid them.

You may want to take a close look at the second commit, as I am not sure why the token strings were being emptied for the property name token and don't want to introduce a regression from that change.

Thanks!