dsheiko / jscodesniffer

⛔️ [DEPRECATED] Tool to ensure that your JavaScript code does not violate the specified coding standard (Idiomatic Style Manifesto or JQuery Core Style Guidelines)
http://dsheiko.github.io/jscodesniffer/
42 stars 8 forks source link

Relax indentation rule(s) for JSDoc comments #21

Closed tersmitten closed 9 years ago

tersmitten commented 9 years ago

It would be nice if there was a setting to relax indentation rules for JSDoc comments.

So we want to force tabs for indenting and no mixing of tabs and spaces is allowed, but it should be possible to format the comment with spaces (one):

    /**
     * Gets a member in object specified by path.
     *
     * @param {Object} object An object
     * @param {Array} path An array of indices indicating a path to a member of object
     */

instead of

    /**
    * Gets a member in object specified by path.
    *
    * @param {Object} object An object
    * @param {Array} path An array of indices indicating a path to a member of object
    */
dsheiko commented 9 years ago

A really good point, thanks. Added an option: ignoreBlockComments:true

This test now passes:

it(" must implement custom standard correctly", function () {
   var code = " /**\n *\n **/\n\t\tvar i = 1,\n\t\tb = 2;",
    modifiers = {
     "Indentation": {
        "allowOnlyTabs": true,
        "allowOnlySpaces": false,
        "ignoreBlockComments": true
      }
    };
        logger = sniffer.getTestResults( code, OPTIONS, modifiers );
    logger.getMessages().length.should.not.be.ok;
  });