2015-07-03 41 views
1

我們已經決定從JSCS切換到ESLint,因爲它允許對其他事物進行更多檢查。我設法轉換了大部分規則,但其中兩個我無法與ESLint規則集匹配。因此,在我深入研究AST並試圖自行編寫它之前,我想問問這些是否已經存在。從JSCS到ESLint:缺少規則

{ 
    // nothing similar to this seems available 
    "requireBlocksOnNewline": 2, 
    // there is only rule for after spaces - space-after-keywords 
    "requireSpaceBeforeKeywords": ["else", "while", "catch"] 
} 

http://jscs.info/rule/requireBlocksOnNewline.html http://jscs.info/rule/requireSpaceBeforeKeywords.html

回答

2

requireBlockOnNewline可以brace-style: [2, "1tbs"] requireSpaceBeforeKeywords被模仿並不存在,但不會太努力創造。

+0

是的,我很害怕這一點。第一條規則也是不同的,因爲我們僅僅在有多於兩條語句時才關心換行符。這種「大括號式」尖叫聲。 – FredyC

+0

'brace-style'有一個選項'allowSingleLine',可能有助於解決這個問題,但主要是不需要圍繞單個線段的花括號,而不是換行符 –