[英]Prettier rule "no-multiple-empty-lines" not working in React.js project
我希望能夠在我的代碼的某些部分使用 2 個空行。 更漂亮的默認行為允許最多有 1 個空行。
我試過使用"no-multiple-empty-lines": [2, {"max": 2 }]
但它根本不起作用而且更漂亮仍然抱怨。
這是我的.eslintrc
配置文件。 如果您需要任何其他信息,請告訴我。
{
"env": {
"node": true,
"browser": true,
"es6": true,
"commonjs": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"jsx": true,
"modules": true
},
"sourceType": "module"
},
"extends": [
"eslint:recommended",
"plugin:prettier/recommended",
"plugin:react/recommended"
],
"rules": {
"prettier/prettier": "error",
"no-multiple-empty-lines": [2, {"max": 2 }],
"react/jsx-uses-vars": [2],
"react/react-in-jsx-scope": "off",
"react/prop-types": "off"
},
"plugins": [
"prettier",
"react"
],
"settings": {
"react": {
"version": "detect" // React version. "detect" automatically picks the version you have installed.
}
}
}
這在你的情況下可能不起作用——我只是在沒有更漂亮的情況下運行 eslint——但試試這一行:
"no-multiple-empty-lines": ["error", { "max": 2, "maxBOF": 0, "maxEOF": 0 }]
但是,如果您確實想使用 eslint 更漂亮地運行它,那么看起來這可能根本行不通。 不確定我是否正確閱讀了這個問題,但似乎在更漂亮的情況下可能無法配置? 如果你只想改變 eslint 的行為,我認為上面的行應該可以工作,因為我只需要在我自己的配置中使用它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.