From 2132488ba61d5541d9afc174cf74ce948854a658 Mon Sep 17 00:00:00 2001 From: Hypnosphi Date: Tue, 10 Apr 2018 01:40:24 +0300 Subject: [PATCH] Add eslint rule to disallow importing devDependencies in lib sources --- .eslintrc.js | 11 ++++++++--- package.json | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7cc1609c..1ab6fb1f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,10 +20,11 @@ module.exports = { "pragma": "React", "version": "15.0" }, - "propWrapperFunctions": [ "forbidExtraProps" ] + "propWrapperFunctions": [ "forbidExtraProps" ], + "import/resolver": "webpack" }, - "extends": ["eslint:recommended", "plugin:react/recommended", "prettier"], + "extends": ["eslint:recommended", "plugin:react/recommended", "plugin:import/recommended", "prettier"], "plugins": ["prettier"], @@ -45,6 +46,10 @@ module.exports = { "prettier/prettier": "error", "react/no-find-dom-node": [0], "react/jsx-closing-bracket-location": [0], - "react/require-default-props": 0 + "react/require-default-props": 0, + "import/no-extraneous-dependencies": [2, { + "devDependencies": ["specs/**"] + }] } + } diff --git a/package.json b/package.json index 284ca2aa..84cc8539 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,8 @@ "cross-env": "^5.0.1", "eslint": "^4.8.0", "eslint-config-prettier": "^2.6.0", + "eslint-import-resolver-webpack": "^0.9.0", + "eslint-plugin-import": "^2.10.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-prettier": "^2.3.1", "eslint-plugin-react": "^7.4.0",