From f3732af8dee5f7c10d68ac68c6b2d62a6644f567 Mon Sep 17 00:00:00 2001 From: James Hush Date: Sun, 17 Sep 2017 16:04:19 -0700 Subject: [PATCH 1/5] chore(Upgrade eslint, add prettier): Upgrade eslint packages, add prettier, run prettier --- .eslintrc | 13 + package.json | 17 +- yarn.lock | 678 +++++++++++++++++++++++++++++++++------------------ 3 files changed, 465 insertions(+), 243 deletions(-) diff --git a/.eslintrc b/.eslintrc index d93d97a..e396466 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,19 @@ "import", "react" ], + "rules": { + "prettier/prettier": ["error", { + "printWidth": 80, + "tabWidth": 4, + "singleQuote": false, + "trailingComma": "none", + "bracketSpacing": false, + "semi": true, + "useTabs": false, + "parser": "babylon", + "jsxBracketSameLine": false + }] + }, "env": { "browser": true, "mocha": true diff --git a/package.json b/package.json index d75ee2e..f9ed1a9 100644 --- a/package.json +++ b/package.json @@ -33,16 +33,19 @@ ], "dependencies": { "deep-equal": "^1.0.1", + "eslint-config-prettier": "^2.5.0", + "eslint-plugin-prettier": "^2.2.0", "eventemitter3": "^2.0.2", "exenv": "^1.2.2", "hoist-non-react-statics": "^1.0.5", "invariant": "^2.2.2", + "prettier": "^1.7.0", "throttle-debounce": "^1.0.1" }, "devDependencies": { "babel-cli": "^6.5.1", "babel-core": "^6.5.1", - "babel-eslint": "^7.0.0", + "babel-eslint": "^8.0.0", "babel-loader": "^6.2.3", "babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-webpack-alias": "^2.1.1", @@ -57,11 +60,11 @@ "conventional-changelog-cli": "^1.2.0", "core-js": "^2.2.2", "cz-conventional-changelog": "^1.1.6", - "eslint": "3.7.1", - "eslint-config-nfl": "10.0.0", - "eslint-plugin-import": "2.0.1", - "eslint-plugin-mocha": "4.7.0", - "eslint-plugin-react": "6.4.1", + "eslint": "4.7.0", + "eslint-config-nfl": "12.0.0", + "eslint-plugin-import": "2.7.0", + "eslint-plugin-mocha": "4.11.0", + "eslint-plugin-react": "7.3.0", "express": "^4.13.4", "history": "^4.3.0", "isparta-loader": "^2.0.0", @@ -106,7 +109,7 @@ "clean": "rimraf lib coverage", "compile": "babel src --out-dir lib", "examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples/apps --inline", - "lint": "eslint src test examples", + "lint": "eslint --fix src test examples", "start": "npm run build && env BABEL_ENV=examples node examples/server/index.js", "pretest": "npm run build", "prepublish": "npm run build && npm run build:umd && npm run build:umd:min", diff --git a/yarn.lock b/yarn.lock index e3d293f..276581d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,9 +34,9 @@ acorn@^3.0.0, acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -acorn@^5.0.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.1.tgz#53fe161111f912ab999ee887a90a0bc52822fd75" +acorn@^5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7" add-stream@^1.0.0: version "1.0.0" @@ -57,6 +57,15 @@ ajv@^4.7.0, ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" +ajv@^5.2.0: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.2.tgz#47c68d69e86f5d953103b0074a9430dc63da5e39" + dependencies: + co "^4.6.0" + fast-deep-equal "^1.0.0" + json-schema-traverse "^0.3.0" + json-stable-stringify "^1.0.1" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -73,6 +82,10 @@ ansi-escapes@^1.1.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-escapes@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-2.0.0.tgz#5bae52be424878dd9783e8910e3fc2922e83c81b" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -145,6 +158,13 @@ array-ify@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" +array-includes@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.0.3.tgz#184b48f62d92d7452bb31b323165c7f8bd02266d" + dependencies: + define-properties "^1.1.2" + es-abstract "^1.7.0" + array-slice@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/array-slice/-/array-slice-0.2.3.tgz#dd3cfb80ed7973a75117cdac69b0b99ec86186f5" @@ -275,6 +295,14 @@ babel-cli@^6.5.1: optionalDependencies: chokidar "^1.6.1" +babel-code-frame@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-7.0.0-beta.0.tgz#418a7b5f3f7dc9a4670e61b1158b4c5661bec98d" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + babel-code-frame@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.22.0.tgz#027620bee567a88c32561574e7fd0801d33118e4" @@ -307,14 +335,14 @@ babel-core@^6.1.4, babel-core@^6.24.1, babel-core@^6.5.1: slash "^1.0.0" source-map "^0.5.0" -babel-eslint@^7.0.0: - version "7.2.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" +babel-eslint@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.0.0.tgz#ce06f385bdfb5b6d7e603f06222f891abd14c240" dependencies: - babel-code-frame "^6.22.0" - babel-traverse "^6.23.1" - babel-types "^6.23.0" - babylon "^6.17.0" + babel-code-frame "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" babel-generator@^6.25.0: version "6.25.0" @@ -388,6 +416,15 @@ babel-helper-explode-class@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" +babel-helper-function-name@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-7.0.0-beta.0.tgz#d1b6779b647e5c5c31ebeb05e13b998e4d352d56" + dependencies: + babel-helper-get-function-arity "7.0.0-beta.0" + babel-template "7.0.0-beta.0" + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babel-helper-function-name@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz#d3475b8c03ed98242a25b48351ab18399d3580a9" @@ -398,6 +435,12 @@ babel-helper-function-name@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" +babel-helper-get-function-arity@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-7.0.0-beta.0.tgz#9d1ab7213bb5efe1ef1638a8ea1489969b5a8b6e" + dependencies: + babel-types "7.0.0-beta.0" + babel-helper-get-function-arity@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz#8f7782aa93407c41d3aa50908f89b031b1b6853d" @@ -464,6 +507,10 @@ babel-loader@^6.2.3: mkdirp "^0.5.1" object-assign "^4.0.1" +babel-messages@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-7.0.0-beta.0.tgz#6df01296e49fc8fbd0637394326a167f36da817b" + babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" @@ -925,6 +972,15 @@ babel-runtime@^6.18.0, babel-runtime@^6.2.0, babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" +babel-template@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-7.0.0-beta.0.tgz#85083cf9e4395d5e48bf5154d7a8d6991cafecfb" + dependencies: + babel-traverse "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + lodash "^4.2.0" + babel-template@^6.24.1, babel-template@^6.25.0, babel-template@^6.3.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.25.0.tgz#665241166b7c2aa4c619d71e192969552b10c071" @@ -935,7 +991,21 @@ babel-template@^6.24.1, babel-template@^6.25.0, babel-template@^6.3.0: babylon "^6.17.2" lodash "^4.2.0" -babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.25.0: +babel-traverse@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-7.0.0-beta.0.tgz#da14be9b762f62a2f060db464eaafdd8cd072a41" + dependencies: + babel-code-frame "7.0.0-beta.0" + babel-helper-function-name "7.0.0-beta.0" + babel-messages "7.0.0-beta.0" + babel-types "7.0.0-beta.0" + babylon "7.0.0-beta.22" + debug "^3.0.1" + globals "^10.0.0" + invariant "^2.2.0" + lodash "^4.2.0" + +babel-traverse@^6.24.1, babel-traverse@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.25.0.tgz#2257497e2fcd19b89edc13c4c91381f9512496f1" dependencies: @@ -949,7 +1019,15 @@ babel-traverse@^6.23.1, babel-traverse@^6.24.1, babel-traverse@^6.25.0: invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.14.0, babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1, babel-types@^6.25.0: +babel-types@7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-7.0.0-beta.0.tgz#eb8b6e556470e6dcc4aef982d79ad229469b5169" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + +babel-types@^6.14.0, babel-types@^6.19.0, babel-types@^6.24.1, babel-types@^6.25.0: version "6.25.0" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.25.0.tgz#70afb248d5660e5d18f811d91c8303b54134a18e" dependencies: @@ -958,7 +1036,11 @@ babel-types@^6.14.0, babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24 lodash "^4.2.0" to-fast-properties "^1.0.1" -babylon@^6.17.0, babylon@^6.17.2: +babylon@7.0.0-beta.22: + version "7.0.0-beta.22" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.22.tgz#74f0ad82ed7c7c3cfeab74cf684f815104161b65" + +babylon@^6.17.2: version "6.17.4" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.4.tgz#3e8b7402b88d22c3423e137a1577883b15ff869a" @@ -1194,7 +1276,7 @@ chai@^3.4.1: deep-eql "^0.1.3" type-detect "^1.0.0" -chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -1204,7 +1286,7 @@ chalk@1.1.3, chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -chalk@2.1.0: +chalk@2.1.0, chalk@^2.0.0, chalk@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.1.0.tgz#ac5becf14fa21b99c6c92ca7a7d7cfd5b17e743e" dependencies: @@ -1249,6 +1331,12 @@ cli-cursor@^1.0.1: dependencies: restore-cursor "^1.0.1" +cli-cursor@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + cli-width@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" @@ -1403,7 +1491,7 @@ concat-stream@1.5.0: readable-stream "~2.0.0" typedarray "~0.0.5" -concat-stream@^1.4.6, concat-stream@^1.4.7: +concat-stream@^1.4.7, concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -1621,6 +1709,14 @@ create-react-class@^15.6.0: loose-envify "^1.3.1" object-assign "^4.1.1" +cross-spawn@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@0.2.x: version "0.2.2" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-0.2.2.tgz#ed91ff1f17ad13d3748288594f8a48a0d26f325c" @@ -1671,12 +1767,6 @@ cz-conventional-changelog@1.2.0, cz-conventional-changelog@^1.1.6: right-pad "^1.0.1" word-wrap "^1.0.3" -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" - dependencies: - es5-ext "^0.10.9" - dargs@^4.0.1: version "4.1.0" resolved "https://registry.yarnpkg.com/dargs/-/dargs-4.1.0.tgz#03a9dbb4b5c2f139bf14ae53f0b8a2a6a86f4e17" @@ -1728,12 +1818,18 @@ debug@2.6.7: dependencies: ms "2.0.0" -debug@2.6.8, debug@^2.1.1, debug@^2.2.0, debug@^2.4.5, debug@^2.6.6: +debug@2.6.8, debug@^2.1.1, debug@^2.2.0, debug@^2.4.5, debug@^2.6.6, debug@^2.6.8: version "2.6.8" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: ms "2.0.0" +debug@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.0.1.tgz#0564c612b521dc92d9f2988f0549e34f9c98db64" + dependencies: + ms "2.0.0" + decamelize@^1.0.0, decamelize@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" @@ -1764,6 +1860,13 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +define-properties@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.2.tgz#83a73f2fea569898fb737193c8f873caf6d45c94" + dependencies: + foreach "^2.0.5" + object-keys "^1.0.8" + defined@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-0.0.0.tgz#f35eea7d705e933baf13b2f03b3f83d921403b3e" @@ -1824,16 +1927,16 @@ diff@3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-3.2.0.tgz#c9ce393a4b7cbd0b058a725c93df299027868ff9" -doctrine@1.3.x: - version "1.3.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.3.0.tgz#13e75682b55518424276f7c173783456ef913d26" +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@^1.2.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" dependencies: esutils "^2.0.2" isarray "^1.0.0" @@ -1952,62 +2055,28 @@ error-ex@^1.2.0: dependencies: is-arrayish "^0.2.1" -es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.24" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.24.tgz#a55877c9924bc0c8d9bd3c2cbe17495ac1709b14" - dependencies: - es6-iterator "2" - es6-symbol "~3.1" - -es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512" +es-abstract@^1.7.0: + version "1.8.2" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.8.2.tgz#25103263dc4decbda60e0c737ca32313518027ee" dependencies: - d "1" - es5-ext "^0.10.14" - es6-symbol "^3.1" + es-to-primitive "^1.1.1" + function-bind "^1.1.1" + has "^1.0.1" + is-callable "^1.1.3" + is-regex "^1.0.4" -es6-map@^0.1.3: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" +es-to-primitive@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.1.1.tgz#45355248a88979034b6792e19bb81f2b7975dd0d" dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-set "~0.1.5" - es6-symbol "~3.1.1" - event-emitter "~0.3.5" + is-callable "^1.1.1" + is-date-object "^1.0.1" + is-symbol "^1.0.1" es6-promise@~4.0.3: version "4.0.5" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.0.5.tgz#7882f30adde5b240ccfa7f7d78c548330951ae42" -es6-set@~0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-symbol "3.1.1" - event-emitter "~0.3.5" - -es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - dependencies: - d "1" - es5-ext "~0.10.14" - -es6-weak-map@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.2.tgz#5e3ab32251ffd1538a1f8e5ffa1357772f92d96f" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" - es6-symbol "^3.1.1" - escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -2027,105 +2096,121 @@ escodegen@1.8.x, escodegen@^1.6.1: optionalDependencies: source-map "~0.2.0" -escope@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" - dependencies: - es6-map "^0.1.3" - es6-weak-map "^2.0.1" - esrecurse "^4.1.0" - estraverse "^4.1.1" +eslint-config-nfl@12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-nfl/-/eslint-config-nfl-12.0.0.tgz#0d32af5354e641b822aa7ba82439df62a3ed421a" -eslint-config-nfl@10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-nfl/-/eslint-config-nfl-10.0.0.tgz#200a62d7280e0efc864090b7b1a42e32df8b1d3f" +eslint-config-prettier@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-2.5.0.tgz#9ecb9296bae4e2e59a3ce361a96c9f825fe67b75" + dependencies: + get-stdin "^5.0.1" -eslint-import-resolver-node@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz#5add8106e8c928db2cba232bcd9efa846e3da16c" +eslint-import-resolver-node@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz#4422574cde66a9a7b099938ee4d508a199e0e3cc" dependencies: - debug "^2.2.0" - object-assign "^4.0.1" - resolve "^1.1.6" + debug "^2.6.8" + resolve "^1.2.0" -eslint-module-utils@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-1.0.0.tgz#c4a57fd3a53efd8426cc2d5550aadab9bbd05fd0" +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.2.0" + debug "^2.6.8" pkg-dir "^1.0.0" -eslint-plugin-import@2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.0.1.tgz#dcfe96357d476b3f822570d42c29bec66f5d9c5c" +eslint-plugin-import@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.7.0.tgz#21de33380b9efb55f5ef6d2e210ec0e07e7fa69f" dependencies: builtin-modules "^1.1.1" contains-path "^0.1.0" - debug "^2.2.0" - doctrine "1.3.x" - eslint-import-resolver-node "^0.2.0" - eslint-module-utils "^1.0.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.cond "^4.3.0" minimatch "^3.0.3" - pkg-up "^1.0.0" + read-pkg-up "^2.0.0" -eslint-plugin-mocha@4.7.0: - version "4.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-4.7.0.tgz#69262362f4ec69ae5849908824f325b8d465e7f3" +eslint-plugin-mocha@4.11.0: + version "4.11.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-mocha/-/eslint-plugin-mocha-4.11.0.tgz#91193a2f55e20a5e35974054a0089d30198ee578" dependencies: - ramda "^0.22.1" + ramda "^0.24.1" -eslint-plugin-react@6.4.1: - version "6.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-6.4.1.tgz#7d1aade747db15892f71eee1fea4addf97bcfa2b" +eslint-plugin-prettier@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.2.0.tgz#f2837ad063903d73c621e7188fb3d41486434088" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^20.0.1" + +eslint-plugin-react@7.3.0: + version "7.3.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.3.0.tgz#ca9368da36f733fbdc05718ae4e91f778f38e344" dependencies: - doctrine "^1.2.2" - jsx-ast-utils "^1.3.1" + doctrine "^2.0.0" + has "^1.0.1" + jsx-ast-utils "^2.0.0" + prop-types "^15.5.10" -eslint@3.7.1: +eslint-scope@^3.7.1: version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.7.1.tgz#7faa84599e0fea422f04bc32db49054051a3f11a" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" dependencies: - chalk "^1.1.3" - concat-stream "^1.4.6" - debug "^2.1.1" - doctrine "^1.2.2" - escope "^3.6.0" - espree "^3.3.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@4.7.0: + version "4.7.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.7.0.tgz#d35fc07c472520be3de85b3da11e99c576afd515" + dependencies: + ajv "^5.2.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.0.1" + doctrine "^2.0.0" + eslint-scope "^3.7.1" + espree "^3.5.1" + esquery "^1.0.0" estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.2.0" - ignore "^3.1.5" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^9.17.0" + ignore "^3.3.3" imurmurhash "^0.1.4" - inquirer "^0.12.0" - is-my-json-valid "^2.10.0" + inquirer "^3.0.6" is-resolvable "^1.0.0" - js-yaml "^3.5.1" - json-stable-stringify "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify "^1.0.1" levn "^0.3.0" - lodash "^4.0.0" - mkdirp "^0.5.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.1" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.6.0" - strip-bom "^3.0.0" - strip-json-comments "~1.0.1" - table "^3.7.8" + optionator "^0.8.2" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" + strip-json-comments "~2.0.1" + table "^4.0.1" text-table "~0.2.0" - user-home "^2.0.0" -espree@^3.3.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.3.tgz#2910b5ccd49ce893c2ffffaab4fd8b3a31b82374" +espree@^3.5.1: + version "3.5.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.1.tgz#0c988b8ab46db53100a1954ae4ba995ddd27d87e" dependencies: - acorn "^5.0.1" + acorn "^5.1.1" acorn-jsx "^3.0.0" esprima@2.7.x, esprima@^2.1.0, esprima@^2.7.1: @@ -2136,6 +2221,12 @@ esprima@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804" +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + esrecurse@^4.1.0: version "4.2.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.0.tgz#fa9568d98d3823f9a41d91e902dcab9ea6e5b163" @@ -2147,7 +2238,7 @@ estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" -estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -2159,13 +2250,6 @@ etag@~1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.0.tgz#6f631aef336d6c46362b51764044ce216be3c051" -event-emitter@~0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - dependencies: - d "1" - es5-ext "~0.10.14" - eventemitter3@1.x.x: version "1.2.0" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508" @@ -2270,6 +2354,14 @@ external-editor@^1.1.0: spawn-sync "^1.0.15" tmp "^0.0.29" +external-editor@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.0.4.tgz#1ed9199da9cbfe2ef2f7a31b2fde8b0d12368972" + dependencies: + iconv-lite "^0.4.17" + jschardet "^1.4.2" + tmp "^0.0.31" + extglob@^0.3.1: version "0.3.2" resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" @@ -2293,6 +2385,14 @@ eyes@0.1.x: version "0.1.8" resolved "https://registry.yarnpkg.com/eyes/-/eyes-0.1.8.tgz#62cf120234c683785d902348a800ef3e0cc20bc0" +fast-deep-equal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" + +fast-diff@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -2334,6 +2434,12 @@ figures@^1.3.5: escape-string-regexp "^1.0.5" object-assign "^4.1.0" +figures@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962" + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" @@ -2439,6 +2545,10 @@ for-own@^0.1.4: dependencies: for-in "^1.0.1" +foreach@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + forever-agent@~0.5.0: version "0.5.2" resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.5.2.tgz#6d0e09c4921f94a27f63d3b49c5feff1ea4c5130" @@ -2531,6 +2641,14 @@ function-bind@^1.0.2: version "1.1.0" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771" +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + +functional-red-black-tree@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -2568,6 +2686,10 @@ get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" +get-stdin@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -2682,7 +2804,11 @@ global@^4.3.2: min-document "^2.19.0" process "~0.5.1" -globals@^9.0.0, globals@^9.2.0: +globals@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-10.1.0.tgz#4425a1881be0d336b4a823a82a7be725d5dd987c" + +globals@^9.0.0, globals@^9.17.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" @@ -2900,6 +3026,10 @@ iconv-lite@0.4.15: version "0.4.15" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb" +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + iconv-lite@~0.4.13: version "0.4.18" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.18.tgz#23d8656b16aae6742ac29732ea8f0336a4789cf2" @@ -2908,9 +3038,9 @@ ieee754@^1.1.4: version "1.1.8" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.8.tgz#be33d40ac10ef1926701f6f08a2d86fbfd1ad3e4" -ignore@^3.1.5: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.3.tgz#432352e57accd87ab3110e82d3fea0e47812156d" +ignore@^3.3.3: + version "3.3.5" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.5.tgz#c4e715455f6073a8d7e5dae72d2fc9d71663dba6" imurmurhash@^0.1.4: version "0.1.4" @@ -2971,22 +3101,23 @@ inquirer@1.2.3: strip-ansi "^3.0.0" through "^2.3.6" -inquirer@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" +inquirer@^3.0.6: + version "3.2.3" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.2.3.tgz#1c7b1731cf77b934ec47d22c9ac5aa8fe7fbe095" dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" + ansi-escapes "^2.0.0" + chalk "^2.0.0" + cli-cursor "^2.1.0" cli-width "^2.0.0" - figures "^1.3.5" + external-editor "^2.0.4" + figures "^2.0.0" lodash "^4.3.0" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" - strip-ansi "^3.0.0" + mute-stream "0.0.7" + run-async "^2.2.0" + rx-lite "^4.0.8" + rx-lite-aggregates "^4.0.8" + string-width "^2.1.0" + strip-ansi "^4.0.0" through "^2.3.6" interpret@^0.6.4: @@ -3027,6 +3158,14 @@ is-builtin-module@^1.0.0: dependencies: builtin-modules "^1.0.0" +is-callable@^1.1.1, is-callable@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.3.tgz#86eb75392805ddc33af71c92a0eedf74ee7604b2" + +is-date-object@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" + is-dotfile@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" @@ -3077,7 +3216,7 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4: +is-my-json-valid@^2.12.4: version "2.16.0" resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" dependencies: @@ -3138,6 +3277,12 @@ is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" +is-regex@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" + dependencies: + has "^1.0.1" + is-resolvable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" @@ -3152,6 +3297,10 @@ is-subset@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" +is-symbol@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.1.tgz#3cc59f00025194b6ab2e38dbae6689256b660572" + is-text-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" @@ -3242,21 +3391,36 @@ istanbul@^0.4.0: which "^1.1.1" wordwrap "^1.0.0" +jest-docblock@^20.0.1: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" + js-tokens@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" -js-yaml@3.x, js-yaml@^3.5.1: +js-yaml@3.x: version "3.9.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.9.1.tgz#08775cebdfdd359209f0d2acd383c8f86a6904a0" dependencies: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^3.9.1: + version "3.10.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.10.0.tgz#2e78441646bd4682e963f22b6e92823c309c62dc" + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" +jschardet@^1.4.2: + version "1.5.1" + resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.5.1.tgz#c519f629f86b3a5bedba58a88d311309eec097f9" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -3265,11 +3429,15 @@ jsesc@~0.5.0: version "0.5.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" +json-schema-traverse@^0.3.0: + version "0.3.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340" + json-schema@0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13" -json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: +json-stable-stringify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" dependencies: @@ -3314,9 +3482,11 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" -jsx-ast-utils@^1.3.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" +jsx-ast-utils@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" + dependencies: + array-includes "^3.0.3" karma-chai-sinon@^0.1.5: version "0.1.5" @@ -3565,7 +3735,7 @@ lodash@^3.8.0: version "3.10.1" resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" -lodash@^4.0.0, lodash@^4.1.0, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0: +lodash@^4.0.0, lodash@^4.1.0, lodash@^4.17.2, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0, lodash@^4.5.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -3601,6 +3771,13 @@ lru-cache@2.2.x: version "2.2.4" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.2.4.tgz#6c658619becf14031d0d0b594b16042ce4dc063d" +lru-cache@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.1.tgz#622e32e82488b49279114a4f9ecf45e7cd6bba55" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + map-obj@^1.0.0, map-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-1.0.1.tgz#d933ceb9205d82bdcf4886f6742bdc2b4dea146d" @@ -3698,6 +3875,10 @@ mime@~1.2.11: version "1.2.11" resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10" +mimic-fn@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" + min-document@^2.19.0: version "2.19.0" resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685" @@ -3766,14 +3947,14 @@ ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" - mute-stream@0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.6.tgz#48962b19e169fd1dfc240b3f1e7317627bbc47db" +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + nan@^2.3.0: version "2.6.2" resolved "https://registry.yarnpkg.com/nan/-/nan-2.6.2.tgz#e4ff34e6c95fdfb5aecc08de6596f43605a7db45" @@ -3911,6 +4092,10 @@ object-component@0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291" +object-keys@^1.0.8: + version "1.0.11" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.0.11.tgz#c54601778ad560f1142ce0e01bcca8b56d13426d" + object.omit@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" @@ -3938,6 +4123,12 @@ onetime@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" +onetime@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4" + dependencies: + mimic-fn "^1.0.0" + open@0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/open/-/open-0.0.5.tgz#42c3e18ec95466b6bf0dc42f3a2945c3f0cad8fc" @@ -3949,7 +4140,7 @@ optimist@^0.6.1, optimist@~0.6.0, optimist@~0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.2: version "0.8.2" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" dependencies: @@ -4084,7 +4275,7 @@ path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" -path-is-inside@^1.0.1: +path-is-inside@^1.0.1, path-is-inside@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" @@ -4164,15 +4355,9 @@ pkg-dir@^1.0.0: dependencies: find-up "^1.0.0" -pkg-up@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-1.0.0.tgz#3e08fb461525c4421624a33b9f7e6d0af5b05a26" - dependencies: - find-up "^1.0.0" - -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" prelude-ls@~1.1.2: version "1.1.2" @@ -4182,6 +4367,10 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.7.0.tgz#47481588f41f7c90f63938feb202ac82554e7150" + prettycli@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/prettycli/-/prettycli-1.4.3.tgz#b28ec2aad9de07ae1fd75ef294fb54cbdee07ed5" @@ -4204,7 +4393,11 @@ process@~0.5.1: version "0.5.2" resolved "https://registry.yarnpkg.com/process/-/process-0.5.2.tgz#1638d8a8e34c2f440a91db95ab9aeb677fc185cf" -progress@^1.1.8, progress@~1.1.8: +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + +progress@~1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" @@ -4232,6 +4425,10 @@ prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + punycode@1.3.2: version "1.3.2" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" @@ -4285,9 +4482,9 @@ radium@^0.18.1: inline-style-prefixer "^2.0.5" rimraf "^2.6.1" -ramda@^0.22.1: - version "0.22.1" - resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.22.1.tgz#031da0c3df417c5b33c96234757eb37033f36a0e" +ramda@^0.24.1: + version "0.24.1" + resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.24.1.tgz#c3b7755197f35b8dc3502228262c4c91ddb6b857" randomatic@^1.1.3: version "1.1.7" @@ -4411,14 +4608,6 @@ readdirp@^2.0.0: readable-stream "^2.0.2" set-immediate-shim "^1.0.1" -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - rechoir@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" @@ -4574,7 +4763,7 @@ request@~2.79.0: tunnel-agent "~0.4.1" uuid "^3.0.0" -require-uncached@^1.0.2: +require-uncached@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" dependencies: @@ -4604,7 +4793,7 @@ resolve@1.1.x: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" -resolve@^1.1.6: +resolve@^1.1.6, resolve@^1.2.0: version "1.4.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.4.0.tgz#a75be01c53da25d934a98ebd0e4c4a7312f92a86" dependencies: @@ -4617,6 +4806,13 @@ restore-cursor@^1.0.1: exit-hook "^1.0.0" onetime "^1.0.0" +restore-cursor@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf" + dependencies: + onetime "^2.0.0" + signal-exit "^3.0.2" + resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" @@ -4643,21 +4839,21 @@ ripemd160@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-0.2.0.tgz#2bf198bde167cacfa51c0a928e84b68bbe171fce" -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" - dependencies: - once "^1.3.0" - run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: is-promise "^2.1.0" -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rx-lite-aggregates@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be" + dependencies: + rx-lite "*" + +rx-lite@*, rx-lite@^4.0.8: + version "4.0.8" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444" rx@^4.1.0: version "4.1.0" @@ -4742,6 +4938,16 @@ sha.js@2.2.6: version "2.2.6" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.2.6.tgz#17ddeddc5f722fb66501658895461977867315ba" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + shelljs@0.7.6: version "0.7.6" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.6.tgz#379cccfb56b91c8601e4793356eb5382924de9ad" @@ -4750,11 +4956,7 @@ shelljs@0.7.6: interpret "^1.0.0" rechoir "^0.6.2" -shelljs@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.6.1.tgz#ec6211bed1920442088fe0f70b2837232ed2c8a8" - -signal-exit@^3.0.0: +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" @@ -4985,7 +5187,7 @@ string-width@^1.0.1, string-width@^1.0.2: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: +string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: @@ -5042,10 +5244,6 @@ strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -strip-json-comments@~1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" - supports-color@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" @@ -5068,9 +5266,9 @@ supports-color@^4.0.0: dependencies: has-flag "^2.0.0" -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" +table@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.1.tgz#a8116c133fac2c61f4a420ab6cdf5c4d61f0e435" dependencies: ajv "^4.7.0" ajv-keywords "^1.0.0" @@ -5162,7 +5360,7 @@ timers-browserify@^2.0.2: global "^4.3.2" setimmediate "^1.0.4" -tmp@0.0.31, tmp@0.0.x: +tmp@0.0.31, tmp@0.0.x, tmp@^0.0.31: version "0.0.31" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7" dependencies: @@ -5186,6 +5384,10 @@ to-fast-properties@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" +to-fast-properties@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" + tough-cookie@>=0.12.0, tough-cookie@~2.3.0: version "2.3.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a" @@ -5324,12 +5526,6 @@ user-home@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/user-home/-/user-home-1.1.1.tgz#2b5be23a32b63a7c9deb8d0f28d485724a3df190" -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" - dependencies: - os-homedir "^1.0.0" - useragent@^2.1.12: version "2.2.1" resolved "https://registry.yarnpkg.com/useragent/-/useragent-2.2.1.tgz#cf593ef4f2d175875e8bb658ea92e18a4fd06d8e" @@ -5485,6 +5681,12 @@ which@^1.0.9, which@^1.1.1, which@^1.2.1, which@^1.2.12, which@~1.2.10: dependencies: isexe "^2.0.0" +which@^1.2.9: + version "1.3.0" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a" + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.2.tgz#571e0f1b0604636ebc0dfc21b0339bbe31341710" @@ -5551,6 +5753,10 @@ xtend@^4.0.0, xtend@~4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + yargs@~3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1" From 979022c978319130f117abe2533b2d3663b8114a Mon Sep 17 00:00:00 2001 From: James Hush Date: Sun, 17 Sep 2017 16:07:43 -0700 Subject: [PATCH 2/5] Run prettier --- .eslintrc | 1 + examples/apps/infinite-scrolling/app.js | 13 +- examples/apps/infinite-scrolling/content.js | 7 +- examples/apps/infinite-scrolling/main.js | 4 +- examples/apps/interstitial/app.js | 19 +- examples/apps/interstitial/main.js | 4 +- examples/apps/lazy-render/app.js | 7 +- examples/apps/lazy-render/main.js | 4 +- examples/apps/log.js | 13 +- examples/apps/responsive/app.js | 56 +++-- examples/apps/responsive/button.js | 15 +- examples/apps/responsive/main.js | 4 +- examples/apps/routing/app.js | 37 +++- examples/apps/routing/main.js | 4 +- examples/apps/routing/page.js | 2 +- examples/apps/single-request/app.js | 32 +-- examples/apps/single-request/button.js | 15 +- examples/apps/single-request/main.js | 4 +- examples/apps/static-ad/app.js | 9 +- examples/apps/static-ad/main.js | 4 +- examples/server/routes.js | 11 +- examples/server/server.js | 25 ++- package.json | 4 +- src/Bling.js | 150 ++++++++----- src/createManager.js | 174 +++++++++------ src/utils/apiList.js | 234 ++++++++++---------- src/utils/filterProps.js | 19 +- src/utils/isInViewport.js | 11 +- src/utils/mockGPT.js | 4 +- test/Bling.spec.js | 180 ++++++++------- test/createManager.spec.js | 142 ++++++++---- test/mockGPT.spec.js | 10 +- 32 files changed, 677 insertions(+), 541 deletions(-) diff --git a/.eslintrc b/.eslintrc index e396466..75450b6 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,6 +6,7 @@ ], "plugins": [ "import", + "prettier", "react" ], "rules": { diff --git a/examples/apps/infinite-scrolling/app.js b/examples/apps/infinite-scrolling/app.js index bd28519..e628629 100644 --- a/examples/apps/infinite-scrolling/app.js +++ b/examples/apps/infinite-scrolling/app.js @@ -16,8 +16,8 @@ class App extends Component { state = { page: 1, size: [728, 90] - } - time = 0 + }; + time = 0; componentDidMount() { window.addEventListener("scroll", this.onScroll); window.addEventListener("resize", this.onScroll); @@ -47,7 +47,7 @@ class App extends Component { page: ++this.state.page }); } - }) + }); startTimer() { this.stopTimer(); this.timer = setInterval(() => { @@ -68,7 +68,8 @@ class App extends Component { const targeting = { test: "infinitescroll" }; - while (contentCnt < page * 3) { // eslint-disable-line no-unmodified-loop-condition + while (contentCnt < page * 3) { + // eslint-disable-line no-unmodified-loop-condition contents.push( -
- {contents} -
+
{contents}
); } diff --git a/examples/apps/infinite-scrolling/content.js b/examples/apps/infinite-scrolling/content.js index 6ecbe9a..3c428f1 100644 --- a/examples/apps/infinite-scrolling/content.js +++ b/examples/apps/infinite-scrolling/content.js @@ -26,7 +26,7 @@ class Content extends Component { static propTypes = { index: PropTypes.number, targeting: PropTypes.object - } + }; render() { const {index, targeting} = this.props; let ad; @@ -48,7 +48,10 @@ class Content extends Component { {ad}

Content {index} - Lorem ipsum dolor sit amet, accusamus complectitur an est + + Lorem ipsum dolor sit amet, accusamus complectitur + an est + {contents[index]}

diff --git a/examples/apps/infinite-scrolling/main.js b/examples/apps/infinite-scrolling/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/infinite-scrolling/main.js +++ b/examples/apps/infinite-scrolling/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/interstitial/app.js b/examples/apps/interstitial/app.js index 813e981..f1876df 100644 --- a/examples/apps/interstitial/app.js +++ b/examples/apps/interstitial/app.js @@ -6,28 +6,25 @@ import styles from "./styles"; class App extends Component { state = { adUnitPath: "/4595/nfl.test.open/page/A" - } + }; onClick = () => { this.setState({ - adUnitPath: this.state.adUnitPath.indexOf("B") > -1 ? "/4595/nfl.test.open/page/A" : "/4595/nfl.test.open/page/B" + adUnitPath: + this.state.adUnitPath.indexOf("B") > -1 + ? "/4595/nfl.test.open/page/A" + : "/4595/nfl.test.open/page/B" }); - } + }; render() { const {adUnitPath} = this.state; return (
- - +
); } diff --git a/examples/apps/interstitial/main.js b/examples/apps/interstitial/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/interstitial/main.js +++ b/examples/apps/interstitial/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/lazy-render/app.js b/examples/apps/lazy-render/app.js index d4aef02..1548f03 100644 --- a/examples/apps/lazy-render/app.js +++ b/examples/apps/lazy-render/app.js @@ -10,14 +10,11 @@ Gpt.configure({viewableThreshold: 0}); class App extends Component { onClick = () => { Gpt.render(); - } + }; render() { return (
-
diff --git a/examples/apps/lazy-render/main.js b/examples/apps/lazy-render/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/lazy-render/main.js +++ b/examples/apps/lazy-render/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/log.js b/examples/apps/log.js index 0e9856e..7e4ad5b 100644 --- a/examples/apps/log.js +++ b/examples/apps/log.js @@ -11,9 +11,18 @@ GPT.on(Events.SLOT_RENDER_ENDED, event => { }, {}); if (!event.isEmpty && event.size) { - console.log(`ad creative '${event.creativeId}' is rendered to slot '${divId}' of size '${event.size[0]}x${event.size[1]}'`, event, targeting); + console.log( + `ad creative '${event.creativeId}' is rendered to slot '${divId}' of size '${event + .size[0]}x${event.size[1]}'`, + event, + targeting + ); } else { - console.log(`ad rendered but empty, div id is ${divId}`, event, targeting); + console.log( + `ad rendered but empty, div id is ${divId}`, + event, + targeting + ); } }); diff --git a/examples/apps/responsive/app.js b/examples/apps/responsive/app.js index dafefac..fdafff9 100644 --- a/examples/apps/responsive/app.js +++ b/examples/apps/responsive/app.js @@ -19,9 +19,9 @@ class App extends Component { {viewport: [1050, 200], slot: [1024, 120]} ], style: styles.adBorder - } + }; - onClick = (params) => { + onClick = params => { if (params === "refresh") { Gpt.refresh(); return; @@ -29,7 +29,10 @@ class App extends Component { let newState; if (params === "adUnitPath") { newState = { - adUnitPath: this.state.adUnitPath === "/4595/nfl.test.open" ? "/4595/nfl.test.open/new" : "/4595/nfl.test.open" + adUnitPath: + this.state.adUnitPath === "/4595/nfl.test.open" + ? "/4595/nfl.test.open/new" + : "/4595/nfl.test.open" }; } else if (params === "targeting") { newState = { @@ -40,47 +43,38 @@ class App extends Component { }; } else if (params === "size") { newState = { - sizeMapping: (this.state.sizeMapping[1].slot[1] === 50) ? [ - {viewport: [0, 0], slot: [1, 1]}, - {viewport: [340, 0], slot: [300, 250]}, - {viewport: [750, 200], slot: [728, 90]}, - {viewport: [1050, 200], slot: [1024, 120]} - ] : [ - {viewport: [0, 0], slot: [1, 1]}, - {viewport: [340, 0], slot: [320, 50]}, - {viewport: [750, 200], slot: [728, 90]}, - {viewport: [1050, 200], slot: [1024, 120]} - ] + sizeMapping: + this.state.sizeMapping[1].slot[1] === 50 + ? [ + {viewport: [0, 0], slot: [1, 1]}, + {viewport: [340, 0], slot: [300, 250]}, + {viewport: [750, 200], slot: [728, 90]}, + {viewport: [1050, 200], slot: [1024, 120]} + ] + : [ + {viewport: [0, 0], slot: [1, 1]}, + {viewport: [340, 0], slot: [320, 50]}, + {viewport: [750, 200], slot: [728, 90]}, + {viewport: [1050, 200], slot: [1024, 120]} + ] }; } this.setState(newState); - } + }; render() { return (
- - - -
diff --git a/examples/apps/responsive/button.js b/examples/apps/responsive/button.js index c4505fb..623dc7a 100644 --- a/examples/apps/responsive/button.js +++ b/examples/apps/responsive/button.js @@ -6,20 +6,15 @@ export default class Button extends Component { static propTypes = { children: PropTypes.node, onClick: PropTypes.func.isRequired, - params: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.object - ]).isRequired - } + params: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) + .isRequired + }; onClick = () => { this.props.onClick(this.props.params); - } + }; render() { return ( - ); diff --git a/examples/apps/responsive/main.js b/examples/apps/responsive/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/responsive/main.js +++ b/examples/apps/responsive/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/routing/app.js b/examples/apps/routing/app.js index 96dfe8c..1918a96 100644 --- a/examples/apps/routing/app.js +++ b/examples/apps/routing/app.js @@ -16,7 +16,7 @@ class App extends Component { location: PropTypes.object, history: PropTypes.object, children: PropTypes.node - } + }; createHref(path) { return `${window.location.origin}${window.location.pathname}#${path}`; @@ -33,9 +33,19 @@ class App extends Component { return (
{ - const route = this.routes[location.pathname] || this.routes["/Travel/Europe"]; + const route = + this.routes[location.pathname] || this.routes["/Travel/Europe"]; const {component: routeComponent, params} = route; this.setState({routeComponent, location, params}); }); @@ -74,13 +86,14 @@ class AppContainer extends Component { this.unlisten(); } - history = createHistory() + history = createHistory(); render() { return ( - {React.createElement(this.state.routeComponent)} diff --git a/examples/apps/routing/main.js b/examples/apps/routing/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/routing/main.js +++ b/examples/apps/routing/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/routing/page.js b/examples/apps/routing/page.js index 30c61ab..77e7071 100644 --- a/examples/apps/routing/page.js +++ b/examples/apps/routing/page.js @@ -8,7 +8,7 @@ class Page extends Component { static propTypes = { adUnitPath: PropTypes.string, params: PropTypes.object - } + }; render() { const {adUnitPath, params} = this.props; diff --git a/examples/apps/single-request/app.js b/examples/apps/single-request/app.js index b581cd9..18c26fc 100644 --- a/examples/apps/single-request/app.js +++ b/examples/apps/single-request/app.js @@ -7,7 +7,9 @@ import "../log"; import Button from "./button"; import styles from "./styles"; -const qs = canUseDOM ? querystring.decode(window.location.search.substr(1)) : {}; +const qs = canUseDOM + ? querystring.decode(window.location.search.substr(1)) + : {}; Gpt.enableSingleRequest().then(value => { console.log("value", value); @@ -22,8 +24,8 @@ class App extends Component { targeting: { test: "responsive" } - } - onClick = (params) => { + }; + onClick = params => { if (params === "refresh") { Gpt.refresh(); } else if (params === "disableInitialLoad") { @@ -40,33 +42,21 @@ class App extends Component { } }); } - } + }; render() { const {adUnitPath, targeting} = this.state; return ( - - - -
diff --git a/examples/apps/single-request/button.js b/examples/apps/single-request/button.js index c4505fb..623dc7a 100644 --- a/examples/apps/single-request/button.js +++ b/examples/apps/single-request/button.js @@ -6,20 +6,15 @@ export default class Button extends Component { static propTypes = { children: PropTypes.node, onClick: PropTypes.func.isRequired, - params: PropTypes.oneOfType([ - PropTypes.string, - PropTypes.object - ]).isRequired - } + params: PropTypes.oneOfType([PropTypes.string, PropTypes.object]) + .isRequired + }; onClick = () => { this.props.onClick(this.props.params); - } + }; render() { return ( - ); diff --git a/examples/apps/single-request/main.js b/examples/apps/single-request/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/single-request/main.js +++ b/examples/apps/single-request/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/apps/static-ad/app.js b/examples/apps/static-ad/app.js index 673526b..0cf9599 100644 --- a/examples/apps/static-ad/app.js +++ b/examples/apps/static-ad/app.js @@ -8,22 +8,19 @@ import styles from "./styles"; class App extends Component { state = { color: "000000" - } + }; onClick = () => { this.setState({ color: this.state.color === "000000" ? "ff0000" : "000000" }); - } + }; render() { const {color} = this.state; return (
-
diff --git a/examples/apps/static-ad/main.js b/examples/apps/static-ad/main.js index 7475b4d..c341ca7 100644 --- a/examples/apps/static-ad/main.js +++ b/examples/apps/static-ad/main.js @@ -2,6 +2,4 @@ import React from "react"; import ReactDOM from "react-dom"; import App from "./app"; -ReactDOM.render(( - -), document.getElementById("example")); +ReactDOM.render(, document.getElementById("example")); diff --git a/examples/server/routes.js b/examples/server/routes.js index d8cfc33..8b5dca4 100644 --- a/examples/server/routes.js +++ b/examples/server/routes.js @@ -7,11 +7,14 @@ import StaticAdApp from "../apps/static-ad/app"; import InterstitialApp from "../apps/interstitial/app"; export default { - "infinite-scrolling": {title: "Infinite Scrolling Example", app: InfiniteScrollApp}, + "infinite-scrolling": { + title: "Infinite Scrolling Example", + app: InfiniteScrollApp + }, "lazy-render": {title: "Lazy Render Example", app: LazyRenderApp}, - "responsive": {title: "Responsive Example", app: ResponsiveApp}, - "routing": {title: "Routing Example", app: RoutingApp}, + responsive: {title: "Responsive Example", app: ResponsiveApp}, + routing: {title: "Routing Example", app: RoutingApp}, "single-request": {title: "Single Request Example", app: SingleRequestApp}, "static-ad": {title: "Static Ad Example", app: StaticAdApp}, - "interstitial": {title: "Interstitial Example", app: InterstitialApp} + interstitial: {title: "Interstitial Example", app: InterstitialApp} }; diff --git a/examples/server/server.js b/examples/server/server.js index e3d4383..67267a5 100644 --- a/examples/server/server.js +++ b/examples/server/server.js @@ -12,15 +12,20 @@ import {renderToString} from "react-dom/server"; import routes from "./routes"; -const globalStyle = fs.readFileSync(path.resolve(__dirname, "../apps/global.css"), "utf8"); +const globalStyle = fs.readFileSync( + path.resolve(__dirname, "../apps/global.css"), + "utf8" +); const app = new Express(); const port = 8080; -app.use(webpackDevMiddleware(webpack(webpackConfig), { - noInfo: true, - publicPath: webpackConfig.output.publicPath -})); +app.use( + webpackDevMiddleware(webpack(webpackConfig), { + noInfo: true, + publicPath: webpackConfig.output.publicPath + }) +); app.use(handleRoutes); function handleRoutes(req, res) { @@ -38,7 +43,9 @@ function handleRoutes(req, res) { const App = routes[routeName].app; const title = routes[routeName].title; - const html = renderToString(); + const html = renderToString( + + ); res.send(renderPage(routeName, html, title)); } @@ -100,10 +107,12 @@ function renderPage(name, html, title) { `; } -app.listen(port, (error) => { +app.listen(port, error => { if (error) { console.error(error); } else { - console.info(`==> 🌎 Listening on port ${port}. Open up http://localhost:${port}/ in your browser.`); + console.info( + `==> 🌎 Listening on port ${port}. Open up http://localhost:${port}/ in your browser.` + ); } }); diff --git a/package.json b/package.json index f9ed1a9..79ff335 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,6 @@ ], "dependencies": { "deep-equal": "^1.0.1", - "eslint-config-prettier": "^2.5.0", - "eslint-plugin-prettier": "^2.2.0", "eventemitter3": "^2.0.2", "exenv": "^1.2.2", "hoist-non-react-statics": "^1.0.5", @@ -61,6 +59,8 @@ "core-js": "^2.2.2", "cz-conventional-changelog": "^1.1.6", "eslint": "4.7.0", + "eslint-config-prettier": "^2.5.0", + "eslint-plugin-prettier": "^2.2.0", "eslint-config-nfl": "12.0.0", "eslint-plugin-import": "2.7.0", "eslint-plugin-mocha": "4.11.0", diff --git a/src/Bling.js b/src/Bling.js index 99f2ea4..d2e26e9 100644 --- a/src/Bling.js +++ b/src/Bling.js @@ -47,10 +47,7 @@ class Bling extends Component { * * @property slotSize */ - slotSize: PropTypes.oneOfType([ - PropTypes.array, - PropTypes.string - ]), + slotSize: PropTypes.oneOfType([PropTypes.array, PropTypes.string]), /** * An optional array of object which contains an array of viewport size and slot size. * This needs to be set if the ad needs to serve different ad sizes per different viewport sizes (responsive ad). @@ -68,10 +65,12 @@ class Bling extends Component { * * @property sizeMapping */ - sizeMapping: PropTypes.arrayOf(PropTypes.shape({ - viewport: PropTypes.array, - slot: PropTypes.array - })), + sizeMapping: PropTypes.arrayOf( + PropTypes.shape({ + viewport: PropTypes.array, + slot: PropTypes.array + }) + ), /** * An optional flag to indicate whether an ad slot should be out-of-page slot. * @@ -186,9 +185,9 @@ class Bling extends Component { * @property style */ style: PropTypes.object - } + }; - /** + /** * An array of prop names which can reflect to the ad by calling `refresh`. * * @property refreshableProps @@ -204,19 +203,14 @@ class Bling extends Component { "companionAdService", "forceSafeFrame", "safeFrameConfig" - ] + ]; /** * An array of prop names which requires to create a new ad slot and render as a new ad. * * @property reRenderProps * @static */ - static reRenderProps = [ - "adUnitPath", - "slotSize", - "outOfPage", - "content" - ] + static reRenderProps = ["adUnitPath", "slotSize", "outOfPage", "content"]; /** * An instance of ad manager. * @@ -224,8 +218,8 @@ class Bling extends Component { * @private * @static */ - static _adManager = createManager() - /** + static _adManager = createManager(); + /** * * @property * @private @@ -253,7 +247,7 @@ class Bling extends Component { * An optional function for the filtered props and the next props to perform equality check. */ propsEqual: deepEqual - } + }; static on(eventType, cb) { Bling._on("on", eventType, cb); @@ -288,7 +282,7 @@ class Bling extends Component { ...config }; } - /** + /** * Returns the GPT version. * * @method getGPTVersion @@ -308,7 +302,7 @@ class Bling extends Component { static getPubadsVersion() { return Bling._adManager.getPubadsVersion(); } - /** + /** * Sets a flag to indicate whether the correlator value should always be same across the ads in the page or not. * * @method syncCorrelator @@ -337,7 +331,7 @@ class Bling extends Component { static refresh(slots, options) { Bling._adManager.refresh(slots, options); } - /** + /** * Clears the ads for the specified ad slots, if no slots are provided, all the ads will be cleared. * * @method clear @@ -365,25 +359,33 @@ class Bling extends Component { state = { scriptLoaded: false, inViewport: false - } + }; get adSlot() { return this._adSlot; } get viewableThreshold() { - return this.props.viewableThreshold >= 0 ? this.props.viewableThreshold : Bling._config.viewableThreshold; + return this.props.viewableThreshold >= 0 + ? this.props.viewableThreshold + : Bling._config.viewableThreshold; } componentDidMount() { Bling._adManager.addInstance(this); - Bling._adManager.load(Bling._config.seedFileUrl).then(this.onScriptLoaded.bind(this)).catch(this.onScriptError.bind(this)); + Bling._adManager + .load(Bling._config.seedFileUrl) + .then(this.onScriptLoaded.bind(this)) + .catch(this.onScriptError.bind(this)); } componentWillReceiveProps(nextProps) { const {propsEqual} = Bling._config; const {sizeMapping} = this.props; - if ((nextProps.sizeMapping || sizeMapping) && !propsEqual(nextProps.sizeMapping, sizeMapping)) { + if ( + (nextProps.sizeMapping || sizeMapping) && + !propsEqual(nextProps.sizeMapping, sizeMapping) + ) { Bling._adManager.removeMQListener(this, nextProps); } } @@ -393,8 +395,8 @@ class Bling extends Component { // otherwise, just refresh const {scriptLoaded, inViewport} = nextState; const notInViewport = this.notInViewport(nextProps, nextState); - const inViewportChanged = (this.state.inViewport !== inViewport); - const isScriptLoaded = (this.state.scriptLoaded !== scriptLoaded); + const inViewportChanged = this.state.inViewport !== inViewport; + const isScriptLoaded = this.state.scriptLoaded !== scriptLoaded; // Exit early for visibility change, before executing deep equality check. if (notInViewport) { @@ -404,10 +406,23 @@ class Bling extends Component { } const {filterProps, propsEqual} = Bling._config; - const refreshableProps = filterProps(Bling.refreshableProps, this.props, nextProps); - const reRenderProps = filterProps(Bling.reRenderProps, this.props, nextProps); - const shouldRender = !propsEqual(reRenderProps.props, reRenderProps.nextProps); - const shouldRefresh = !shouldRender && !propsEqual(refreshableProps.props, refreshableProps.nextProps); + const refreshableProps = filterProps( + Bling.refreshableProps, + this.props, + nextProps + ); + const reRenderProps = filterProps( + Bling.reRenderProps, + this.props, + nextProps + ); + const shouldRender = !propsEqual( + reRenderProps.props, + reRenderProps.nextProps + ); + const shouldRefresh = + !shouldRender && + !propsEqual(refreshableProps.props, refreshableProps.nextProps); // console.log(`shouldRefresh: ${shouldRefresh}, shouldRender: ${shouldRender}, isScriptLoaded: ${isScriptLoaded}, syncCorrelator: ${Bling._adManager._syncCorrelator}`); if (shouldRefresh) { @@ -466,11 +481,16 @@ class Bling extends Component { } onScriptError(err) { - console.warn(`Ad: Failed to load gpt for ${Bling._config.seedFileUrl}`, err); + console.warn( + `Ad: Failed to load gpt for ${Bling._config.seedFileUrl}`, + err + ); } getRenderWhenViewable(props = this.props) { - return props.renderWhenViewable !== undefined ? props.renderWhenViewable : Bling._config.renderWhenViewable; + return props.renderWhenViewable !== undefined + ? props.renderWhenViewable + : Bling._config.renderWhenViewable; } foldCheck() { @@ -486,7 +506,11 @@ class Bling extends Component { slotSize = [0, 0]; } - const inViewport = Bling._adManager.isInViewport(ReactDOM.findDOMNode(this), slotSize, this.viewableThreshold); + const inViewport = Bling._adManager.isInViewport( + ReactDOM.findDOMNode(this), + slotSize, + this.viewableThreshold + ); if (inViewport) { this.setState({inViewport: true}); } @@ -495,9 +519,11 @@ class Bling extends Component { defineSizeMapping(adSlot, sizeMapping) { if (sizeMapping) { Bling._adManager.addMQListener(this, this.props); - const sizeMappingArray = sizeMapping.reduce((mapping, size) => { - return mapping.addSize(size.viewport, size.slot); - }, Bling._adManager.googletag.sizeMapping()).build(); + const sizeMappingArray = sizeMapping + .reduce((mapping, size) => { + return mapping.addSize(size.viewport, size.slot); + }, Bling._adManager.googletag.sizeMapping()) + .build(); adSlot.defineSizeMapping(sizeMappingArray); } } @@ -532,7 +558,9 @@ class Bling extends Component { companionAdsService.enableSyncLoading(); } if (serviceConfig.hasOwnProperty("refreshUnfilledSlots")) { - companionAdsService.setRefreshUnfilledSlots(serviceConfig.refreshUnfilledSlots); + companionAdsService.setRefreshUnfilledSlots( + serviceConfig.refreshUnfilledSlots + ); } } } @@ -564,18 +592,22 @@ class Bling extends Component { } defineSlot() { - const { - adUnitPath, - outOfPage - } = this.props; + const {adUnitPath, outOfPage} = this.props; const divId = this._divId; const slotSize = this.getSlotSize(); if (!this._adSlot) { if (outOfPage) { - this._adSlot = Bling._adManager.googletag.defineOutOfPageSlot(adUnitPath, divId); + this._adSlot = Bling._adManager.googletag.defineOutOfPageSlot( + adUnitPath, + divId + ); } else { - this._adSlot = Bling._adManager.googletag.defineSlot(adUnitPath, slotSize || [], divId); + this._adSlot = Bling._adManager.googletag.defineSlot( + adUnitPath, + slotSize || [], + divId + ); } } @@ -658,11 +690,17 @@ class Bling extends Component { if (content) { Bling._adManager.googletag.content().setContent(adSlot, content); } else { - if (!Bling._adManager._disableInitialLoad && !Bling._adManager._syncCorrelator) { + if ( + !Bling._adManager._disableInitialLoad && + !Bling._adManager._syncCorrelator + ) { Bling._adManager.updateCorrelator(); } Bling._adManager.googletag.display(divId); - if (Bling._adManager._disableInitialLoad && !Bling._adManager._initialRender) { + if ( + Bling._adManager._disableInitialLoad && + !Bling._adManager._initialRender + ) { this.refresh(); } } @@ -711,7 +749,10 @@ class Bling extends Component { if (slotSize === "fluid") { slotSize = ["auto", "auto"]; } - const emptyStyle = slotSize && {width: slotSize[0], height: slotSize[1]}; + const emptyStyle = slotSize && { + width: slotSize[0], + height: slotSize[1] + }; // render node element instead of script element so that `inViewport` check works. return
; } @@ -729,7 +770,10 @@ class Bling extends Component { } // proxy pubads API through Bling -export default hoistStatics(Bling, pubadsAPI.reduce((api, method) => { - api[method] = (...args) => Bling._adManager.pubadsProxy({method, args}); - return api; -}, {})); +export default hoistStatics( + Bling, + pubadsAPI.reduce((api, method) => { + api[method] = (...args) => Bling._adManager.pubadsProxy({method, args}); + return api; + }, {}) +); diff --git a/src/createManager.js b/src/createManager.js index 6fbfff3..59e92aa 100644 --- a/src/createManager.js +++ b/src/createManager.js @@ -48,13 +48,13 @@ export class AdManager extends EventEmitter { } } - _adCnt = 0 + _adCnt = 0; - _initialRender = true + _initialRender = true; - _syncCorrelator = false + _syncCorrelator = false; - _testMode = false + _testMode = false; get googletag() { return this._googletag; @@ -100,9 +100,15 @@ export class AdManager extends EventEmitter { _processPubadsQueue() { if (this._pubadsProxyQueue) { Object.keys(this._pubadsProxyQueue).forEach(method => { - if ((this.googletag && !this.googletag.pubadsReady && APIToCallBeforeServiceEnabled.indexOf(method) > -1) || - this.pubadsReady) { - this._pubadsProxyQueue[method].forEach((params) => this.pubadsProxy(params)); + if ( + (this.googletag && + !this.googletag.pubadsReady && + APIToCallBeforeServiceEnabled.indexOf(method) > -1) || + this.pubadsReady + ) { + this._pubadsProxyQueue[method].forEach(params => + this.pubadsProxy(params) + ); delete this._pubadsProxyQueue[method]; } }); @@ -114,7 +120,11 @@ export class AdManager extends EventEmitter { _callPubads({method, args, resolve, reject}) { if (typeof this.googletag.pubads()[method] !== "function") { - reject(new Error(`googletag.pubads does not support ${method}, please update pubadsAPI`)); + reject( + new Error( + `googletag.pubads does not support ${method}, please update pubadsAPI` + ) + ); } else { try { const result = this.googletag.pubads()[method](...args); @@ -127,7 +137,10 @@ export class AdManager extends EventEmitter { _toggleListener(add) { ["scroll", "resize"].forEach(eventName => { - window[add ? "addEventListener" : "removeEventListener"](eventName, this._foldCheck); + window[add ? "addEventListener" : "removeEventListener"]( + eventName, + this._foldCheck + ); }); } @@ -142,7 +155,7 @@ export class AdManager extends EventEmitter { if (this.testMode) { this._getTimer(); } - }) + }); _getTimer() { return Date.now(); @@ -165,7 +178,7 @@ export class AdManager extends EventEmitter { } }); } - } + }; _listen() { if (!this._listening) { @@ -176,7 +189,12 @@ export class AdManager extends EventEmitter { ].forEach(eventType => { ["pubads", "content", "companionAds"].forEach(service => { // there is no API to remove listeners. - this.googletag[service]().addEventListener(eventType, this._onEvent.bind(this, eventType)); + this.googletag + [service]() + .addEventListener( + eventType, + this._onEvent.bind(this, eventType) + ); }); }); this._listening = true; @@ -191,7 +209,9 @@ export class AdManager extends EventEmitter { // call event handler props const instances = this.getMountedInstances(); const {slot} = event; - const funcName = `on${eventType.charAt(0).toUpperCase()}${eventType.substr(1)}`; + const funcName = `on${eventType + .charAt(0) + .toUpperCase()}${eventType.substr(1)}`; const instance = instances.filter(inst => slot === inst.adSlot)[0]; if (instance && instance.props[funcName]) { instance.props[funcName](event); @@ -251,14 +271,18 @@ export class AdManager extends EventEmitter { this._mqls = {}; } if (!this._mqls[viewportWidth]) { - const mql = window.matchMedia(`(min-width: ${viewportWidth}px)`); + const mql = window.matchMedia( + `(min-width: ${viewportWidth}px)` + ); mql.addListener(this._handleMediaQueryChange); this._mqls[viewportWidth] = { mql, listeners: [] }; } - if (this._mqls[viewportWidth].listeners.indexOf(instance) === -1) { + if ( + this._mqls[viewportWidth].listeners.indexOf(instance) === -1 + ) { this._mqls[viewportWidth].listeners.push(instance); } } @@ -270,17 +294,18 @@ export class AdManager extends EventEmitter { return; } - Object.keys(this._mqls) - .forEach(key => { - const index = this._mqls[key].listeners.indexOf(instance); - if (index > -1) { - this._mqls[key].listeners.splice(index, 1); - } - if (this._mqls[key].listeners.length === 0) { - this._mqls[key].mql.removeListener(this._handleMediaQueryChange); - delete this._mqls[key]; - } - }); + Object.keys(this._mqls).forEach(key => { + const index = this._mqls[key].listeners.indexOf(instance); + if (index > -1) { + this._mqls[key].listeners.splice(index, 1); + } + if (this._mqls[key].listeners.length === 0) { + this._mqls[key].mql.removeListener( + this._handleMediaQueryChange + ); + delete this._mqls[key]; + } + }); } isInViewport(...args) { @@ -333,7 +358,7 @@ export class AdManager extends EventEmitter { let dummyAdSlot; // Define all the slots - instances.forEach((instance) => { + instances.forEach(instance => { if (!instance.notInViewport()) { instance.defineSlot(); const adSlot = instance.adSlot; @@ -341,7 +366,10 @@ export class AdManager extends EventEmitter { if (adSlot && adSlot.hasOwnProperty("getServices")) { const services = adSlot.getServices(); if (!hasPubAdsService) { - hasPubAdsService = services.filter(service => !!service.enableAsyncRendering).length > 0; + hasPubAdsService = + services.filter( + service => !!service.enableAsyncRendering + ).length > 0; } } } @@ -373,7 +401,7 @@ export class AdManager extends EventEmitter { this.emit(Events.READY, this.googletag); // Call display - instances.forEach((instance) => { + instances.forEach(instance => { if (!instance.notInViewport()) { instance.display(); } @@ -383,7 +411,7 @@ export class AdManager extends EventEmitter { this._initialRender = false; }); - }) + }); /** * Re-render(not refresh) all the ads in the page and the first ad will update the correlator value. @@ -407,7 +435,7 @@ export class AdManager extends EventEmitter { }); return true; - }) + }); getGPTVersion() { if (!this.apiReady) { @@ -433,45 +461,48 @@ export class AdManager extends EventEmitter { } load(url) { - return this._loadPromise || (this._loadPromise = new Promise((resolve, reject) => { - // test mode can't be enabled in production mode - if (this.testMode) { - resolve(this.googletag); - return; - } - if (!canUseDOM) { - reject(new Error("DOM not available")); - return; - } - if (!url) { - reject(new Error("url is missing")); - return; - } - const onLoad = () => { - if (window.googletag) { - this._googletag = window.googletag; - // make sure API is ready for use. - this.googletag.cmd.push(() => { - this._isLoaded = true; - resolve(this.googletag); - }); - } else { - reject(new Error("window.googletag is not available")); + return ( + this._loadPromise || + (this._loadPromise = new Promise((resolve, reject) => { + // test mode can't be enabled in production mode + if (this.testMode) { + resolve(this.googletag); + return; } - }; - if (window.googletag && window.googletag.apiReady) { - onLoad(); - } else { - const script = document.createElement("script"); - script.async = true; - script.onload = onLoad; - script.onerror = () => { - reject(new Error("failed to load script")); + if (!canUseDOM) { + reject(new Error("DOM not available")); + return; + } + if (!url) { + reject(new Error("url is missing")); + return; + } + const onLoad = () => { + if (window.googletag) { + this._googletag = window.googletag; + // make sure API is ready for use. + this.googletag.cmd.push(() => { + this._isLoaded = true; + resolve(this.googletag); + }); + } else { + reject(new Error("window.googletag is not available")); + } }; - script.src = url; - document.head.appendChild(script); - } - })); + if (window.googletag && window.googletag.apiReady) { + onLoad(); + } else { + const script = document.createElement("script"); + script.async = true; + script.onload = onLoad; + script.onerror = () => { + reject(new Error("failed to load script")); + }; + script.src = url; + document.head.appendChild(script); + } + })) + ); } pubadsProxy({method, args = [], resolve, reject}) { @@ -482,7 +513,12 @@ export class AdManager extends EventEmitter { this[`_${method}`] = (args && args.length && args[0]) || true; } return new Promise((resolve2, reject2) => { - const params = {method, args, resolve: resolve2, reject: reject2}; + const params = { + method, + args, + resolve: resolve2, + reject: reject2 + }; if (!this.pubadsReady) { if (!this._pubadsProxyQueue) { this._pubadsProxyQueue = {}; diff --git a/src/utils/apiList.js b/src/utils/apiList.js index e2ff40c..63baecf 100644 --- a/src/utils/apiList.js +++ b/src/utils/apiList.js @@ -4,126 +4,126 @@ export const gptVersion = 110; export const gptAPI = [ - ["getVersion", "function"], - ["cmd", "object"], - ["getEventLog", "function"], - ["enableServices", "function"], - ["setAdIframeTitle", "function"], - ["impl", "object"], - ["pubads", "function"], - ["defineOutOfPageSlot", "function"], - ["defineSlot", "function"], - ["defineUnit", "function"], - ["destroySlots", "function"], - ["display", "function"], - ["companionAds", "function"], - ["content", "function"], - ["debug_log", "object"], - ["service_manager_instance", "object"], - ["disablePublisherConsole", "function"], - ["onPubConsoleJsLoad", "function"], - ["openConsole", "function"], - ["sizeMapping", "function"], - ["evalScripts", "function"], - ["apiReady", "boolean"], - ["slot_manager_instance", "object"], - ["pubadsReady", "boolean"] + ["getVersion", "function"], + ["cmd", "object"], + ["getEventLog", "function"], + ["enableServices", "function"], + ["setAdIframeTitle", "function"], + ["impl", "object"], + ["pubads", "function"], + ["defineOutOfPageSlot", "function"], + ["defineSlot", "function"], + ["defineUnit", "function"], + ["destroySlots", "function"], + ["display", "function"], + ["companionAds", "function"], + ["content", "function"], + ["debug_log", "object"], + ["service_manager_instance", "object"], + ["disablePublisherConsole", "function"], + ["onPubConsoleJsLoad", "function"], + ["openConsole", "function"], + ["sizeMapping", "function"], + ["evalScripts", "function"], + ["apiReady", "boolean"], + ["slot_manager_instance", "object"], + ["pubadsReady", "boolean"] ]; export const pubadsVersion = 110; export const pubadsAPI = [ - ["set", "function"], - ["get", "function"], - ["getAttributeKeys", "function"], - ["display", "function"], - ["getName", "function"], - ["setCookieOptions", "function"], - ["setTagForChildDirectedTreatment", "function"], - ["clearTagForChildDirectedTreatment", "function"], - ["setKidsFriendlyAds", "function"], - ["setTargeting", "function"], - ["clearTargeting", "function"], - ["getTargeting", "function"], - ["getTargetingKeys", "function"], - ["setCategoryExclusion", "function"], - ["clearCategoryExclusions", "function"], - ["disableInitialLoad", "function"], - ["enableSingleRequest", "function"], - ["enableAsyncRendering", "function"], - ["enableSyncRendering", "function"], - ["setCentering", "function"], - ["setPublisherProvidedId", "function"], - ["definePassback", "function"], - ["defineOutOfPagePassback", "function"], - ["refresh", "function"], - ["enableVideoAds", "function"], - ["setVideoContent", "function"], - ["getVideoContent", "function"], - ["getCorrelator", "function"], - ["setCorrelator", "function"], - ["updateCorrelator", "function"], - ["isAdRequestFinished", "function"], - ["collapseEmptyDivs", "function"], - ["clear", "function"], - ["setLocation", "function"], - ["getVersion", "function"], - ["forceExperiment", "function"], - ["markAsAmp", "function"], - ["setSafeFrameConfig", "function"], - ["setForceSafeFrame", "function"], - ["enableChromeInterventionSignals", "function"], - ["markAsGladeControl", "function"], - ["markAsGladeOptOut", "function"], - ["getName", "function"], - ["getVersion", "function"], - ["getSlots", "function"], - ["getSlotIdMap", "function"], - ["enable", "function"], - ["addEventListener", "function"] + ["set", "function"], + ["get", "function"], + ["getAttributeKeys", "function"], + ["display", "function"], + ["getName", "function"], + ["setCookieOptions", "function"], + ["setTagForChildDirectedTreatment", "function"], + ["clearTagForChildDirectedTreatment", "function"], + ["setKidsFriendlyAds", "function"], + ["setTargeting", "function"], + ["clearTargeting", "function"], + ["getTargeting", "function"], + ["getTargetingKeys", "function"], + ["setCategoryExclusion", "function"], + ["clearCategoryExclusions", "function"], + ["disableInitialLoad", "function"], + ["enableSingleRequest", "function"], + ["enableAsyncRendering", "function"], + ["enableSyncRendering", "function"], + ["setCentering", "function"], + ["setPublisherProvidedId", "function"], + ["definePassback", "function"], + ["defineOutOfPagePassback", "function"], + ["refresh", "function"], + ["enableVideoAds", "function"], + ["setVideoContent", "function"], + ["getVideoContent", "function"], + ["getCorrelator", "function"], + ["setCorrelator", "function"], + ["updateCorrelator", "function"], + ["isAdRequestFinished", "function"], + ["collapseEmptyDivs", "function"], + ["clear", "function"], + ["setLocation", "function"], + ["getVersion", "function"], + ["forceExperiment", "function"], + ["markAsAmp", "function"], + ["setSafeFrameConfig", "function"], + ["setForceSafeFrame", "function"], + ["enableChromeInterventionSignals", "function"], + ["markAsGladeControl", "function"], + ["markAsGladeOptOut", "function"], + ["getName", "function"], + ["getVersion", "function"], + ["getSlots", "function"], + ["getSlotIdMap", "function"], + ["enable", "function"], + ["addEventListener", "function"] ]; export const slotAPI = [ - ["getPassbackPageUrl", "function"], - ["set", "function"], - ["get", "function"], - ["getAttributeKeys", "function"], - ["addService", "function"], - ["getName", "function"], - ["getAdUnitPath", "function"], - ["getInstance", "function"], - ["getSlotElementId", "function"], - ["getSlotId", "function"], - ["getServices", "function"], - ["getSizes", "function"], - ["defineSizeMapping", "function"], - ["hasWrapperDiv", "function"], - ["setClickUrl", "function"], - ["getClickUrl", "function"], - ["setForceSafeFrame", "function"], - ["setCategoryExclusion", "function"], - ["clearCategoryExclusions", "function"], - ["getCategoryExclusions", "function"], - ["setTargeting", "function"], - ["clearTargeting", "function"], - ["getTargetingMap", "function"], - ["getTargeting", "function"], - ["getTargetingKeys", "function"], - ["getOutOfPage", "function"], - ["getAudExtId", "function"], - ["gtfcd", "function"], - ["setCollapseEmptyDiv", "function"], - ["getCollapseEmptyDiv", "function"], - ["getDivStartsCollapsed", "function"], - ["fetchStarted", "function"], - ["getContentUrl", "function"], - ["fetchEnded", "function"], - ["renderStarted", "function"], - ["getResponseInformation", "function"], - ["renderEnded", "function"], - ["loaded", "function"], - ["impressionViewable", "function"], - ["visibilityChanged", "function"], - ["setFirstLook", "function"], - ["getFirstLook", "function"], - ["getEscapedQemQueryId", "function"], - ["setSafeFrameConfig", "function"], - ["getCsiId", "function"] + ["getPassbackPageUrl", "function"], + ["set", "function"], + ["get", "function"], + ["getAttributeKeys", "function"], + ["addService", "function"], + ["getName", "function"], + ["getAdUnitPath", "function"], + ["getInstance", "function"], + ["getSlotElementId", "function"], + ["getSlotId", "function"], + ["getServices", "function"], + ["getSizes", "function"], + ["defineSizeMapping", "function"], + ["hasWrapperDiv", "function"], + ["setClickUrl", "function"], + ["getClickUrl", "function"], + ["setForceSafeFrame", "function"], + ["setCategoryExclusion", "function"], + ["clearCategoryExclusions", "function"], + ["getCategoryExclusions", "function"], + ["setTargeting", "function"], + ["clearTargeting", "function"], + ["getTargetingMap", "function"], + ["getTargeting", "function"], + ["getTargetingKeys", "function"], + ["getOutOfPage", "function"], + ["getAudExtId", "function"], + ["gtfcd", "function"], + ["setCollapseEmptyDiv", "function"], + ["getCollapseEmptyDiv", "function"], + ["getDivStartsCollapsed", "function"], + ["fetchStarted", "function"], + ["getContentUrl", "function"], + ["fetchEnded", "function"], + ["renderStarted", "function"], + ["getResponseInformation", "function"], + ["renderEnded", "function"], + ["loaded", "function"], + ["impressionViewable", "function"], + ["visibilityChanged", "function"], + ["setFirstLook", "function"], + ["getFirstLook", "function"], + ["getEscapedQemQueryId", "function"], + ["setSafeFrameConfig", "function"], + ["getCsiId", "function"] ]; diff --git a/src/utils/filterProps.js b/src/utils/filterProps.js index be489d4..3b3ad42 100644 --- a/src/utils/filterProps.js +++ b/src/utils/filterProps.js @@ -1,10 +1,13 @@ export default function filterProps(propKeys, props, nextProps) { - return propKeys.reduce((filtered, key) => { - filtered.props[key] = props[key]; - filtered.nextProps[key] = nextProps[key]; - return filtered; - }, { - props: {}, - nextProps: {} - }); + return propKeys.reduce( + (filtered, key) => { + filtered.props[key] = props[key]; + filtered.nextProps[key] = nextProps[key]; + return filtered; + }, + { + props: {}, + nextProps: {} + } + ); } diff --git a/src/utils/isInViewport.js b/src/utils/isInViewport.js index 646a5e1..28e50b0 100644 --- a/src/utils/isInViewport.js +++ b/src/utils/isInViewport.js @@ -15,11 +15,10 @@ export default function isInViewport(el, [width, height] = [0, 0], offset = 0) { bottom: window.innerHeight, right: window.innerWidth }; - const inViewport = ( - rect.bottom >= (viewport.top + height * offset) && - rect.right >= (viewport.left + width * offset) && - rect.top <= (viewport.bottom - height * offset) && - rect.left <= (viewport.right - width * offset) - ); + const inViewport = + rect.bottom >= viewport.top + height * offset && + rect.right >= viewport.left + width * offset && + rect.top <= viewport.bottom - height * offset && + rect.left <= viewport.right - width * offset; return inViewport; } diff --git a/src/utils/mockGPT.js b/src/utils/mockGPT.js index 80ce4da..65b41a6 100644 --- a/src/utils/mockGPT.js +++ b/src/utils/mockGPT.js @@ -208,7 +208,9 @@ class GPTMock { this.config = config; this.version = gptVersion; this.cmd = {}; - this.cmd.push = cb => {cb();}; + this.cmd.push = cb => { + cb(); + }; } pubadsReady = false; getVersion() { diff --git a/test/Bling.spec.js b/test/Bling.spec.js index 7c3765f..b9b78e0 100644 --- a/test/Bling.spec.js +++ b/test/Bling.spec.js @@ -34,13 +34,15 @@ describe("Bling", () => { it("initially renders empty div with style", () => { const renderer = ReactTestUtils.createRenderer(); - renderer.render(); + renderer.render( + + ); const result = renderer.getRenderOutput(); expect(result.type).to.equal("div"); expect(result.props.style).to.eql({width: 728, height: 90}); }); - it("returns gpt version", (done) => { + it("returns gpt version", done => { Bling.once(Events.READY, () => { expect(Bling.getGPTVersion()).to.equal(gptVersion); done(); @@ -51,7 +53,7 @@ describe("Bling", () => { ); }); - it("returns pubads version", (done) => { + it("returns pubads version", done => { Bling.once(Events.READY, () => { expect(Bling.getPubadsVersion()).to.equal(pubadsVersion); done(); @@ -62,7 +64,7 @@ describe("Bling", () => { ); }); - it("accepts syncCorrelator", (done) => { + it("accepts syncCorrelator", done => { const render = sinon.stub(Bling._adManager, "render", function () { expect(this._syncCorrelator).to.be.true; render.restore(); @@ -76,7 +78,7 @@ describe("Bling", () => { ); }); - it("accepts pubads API", (done) => { + it("accepts pubads API", done => { const apiStubs = {}; pubadsAPI.forEach(method => { apiStubs[method] = sinon.stub(googletag.pubads(), method); @@ -114,7 +116,7 @@ describe("Bling", () => { ); }); - it("can call pubads API multiple times", (done) => { + it("can call pubads API multiple times", done => { const spy = sinon.stub(googletag.pubads(), "setTargeting"); Bling.once(Events.RENDER, () => { @@ -133,7 +135,7 @@ describe("Bling", () => { ); }); - it("fires once event", (done) => { + it("fires once event", done => { const events = Object.keys(Events).map(key => Events[key]); function afterReady() { @@ -156,7 +158,7 @@ describe("Bling", () => { ); }); - it("fires on event", (done) => { + it("fires on event", done => { const events = Object.keys(Events).map(key => Events[key]); function afterReady() { @@ -180,7 +182,7 @@ describe("Bling", () => { ); }); - it("removes event", (done) => { + it("removes event", done => { const spy = sinon.spy(); Bling.on(Events.RENDER, spy); Bling.removeListener(Events.RENDER, spy); @@ -236,7 +238,10 @@ describe("Bling", () => { }); it("updates correlator", () => { - const updateCorrelator = sinon.stub(Bling._adManager, "updateCorrelator"); + const updateCorrelator = sinon.stub( + Bling._adManager, + "updateCorrelator" + ); Bling.updateCorrelator(); @@ -244,7 +249,7 @@ describe("Bling", () => { updateCorrelator.restore(); }); - it("reflects adUnitPath props to adSlot", (done) => { + it("reflects adUnitPath props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; expect(adSlot.getAdUnitPath()).to.equal("/4595/nfl.test.open"); @@ -252,14 +257,11 @@ describe("Bling", () => { }); const instance = ReactTestUtils.renderIntoDocument( - + ); }); - it("reflects slotSize props to adSlot", (done) => { + it("reflects slotSize props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; expect(adSlot.getSizes()).to.eql([300, 250]); @@ -267,17 +269,18 @@ describe("Bling", () => { }); const instance = ReactTestUtils.renderIntoDocument( - + ); }); - it("reflects sizeMapping props to adSlot", (done) => { + it("reflects sizeMapping props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; - expect(adSlot.getSizes()).to.eql([[[0, 0], [320, 50]], [[750, 200], [728, 90]], [[1050, 200], [1024, 120]]]); + expect(adSlot.getSizes()).to.eql([ + [[0, 0], [320, 50]], + [[750, 200], [728, 90]], + [[1050, 200], [1024, 120]] + ]); done(); }); @@ -293,7 +296,7 @@ describe("Bling", () => { ); }); - it("reflects targeting props to adSlot", (done) => { + it("reflects targeting props to adSlot", done => { const targeting = {t1: "v1", t2: [1, 2, 3]}; Bling.once(Events.RENDER, () => { @@ -313,7 +316,7 @@ describe("Bling", () => { ); }); - it("reflects collapseEmptyDiv props to adSlot", (done) => { + it("reflects collapseEmptyDiv props to adSlot", done => { Bling.once(Events.RENDER, () => { expect(ads[0].adSlot.getCollapseEmptyDiv()).to.be.true; expect(ads[1].adSlot.getCollapseEmptyDiv()).to.be.false; @@ -323,11 +326,9 @@ describe("Bling", () => { class Wrapper extends Component { static propTypes = { children: PropTypes.node - } + }; render() { - return ( -
{this.props.children}
- ); + return
{this.props.children}
; } } @@ -345,10 +346,13 @@ describe("Bling", () => { /> ); - const ads = ReactTestUtils.scryRenderedComponentsWithType(instance, Bling); + const ads = ReactTestUtils.scryRenderedComponentsWithType( + instance, + Bling + ); }); - it("reflects attributes props to adSlot", (done) => { + it("reflects attributes props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; expect(adSlot.get("attr1")).to.equal("val1"); @@ -366,7 +370,7 @@ describe("Bling", () => { ); }); - it("reflects categoryExclusion props to adSlot", (done) => { + it("reflects categoryExclusion props to adSlot", done => { Bling.once(Events.RENDER, () => { expect(ads[0].adSlot.getCategoryExclusions()).to.eql(["Airline"]); expect(ads[1].adSlot.getCategoryExclusions()).to.eql(["Airline"]); @@ -376,11 +380,9 @@ describe("Bling", () => { class Wrapper extends Component { static propTypes = { children: PropTypes.node - } + }; render() { - return ( -
{this.props.children}
- ); + return
{this.props.children}
; } } @@ -398,10 +400,13 @@ describe("Bling", () => { /> ); - const ads = ReactTestUtils.scryRenderedComponentsWithType(instance, Bling); + const ads = ReactTestUtils.scryRenderedComponentsWithType( + instance, + Bling + ); }); - it("reflects clickUrl props to adSlot", (done) => { + it("reflects clickUrl props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; expect(adSlot.getClickUrl()).to.equal("clickUrl"); @@ -417,11 +422,13 @@ describe("Bling", () => { ); }); - it("reflects companionAdService props to adSlot", (done) => { + it("reflects companionAdService props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; const services = adSlot.getServices(); - const companionAdService = services.filter(service => !!service.setRefreshUnfilledSlots)[0]; + const companionAdService = services.filter( + service => !!service.setRefreshUnfilledSlots + )[0]; expect(companionAdService._enableSyncLoading).to.be.true; expect(companionAdService._refreshUnfilledSlots).to.be.true; done(); @@ -430,13 +437,16 @@ describe("Bling", () => { const instance = ReactTestUtils.renderIntoDocument( ); }); - it("reflects outOfPage props to adSlot", (done) => { + it("reflects outOfPage props to adSlot", done => { Bling.once(Events.RENDER, () => { const adSlot = instance.adSlot; expect(adSlot.getSizes()).to.eql([1, 1]); @@ -444,14 +454,11 @@ describe("Bling", () => { }); const instance = ReactTestUtils.renderIntoDocument( - + ); }); - it("renders static ad", (done) => { + it("renders static ad", done => { const content = ``; Bling.once(Events.RENDER, () => { @@ -469,8 +476,12 @@ describe("Bling", () => { ); }); - it("does not render ad when renderWhenViewable prop is set to true and the component is not in viewport", (done) => { - const isInViewport = sinon.stub(Bling._adManager, "isInViewport", () => false); + it("does not render ad when renderWhenViewable prop is set to true and the component is not in viewport", done => { + const isInViewport = sinon.stub( + Bling._adManager, + "isInViewport", + () => false + ); Bling.once(Events.SLOT_RENDER_ENDED, event => { expect(event.slot).to.equal(ads[1].adSlot); @@ -485,11 +496,9 @@ describe("Bling", () => { class Wrapper extends Component { static propTypes = { children: PropTypes.node - } + }; render() { - return ( -
{this.props.children}
- ); + return
{this.props.children}
; } } @@ -508,11 +517,18 @@ describe("Bling", () => { /> ); - const ads = ReactTestUtils.scryRenderedComponentsWithType(instance, Bling); + const ads = ReactTestUtils.scryRenderedComponentsWithType( + instance, + Bling + ); }); - it("renders ad as soon as the component gets in the viewport", (done) => { - const isInViewport = sinon.stub(Bling._adManager, "isInViewport", () => false); + it("renders ad as soon as the component gets in the viewport", done => { + const isInViewport = sinon.stub( + Bling._adManager, + "isInViewport", + () => false + ); Bling.once(Events.SLOT_RENDER_ENDED, event => { expect(event.slot).to.equal(ads[0].adSlot); @@ -530,11 +546,9 @@ describe("Bling", () => { class Wrapper extends Component { static propTypes = { children: PropTypes.node - } + }; render() { - return ( -
{this.props.children}
- ); + return
{this.props.children}
; } } @@ -547,10 +561,13 @@ describe("Bling", () => { /> ); - const ads = ReactTestUtils.scryRenderedComponentsWithType(instance, Bling); + const ads = ReactTestUtils.scryRenderedComponentsWithType( + instance, + Bling + ); }); - it("refreshes ad when refreshable prop changes", (done) => { + it("refreshes ad when refreshable prop changes", done => { let count = 0; Bling.syncCorrelator(); @@ -558,7 +575,7 @@ describe("Bling", () => { class Wrapper extends Component { state = { targeting: {prop: "val"} - } + }; onSlotRenderEnded = event => { if (count === 0) { expect(event.slot.getTargeting("prop")).to.equal("val"); @@ -570,7 +587,7 @@ describe("Bling", () => { expect(event.slot.getTargeting("prop")).to.equal("val2"); done(); } - } + }; render() { const {targeting} = this.state; return ( @@ -584,12 +601,10 @@ describe("Bling", () => { } } - ReactTestUtils.renderIntoDocument( - - ); + ReactTestUtils.renderIntoDocument(); }); - it("refreshes ad when refreshableProps changes w/o sync correlator", (done) => { + it("refreshes ad when refreshableProps changes w/o sync correlator", done => { let count = 0; Bling.syncCorrelator(false); @@ -597,7 +612,7 @@ describe("Bling", () => { class Wrapper extends Component { state = { targeting: {prop: "val"} - } + }; onSlotRenderEnded = event => { if (count === 0) { expect(event.slot.getTargeting("prop")).to.equal("val"); @@ -609,7 +624,7 @@ describe("Bling", () => { expect(event.slot.getTargeting("prop")).to.equal("val2"); done(); } - } + }; render() { const {targeting} = this.state; return ( @@ -623,12 +638,10 @@ describe("Bling", () => { } } - ReactTestUtils.renderIntoDocument( - - ); + ReactTestUtils.renderIntoDocument(); }); - it("re-renders ad when reRenderProps changes", (done) => { + it("re-renders ad when reRenderProps changes", done => { let count = 0; Bling.syncCorrelator(); @@ -636,19 +649,23 @@ describe("Bling", () => { class Wrapper extends Component { state = { adUnitPath: "/4595/nfl.test.open" - } + }; onSlotRenderEnded = event => { if (count === 0) { - expect(event.slot.getAdUnitPath()).to.equal("/4595/nfl.test.open"); + expect(event.slot.getAdUnitPath()).to.equal( + "/4595/nfl.test.open" + ); this.setState({ adUnitPath: "/4595/nfl.test.open/new" }); count++; } else { - expect(event.slot.getAdUnitPath()).to.equal("/4595/nfl.test.open/new"); + expect(event.slot.getAdUnitPath()).to.equal( + "/4595/nfl.test.open/new" + ); done(); } - } + }; render() { const {adUnitPath} = this.state; return ( @@ -661,17 +678,12 @@ describe("Bling", () => { } } - ReactTestUtils.renderIntoDocument( - - ); + ReactTestUtils.renderIntoDocument(); }); it("removes itself from registry when unmounted", () => { const instance = ReactTestUtils.renderIntoDocument( - + ); instance.componentWillUnmount(); expect(Bling._adManager.getMountedInstances()).to.have.length(0); diff --git a/test/createManager.spec.js b/test/createManager.spec.js index 23afdb3..623955f 100644 --- a/test/createManager.spec.js +++ b/test/createManager.spec.js @@ -1,4 +1,9 @@ -import {createManager, AdManager, pubadsAPI, APIToCallBeforeServiceEnabled} from "../src/createManager"; +import { + createManager, + AdManager, + pubadsAPI, + APIToCallBeforeServiceEnabled +} from "../src/createManager"; import Events from "../src/Events"; import {gptVersion} from "../src/utils/apiList"; import {createManagerTest} from "../src/utils/createManagerTest"; @@ -21,7 +26,7 @@ describe("createManager", () => { expect(adManager._syncCorrelator).to.be.true; }); - it("accepts pubads API before pubads is ready", (done) => { + it("accepts pubads API before pubads is ready", done => { const apiStubs = {}; pubadsAPI.forEach(method => { apiStubs[method] = sinon.stub(googletag.pubads(), method); @@ -58,7 +63,7 @@ describe("createManager", () => { adManager.render(); }); - it("accepts pubads API after pubads is ready", (done) => { + it("accepts pubads API after pubads is ready", done => { const apiStubs = {}; pubadsAPI.forEach(method => { apiStubs[method] = sinon.stub(googletag.pubads(), method); @@ -94,8 +99,9 @@ describe("createManager", () => { adManager.render(); }); - it("loads gpt", (done) => { - adManager.load("//www.googletagservices.com/tag/js/gpt.js") + it("loads gpt", done => { + adManager + .load("//www.googletagservices.com/tag/js/gpt.js") .then(result => { expect(result).to.be.an("object"); expect(adManager.isLoaded).to.be.true; @@ -104,9 +110,10 @@ describe("createManager", () => { .catch(done); }); - it("uses gpt when already exists", (done) => { + it("uses gpt when already exists", done => { window.googletag = googletag; - adManager.load("//www.googletagservices.com/tag/js/gpt-invalid.js") + adManager + .load("//www.googletagservices.com/tag/js/gpt-invalid.js") .then(() => { expect(adManager.isLoaded).to.be.true; done(); @@ -114,31 +121,30 @@ describe("createManager", () => { .catch(done); }); - it("handles missing url", (done) => { + it("handles missing url", done => { adManager = createManager(); - adManager.load("") - .catch(err => { - expect(err.message).to.equal("url is missing"); - done(); - }); + adManager.load("").catch(err => { + expect(err.message).to.equal("url is missing"); + done(); + }); }); - it("handles invalid url", (done) => { + it("handles invalid url", done => { adManager = createManager(); - adManager.load("//www.googletagservices.com/tag/js/gpt-invalid.js") + adManager + .load("//www.googletagservices.com/tag/js/gpt-invalid.js") .catch(err => { expect(err.message).to.equal("failed to load script"); done(); }); }); - it("handles gpt existence", (done) => { + it("handles gpt existence", done => { adManager = createManager(); - adManager.load("//www.google.com/jsapi") - .catch(err => { - expect(err.message).to.equal("window.googletag is not available"); - done(); - }); + adManager.load("//www.google.com/jsapi").catch(err => { + expect(err.message).to.equal("window.googletag is not available"); + done(); + }); }); it("returns gpt version", () => { @@ -146,9 +152,15 @@ describe("createManager", () => { }); it("maintains instance list", () => { - const _toggleListener = sinon.stub(AdManager.prototype, "_toggleListener"); + const _toggleListener = sinon.stub( + AdManager.prototype, + "_toggleListener" + ); const addMQListener = sinon.stub(AdManager.prototype, "addMQListener"); - const removeMQListener = sinon.stub(AdManager.prototype, "removeMQListener"); + const removeMQListener = sinon.stub( + AdManager.prototype, + "removeMQListener" + ); const instances = [{}, {}]; adManager.addInstance(instances[0]); @@ -185,9 +197,7 @@ describe("createManager", () => { // case 1 - missing `sizeMapping` let instance = { - props: { - - } + props: {} }; adManager.addInstance(instance); @@ -324,8 +334,12 @@ describe("createManager", () => { instanceRefresh.restore(); }); - it("debounces render", (done) => { - const enableServices = sinon.stub(googletag, "enableServices", googletag.enableServices); + it("debounces render", done => { + const enableServices = sinon.stub( + googletag, + "enableServices", + googletag.enableServices + ); adManager.once(Events.RENDER, () => { expect(enableServices.calledOnce).to.be.true; @@ -338,8 +352,12 @@ describe("createManager", () => { adManager.render(); }); - it("executes render once", (done) => { - const enableServices = sinon.stub(googletag, "enableServices", googletag.enableServices); + it("executes render once", done => { + const enableServices = sinon.stub( + googletag, + "enableServices", + googletag.enableServices + ); adManager.once(Events.RENDER, () => { expect(enableServices.calledOnce).to.be.true; @@ -358,18 +376,26 @@ describe("createManager", () => { adManager.render(); }); - it("manages initial render", (done) => { + it("manages initial render", done => { adManager.pubadsProxy({method: "disableInitialLoad"}); adManager.pubadsProxy({method: "collapseEmptyDivs", args: [false]}); - const disableInitialLoad = sinon.stub(googletag.pubads(), "disableInitialLoad"); - const collapseEmptyDivs = sinon.stub(googletag.pubads(), "collapseEmptyDivs"); + const disableInitialLoad = sinon.stub( + googletag.pubads(), + "disableInitialLoad" + ); + const collapseEmptyDivs = sinon.stub( + googletag.pubads(), + "collapseEmptyDivs" + ); const instance = { props: { sizeMapping: [{viewport: [0, 0], slot: [320, 50]}] }, - notInViewport() {return false;}, + notInViewport() { + return false; + }, defineSlot() {}, display() {}, adSlot: googletag.defineSlot("/", []) @@ -399,7 +425,7 @@ describe("createManager", () => { adManager.render(); }); - it("throttles foldCheck", (done) => { + it("throttles foldCheck", done => { const instance = { props: { sizeMapping: [{viewport: [0, 0], slot: [320, 50]}] @@ -422,8 +448,14 @@ describe("createManager", () => { const foldCheck = sinon.stub(instance, "foldCheck"); const foldCheck2 = sinon.stub(instance2, "foldCheck"); - const getRenderWhenViewable = sinon.spy(instance, "getRenderWhenViewable"); - const getRenderWhenViewable2 = sinon.spy(instance2, "getRenderWhenViewable"); + const getRenderWhenViewable = sinon.spy( + instance, + "getRenderWhenViewable" + ); + const getRenderWhenViewable2 = sinon.spy( + instance2, + "getRenderWhenViewable" + ); const managerFoldCheck = sinon.spy(adManager, "_foldCheck"); const timer = sinon.spy(adManager, "_getTimer"); @@ -446,7 +478,9 @@ describe("createManager", () => { setTimeout(() => { expect(managerFoldCheck.callCount).to.equal(5); expect(timer.calledTwice).to.be.true; - expect(timer.returnValues[1] - timer.returnValues[0]).to.be.above(19); // timer above 20ms timeout + expect(timer.returnValues[1] - timer.returnValues[0]).to.be.above( + 19 + ); // timer above 20ms timeout expect(timer.returnValues[0] - start).to.be.below(5); // should start ~immediately expect(foldCheck.calledTwice).to.be.true; expect(foldCheck2.notCalled).to.be.true; @@ -463,9 +497,12 @@ describe("createManager", () => { }, 100); }); - it("renders all ads", (done) => { + it("renders all ads", done => { googletag.apiReady = false; - const updateCorrelator = sinon.stub(AdManager.prototype, "updateCorrelator"); + const updateCorrelator = sinon.stub( + AdManager.prototype, + "updateCorrelator" + ); const instance = { props: {}, @@ -533,22 +570,28 @@ describe("createManager", () => { clear.restore(); }); - it("calls prop function for gpt event", (done) => { + it("calls prop function for gpt event", done => { const listeners = []; const slot = googletag.defineSlot("/", []); - const addEventListener = sinon.stub(googletag.pubads(), "addEventListener", (eventType, cb) => { - if (!listeners[eventType]) { - listeners[eventType] = []; + const addEventListener = sinon.stub( + googletag.pubads(), + "addEventListener", + (eventType, cb) => { + if (!listeners[eventType]) { + listeners[eventType] = []; + } + listeners[eventType].push(cb); } - listeners[eventType].push(cb); - }); + ); const instance = { props: { onSlotRenderEnded() {} }, adSlot: slot, - notInViewport() {return false;}, + notInViewport() { + return false; + }, defineSlot() {}, display() {} }; @@ -563,7 +606,10 @@ describe("createManager", () => { }); }); - const onSlotRenderEnded = sinon.stub(instance.props, "onSlotRenderEnded"); + const onSlotRenderEnded = sinon.stub( + instance.props, + "onSlotRenderEnded" + ); adManager.addInstance(instance); diff --git a/test/mockGPT.spec.js b/test/mockGPT.spec.js index 37a3078..ec625f9 100644 --- a/test/mockGPT.spec.js +++ b/test/mockGPT.spec.js @@ -28,7 +28,11 @@ describe("mockGPT", () => { .addSize([640, 480], "fluid"); expect(sizeMappingBuilder).to.equal(sizeMappingBuilder2); const mapping = sizeMappingBuilder2.build(); - expect(mapping).to.eql([[[1024, 768], [970, 250]], [[980, 690], [728, 90]], [[640, 480], "fluid"]]); + expect(mapping).to.eql([ + [[1024, 768], [970, 250]], + [[980, 690], [728, 90]], + [[640, 480], "fluid"] + ]); }); it("returns pubAdsService from pubads()", () => { @@ -38,7 +42,9 @@ describe("mockGPT", () => { it("returns companionAdsService from companionAds()", () => { const companionAdsService = gptMock.companionAds(); - expect(companionAdsService).to.be.an.instanceof(CompanionAdsServiceMock); + expect(companionAdsService).to.be.an.instanceof( + CompanionAdsServiceMock + ); }); it("returns contentService from content()", () => { From ffb99a7fc34a67904da9673bfd7a61149e9cfabb Mon Sep 17 00:00:00 2001 From: James Hush Date: Sun, 17 Sep 2017 16:14:57 -0700 Subject: [PATCH 3/5] fix lint --- examples/apps/responsive/app.js | 21 +++++++++++---------- examples/apps/routing/app.js | 14 +++++++------- src/createManager.js | 3 ++- test/Bling.spec.js | 2 +- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/examples/apps/responsive/app.js b/examples/apps/responsive/app.js index fdafff9..e7b3a89 100644 --- a/examples/apps/responsive/app.js +++ b/examples/apps/responsive/app.js @@ -1,3 +1,4 @@ +/* eslint-disable indent */ import React, {Component} from "react"; import Radium from "radium"; import {Bling as Gpt} from "react-gpt"; // eslint-disable-line import/no-unresolved @@ -46,17 +47,17 @@ class App extends Component { sizeMapping: this.state.sizeMapping[1].slot[1] === 50 ? [ - {viewport: [0, 0], slot: [1, 1]}, - {viewport: [340, 0], slot: [300, 250]}, - {viewport: [750, 200], slot: [728, 90]}, - {viewport: [1050, 200], slot: [1024, 120]} - ] + {viewport: [0, 0], slot: [1, 1]}, + {viewport: [340, 0], slot: [300, 250]}, + {viewport: [750, 200], slot: [728, 90]}, + {viewport: [1050, 200], slot: [1024, 120]} + ] : [ - {viewport: [0, 0], slot: [1, 1]}, - {viewport: [340, 0], slot: [320, 50]}, - {viewport: [750, 200], slot: [728, 90]}, - {viewport: [1050, 200], slot: [1024, 120]} - ] + {viewport: [0, 0], slot: [1, 1]}, + {viewport: [340, 0], slot: [320, 50]}, + {viewport: [750, 200], slot: [728, 90]}, + {viewport: [1050, 200], slot: [1024, 120]} + ] }; } this.setState(newState); diff --git a/examples/apps/routing/app.js b/examples/apps/routing/app.js index 1918a96..10efd74 100644 --- a/examples/apps/routing/app.js +++ b/examples/apps/routing/app.js @@ -61,13 +61,6 @@ class App extends Component { } class AppContainer extends Component { - routes = { - // eslint-disable-line react/sort-comp - "/Travel/Europe": {component: Home}, - "/Travel/Europe/France": {component: Page, params: {id: "France"}}, - "/Travel/Europe/Spain": {component: Page, params: {id: "Spain"}} - }; - state = { routeComponent: this.routes["/Travel/Europe"].component }; @@ -88,6 +81,13 @@ class AppContainer extends Component { history = createHistory(); + routes = { + // eslint-disable-line react/sort-comp + "/Travel/Europe": {component: Home}, + "/Travel/Europe/France": {component: Page, params: {id: "France"}}, + "/Travel/Europe/Spain": {component: Page, params: {id: "Spain"}} + }; + render() { return ( { }); it("accepts syncCorrelator", done => { - const render = sinon.stub(Bling._adManager, "render", function () { + const render = sinon.stub(Bling._adManager, "render", () => { expect(this._syncCorrelator).to.be.true; render.restore(); done(); From 929d93ab1969d9e42095fbd70e37555caf8bead2 Mon Sep 17 00:00:00 2001 From: James Hush Date: Sun, 17 Sep 2017 16:19:14 -0700 Subject: [PATCH 4/5] Fix lint --- examples/apps/infinite-scrolling/app.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/apps/infinite-scrolling/app.js b/examples/apps/infinite-scrolling/app.js index e628629..70cdf87 100644 --- a/examples/apps/infinite-scrolling/app.js +++ b/examples/apps/infinite-scrolling/app.js @@ -69,7 +69,6 @@ class App extends Component { test: "infinitescroll" }; while (contentCnt < page * 3) { - // eslint-disable-line no-unmodified-loop-condition contents.push( Date: Sun, 17 Sep 2017 16:33:09 -0700 Subject: [PATCH 5/5] Fix function name --- test/Bling.spec.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/Bling.spec.js b/test/Bling.spec.js index 4436d80..4b18316 100644 --- a/test/Bling.spec.js +++ b/test/Bling.spec.js @@ -65,11 +65,15 @@ describe("Bling", () => { }); it("accepts syncCorrelator", done => { - const render = sinon.stub(Bling._adManager, "render", () => { - expect(this._syncCorrelator).to.be.true; - render.restore(); - done(); - }); + const render = sinon.stub( + Bling._adManager, + "render", + function syncCorrelator() { + expect(this._syncCorrelator).to.be.true; + render.restore(); + done(); + } + ); Bling.syncCorrelator();