修复了不支持的jsdoc规则

Unsupported jsdoc rule fix

本文关键字:jsdoc 规则 不支持      更新时间:2023-09-26

使用.jsrc文件,我得到了服务器/前端文件的以下错误。它在我的文件顶部抛出了一个错误。我怎样才能抑制这种情绪呢?

Unsupported rule: fix at js/server.js :
 1 |'use strict';
Unsupported rule: fix at js/example.js :
 1 |(function() {

这是我的.jscsrc文件

  // http://jscs.info/rules.html
  {
    "requireOperatorBeforeLineBreak": true,
    "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
    "maximumLineLength": {
      "value": 100,
      "allowComments": true,
      "allowRegex": true
    },
    "validateIndentation": 2,
    "validateQuoteMarks": { "mark": "'", "escape": true },
    "disallowMultipleLineStrings": true,
    "disallowMixedSpacesAndTabs": true,
    "disallowTrailingWhitespace": true,
    "disallowSpaceAfterPrefixUnaryOperators": true,
    "disallowKeywordsOnNewLine": ["else"],
    "requireSpaceAfterKeywords": [
      "if",
      "else",
      "for",
      "while",
      "do",
      "switch",
      "return",
      "try",
      "catch"
    ],
    "requireSpaceBeforeBinaryOperators": [
        "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
        "&=", "|=", "^=", "+=",
        "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
        "|", "^", "&&", "||", "===", "==", ">=",
        "<=", "<", ">", "!=", "!=="
    ],
    "requireSpaceAfterBinaryOperators": true,
    "requireSpacesInConditionalExpression": true,
    "requireSpaceBeforeBlockStatements": true,
    "requireSpacesInForStatement": true,
    "requireLineFeedAtFileEnd": true,
    "requireSpacesInFunctionExpression": {
        "beforeOpeningCurlyBrace": true
    },
    "disallowSpacesInAnonymousFunctionExpression": {
        "beforeOpeningRoundBrace": true
    },
    "disallowSpacesInsideArrayBrackets": "all",
    "disallowSpacesInsideParentheses": true,
    "disallowMultipleLineBreaks": true,
    "disallowNewlineBeforeBlockStatements": true
  }

在.jscsrc中添加以下检查将消除您的错误:

"jsDoc": {
    "checkParamNames": true,
    "requireParamTypes": true
}

"validateJSDoc"被禁用;请参阅以下网址

访问获取更多信息http://jscs.info/rule/jsDoc.html

Pull Request https://github.com/roots/sage/pull/1522

提交SHA https://github.com/chrisk2020/sage/commit/bcefb5908fdb457d2126833198cd760378ffe949

我的所有文件上都显示了相同的错误消息。我的.jscsrc文件中有一个"fix: true"规则;我不记得从哪儿弄来的了。它应该自动修复诸如间距错误之类的问题。也许这在以前的JSCS版本中有效,但现在不起作用了。我正在使用grunt,我必须修改grunt任务以获得期望的结果。之前我有

grunt.config.set('jscs', {
  js: {
    src: [ /* path to my files */ ]
  }
});

我在src之后添加了以下内容:

options: {
  config: ".jscsrc",
  fix: true
}