From c3e5b85f5af63f590cce342e9c45c9972bd2e9b4 Mon Sep 17 00:00:00 2001 From: Greg Tatum Date: Tue, 7 Mar 2017 16:07:04 -0600 Subject: [PATCH] Add eslint-plugin-import to handle flow type imports The built-in no duplicate rule for imports was breaking when I would import from a file, then below that, import types from that same file. It would incorrectly label the second import as a duplicate. --- .eslintrc.js | 9 +++++++-- package.json | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 30a9e57f4a..44abcb66b5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,7 +15,8 @@ module.exports = { }, "plugins": [ "react", - "flowtype" + "flowtype", + "import" ], "rules": { // Flow type rules: @@ -26,6 +27,11 @@ module.exports = { "flowtype/space-after-type-colon": [ 2, "always" ], "flowtype/delimiter-dangle": [ 2, "always-multiline" ], + // ES6 Import rules: + "import/no-duplicates": "error", + "import/no-unresolved": "error", + "import/named": "error", + // JS Rules: "indent": [ "error", @@ -85,7 +91,6 @@ module.exports = { "space-in-parens": ["error", "never"], "spaced-comment": "error", "generator-star-spacing": "error", - "no-duplicate-imports": "error", "no-var": "error", "prefer-const": "error", "array-bracket-spacing": "error", diff --git a/package.json b/package.json index 3c5dd45a08..dd5888e93e 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "eslint": "^3.10.2", "eslint-config-google": "^0.6.0", "eslint-plugin-flowtype": "^2.30.0", + "eslint-plugin-import": "^2.2.0", "eslint-plugin-react": "^6.4.0", "express": "^4.13.4", "fetch-jsonp": "^1.0.2",