Articles of jscs

预期4个字符的缩进

UPDATE 作为@ dev-null(btw thx很多:))build议(见评论)正确的方法是 jscs –fix file.js 我的缩进有什么问题? .editorconfig root = true [*] indent_style = space indent_size = 4 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false .jscsrc { "disallowKeywords": ["with"], "disallowKeywordsOnNewLine": ["else"], "disallowMixedSpacesAndTabs": true, "disallowMultipleVarDecl": "exceptUndefined", "disallowNewlineBeforeBlockStatements": true, "disallowQuotedKeysInObjects": true, "disallowSpaceAfterObjectKeys": true, "disallowSpaceAfterPrefixUnaryOperators": true, "disallowSpacesInFunction": { […]

jscs错误:validateLineBreaks:在filename.js无效换行符

在grunt-jscs它为base/index.js文件提供以下错误。 Running "jscs:src" (jscs) task validateLineBreaks: Invalid line break at api/v1/base/index.js : 1 |var errors = require('restify-errors'); ———————————————–^ 2 |function Base(Model) { 在我删除var errors = require('restify-errors'); 这一行,它开始给出下面的错误 Running "jscs:src" (jscs) task validateLineBreaks: Invalid line break at api/v1/base/index.js : 1 |function Base(Model) { ——————————^ 如何解决这个问题? find解决方法 :创build新文件并将所有内容复制到该文件中解决问题。 还想知道为什么发生这种情况的具体原因?

如何在Windows上创build一个JSCSconfiguration文件

当我尝试创build一个JSCSconfiguration文件时: C:\Blog\BlogWeb>jscs –auto-configure "C:\Blog\BlogWeb\temp.jscs" 我得到以下错误: safeContextKeyword选项需要string或数组值 我应该通过什么参数? 什么是safecontext关键字? 新来NPM和JSCS,请原谅无知。

Node / NPM / Grunt在jscs上失败(grunt-jscs)

我有一个在JS代码基础上运行JSCS的grunt任务,它一直在工作,直到与使用最新,稳定版本的grunt,npm / node的构build服务器集成为止。 在npm 1.XX.X下全部运行正常,但在升级到2.XX.X后, 我尝试了最新的3.XX.X,并且以与2.XX.X相同的方式失败。 我认为所需的相关部分是 cli输出: $ node -v v5.2.0 $ npm -v 3.3.12 $ grunt –version grunt-cli v0.1.13 grunt v0.4.5 $ grunt jscs Loading "jscs.js" tasks…ERROR >> TypeError: fn.call is not a function Warning: Task "jscs" not found. Use –force to continue. Aborted due to warnings. 的package.json: { "name": "Javascript", "version": "1.0.0", […]

gulp-jscs Object.keys在非对象上调用

我是一个新手,尝试玩弄它。 我尝试使用gulp-jscs时出现此错误 'default' errored after 98 ms [16:58:00] TypeError: Object.keys called on non-object at Function.keys (native) at NodeConfiguration.Configuration._throwNonCamelCaseErrorIfNeeded (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:440:12) at NodeConfiguration.Configuration.load (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:51:10) at StringChecker.configure (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/string-checker.js:66:29) at Checker.configure (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/node_modules/jscs/lib/checker.js:26:39) at module.exports (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp-jscs/index.js:31:11) at Gulp.<anonymous> (/home/kbadr/Node_Projects/demo/membership/gulpfile.js:22:15) at module.exports (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7) at Gulp.Orchestrator._runTask (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/index.js:273:3) at Gulp.Orchestrator._runStep (/home/kbadr/Node_Projects/demo/membership/node_modules/gulp/node_modules/orchestrator/index.js:214:10 这是我的大gulpfile var gulp = require('gulp'); var jscs = require('gulp-jscs'); gulp.task('default', function () […]