2
我有一個index.js
其中出口幾個文件/模塊目錄:eslint正確固定「Y的出口x」來「exportxfrom Y」
export DaysAsTimePeriod from "./DaysAsTimePeriod"
export Money from "./Money"
export NumberOfProducts from "./NumberOfProducts"
export ItemNumber from "./ItemNumber"
運行eslint --fix
刪除空白導致不正確的語法:
exportDaysAsTimePeriodfrom "./DaysAsTimePeriod"
exportMoneyfrom "./Money"
exportNumberOfProductsfrom "./NumberOfProducts"
exportItemNumberfrom "./ItemNumber"
exportAttachedProducts, {NAME as PRODUCTS_NAME} from "./AttachedProducts"
我無法找到相關的規則/格式/插件,以幫助這個
的項目.eslintrc
:
注:我也有"import/prefer-default-export": [0, { "includeExports": false }],
{
"extends": "airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"allowInlineConfig": false,
"globals": {
"expect": true,
"shallow": true,
"sinon": true,
"mount": true,
"snapshot": true,
"__USEMOCKS__": true
},
"rules": {
"array-callback-return": 0,
"arrow-body-style": 0,
"camelcase": 0,
"class-methods-use-this": 0,
"comma-dangle": [2, "never"],
"func-names": 0,
"import/extensions": 0,
"import/no-extraneous-dependencies": 0,
"import/no-named-as-default-member": 0,
"import/prefer-default-export": 0,
"indent": [2, 2],
"jsx-a11y/img-has-alt": 0,
"jsx-a11y/no-static-element-interactions": 0,
"no-alert": 0,
"no-console": 0,
"no-underscore-dangle": 0,
"object-curly-spacing": [2, "never"],
"prefer-arrow-callback": 0,
"quote-props": ["error", "consistent-as-needed"],
"quotes": [2, "double"],
"react/jsx-closing-bracket-location": [2, "after-props"],
"react/forbid-prop-types": [2, { "forbid": ["any"] }],
"react/jsx-curly-spacing": [2, "never"],
"react/jsx-filename-extension": 0,
"react/jsx-no-bind": 0,
"react/jsx-uses-react": 1,
"react/no-array-index-key": 0,
"react/prefer-stateless-function": 0,
"react/react-in-jsx-scope": 0,
"semi": [2, "never"],
"space-before-function-paren": ["error", "never"],
"vars-on-top": 0
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"plugins": [
"class-property"
]
}
而且從項目package.json
"eslint": "3.19.0",
"eslint-config-airbnb": "14.1.0",
"eslint-plugin-babel": "4.1.1",
"eslint-plugin-class-property": "1.0.6",
"eslint-plugin-import": "2.2.0",
"eslint-plugin-jsx-a11y": "4.0.0",
"eslint-plugin-react": "6.10.3",
我覺得這是一個問題。你應該將一個問題記錄到eslint-plugin-import repo上,因爲我認爲這個問題可能是由他們的一個規則引起的(不是100%確定的)......只是運行沒有修復標誌來查看哪個規則給你錯誤。 – Gyandeep
發現它的階段1建議的語法 –