jscs-jsdoc icon indicating copy to clipboard operation
jscs-jsdoc copied to clipboard

[Question] easiest way to give number as an option

Open dtracers opened this issue 10 years ago • 1 comments

I am making the new rule for description style for params and basically I want them to either put a string or an object that contains a number.

ex:

validTagDescription: "single-line"

or

validTagDescription: { spaces: 10 }

I did not know if there was a way to put in the valid values space like

validTagDescription: { allowedValues: ['single-line', { spaces: '#' }]

or something that represents the number type?

I saw that the check annotations just did the check by hand and then stored a value locally.

Also I do not want to allow true as it does not make sense as to what the default should be (but false is allowed obviously)

dtracers avatar Jun 22 '15 04:06 dtracers

There were no real use-cases for Numbers so I've left them to the further researches. In the JSCS repo we thinking about some schema: https://github.com/jscs-dev/node-jscs/issues/895

I think it can be a function for a while with a pure checking like: function (v) { return typeof v === 'number' || v === true; }

qfox avatar Jun 24 '15 17:06 qfox