From d7165e5cbbade7262832b28d69c2b8fd463216fc Mon Sep 17 00:00:00 2001 From: Rafael Oleza Date: Wed, 28 Feb 2018 04:07:25 -0800 Subject: [PATCH] Add extraneous dependencies eslint plugin to metro Reviewed By: davidaurelio Differential Revision: D7084893 fbshipit-source-id: f1726fc189174bde8fc6f32ed6b0125764fe5093 --- .eslintrc.js | 8 ++- package.json | 3 +- packages/metro-core/package.json | 3 +- packages/metro/package.json | 7 ++- .../ModuleGraph/output/indexed-ram-bundle.js | 2 +- yarn.lock | 58 +++++++++++++++++-- 6 files changed, 69 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8a6e4ef9..5b4dbd01 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,8 @@ /** - * Copyright 2004-present Facebook. All Rights Reserved. + * Copyright (c) 2004-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @format */ @@ -10,9 +13,10 @@ module.exports = { node: true, }, extends: 'eslint-config-fb-strict', - plugins: ['babel', 'flowtype', 'prettier'], + plugins: ['babel', 'flowtype', 'import', 'prettier'], parser: 'babel-eslint', rules: { + 'import/no-extraneous-dependencies': 'error', 'lint/extra-arrow-initializer': 'off', 'max-len': 'off', 'no-alert': 'off', diff --git a/package.json b/package.json index 971c3995..1f4c2e3f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "eslint-config-fb-strict": "22.1.0", "eslint-plugin-babel": "4.1.2", "eslint-plugin-flowtype": "2.43.0", + "eslint-plugin-import": "^2.9.0", "eslint-plugin-jest": "21.8.0", "eslint-plugin-jsx-a11y": "6.0.3", "eslint-plugin-prettier": "2.6.0", @@ -36,7 +37,7 @@ "mkdirp": "^0.5.1", "prettier": "1.9.1", "promise": "^7.1.1", - "sinon": "^2.3.1", + "sinon": "^2.2.0", "temp": "^0.8.3" }, "scripts": { diff --git a/packages/metro-core/package.json b/packages/metro-core/package.json index ea42d894..d4d61c02 100644 --- a/packages/metro-core/package.json +++ b/packages/metro-core/package.json @@ -12,6 +12,7 @@ "cleanup-release": "test ! -e build && mv src build && mv src.real src" }, "dependencies": { - "lodash.throttle": "^4.1.1" + "lodash.throttle": "^4.1.1", + "wordwrap": "^1.0.0" } } diff --git a/packages/metro/package.json b/packages/metro/package.json index 800c1d74..69592e3f 100644 --- a/packages/metro/package.json +++ b/packages/metro/package.json @@ -48,10 +48,12 @@ "babel-core": "^6.24.1", "babel-generator": "^6.26.0", "babel-plugin-external-helpers": "^6.22.0", + "babel-plugin-transform-flow-strip-types": "^6.21.0", "babel-preset-es2015-node": "^6.1.1", "babel-preset-fbjs": "^2.1.4", "babel-preset-react-native": "^4.0.0", "babel-register": "^6.24.1", + "babel-template": "^6.24.1", "babylon": "^6.18.0", "chalk": "^1.1.1", "concat-stream": "^1.6.0", @@ -80,7 +82,9 @@ "metro-source-map": "0.28.0", "mime-types": "2.1.11", "mkdirp": "^0.5.1", + "node-fetch": "^1.3.3", "request": "^2.79.0", + "resolve": "^1.5.0", "rimraf": "^2.5.4", "serialize-error": "^2.1.0", "source-map": "^0.5.6", @@ -93,6 +97,7 @@ "yargs": "^9.0.0" }, "devDependencies": { - "babel-cli": "^6.26.0" + "babel-cli": "^6.26.0", + "sinon": "^2.2.0" } } diff --git a/packages/metro/src/ModuleGraph/output/indexed-ram-bundle.js b/packages/metro/src/ModuleGraph/output/indexed-ram-bundle.js index 58755b70..594a681f 100644 --- a/packages/metro/src/ModuleGraph/output/indexed-ram-bundle.js +++ b/packages/metro/src/ModuleGraph/output/indexed-ram-bundle.js @@ -11,7 +11,7 @@ 'use strict'; const buildSourceMapWithMetaData = require('../../shared/output/unbundle/build-unbundle-sourcemap-with-metadata.js'); -const invariant = require('invariant'); +const invariant = require('fbjs/lib/invariant'); const {createRamBundleGroups} = require('../../Bundler/util'); const { diff --git a/yarn.lock b/yarn.lock index 9f9197d4..1c408f45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1517,7 +1517,7 @@ buffer-shims@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" -builtin-modules@^1.0.0: +builtin-modules@^1.0.0, builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -1748,6 +1748,10 @@ console-control-strings@^1.0.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + content-type-parser@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/content-type-parser/-/content-type-parser-1.0.1.tgz#c3e56988c53c65127fb46d4032a3a900246fdc94" @@ -1987,7 +1991,7 @@ dateformat@^1.0.11, dateformat@^1.0.12: get-stdin "^4.0.1" meow "^3.3.0" -debug@2.6.9, debug@^2.6.8: +debug@2.6.9, debug@^2.6.8, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: @@ -2090,6 +2094,13 @@ diff@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.0.tgz#056695150d7aa93237ca7e378ac3b1682b7963b9" +doctrine@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + doctrine@^2.0.2, doctrine@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" @@ -2201,6 +2212,20 @@ eslint-config-fbjs@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/eslint-config-fbjs/-/eslint-config-fbjs-2.0.1.tgz#395896fd740e0e28dc1c2072e3bc982e88247df5" +eslint-import-resolver-node@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" + dependencies: + debug "^2.6.9" + resolve "^1.5.0" + +eslint-module-utils@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + eslint-plugin-babel@4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-babel/-/eslint-plugin-babel-4.1.2.tgz#79202a0e35757dd92780919b2336f1fa2fe53c1e" @@ -2211,6 +2236,21 @@ eslint-plugin-flowtype@2.43.0: dependencies: lodash "^4.15.0" +eslint-plugin-import@^2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.9.0.tgz#26002efbfca5989b7288ac047508bd24f217b169" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.1.1" + has "^1.0.1" + lodash "^4.17.4" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + eslint-plugin-jest@21.8.0: version "21.8.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-21.8.0.tgz#4f3155e2898c1efb0ce548f3e084e07db5e21c07" @@ -3198,7 +3238,7 @@ isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" -isarray@1.0.0, isarray@~1.0.0: +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -4096,7 +4136,7 @@ natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" -node-fetch@^1.0.1: +node-fetch@^1.0.1, node-fetch@^1.3.3: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" dependencies: @@ -4403,6 +4443,12 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + pkg-dir@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b" @@ -4809,7 +4855,7 @@ resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.3.2: +resolve@^1.3.2, resolve@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: @@ -4932,7 +4978,7 @@ signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" -sinon@^2.3.1: +sinon@^2.2.0: version "2.3.1" resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.3.1.tgz#48c9c758b4d0bb86327486833f1c4298919ce9ee" dependencies: