使用.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
}
答案 0 :(得分:7)
在.jscsrc中添加以下检查将删除您的错误:
"jsDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
&#34; validateJSDoc&#34;被诽谤;请参阅以下网址
访问以获取更多信息http://jscs.info/rule/jsDoc.html
提取请求https://github.com/roots/sage/pull/1522
提交SHA https://github.com/chrisk2020/sage/commit/bcefb5908fdb457d2126833198cd760378ffe949
答案 1 :(得分:0)
我的所有文件都显示相同的错误消息。我的.jscsrc文件中有一个“fix:true”规则;不记得我在哪里。它应该自动修复间距错误之类的东西。也许这在JSCS的早期版本中有效,但它现在不起作用。我正在使用grunt,我不得不修改grunt任务以获得理想的结果。我以前在哪里
grunt.config.set('jscs', {
js: {
src: [ /* path to my files */ ]
}
});
我在src
之后添加了以下内容:
options: {
config: ".jscsrc",
fix: true
}