Created
April 22, 2015 05:47
-
-
Save lizzie/99a8cbec4cfb0f350952 to your computer and use it in GitHub Desktop.
jscs 的配置文件
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jscs 配置文件 | |
{ | |
disallowAnonymousFunctions: true, // 不允许匿名函数 | |
disallowCapitalizedComments: true, // 不允许注释首字符大写 | |
disallowCommaBeforeLineBreak: true, // 不允许逗号出现在换行符之前 | |
disallowCurlyBraces: true, // 不允许语句后面出现不必要的大括号 | |
disallowDanglingUnderscores: true, // 除特殊内置变量外,不允许变量名是下划线开头或结尾的 | |
disallowEmptyBlocks: true, // 除 try catch 外,不允许空语句块 | |
disallowFunctionDeclarations: true, // 不允许声明函数 | |
disallowIdentifierNames: ['foo', 'bar'], // 不允许使用的变量名 | |
disallowImplicitTypeConversion: ['numeric', 'boolean'], // 不允许类型的隐式转换 | |
disallowKeywordsInComments: true, // 不允许注释中出现某些关键字 | |
disallowKeywordsOnNewLine: [], // 不允许某些关键字新开一行 | |
disallowKeywords: [], // 不允许出现某些关键字 | |
disallowMixedSpacesAndTabs: true, // 不允许混用tab和空格 | |
disallowMultipleLineBreaks: true, // 不允许出现多个空行 | |
disallowMultipleLineStrings: true, // 不允许多行字符串 | |
disallowMultipleSpaces: true, // 不允许多余的空字符 | |
disallowMultipleVarDecl: true, // 除在循环中外,不允许多个变量声明只使用一个 var | |
disallowNewlineBeforeBlockStatements: true, // 不允许大括号在新一行 | |
disallowOperatorBeforeLineBreak: [], // 不允许某些操作符出现在新行起始位置 | |
disallowPaddingNewLinesAfterBlocks: true, // 不允许块语句后出现空行 | |
disallowPaddingNewlinesBeforeKeywords: [], // 不允许某些关键字上方出现空行 | |
disallowPaddingNewLinesBeforeLineComments: true, // 不允许注释上方出现空行 | |
disallowPaddingNewlinesInBlocks: true, // 不允许块语句中出现多余的空行 | |
disallowPaddingNewLinesInObjects: true, // 不允许 Object 的 {} 中出现换行 | |
disallowQuotedKeysInObjects: true, // 不允许 Object 的 key 字段使用引号包裹 | |
disallowSemicolons: true, // 不允许逗号出现在行末 | |
disallowSpaceAfterBinaryOperators: [], // 不允许二元操作符右侧出现空格 | |
disallowSpaceAfterKeywords: [], // 不允许关键字后出现空格 | |
disallowSpaceAfterLineComment: true, // 不允许注释符后面出现空格 | |
disallowSpaceAfterObjectKeys: true, // 不允许对象的 key 字段后面出现空格 | |
disallowSpaceAfterPrefixUnaryOperators: [], // 不允许一元操作符的右侧出现空格 | |
disallowSpaceBeforeBinaryOperators: [], // 不允许二元操作符的左侧出现空格 | |
disallowSpaceBeforeBlockStatements: true, // 不允许语句块的起始大括号之前出现空格 | |
disallowSpaceBeforeKeywords: [], // 不允许关键字前面出现空格 | |
disallowSpaceBeforeObjectValues: true, // 不允许 Object 各字段的值之前出现空格 | |
disallowSpaceBeforePostfixUnaryOperators: [], // 不允许二元操作符左侧出现空格 | |
disallowSpaceBetweenArguments: true, // 不允许参数的分隔符后面出现空格 | |
disallowSpacesInAnonymousFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 不允许匿名函数的大括号,小括号之前出现空格 | |
disallowSpacesInCallExpression: true, // 不允许函数调用的括号前面出现空格 | |
disallowSpacesInConditionalExpression: { | |
afterTest: true, | |
beforeConsequent: true, | |
afterConsequent: true, | |
beforeAlternate: true | |
}, // 不允许三元操作符两侧出现空格 | |
disallowSpacesInForStatement: true, // 不允许同一行多语句间出现空格 | |
disallowSpacesInFunctionDeclaration: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 不允许声明函数时,大括号和小括号之前出现空格 | |
disallowSpacesInFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 不允许匿名或具名的函数表达式中的大括号和小括号之前出现空格 | |
disallowSpacesInFunction: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 不允许声明函数及匿名或具名的函数表达式中,大括号和小括号之前出现空格 | |
disallowSpacesInNamedFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 不允许具名函数表达式中,大括号和小括号之前出现空格 | |
disallowSpacesInsideArrayBrackets: true, // 不允许数组左方括号右侧及右方括号左侧出现空格 | |
disallowSpacesInsideBrackets: true, // 不允许左方括号右侧及右方括号左侧出现空格 | |
disallowSpacesInsideObjectBrackets: true, // 不允许对象的左大括号右侧及右大括号左侧出现空格 | |
disallowSpacesInsideParentheses: true, // 不允许左小括号右侧及右小括号左侧出现空格 | |
disallowTrailingComma: true, // 不允许数组和对象的最后一个对象末尾出现逗号 | |
disallowTrailingWhitespace: true, // 不允许行末出现空白字符 | |
disallowYodaConditions: true, // 在布尔比较时,变量出现在运算符左侧 | |
maximumLineLength: 80, // 每行的最大字符数 | |
requireAlignedObjectValues: 'all', // 对象中,对齐 Key 字段 | |
requireAnonymousFunctions: true, // 不允许给匿名函数添加名字 | |
requireBlocksOnNewline: true, // 块语句的开始与结束位置允许添加换行符 | |
requireCamelCaseOrUpperCaseIdentifiers: true, // 变量名按照驼峰风格或大写加下划线风格定义 | |
requireCapitalizedComments: true, // 注释的首个字符需要大写 | |
requireCapitalizedConstructors: true, // 除 this 外,构造类名需要大写字符开头 | |
requireCommaBeforeLineBreak: true, // list 对象中,换行前需要加逗号 | |
requireCurlyBraces: true, // 某些语句需要强制添加大括号 | |
requireDollarBeforejQueryAssignment: true, // 变量名需要以 $ 字符开头以表明此变量为 jQuery 对象 | |
requireDotNotation: true, // 当有必要时才使用 `.` 字符获取对象的子属性 | |
requireFunctionDeclarations: true, // 函数声明时,不允许被赋给其他变量。 | |
requireKeywordsOnNewLine: {}, // 某些关键词应该换新行 | |
requireLineBreakAfterVariableAssignment: true, // 声明变量时如果也赋值了,需要换新行 | |
requireLineFeedAtFileEnd: true, // 每个文件末尾需加空行 | |
requireMultipleVarDecl: true, // 声明时,同一个上下文只需要一个 var 声明多个变量 | |
requireNewlineBeforeBlockStatements: true, // 块语句中,大括号需在新行 | |
requireOperatorBeforeLineBreak: true, // 操作符之前不能换行 | |
requirePaddingNewLineAfterVariableDeclaration: true, // var 声明后,添加额外的空行 | |
requirePaddingNewLinesAfterBlocks: true, // 语句块后加空行区分 | |
requirePaddingNewlinesBeforeKeywords: true, // 某些关键之前加空行 | |
requirePaddingNewLinesBeforeLineComments: true, // 注释行之前加空行 | |
requirePaddingNewlinesInBlocks: true, // 语句块内部起始及结束位置添加空行 | |
requirePaddingNewLinesInObjects: true, // 对象内部,每级大括号内,添加空行 | |
requireParenthesesAroundIIFE: true, // 匿名函数加括号才能被调用 | |
requireQuotedKeysInObjects: true, // 对象的每个 key 加引号包裹 | |
requireSemicolons: true, // 语句后必加分号结束 | |
requireSpaceAfterBinaryOperators: true, // 二元操作符之后加空格 | |
requireSpaceAfterKeywords: true, // 关键字后加空格 | |
requireSpaceAfterLineComment: true, // 注释符后加空格 | |
requireSpaceAfterObjectKeys: true, // 对象的每个 key 后加空格 | |
requireSpaceAfterPrefixUnaryOperators: true, // 后缀一元操作符后加空格 | |
requireSpaceBeforeBinaryOperators: true, // 二元操作符前加空格 | |
requireSpaceBeforeBlockStatements: true, // 块语句前加空行 | |
requireSpaceBeforeKeywords: true, // 关键字前加空格 | |
requireSpaceBeforeObjectValues: true, // 对象的 value 值前加空格 | |
requireSpaceBeforePostfixUnaryOperators: true, // 前缀一元操作符前加空格 | |
requireSpaceBetweenArguments: true, // 参数间加空格 | |
requireSpacesInAnonymousFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 匿名函数表达式中,在大括号和小括号之前需要空格 | |
requireSpacesInCallExpression: true, // 函数调用时,小括号前加空格 | |
requireSpacesInConditionalExpression: { | |
afterTest: true, | |
beforeConsequent: true, | |
afterConsequent: true, | |
beforeAlternate: true | |
}, // 三元操作符中加空格 | |
requireSpacesInForStatement: true, // for 语句中加空格间隔多语句 | |
requireSpacesInFunctionDeclaration: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 函数声明时,左大括号和左小括号之前加空格 | |
requireSpacesInFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 匿名或具名函数表达式中,左大括号和左小括号之前加空格 | |
requireSpacesInFunction: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 匿名或具名的函数声明及表达式中,左大括号和左小括号之前加空格 | |
requireSpacesInNamedFunctionExpression: { | |
beforeOpeningRoundBrace: true, | |
beforeOpeningCurlyBrace: true | |
}, // 具名函数表达式中,左大括号和左小括号之前加空格 | |
requireSpacesInsideArrayBrackets: 'all', // 在数组中的,左方括号或大括号与右方括号或大括号之间,需加空格 | |
requireSpacesInsideBrackets: true, // 在左方括号与右方括号之间,需加空格 | |
requireSpacesInsideObjectBrackets: 'all', // 在对象中的,左大括号与右大括号之间,需加空格 | |
requireSpacesInsideParentheses: { | |
all: true, | |
except: ['{', '}'] | |
}, // 在左小括号与右小括号之间,需加空格 | |
requireTrailingComma: true, // 数组和对象的最后一个对象末尾需加逗号 | |
requireYodaConditions: true, // 在布尔比较时,变量出现在运算符右侧 | |
safeContextKeyword: ['that'], // 检查 var that = this | |
validateIndentation: 2, // 缩进的校验。每级缩进包含几个空格 | |
validateLineBreaks: 'CR', // 换行符的校验 | |
validateParameterSeparator: ', ', // 函数入参分隔符的校验 | |
validateQuoteMarks: true // 字符串使用双引号还是单引号 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment