From 3d8a95766dfce5647907583941de9a4605c5cf2c Mon Sep 17 00:00:00 2001 From: William Johnson Date: Wed, 19 Sep 2018 16:12:32 -0700 Subject: [PATCH] feat: Begin update to Babel 7 (WIP) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 6aa8b6f02ff83cfb14eae2432f226f113929a50f Author: Henry Zhu Date: Mon Aug 27 18:09:21 2018 -0400 9.0.0 commit c7ee9aecd5c7129507bfe633f75f2575ec378d57 Author: Brian Ng Date: Mon Aug 27 17:04:26 2018 -0500 Bump to babel@7.0.0 🎉 (#676) commit 3ece54953f40c891055484a98380f7fe249cb899 Author: Ed Morley <501702+edmorley@users.noreply.github.com> Date: Thu Aug 23 06:23:06 2018 +0100 Docs: Make the default parserOptions more explicit (#673) In particular, previously the `.eslintrc` example implied that the default value for `codeFrame` was `false`, when in fact it is `true`: https://github.com/babel/babel-eslint/blob/v9.0.0-beta.3/lib/parse.js#L14 commit 0b3695163f7ecc76c80597e1c95f5c41ae7d903f Author: Alexandre Borela Date: Thu Aug 23 02:21:45 2018 -0300 Add logical assignment plugin (#674) Fix #672 commit 5856ff5e71bebb5015ba9e3417fc2100942cfdcb Author: Brian Ng Date: Tue Aug 21 15:18:02 2018 -0500 Bump some devDeps commit 45938d9a280186ea0eb9571e5797a13fb624b375 Author: Leo Yin Date: Wed Aug 22 04:00:17 2018 +0800 build(deps): upgrade @babel/* to 7.0.0-rc.2 (#668) commit bc9787530b95d6b1cd6e68f076f9f961b38cbfff Author: Henry Zhu Date: Thu Jul 12 09:50:58 2018 -0400 9.0.0-beta.3 commit 74c5d62cef5ec846de9d718897c61deacc702db4 Author: Henry Zhu Date: Thu Jul 12 09:50:30 2018 -0400 update lock commit 6a45632af9f91abf8c56521a63619c90fba2d7a1 Author: Mark Tse Date: Thu Jul 12 09:49:43 2018 -0400 chore - fixing eslint-scope to a safe version; resolves #656. (#657) commit e0119e088764efb9def4ce94b34825a0ecd287e6 Author: Brian Ng Date: Fri Jul 6 11:24:45 2018 -0500 9.0.0-beta.2 commit 198964bda08e2adf2abcf207c2d5bdc350824ae7 Merge: 8948d83 9b06e1f Author: RubĂ©n Norte Date: Fri Jul 6 17:20:52 2018 +0100 Merge pull request #645 from rubennorte/support-new-flow-syntax-in-scope-analysis Support new flow syntax in scope analysis commit 9b06e1fdaf7972d87c49af4ff977b1204916c80b Author: RubĂ©n Norte Date: Fri Jul 6 11:33:37 2018 +0100 Added failing test for variables used in type parameters commit 8948d8312662609cb7ef141664f59cd3fc929a22 Author: RubĂ©n Norte Date: Fri Jul 6 14:50:59 2018 +0100 Upgrade Babel to v7.0.0-beta.52 (#650) * Upgrade Babel to v7.0.0-beta.52 * Fixed failing test commit 4882b2906619545f24c215ed57cd4997ca8e7b92 Author: Brian Ng Date: Fri Jun 29 08:37:18 2018 -0500 9.0.0-beta.1 commit 15e8d6f5a9db9192a771137d960117f6b79f6315 Author: RubĂ©n Norte Date: Fri Jun 29 14:26:43 2018 +0100 Breaking: Upgraded Babel to 7.0.0-beta.51 (#642) * Upgraded Babel to 7.0.0-beta.51, with changes to decorators * Removed support for Node 4 and added it for Node 10 * nit: fix typo [skip ci] commit e8651042e31ae36bd909b90f7575b935639fe756 Author: Brian Ng Date: Sat Jun 23 08:20:40 2018 -0500 8.2.5 commit 10a402c764de9dfda2ae7b8848591caec0039150 Author: Brian Ng Date: Sat Jun 23 08:20:08 2018 -0500 Revert bump to babel 51 (#640) commit 2bd8508345bbfda5f8721de451ef6d41abd8ce8d Author: Brian Ng Date: Fri Jun 22 13:39:23 2018 -0500 8.2.4 commit 5881648e11117f11801f1cf36aa97d38e821fde0 Author: Brian Ng Date: Fri Jun 22 11:12:54 2018 -0500 Add test for template string with object with template string inside (#639) Closes https://github.com/babel/babel-eslint/pull/538. Fixes https://github.com/babel/babel-eslint/issues/537. Now that https://github.com/babel/babel-eslint/pull/610 has landed, I wanted to make sure this case was covered. commit 476426a41c637346b27a5b70d5301583ad39efb4 Author: Brian Ng Date: Fri Jun 22 11:03:15 2018 -0500 Support OptionalMemberExpression with scope too (#634) commit 92874d43990f8ca5005fc18f3d67eaa9a174f678 Author: Brian Ng Date: Fri Jun 15 16:39:58 2018 -0500 Drop node4 in travis commit d2ac299696b9293a5448b38310436bcdbaa155f6 Author: Brian Ng Date: Mon Jun 11 08:47:15 2018 -0500 Bump Babel deps commit e63962ddd340e3a412ee33d9f0ed443a88d3975f Author: Cristian PallarĂ©s Date: Wed Jun 6 00:18:13 2018 +0200 refactor: rename babylon to @babel/parser commit 873f02f058417cfdc30eb3889fc29d8ffe861888 Author: Brian Ng Date: Mon Jun 18 16:46:31 2018 -0500 Fix converting template types to handle nested templates (#610) Fixes https://github.com/babel/babel-eslint/issues/603 (and the fixture from https://github.com/babel/babel-eslint/issues/609 works). Reworks our code that converts the format of Babylon template tokens to be a bit more robust, especially with things like nested templates with arrows. (Adapted the logic from https://github.com/eslint/espree/blob/master/lib/token-translator.js) commit 74a3207f0a4315c60880b231c6b73cadb31af9fa Author: RubĂ©n Norte Date: Fri Jun 15 15:42:05 2018 +0100 Fix token types for experimental operators (#632) * Added failing tests * Recognized nullish coalescing, optional chaining and pipeline operators as Punctuator tokens commit e802577d57de1a5f1a4b65dba4f513ece9dfc480 Author: RubĂ©n Norte Date: Fri Jun 15 15:31:43 2018 +0100 Add support for the optional chaining operator (#630) commit ebc46e1528bf6d1eb7cd97735cb6a84931b4f282 Author: jmurretxactly <35241735+jmurretxactly@users.noreply.github.com> Date: Tue May 8 05:52:59 2018 -0600 don't require unpad per test fixture, fixes #572 (#618) commit 9641e4bca41ec52b160c5e1fdf64eeb4138453d7 Author: Ankur Oberoi Date: Fri Apr 13 09:26:41 2018 -0700 updates readme for latest eslint & babel-eslint (#607) [skip ci] commit aaeb46beeec64c0e8c26b40556fc48581e7fa733 Author: Henry Zhu Date: Fri Apr 13 11:25:03 2018 -0400 8.2.3 commit afc3c8743b7789b637ec8b50196f50675788da09 Author: Henry Zhu Date: Fri Apr 13 11:23:59 2018 -0400 lock to beta.44 commit 92202bedc638a8863ca2df45e66cb679870a17c1 Author: Bary Levi Date: Fri Apr 13 18:23:03 2018 +0300 Save babel beta packages as exact versions (#606) [skip ci] commit 9a6d66305e2d81f5674b5f227b0d3f1dcb0a3106 Author: Daniel Tschinder Date: Tue Feb 20 11:57:07 2018 +0100 8.2.2 commit 51afa9e34642b83d4f43f657d44e329662bd9c75 Author: Daniel Tschinder Date: Tue Feb 20 11:56:40 2018 +0100 Allow newer versions of babel commit 7928722e4d6dea45576ca9196a8879421a362567 Author: Daniel Tschinder Date: Tue Feb 20 11:54:09 2018 +0100 Update dependencies commit f958995e712fe8ee4da6f1b8d1d3577906b2ad58 Author: Daniel Tschinder Date: Tue Feb 20 11:49:19 2018 +0100 chore(package): update lint-staged to version 6.1.1 (#592) Closes #539 commit 29b12abc4427b34e21f872c3e5302984a7022b42 Author: Brian Ng Date: Thu Feb 15 21:39:42 2018 -0600 Bump deps (#591) commit 236adb8e49cc20252c092d0e965aacebba1a7a7d Author: Toru Nagashima Date: Wed Jan 17 15:10:55 2018 +0900 Fix: wrong token type of ! and ~ (fixes #576) (#577) commit bf27f6021e3a3661589bfa1e314f45876edeb20b Author: Henry Zhu Date: Mon Jan 8 19:15:40 2018 -0500 8.2.1 commit d96ce555904bc7d12841fa8fb6f18da70ba23947 Author: Henry Zhu Date: Mon Jan 8 19:15:22 2018 -0500 fix export change (#571) commit ef276702e73a74d284fcafa71e3da2992c11c5a3 Author: Kai Cataldo Date: Mon Jan 8 18:06:57 2018 -0500 8.2.0 commit eba5920e29ce8be62d517510653f1391b6e98b01 Author: Henry Zhu Date: Mon Jan 8 17:46:57 2018 -0500 Add other parser plugins, update yarn.lock (#569) commit e201fb470794ee2153bc6504054e9798add2a19b Author: Kai Cataldo Date: Mon Jan 8 17:45:24 2018 -0500 Make 2018 the default ecmaVersion for rules relying on parserOptions (#556) commit 1dedd1bf282ba7df77b95c8163af88ad0dc5e378 Author: jony89 Date: Tue Jan 9 00:40:11 2018 +0200 update babel packages (#565) * update babel packages There is some critical bug fixes in version babylon#7.0.0-beta.33 regard `async` - `await` syntax which is needed pretty immediately :) * remove test 42 (test for import type *) `import type *` is invalid, since the namespace can't be a type commit 36bf8b450d822ab78a1093d5361a34e7052cb375 Author: Toru Nagashima Date: Tue Dec 26 10:59:19 2017 +0900 8.1.2 commit 5aaf0e1be5fdfc05fae39015a5bebcc7cf0723b7 Author: Toru Nagashima Date: Tue Dec 26 10:50:13 2017 +0900 Fix: add Literal type to visitorKeys (#562) * Fix: add Literal type to visitorKeys * Fix: use ./visitor-keys commit bf9092ab6c3bccf5c9d4cbc91de59d7edfe3641e Author: Toru Nagashima Date: Tue Dec 26 10:49:36 2017 +0900 Fix: ignore eval (fixes #560) (#561) commit d84b236467474940c7794135d7b10866d54374c5 Author: Toru Nagashima Date: Mon Dec 25 15:57:19 2017 +0900 8.1.1 commit e4bed5a4d5757b44d145d683a2f5aaa28a4f96ef Author: Teddy Katz Date: Mon Dec 25 01:52:36 2017 -0500 Fix: Prevent parseForESLint() behavior from changing after parse() is called (fixes #558)(#559) * Prevent parseForESLint() behavior from changing after parse() is called (fixes https://github.com/babel/babel-eslint/issues/558, fixes https://github.com/eslint/eslint/issues/9767) * Avoid using the enhanced referencer after monkeypatching * Chore: add test for #558 * Pass correct scope analyzer options * fix escope patch and improve tests * remove process.exit(1) commit 893a5e308e237c77b733224aeeaece53df6dd326 Author: Teddy Katz Date: Sun Dec 24 02:02:44 2017 -0500 8.1.0 commit bba9d00dec48e0d0fea4160d7f53433ab605c4d4 Author: Teddy Katz Date: Sun Dec 24 02:00:29 2017 -0500 Re-add parseNoPatch function (accidentally removed) (#557) commit dbc6546e0713a83c3362bb28d2d4604dbbebcf19 Author: Toru Nagashima Date: Sun Dec 24 15:42:17 2017 +0900 Use new scopeManager/visitorKeys APIs (#542) (fixes https://github.com/eslint/eslint/issues/9762) commit 1f220c28cf32f2a2f4b6e5963247b21f4ad5edfb Author: Logan Smyth Date: Fri Dec 1 10:06:40 2017 -0800 8.0.3 commit cf5ab038988b622f5c3f951533081418da9b0602 Author: Logan Smyth Date: Fri Dec 1 10:06:24 2017 -0800 Fix mocha command path. commit 0609da87289c05c83823ec768d8986c11002d821 Author: Logan Smyth Date: Fri Dec 1 10:05:34 2017 -0800 Lock down dependency versions. commit a0fbd503d89fbaddca0aea0bcd277812df17a97d Author: Henry Zhu Date: Mon Nov 6 15:00:41 2017 -0500 8.0.2 commit 2004b913c7abef8d21cebca7f3ae39a9deaee767 Author: Henry Zhu Date: Mon Nov 6 14:57:56 2017 -0500 require correct deps commit fa56d21f3e9acd023fc4610ca36666e3a3078bbb Author: Henry Zhu Date: Mon Nov 6 12:51:19 2017 -0500 Always use unpad (#535) commit 295091df9146a725abd69e43c7863aa4741853c3 Author: Henry Zhu Date: Mon Nov 6 12:47:47 2017 -0500 Allow ^ version for babel dependencies (#534) commit d3b8519d935dbc4e6bf538548c0002afde916603 Author: greenkeeper[bot] Date: Mon Nov 6 12:25:35 2017 -0500 fix(package): update babylon to version 7.0.0-beta.31 (#533) commit 54ab4ac772364b2742aafb9a2549d81a57bd42a5 Author: Henry Zhu Date: Tue Sep 26 16:18:43 2017 -0400 8.0.1 commit c1a78824688425f12687e79124fc847d484034eb Author: Clement Hoang Date: Tue Oct 31 11:50:35 2017 -0700 Update README.md support (#531) [skip ci] #linting channel is now archived in babel slack. commit 51100c960ae151989d4eea1ec52d2ef5a2f5a2de Author: greenkeeper[bot] Date: Wed Oct 11 14:14:29 2017 +0200 chore(package): update mocha to version 4.0.0 (#524) commit 5742b713746accacfcf4dfae1cb67bcefcc6d43a Author: Jordan Gensler Date: Tue Sep 26 13:17:44 2017 -0700 Adding optionalCatchBinding to plugins. (#521) commit 905887c4fe4e5f4b56e34acb526e80aad83880cb Author: Henry Zhu Date: Tue Sep 12 09:44:23 2017 -0400 8.0.0 commit 49493e496de2072e94229a02605637e51152eeef Author: Henry Zhu Date: Tue Sep 12 09:42:30 2017 -0400 update to beta.0 commit 42d0c5b20cf65ae4100d06aa8dcaf372723f378d Author: Daniel Tschinder Date: Wed Aug 2 14:37:01 2017 +0200 Remove already fixed workaround (#508) commit 25bd2084b5695d8fef0f205ebba75954bd773f05 Author: Henry Zhu Date: Wed Jul 26 16:19:29 2017 -0400 8.0.0-alpha.17 commit 1468905a8602e3e8208126173c94e9621600b94d Author: Henry Zhu Date: Wed Jul 26 16:18:45 2017 -0400 alpha.17 commit 57c133ef7f2774e10e90262c9f7c3324ff1e4545 Author: Henry Zhu Date: Thu Jul 13 13:01:31 2017 -0400 8.0.0-alpha.15 commit 1e4116247e01bf655f0b64aab960828d203ace8f Author: Henry Zhu Date: Thu Jul 13 12:58:45 2017 -0400 update (#504) commit c31b5772a0a3705fd5424a2918367d9a2be38f82 Author: Evan Brodie Date: Sun Jul 9 21:03:59 2017 -0400 Readme update usage section (#501) [skip ci] * Updates README: Consolidates versioning table Basically a revert of 52b4a13. It is easier to read a single table instead of two locations in the README for the version compatabilities between ESLint and babel-eslint * Updates README: Add yarn command for installation * [skip ci] commit c2626f9d2569eb63e9481330aaeaf110b7d23b5f Author: greenkeeper[bot] Date: Sun Jun 25 08:30:29 2017 -0700 Update eslint to the latest version 🚀 (#500) * chore(package): update eslint to version 4.1.0 * escope -> eslint-scope * Fix linting commit 3c6b2de7f99e023ae0577a9b5082c4aad68fce02 Author: greenkeeper[bot] Date: Thu Jun 22 13:18:47 2017 -0700 chore(package): update husky to version 0.14.0 (#498) commit e052d5a8a4e0104dc6f87a4577bf0c1badddc332 Author: Kevin MĂ„rtensson Date: Tue Jun 20 23:49:46 2017 +0200 Update install instructions to use latest stable release (#497) [skip ci] commit 8e3e088cf2583417cf0bcc3268088e348cbc533f Author: Henry Zhu Date: Sun Jun 18 18:33:40 2017 -0400 8.0.0-alpha.13 commit f757e22df00db8b2cff668a314f611dcd6a5aff3 Merge: 37f9242 5736be6 Author: Henry Zhu Date: Sun Jun 18 18:30:59 2017 -0400 Merge pull request #493 from danez/regression-test Test for babylon regression commit 5736be6b7ea08f8f473c9188f4deff567fde516c Author: Daniel Tschinder Date: Sun Jun 18 23:12:08 2017 +0200 Update babylon commit 37f9242fc6979fdd90e22dd26ef5b1ca7905b486 Author: Brian Ng Date: Sat Jun 17 14:14:42 2017 -0500 Add Prettier (#491) commit d0c3223932d4a10d39a15642ea3f4de6821891cc Author: Daniel Tschinder Date: Sat Jun 17 21:12:07 2017 +0200 Test for babylon regression commit 945f00a2e03b5a4cf2967b2cc0fa20dfc9856192 Author: Henry Zhu Date: Fri Jun 16 16:56:32 2017 -0400 8.0.0-alpha.12 commit 39b4a6ad30039ee67ed7fac7f865060713a918ca Author: Daniel Tschinder Date: Thu Jun 15 23:03:02 2017 +0200 Use babylon estree and ranges (#489) commit 1aedb95ef40c5d51223831dfd8be65efbdc27e09 Author: Mark Banner Date: Thu Jun 8 17:23:08 2017 +0100 Fix: allow options to be optional when monkey patching escope.analyze (fixes #470). (#484) commit a8003c0ab25eb1877c1f10014e1951bb49cb467b Author: Reyad Attiyat Date: Tue Jun 6 20:38:49 2017 -0500 Use Node 8 and drop Node 5 from travis (#483) * Use Node 8 and drop Node 5 from travis * switch the order [skip ci] commit c66ec51878e43d05d01fa8151525654cd35eb094 Author: Reyad Attiyat Date: Tue Jun 6 20:37:57 2017 -0500 Update to Babylon 7 (fixes #481) (#482) * Update to Babylon 7 (fixes #481) * Pin dependencies to alpha version * fix deprecation, add other plugins * oops * Update index.js * Add tests for private class properties with rules no-undef no-unused-vars commit 54ed517d2ecb3afb93ac338c019f8dff224918c2 Author: Reyad Attiyat Date: Mon May 29 20:41:14 2017 -0500 Fix: Convert RegExpLieteral value to RegExp object (fixes #477) (#478) commit 94bb5a1d36c5624fb612de2dd704ffa586d38845 Author: Sebastian McKenzie Date: Fri Apr 21 22:14:19 2017 +0100 7.2.3 commit dfaff04bad37823842aec19fe131f75a069b7799 Author: Andres Suarez Date: Fri Apr 21 11:48:52 2017 -0400 Fix flow type spread handling (#465) commit f59d2009652e14acf1231a1268a8324cf046514e Author: Henry Zhu Date: Wed Apr 12 12:07:05 2017 -0400 7.2.2 commit 862200945ee2860cbd00e770280dda3d56b055eb Author: Vitor Balocco Date: Wed Apr 12 17:59:23 2017 +0200 Fix: use eslint-scope instead of escope if present (#461) commit 0f611b83311d1b44912fc1dd0fc2cd88a0ae9d0c Author: Andres Suarez Date: Thu Mar 30 13:49:51 2017 -0400 Separate finding peer deps from monkeypatching (#460) commit 1201e12800bbb4badb55620100bc871193572784 Author: Andres Suarez Date: Sat Mar 25 19:36:10 2017 -0400 Remove unused .gitmodules (#457) commit a750684e477ab72d4a62822a965c7c8f909aa37d Author: Andres Suarez Date: Sat Mar 25 19:32:05 2017 -0400 Use dedent for unpadding (#456) commit cdb92fe60d25980a8e9c66acc8c32d81de01aca1 Merge: 21dac73 ec14787 Author: Henry Zhu Date: Sat Mar 25 19:15:23 2017 -0400 Merge pull request #455 from babel/babylon-to-espree-tidy Tidy up babylon-to-espree commit ec14787172795c81fa2c544d100727d897521ebe Author: Andres Suarez Date: Sat Mar 25 18:03:17 2017 -0400 Enable strict mode in all of babylon-to-espree commit 6c5beec589cbf343c528f1a78efe42874d7c83d4 Author: Andres Suarez Date: Sat Mar 25 18:01:13 2017 -0400 Move ast convert steps to babylon-to-espree commit d2ce7894bc864ed46c0c91eeef60af0a91886d8a Author: Andres Suarez Date: Sat Mar 25 17:42:51 2017 -0400 Use for-loop for template literal conversion commit 539af05bae280d15059d783b59d77b8814a48084 Author: Andres Suarez Date: Sat Mar 25 17:36:20 2017 -0400 Only iterate over tokens once commit 06c3a31b96cb890fe3544931f60f021e5186f62a Author: Andres Suarez Date: Sat Mar 25 17:28:01 2017 -0400 Inline fixDirectives and use for-loop commit 5d32ad0d56c8769aeea680cc7a4aafa1df4c2a04 Author: Andres Suarez Date: Sat Mar 25 17:07:41 2017 -0400 Consolidate versions of "convertComments" commit 2541fc93b9bacf179661d8e27e040afe011e2926 Author: Andres Suarez Date: Sat Mar 25 00:18:57 2017 -0400 toAst pass "source" in state instead of keeping in scope commit 21dac7391470b8eb24a07cd11c527293df3c7a23 Author: Andres Suarez Date: Thu Mar 23 15:46:48 2017 -0400 Add type parameter scope tests (#454) commit 3cda62ee066c741b766526155dcdb98db1a2a2d5 Author: Henry Zhu Date: Thu Mar 23 14:03:23 2017 -0400 7.2.1 commit 5626de120d866f7c99df78566af2514a1674199c Author: Andres Suarez Date: Thu Mar 23 14:02:24 2017 -0400 Remove left over eslint 2 estraverse code (#452) This was missed in #361 commit b5fb53b718d15e95252197b5f30787ca807d069a Author: Andres Suarez Date: Thu Mar 23 12:49:19 2017 -0400 Fix type param and interface declaration scoping (#449) commit f1cee0f23193fb222270d69986313a3bd2453ba6 Author: Andres Suarez Date: Wed Mar 22 22:35:31 2017 -0400 Remove lodash dependency (#450) commit eb05812e8d3d7e203fa555f42288ff3e0ed8bd5f Author: Andres Suarez Date: Wed Mar 22 22:34:13 2017 -0400 Format non-regression errors for legibility (#451) commit 7972a052e72f44802d0860c5491abe80158a7e43 Author: LuĂ­s Couto Date: Tue Mar 21 00:11:30 2017 +0000 Update README.md with codeFrame option (#448) commit 4db4db54d18d5d2833ed9a02c5e4cde20474e995 Author: Henry Zhu Date: Mon Mar 20 17:53:26 2017 -0400 7.2.0 commit 44994124941b1e50772ee2661cf5d8c910105308 Author: wtgtybhertgeghgtwtg Date: Mon Mar 20 14:50:09 2017 -0700 Use `lodash` instead of `lodash.pickby`. (#435) commit a2c3b30e6a86a39e0cb44a95a1990ca54415bd1f Author: Alex Rattray Date: Mon Mar 20 14:46:07 2017 -0700 [flow] Process polymorphic type bounds on functions (#444) commit 515adefc54bb6097ad2fdc076614606ad0ae4262 Author: LuĂ­s Couto Date: Mon Mar 20 21:45:11 2017 +0000 Add option to disable code frame. (#446) * Add option to disable code hightlight. * Rename codeHighlight with codeFrame * Add codeFrame tests * Remove colors from test assertions commit ce66e73749dc33520013399f8585cfe00e755c09 Merge: bdeb86f b49ab20 Author: Henry Zhu Date: Mon Mar 20 11:44:33 2017 -0400 Merge pull request #447 from kaicataldo/clean-up-eslint Chore: Clean up and upgrades commit b49ab204a2091861f9645ce95e019ee88a9b08eb Author: Kai Cataldo Date: Mon Mar 20 10:33:14 2017 -0400 Updates ESLint version/remove unnecessary config commit 702d6b8279549df555451e4fe64173eb4b803327 Author: Kai Cataldo Date: Mon Mar 20 10:27:28 2017 -0400 Remove broken ESLint tests commit 6b4c4ca36a9d1930468fb105c1d88fa4d908c315 Author: Kai Cataldo Date: Sat Mar 11 22:15:47 2017 -0500 Upgrade outdated dependencies --- .eslintrc.js | 6 +- .prettierignore | 1 + .prettierrc | 3 + .travis.yml | 4 +- Makefile | 2 +- README.md | 62 +- babylon-to-espree/convertTemplateType.js | 95 - babylon-to-espree/toAST.js | 272 -- babylon-to-espree/toToken.js | 72 - babylon-to-espree/toTokens.js | 19 - lib/analyze-scope.js | 343 +++ .../babylon-to-espree}/attachComments.js | 2 +- lib/babylon-to-espree/convertComments.js | 17 + lib/babylon-to-espree/convertTemplateType.js | 92 + .../babylon-to-espree}/index.js | 14 +- lib/babylon-to-espree/toAST.js | 118 + lib/babylon-to-espree/toToken.js | 84 + lib/babylon-to-espree/toTokens.js | 10 + lib/index.js | 22 + lib/parse-with-patch.js | 9 + lib/parse-with-scope.js | 12 + lib/parse.js | 93 + index.js => lib/patch-eslint-scope.js | 272 +- lib/visitor-keys.js | 15 + package.json | 53 +- test/babel-eslint.js | 481 ++-- test/fixtures/assert-implements-ast.js | 41 + .../eslint-plugin-import/.eslintrc.yml | 11 + test/fixtures/eslint-plugin-import/a.js | 1 + test/fixtures/eslint-plugin-import/b.js | 1 + test/fixtures/eslint-plugin-import/c.js | 4 + test/fixtures/preprocess-to-patch.js | 5 + test/fixtures/use-eslint-old.js | 12 + test/integration.js | 319 +-- test/non-regression.js | 1686 ++++++------ test/z_parser-for-eslint-after-patched.js | 45 + yarn.lock | 2271 +++++++++++++---- 37 files changed, 4038 insertions(+), 2531 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc delete mode 100644 babylon-to-espree/convertTemplateType.js delete mode 100644 babylon-to-espree/toAST.js delete mode 100644 babylon-to-espree/toToken.js delete mode 100644 babylon-to-espree/toTokens.js create mode 100644 lib/analyze-scope.js rename {babylon-to-espree => lib/babylon-to-espree}/attachComments.js (97%) create mode 100644 lib/babylon-to-espree/convertComments.js create mode 100644 lib/babylon-to-espree/convertTemplateType.js rename {babylon-to-espree => lib/babylon-to-espree}/index.js (58%) create mode 100644 lib/babylon-to-espree/toAST.js create mode 100644 lib/babylon-to-espree/toToken.js create mode 100644 lib/babylon-to-espree/toTokens.js create mode 100644 lib/index.js create mode 100644 lib/parse-with-patch.js create mode 100644 lib/parse-with-scope.js create mode 100644 lib/parse.js rename index.js => lib/patch-eslint-scope.js (59%) create mode 100644 lib/visitor-keys.js create mode 100644 test/fixtures/assert-implements-ast.js create mode 100644 test/fixtures/eslint-plugin-import/.eslintrc.yml create mode 100644 test/fixtures/eslint-plugin-import/a.js create mode 100644 test/fixtures/eslint-plugin-import/b.js create mode 100644 test/fixtures/eslint-plugin-import/c.js create mode 100644 test/fixtures/preprocess-to-patch.js create mode 100644 test/fixtures/use-eslint-old.js create mode 100644 test/z_parser-for-eslint-after-patched.js diff --git a/.eslintrc.js b/.eslintrc.js index 20f31f1e..64dc12e6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,9 +1,13 @@ module.exports = { root: true, extends: "babel", + "plugins": [ + "prettier" + ], rules: { "no-var": 0, - "max-len": 0 + "max-len": 0, + "prettier/prettier": "error", }, env: { node: true, diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..a6c57f5f --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..88a0e9a2 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "trailingComma": "es5" + } \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 7f84d147..218432b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ sudo: false language: node_js node_js: - - "4" - - "5" + - "10" + - "8" - "6" matrix: diff --git a/Makefile b/Makefile index 53bfdbc7..d35bcfa0 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: publish-patch publish-patch: - mocha + ./node_modules/.bin/mocha npm version patch npm publish git push --follow-tags diff --git a/README.md b/README.md index 3a0ecdff..19c117f8 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,28 @@ -# @oigroup/lightscript-eslint +# @lightscript/eslint -> `@oigroup/lightscript-eslint` is most frequently tested with `eslint@^4.0.0`. -> It SHOULD be backwards-compatible with `eslint@^3.0.0` as well. - -`@oigroup/lightscript-eslint` is a fork of `babel-eslint` that parses code with -`@oigroup/babylon-lightscript` and `@oigroup/babel-plugin-lightscript`. +`@lightscript/eslint` is a fork of `babel-eslint` that parses LightScript code. Any file that includes `.lsc` or `.lsx` in the filename (including, eg, `.lsc.js`) will be processed with the LightScript compiler; all others will be processed exactly as in `babel-eslint`. -To use, just `npm install --save-dev @oigroup/lightscript-eslint` -and add `parser: "@oigroup/lightscript-eslint"` to your `.eslintrc`. +To use, just `npm install --save-dev @lightscript/eslint` +and add `parser: "@lightscript/eslint"` to your `.eslintrc`. + +## Usage + +### Supported ESLint versions + +ESLint | babel-eslint +------------ | ------------- +4.x | >= 6.x +3.x | >= 6.x +2.x | >= 6.x +1.x | >= 5.x + +### Example Configuration -Example configuration (with React): +**.eslintrc** ```json { @@ -39,6 +48,25 @@ When running `eslint` from the CLI, you must tell it to process LightScript file $ eslint --ext .js,.lsc src ``` +### Options + +> Note that the `ecmaFeatures` config property may still be required for ESLint to work properly with features not in ECMAScript 5 by default. Examples are `globalReturn` and `modules`). + +- `sourceType` can be set to `'module'`(default) or `'script'` if your code isn't using ECMAScript modules. +- `allowImportExportEverywhere` (default `false`) can be set to `true` to allow import and export declarations to appear anywhere a statement is allowed if your build environment supports that. Otherwise import and export declarations can only appear at a program's top level. +- `codeFrame` (default `true`) can be set to `false` to disable the code frame in the reporter. This is useful since some eslint formatters don't play well with it. + +```json +{ + "parser": "babel-eslint", + "parserOptions": { + "sourceType": "module", + "allowImportExportEverywhere": false, + "codeFrame": true + } +} +``` + ### Live Linting #### Visual Studio Code @@ -50,7 +78,21 @@ $ eslint --ext .js,.lsc src "eslint.validate": ["javascript", "javascriptreact", "lightscript"] ``` -### Broken Rules +### Known Issues + +Flow: +> Check out [eslint-plugin-flowtype](https://github.com/gajus/eslint-plugin-flowtype): An `eslint` plugin that makes flow type annotations global variables and marks declarations as used. Solves the problem of false positives with `no-undef` and `no-unused-vars`. +- `no-undef` for global flow types: `ReactElement`, `ReactClass` [#130](https://github.com/babel/babel-eslint/issues/130#issuecomment-111215076) + - Workaround: define types as globals in `.eslintrc` or define types and import them `import type ReactElement from './types'` +- `no-unused-vars/no-undef` with Flow declarations (`declare module A {}`) [#132](https://github.com/babel/babel-eslint/issues/132#issuecomment-112815926) + +Modules/strict mode +- `no-unused-vars: [2, {vars: local}]` [#136](https://github.com/babel/babel-eslint/issues/136) + +Please check out [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) for React/JSX issues +- `no-unused-vars` with jsx + +Please check out [eslint-plugin-babel](https://github.com/babel/eslint-plugin-babel) for other issues The following lint rules are either buggy, broken, or do not make sense in the context of LightScript. They are disabled at the code level and will not run even if you enable them in your configuration. diff --git a/babylon-to-espree/convertTemplateType.js b/babylon-to-espree/convertTemplateType.js deleted file mode 100644 index 8b647c39..00000000 --- a/babylon-to-espree/convertTemplateType.js +++ /dev/null @@ -1,95 +0,0 @@ -"use strict"; - -module.exports = function (tokens, tt) { - var startingToken = 0; - var currentToken = 0; - var numBraces = 0; // track use of {} - var numBackQuotes = 0; // track number of nested templates - - function isBackQuote(token) { - return tokens[token].type === tt.backQuote; - } - - function isTemplateStarter(token) { - return isBackQuote(token) || - // only can be a template starter when in a template already - tokens[token].type === tt.braceR && numBackQuotes > 0; - } - - function isTemplateEnder(token) { - return isBackQuote(token) || - tokens[token].type === tt.dollarBraceL; - } - - // append the values between start and end - function createTemplateValue(start, end) { - var value = ""; - while (start <= end) { - if (tokens[start].value) { - value += tokens[start].value; - } else if (tokens[start].type !== tt.template) { - value += tokens[start].type.label; - } - start++; - } - return value; - } - - // create Template token - function replaceWithTemplateType(start, end) { - var templateToken = { - type: "Template", - value: createTemplateValue(start, end), - start: tokens[start].start, - end: tokens[end].end, - loc: { - start: tokens[start].loc.start, - end: tokens[end].loc.end - } - }; - - // put new token in place of old tokens - tokens.splice(start, end - start + 1, templateToken); - } - - function trackNumBraces(token) { - if (tokens[token].type === tt.braceL) { - numBraces++; - } else if (tokens[token].type === tt.braceR) { - numBraces--; - } - } - - while (startingToken < tokens.length) { - // template start: check if ` or } - if (isTemplateStarter(startingToken) && numBraces === 0) { - if (isBackQuote(startingToken)) { - numBackQuotes++; - } - - currentToken = startingToken + 1; - - // check if token after template start is "template" - if (currentToken >= tokens.length - 1 || tokens[currentToken].type !== tt.template) { - break; - } - - // template end: find ` or ${ - while (!isTemplateEnder(currentToken)) { - if (currentToken >= tokens.length - 1) { - break; - } - currentToken++; - } - - if (isBackQuote(currentToken)) { - numBackQuotes--; - } - // template start and end found: create new token - replaceWithTemplateType(startingToken, currentToken); - } else if (numBackQuotes > 0) { - trackNumBraces(startingToken); - } - startingToken++; - } -}; diff --git a/babylon-to-espree/toAST.js b/babylon-to-espree/toAST.js deleted file mode 100644 index 235cf261..00000000 --- a/babylon-to-espree/toAST.js +++ /dev/null @@ -1,272 +0,0 @@ -"use strict"; - -var convertComments = require("./convertComments"); -var cloneDeep = require("lodash/cloneDeep"); - -module.exports = function (ast, traverse, code) { - var state = { source: code }; - ast.range = [ast.start, ast.end]; - traverse(ast, astTransformVisitor, null, state); -}; - -function changeToLiteral(node, state) { - node.type = "Literal"; - if (!node.raw) { - if (node.extra && node.extra.raw) { - node.raw = node.extra.raw; - } else { - node.raw = state.source.slice(node.start, node.end); - } - } -} - -function isForInOfShorthand(node) { - return ( - (node.type === "ForOfStatement" || node.type === "ForInStatement") && - node.left.type === "Identifier" - ); -} - -function transformAutoConstFor(node) { - var id = cloneDeep(node.left); - var decl = cloneDeep(node.left); - decl.type = "VariableDeclarator"; - decl.id = id; - decl.init = null; - - node.left.declarations = [decl]; - node.left.type = "VariableDeclaration"; - node.left.kind = "const"; - delete node.left.name; -} - -var astTransformVisitor = { - enter (path) { - var node = path.node; - if (node.start == null || node.end == null || node.loc == null) { - //console.log("Unmapped node of type", node.type, " at ", path.getPathLocation()); - node.start = 0; node.end = 1; - node.loc = { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } }; - } - - node.range = [node.start, node.end]; - node = path.node; - - // auto-const for for-in/for-of - if (isForInOfShorthand(node)) { - transformAutoConstFor(node); - } - - // private var to track original node type - node._babelType = node.type; - - if (node.innerComments) { - node.trailingComments = node.innerComments; - delete node.innerComments; - } - - if (node.trailingComments) { - convertComments(node.trailingComments); - } - - if (node.leadingComments) { - convertComments(node.leadingComments); - } - - // make '_paths' non-enumerable (babel-eslint #200) - Object.defineProperty(node, "_paths", { value: node._paths, writable: true }); - }, - exit (path, state) { - var node = path.node; - - // fixDirectives - if (path.isFunction() || path.isProgram()) { - var directivesContainer = node; - var body = node.body; - if (node.type !== "Program") { - directivesContainer = body; - body = body.body; - } - if (directivesContainer.directives) { - for (var i = directivesContainer.directives.length - 1; i >= 0; i--) { - var directive = directivesContainer.directives[i]; - directive.type = "ExpressionStatement"; - directive.expression = directive.value; - delete directive.value; - directive.expression.type = "Literal"; - changeToLiteral(directive.expression, state); - body.unshift(directive); - } - delete directivesContainer.directives; - } - } - - if (path.isJSXText()) { - node.type = "Literal"; - node.raw = node.value; - } - - if (path.isNumericLiteral() || - path.isStringLiteral()) { - changeToLiteral(node, state); - } - - if (path.isBooleanLiteral()) { - node.type = "Literal"; - node.raw = String(node.value); - } - - if (path.isNullLiteral()) { - node.type = "Literal"; - node.raw = "null"; - node.value = null; - } - - if (path.isRegExpLiteral()) { - node.type = "Literal"; - node.raw = node.extra.raw; - try { - node.value = new RegExp(node.pattern, node.flags); - } catch (err) { - node.value = null; - } - node.regex = { - pattern: node.pattern, - flags: node.flags - }; - delete node.extra; - delete node.pattern; - delete node.flags; - } - - if (path.isObjectProperty()) { - node.type = "Property"; - node.kind = "init"; - } - - if (path.isClassMethod() || path.isObjectMethod()) { - var code = state.source.slice(node.key.end, node.body.start); - var offset = code.indexOf("("); - - node.value = { - type: "FunctionExpression", - id: node.id, - params: node.params, - body: node.body, - async: node.async, - generator: node.generator, - expression: node.expression, - defaults: [], // basic support - TODO: remove (old esprima) - loc: { - start: { - line: node.key.loc.start.line, - column: node.key.loc.end.column + offset // a[() {] - }, - end: node.body.loc.end - } - }; - // [asdf]() { - node.value.range = [node.key.end + offset, node.body.end]; - - node.value.start = node.value.range && node.value.range[0] || node.value.loc.start.column; - node.value.end = node.value.range && node.value.range[1] || node.value.loc.end.column; - - if (node.returnType) { - node.value.returnType = node.returnType; - } - - if (node.typeParameters) { - node.value.typeParameters = node.typeParameters; - } - - if (path.isClassMethod()) { - node.type = "MethodDefinition"; - } - - if (path.isObjectMethod()) { - node.type = "Property"; - if (node.kind === "method") { - node.kind = "init"; - } - } - - delete node.body; - delete node.id; - delete node.async; - delete node.generator; - delete node.expression; - delete node.params; - delete node.returnType; - delete node.typeParameters; - } - - if (path.isRestProperty() || path.isSpreadProperty()) { - node.type = `Experimental${node.type}`; - } - - if (path.isTypeParameter && path.isTypeParameter()) { - node.type = "Identifier"; - node.typeAnnotation = node.bound; - delete node.bound; - } - - // flow: prevent "no-undef" - // for "Component" in: "let x: React.Component" - if (path.isQualifiedTypeIdentifier()) { - delete node.id; - } - // for "b" in: "var a: { b: Foo }" - if (path.isObjectTypeProperty()) { - delete node.key; - } - // for "indexer" in: "var a: {[indexer: string]: number}" - if (path.isObjectTypeIndexer()) { - delete node.id; - } - // for "param" in: "var a: { func(param: Foo): Bar };" - if (path.isFunctionTypeParam()) { - delete node.name; - } - - // modules - - if (path.isImportDeclaration()) { - delete node.isType; - } - - if (path.isExportDeclaration()) { - var declar = path.get("declaration"); - if (declar.isClassExpression()) { - node.declaration.type = "ClassDeclaration"; - } else if (declar.isFunctionExpression()) { - node.declaration.type = "FunctionDeclaration"; - } - } - - // TODO: remove (old esprima) - if (path.isFunction()) { - if (!node.defaults) { - node.defaults = []; - } - } - - // template string range fixes - if (path.isTemplateLiteral()) { - for (var j = 0; j < node.quasis.length; j++) { - var q = node.quasis[j]; - q.range[0] -= 1; - if (q.tail) { - q.range[1] += 1; - } else { - q.range[1] += 2; - } - q.loc.start.column -= 1; - if (q.tail) { - q.loc.end.column += 1; - } else { - q.loc.end.column += 2; - } - } - } - } -}; diff --git a/babylon-to-espree/toToken.js b/babylon-to-espree/toToken.js deleted file mode 100644 index 9535fb17..00000000 --- a/babylon-to-espree/toToken.js +++ /dev/null @@ -1,72 +0,0 @@ -"use strict"; - -module.exports = function (token, tt, source) { - var type = token.type; - token.range = [token.start, token.end]; - - if (type === tt.name) { - token.type = "Identifier"; - } else if (type === tt.semi || type === tt.comma || - type === tt.parenL || type === tt.parenR || - type === tt.braceL || type === tt.braceR || - type === tt.slash || type === tt.dot || - type === tt.bracketL || type === tt.bracketR || - type === tt.ellipsis || type === tt.arrow || - type === tt.star || type === tt.incDec || - type === tt.colon || type === tt.question || - type === tt.template || type === tt.backQuote || - type === tt.dollarBraceL || type === tt.at || - type === tt.logicalOR || type === tt.logicalAND || - type === tt.bitwiseOR || type === tt.bitwiseXOR || - type === tt.bitwiseAND || type === tt.equality || - type === tt.relational || type === tt.bitShift || - type === tt.plusMin || type === tt.modulo || - type === tt.exponent || type === tt.prefix || - type === tt.doubleColon || - type.isAssign) { - token.type = "Punctuator"; - if (!token.value) token.value = type.label; - } else if (type === tt.tilde) { - token.type = "Punctuator"; - token.value = "."; - } else if (type === tt.awaitArrow) { - token.type = "Punctuator"; - token.value = "="; - } else if (type === tt.elvis) { - token.type = "Punctuator"; - // ?. -> . and ?[ -> [ - token.value = token.value[1]; - } else if (type === tt.jsxTagStart) { - token.type = "Punctuator"; - token.value = "<"; - } else if (type === tt.jsxTagEnd) { - token.type = "Punctuator"; - token.value = ">"; - } else if (type === tt.jsxName) { - token.type = "JSXIdentifier"; - } else if (type === tt.jsxText) { - token.type = "JSXText"; - } else if (type.keyword === "null") { - token.type = "Null"; - } else if (type.keyword === "false" || type.keyword === "true") { - token.type = "Boolean"; - } else if (type.keyword) { - token.type = "Keyword"; - } else if (type === tt.num) { - token.type = "Numeric"; - token.value = source.slice(token.start, token.end); - } else if (type === tt.string) { - token.type = "String"; - token.value = source.slice(token.start, token.end); - } else if (type === tt.regexp) { - token.type = "RegularExpression"; - var value = token.value; - token.regex = { - pattern: value.pattern, - flags: value.flags - }; - token.value = `/${value.pattern}/${value.flags}`; - } - - return token; -}; diff --git a/babylon-to-espree/toTokens.js b/babylon-to-espree/toTokens.js deleted file mode 100644 index 81ec9850..00000000 --- a/babylon-to-espree/toTokens.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -var convertTemplateType = require("./convertTemplateType"); -var toToken = require("./toToken"); - -module.exports = function (tokens, tt, code) { - // transform tokens to type "Template" - convertTemplateType(tokens, tt); - - var transformedTokens = []; - for (var i = 0; i < tokens.length; i++) { - var token = tokens[i]; - if (token.type !== "CommentLine" && token.type !== "CommentBlock") { - transformedTokens.push(toToken(token, tt, code)); - } - } - - return transformedTokens; -}; diff --git a/lib/analyze-scope.js b/lib/analyze-scope.js new file mode 100644 index 00000000..9b2a40d6 --- /dev/null +++ b/lib/analyze-scope.js @@ -0,0 +1,343 @@ +"use strict"; + +const t = require("@babel/types"); +const escope = require("eslint-scope"); +const Definition = require("eslint-scope/lib/definition").Definition; +const OriginalPatternVisitor = require("eslint-scope/lib/pattern-visitor"); +const OriginalReferencer = require("eslint-scope/lib/referencer"); +const fallback = require("eslint-visitor-keys").getKeys; +const childVisitorKeys = require("./visitor-keys"); + +const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ + "ArrayPattern", + "ClassDeclaration", + "ClassExpression", + "FunctionDeclaration", + "FunctionExpression", + "Identifier", + "ObjectPattern", + "RestElement", +]); +const visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { + const value = t.VISITOR_KEYS[key]; + if (flowFlippedAliasKeys.indexOf(value) === -1) { + acc[key] = value; + } + return acc; +}, {}); + +const propertyTypes = { + // loops + callProperties: { type: "loop", values: ["value"] }, + indexers: { type: "loop", values: ["key", "value"] }, + properties: { type: "loop", values: ["argument", "value"] }, + types: { type: "loop" }, + params: { type: "loop" }, + // single property + argument: { type: "single" }, + elementType: { type: "single" }, + qualification: { type: "single" }, + rest: { type: "single" }, + returnType: { type: "single" }, + // others + typeAnnotation: { type: "typeAnnotation" }, + typeParameters: { type: "typeParameters" }, + id: { type: "id" }, +}; + +class PatternVisitor extends OriginalPatternVisitor { + ArrayPattern(node) { + node.elements.forEach(this.visit, this); + } + + ObjectPattern(node) { + node.properties.forEach(this.visit, this); + } +} + +class Referencer extends OriginalReferencer { + // inherits. + visitPattern(node, options, callback) { + if (!node) { + return; + } + + // Visit type annotations. + this._checkIdentifierOrVisit(node.typeAnnotation); + if (t.isAssignmentPattern(node)) { + this._checkIdentifierOrVisit(node.left.typeAnnotation); + } + + // Overwrite `super.visitPattern(node, options, callback)` in order to not visit `ArrayPattern#typeAnnotation` and `ObjectPattern#typeAnnotation`. + if (typeof options === "function") { + callback = options; + options = { processRightHandNodes: false }; + } + + const visitor = new PatternVisitor(this.options, node, callback); + visitor.visit(node); + + // Process the right hand nodes recursively. + if (options.processRightHandNodes) { + visitor.rightHandNodes.forEach(this.visit, this); + } + } + + // inherits. + visitClass(node) { + // Decorators. + this._visitArray(node.decorators); + + // Flow type parameters. + const typeParamScope = this._nestTypeParamScope(node); + + // Flow super types. + this._visitTypeAnnotation(node.implements); + this._visitTypeAnnotation( + node.superTypeParameters && node.superTypeParameters.params + ); + + // Basic. + super.visitClass(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitFunction(node) { + const typeParamScope = this._nestTypeParamScope(node); + + // Flow return types. + this._checkIdentifierOrVisit(node.returnType); + + // Basic. + super.visitFunction(node); + + // Close the type parameter scope. + if (typeParamScope) { + this.close(node); + } + } + + // inherits. + visitProperty(node) { + if (node.value && node.value.type === "TypeCastExpression") { + this._visitTypeAnnotation(node.value); + } + this._visitArray(node.decorators); + super.visitProperty(node); + } + + InterfaceDeclaration(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + // TODO: Handle mixins + this._visitArray(node.extends); + this.visit(node.body); + + if (typeParamScope) { + this.close(node); + } + } + + TypeAlias(node) { + this._createScopeVariable(node, node.id); + + const typeParamScope = this._nestTypeParamScope(node); + + this.visit(node.right); + + if (typeParamScope) { + this.close(node); + } + } + + ClassProperty(node) { + this._visitClassProperty(node); + } + + ClassPrivateProperty(node) { + this._visitClassProperty(node); + } + + DeclareModule(node) { + this._visitDeclareX(node); + } + + DeclareFunction(node) { + this._visitDeclareX(node); + } + + DeclareVariable(node) { + this._visitDeclareX(node); + } + + DeclareClass(node) { + this._visitDeclareX(node); + } + + // visit OptionalMemberExpression as a MemberExpression. + OptionalMemberExpression(node) { + super.MemberExpression(node); + } + + _visitClassProperty(node) { + this._visitTypeAnnotation(node.typeAnnotation); + this.visitProperty(node); + } + + _visitDeclareX(node) { + if (node.id) { + this._createScopeVariable(node, node.id); + } + + const typeParamScope = this._nestTypeParamScope(node); + if (typeParamScope) { + this.close(node); + } + } + + _createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null) + ); + } + + _nestTypeParamScope(node) { + if (!node.typeParameters) { + return null; + } + + const parentScope = this.scopeManager.__currentScope; + const scope = new escope.Scope( + this.scopeManager, + "type-parameters", + parentScope, + node, + false + ); + + this.scopeManager.__nestScope(scope); + for (let j = 0; j < node.typeParameters.params.length; j++) { + const name = node.typeParameters.params[j]; + scope.__define(name, new Definition("TypeParameter", name, name)); + if (name.typeAnnotation) { + this._checkIdentifierOrVisit(name); + } + } + scope.__define = function() { + return parentScope.__define.apply(parentScope, arguments); + }; + + return scope; + } + + _visitTypeAnnotation(node) { + if (!node) { + return; + } + if (Array.isArray(node)) { + node.forEach(this._visitTypeAnnotation, this); + return; + } + + // get property to check (params, id, etc...) + const visitorValues = visitorKeysMap[node.type]; + if (!visitorValues) { + return; + } + + // can have multiple properties + for (let i = 0; i < visitorValues.length; i++) { + const visitorValue = visitorValues[i]; + const propertyType = propertyTypes[visitorValue]; + const nodeProperty = node[visitorValue]; + // check if property or type is defined + if (propertyType == null || nodeProperty == null) { + continue; + } + if (propertyType.type === "loop") { + for (let j = 0; j < nodeProperty.length; j++) { + if (Array.isArray(propertyType.values)) { + for (let k = 0; k < propertyType.values.length; k++) { + const loopPropertyNode = nodeProperty[j][propertyType.values[k]]; + if (loopPropertyNode) { + this._checkIdentifierOrVisit(loopPropertyNode); + } + } + } else { + this._checkIdentifierOrVisit(nodeProperty[j]); + } + } + } else if (propertyType.type === "single") { + this._checkIdentifierOrVisit(nodeProperty); + } else if (propertyType.type === "typeAnnotation") { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (propertyType.type === "typeParameters") { + for (let l = 0; l < node.typeParameters.params.length; l++) { + this._checkIdentifierOrVisit(node.typeParameters.params[l]); + } + } else if (propertyType.type === "id") { + if (node.id.type === "Identifier") { + this._checkIdentifierOrVisit(node.id); + } else { + this._visitTypeAnnotation(node.id); + } + } + } + } + + _checkIdentifierOrVisit(node) { + if (node && node.typeAnnotation) { + this._visitTypeAnnotation(node.typeAnnotation); + } else if (node && node.type === "Identifier") { + this.visit(node); + } else { + this._visitTypeAnnotation(node); + } + } + + _visitArray(nodeList) { + if (nodeList) { + for (const node of nodeList) { + this.visit(node); + } + } + } +} + +module.exports = function(ast, parserOptions) { + const options = { + ignoreEval: true, + optimistic: false, + directive: false, + nodejsScope: + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true, + impliedStrict: false, + sourceType: ast.sourceType, + ecmaVersion: parserOptions.ecmaVersion || 2018, + fallback, + }; + + if (OriginalReferencer._babelEslintPatched) { + require("./patch-eslint-scope")(parserOptions); + return escope.analyze(ast, options); + } + + options.childVisitorKeys = childVisitorKeys; + + const scopeManager = new escope.ScopeManager(options); + const referencer = new Referencer(options, scopeManager); + + referencer.visit(ast); + + return scopeManager; +}; diff --git a/babylon-to-espree/attachComments.js b/lib/babylon-to-espree/attachComments.js similarity index 97% rename from babylon-to-espree/attachComments.js rename to lib/babylon-to-espree/attachComments.js index 9fc9f339..8c608a45 100644 --- a/babylon-to-espree/attachComments.js +++ b/lib/babylon-to-espree/attachComments.js @@ -1,7 +1,7 @@ "use strict"; // comment fixes -module.exports = function (ast, comments, tokens) { +module.exports = function(ast, comments, tokens) { if (comments.length) { var firstComment = comments[0]; var lastComment = comments[comments.length - 1]; diff --git a/lib/babylon-to-espree/convertComments.js b/lib/babylon-to-espree/convertComments.js new file mode 100644 index 00000000..17d71173 --- /dev/null +++ b/lib/babylon-to-espree/convertComments.js @@ -0,0 +1,17 @@ +"use strict"; + +module.exports = function(comments) { + for (var i = 0; i < comments.length; i++) { + var comment = comments[i]; + if (comment.type === "CommentBlock") { + comment.type = "Block"; + } else if (comment.type === "CommentLine") { + comment.type = "Line"; + } + // sometimes comments don't get ranges computed, + // even with options.ranges === true + if (!comment.range) { + comment.range = [comment.start, comment.end]; + } + } +}; diff --git a/lib/babylon-to-espree/convertTemplateType.js b/lib/babylon-to-espree/convertTemplateType.js new file mode 100644 index 00000000..accde61e --- /dev/null +++ b/lib/babylon-to-espree/convertTemplateType.js @@ -0,0 +1,92 @@ +"use strict"; + +module.exports = function(tokens, tt) { + let curlyBrace = null; + let templateTokens = []; + const result = []; + + function addTemplateType() { + const start = templateTokens[0]; + const end = templateTokens[templateTokens.length - 1]; + + const value = templateTokens.reduce((result, token) => { + if (token.value) { + result += token.value; + } else if (token.type !== tt.template) { + result += token.type.label; + } + + return result; + }, ""); + + result.push({ + type: "Template", + value: value, + start: start.start, + end: end.end, + loc: { + start: start.loc.start, + end: end.loc.end, + }, + }); + + templateTokens = []; + } + + tokens.forEach(token => { + switch (token.type) { + case tt.backQuote: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + + if (templateTokens.length > 1) { + addTemplateType(); + } + + break; + + case tt.dollarBraceL: + templateTokens.push(token); + addTemplateType(); + break; + + case tt.braceR: + if (curlyBrace) { + result.push(curlyBrace); + } + + curlyBrace = token; + break; + + case tt.template: + if (curlyBrace) { + templateTokens.push(curlyBrace); + curlyBrace = null; + } + + templateTokens.push(token); + break; + + case tt.eof: + if (curlyBrace) { + result.push(curlyBrace); + } + + break; + + default: + if (curlyBrace) { + result.push(curlyBrace); + curlyBrace = null; + } + + result.push(token); + } + }); + + return result; +}; diff --git a/babylon-to-espree/index.js b/lib/babylon-to-espree/index.js similarity index 58% rename from babylon-to-espree/index.js rename to lib/babylon-to-espree/index.js index 94e6832f..6d6e12bf 100644 --- a/babylon-to-espree/index.js +++ b/lib/babylon-to-espree/index.js @@ -1,16 +1,11 @@ "use strict"; -var attachComments = require("./attachComments"); +var attachComments = require("./attachComments"); var convertComments = require("./convertComments"); -var toTokens = require("./toTokens"); -var toAST = require("./toAST"); - -module.exports = function (ast, traverse, tt, code) { - // remove EOF token, eslint doesn't use this for anything and it interferes - // with some rules see https://github.com/babel/babel-eslint/issues/2 - // todo: find a more elegant way to do this - ast.tokens.pop(); +var toTokens = require("./toTokens"); +var toAST = require("./toAST"); +module.exports = function(ast, traverse, tt, code) { // convert tokens ast.tokens = toTokens(ast.tokens, tt, code); @@ -30,7 +25,6 @@ module.exports = function (ast, traverse, tt, code) { ast.directives = ast.program.directives; ast.body = ast.program.body; delete ast.program; - delete ast._paths; attachComments(ast, ast.comments, ast.tokens); }; diff --git a/lib/babylon-to-espree/toAST.js b/lib/babylon-to-espree/toAST.js new file mode 100644 index 00000000..b3da41f0 --- /dev/null +++ b/lib/babylon-to-espree/toAST.js @@ -0,0 +1,118 @@ +"use strict"; + +var t = require("@babel/types"); +var convertComments = require("./convertComments"); + +module.exports = function(ast, traverse, code) { + var state = { source: code }; + + // Monkey patch visitor keys in order to be able to traverse the estree nodes + t.VISITOR_KEYS.Property = t.VISITOR_KEYS.ObjectProperty; + t.VISITOR_KEYS.MethodDefinition = [ + "key", + "value", + "decorators", + "returnType", + "typeParameters", + ]; + + traverse(ast, astTransformVisitor, null, state); + + delete t.VISITOR_KEYS.Property; + delete t.VISITOR_KEYS.MethodDefinition; +}; + +var astTransformVisitor = { + noScope: true, + enter(path) { + var node = path.node; + + // private var to track original node type + node._babelType = node.type; + + if (node.innerComments) { + node.trailingComments = node.innerComments; + delete node.innerComments; + } + + if (node.trailingComments) { + convertComments(node.trailingComments); + } + + if (node.leadingComments) { + convertComments(node.leadingComments); + } + }, + exit(path) { + var node = path.node; + + if (path.isJSXText()) { + node.type = "Literal"; + } + + if ( + path.isRestElement() && + path.parent && + path.parent.type === "ObjectPattern" + ) { + node.type = "ExperimentalRestProperty"; + } + + if ( + path.isSpreadElement() && + path.parent && + path.parent.type === "ObjectExpression" + ) { + node.type = "ExperimentalSpreadProperty"; + } + + if (path.isTypeParameter()) { + node.type = "Identifier"; + node.typeAnnotation = node.bound; + delete node.bound; + } + + // flow: prevent "no-undef" + // for "Component" in: "let x: React.Component" + if (path.isQualifiedTypeIdentifier()) { + delete node.id; + } + // for "b" in: "var a: { b: Foo }" + if (path.isObjectTypeProperty()) { + delete node.key; + } + // for "indexer" in: "var a: {[indexer: string]: number}" + if (path.isObjectTypeIndexer()) { + delete node.id; + } + // for "param" in: "var a: { func(param: Foo): Bar };" + if (path.isFunctionTypeParam()) { + delete node.name; + } + + // modules + + if (path.isImportDeclaration()) { + delete node.isType; + } + + // template string range fixes + if (path.isTemplateLiteral()) { + for (var j = 0; j < node.quasis.length; j++) { + var q = node.quasis[j]; + q.range[0] -= 1; + if (q.tail) { + q.range[1] += 1; + } else { + q.range[1] += 2; + } + q.loc.start.column -= 1; + if (q.tail) { + q.loc.end.column += 1; + } else { + q.loc.end.column += 2; + } + } + } + }, +}; diff --git a/lib/babylon-to-espree/toToken.js b/lib/babylon-to-espree/toToken.js new file mode 100644 index 00000000..44c73529 --- /dev/null +++ b/lib/babylon-to-espree/toToken.js @@ -0,0 +1,84 @@ +"use strict"; + +module.exports = function(token, tt, source) { + var type = token.type; + token.range = [token.start, token.end]; + + if (type === tt.name) { + token.type = "Identifier"; + } else if ( + type === tt.semi || + type === tt.comma || + type === tt.parenL || + type === tt.parenR || + type === tt.braceL || + type === tt.braceR || + type === tt.slash || + type === tt.dot || + type === tt.bracketL || + type === tt.bracketR || + type === tt.ellipsis || + type === tt.arrow || + type === tt.pipeline || + type === tt.star || + type === tt.incDec || + type === tt.colon || + type === tt.question || + type === tt.questionDot || + type === tt.template || + type === tt.backQuote || + type === tt.dollarBraceL || + type === tt.at || + type === tt.logicalOR || + type === tt.logicalAND || + type === tt.nullishCoalescing || + type === tt.bitwiseOR || + type === tt.bitwiseXOR || + type === tt.bitwiseAND || + type === tt.equality || + type === tt.relational || + type === tt.bitShift || + type === tt.plusMin || + type === tt.modulo || + type === tt.exponent || + type === tt.bang || + type === tt.tilde || + type === tt.doubleColon || + type.isAssign + ) { + token.type = "Punctuator"; + if (!token.value) token.value = type.label; + } else if (type === tt.jsxTagStart) { + token.type = "Punctuator"; + token.value = "<"; + } else if (type === tt.jsxTagEnd) { + token.type = "Punctuator"; + token.value = ">"; + } else if (type === tt.jsxName) { + token.type = "JSXIdentifier"; + } else if (type === tt.jsxText) { + token.type = "JSXText"; + } else if (type.keyword === "null") { + token.type = "Null"; + } else if (type.keyword === "false" || type.keyword === "true") { + token.type = "Boolean"; + } else if (type.keyword) { + token.type = "Keyword"; + } else if (type === tt.num) { + token.type = "Numeric"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.string) { + token.type = "String"; + token.value = source.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = "RegularExpression"; + var value = token.value; + token.regex = { + pattern: value.pattern, + flags: value.flags, + }; + token.value = `/${value.pattern}/${value.flags}`; + } + + return token; +}; diff --git a/lib/babylon-to-espree/toTokens.js b/lib/babylon-to-espree/toTokens.js new file mode 100644 index 00000000..bb30819b --- /dev/null +++ b/lib/babylon-to-espree/toTokens.js @@ -0,0 +1,10 @@ +"use strict"; + +var convertTemplateType = require("./convertTemplateType"); +var toToken = require("./toToken"); + +module.exports = function(tokens, tt, code) { + return convertTemplateType(tokens, tt) + .filter(t => t.type !== "CommentLine" && t.type !== "CommentBlock") + .map(t => toToken(t, tt, code)); +}; diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 00000000..c4655280 --- /dev/null +++ b/lib/index.js @@ -0,0 +1,22 @@ +"use strict"; + +exports.parse = function(code, options) { + return exports.parseForESLint(code, options).ast; +}; + +exports.parseForESLint = function(code, options) { + options = options || {}; + options.ecmaVersion = options.ecmaVersion || 2018; + options.sourceType = options.sourceType || "module"; + options.allowImportExportEverywhere = + options.allowImportExportEverywhere || false; + + if (options.eslintVisitorKeys && options.eslintScopeManager) { + return require("./parse-with-scope")(code, options); + } + return { ast: require("./parse-with-patch")(code, options) }; +}; + +exports.parseNoPatch = function(code, options) { + return require("./parse")(code, options); +}; diff --git a/lib/parse-with-patch.js b/lib/parse-with-patch.js new file mode 100644 index 00000000..ba1b95b5 --- /dev/null +++ b/lib/parse-with-patch.js @@ -0,0 +1,9 @@ +"use strict"; + +var parse = require("./parse"); +var patchEscope = require("./patch-eslint-scope"); + +module.exports = function(code, options) { + patchEscope(options); + return parse(code, options); +}; diff --git a/lib/parse-with-scope.js b/lib/parse-with-scope.js new file mode 100644 index 00000000..36e3fce5 --- /dev/null +++ b/lib/parse-with-scope.js @@ -0,0 +1,12 @@ +"use strict"; + +const visitorKeys = require("./visitor-keys"); +const analyzeScope = require("./analyze-scope"); +const parse = require("./parse"); + +module.exports = function(code, options) { + const ast = parse(code, options); + const scopeManager = analyzeScope(ast, options); + + return { ast, scopeManager, visitorKeys }; +}; diff --git a/lib/parse.js b/lib/parse.js new file mode 100644 index 00000000..b23b9dc9 --- /dev/null +++ b/lib/parse.js @@ -0,0 +1,93 @@ +"use strict"; + +var babylonToEspree = require("./babylon-to-espree"); +var parse = require("@babel/parser").parse; +var tt = require("@babel/parser").tokTypes; +var traverse = require("@babel/traverse").default; +var codeFrameColumns = require("@babel/code-frame").codeFrameColumns; + +module.exports = function(code, options) { + const legacyDecorators = + options.ecmaFeatures && options.ecmaFeatures.legacyDecorators; + + var opts = { + codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, + sourceType: options.sourceType, + allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree + allowReturnOutsideFunction: true, + allowSuperOutsideMethod: true, + ranges: true, + tokens: true, + plugins: [ + ["flow", { all: true }], + "jsx", + "estree", + "asyncFunctions", + "asyncGenerators", + "classConstructorCall", + "classProperties", + legacyDecorators + ? "decorators-legacy" + : ["decorators", { decoratorsBeforeExport: false }], + "doExpressions", + "exponentiationOperator", + "exportDefaultFrom", + "exportNamespaceFrom", + "functionBind", + "functionSent", + "objectRestSpread", + "trailingFunctionCommas", + "dynamicImport", + "numericSeparator", + "optionalChaining", + "importMeta", + "classPrivateProperties", + "bigInt", + "optionalCatchBinding", + "throwExpressions", + ["pipelineOperator", { proposal: "minimal" }], + "nullishCoalescingOperator", + "logicalAssignment", + ], + }; + + var ast; + try { + ast = parse(code, opts); + } catch (err) { + if (err instanceof SyntaxError) { + err.lineNumber = err.loc.line; + err.column = err.loc.column; + + if (opts.codeFrame) { + err.lineNumber = err.loc.line; + err.column = err.loc.column + 1; + + // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start + err.message = + "Line " + + err.lineNumber + + ": " + + err.message.replace(/ \((\d+):(\d+)\)$/, "") + + // add codeframe + "\n\n" + + codeFrameColumns( + code, + { + start: { + line: err.lineNumber, + column: err.column, + }, + }, + { highlightCode: true } + ); + } + } + + throw err; + } + + babylonToEspree(ast, traverse, tt, code); + + return ast; +}; diff --git a/index.js b/lib/patch-eslint-scope.js similarity index 59% rename from index.js rename to lib/patch-eslint-scope.js index df146474..2bf2b350 100644 --- a/index.js +++ b/lib/patch-eslint-scope.js @@ -1,23 +1,8 @@ -var babylonToEspree = require("./babylon-to-espree"); -var Module = require("module"); -var path = require("path"); -var jsParse = require("babylon").parse; -var babel = require("babel-core"); -var t = require("babel-types"); -var tt = require("babylon").tokTypes; -var traverse = require("babel-traverse").default; -var codeFrame = require("babel-code-frame"); - -var lscPlugin = require("@oigroup/babel-plugin-lightscript"); -var lscTooling = require("@oigroup/babel-plugin-lightscript/lib/tooling"); - -var lightScriptDisabledRulesTable = { - "no-unexpected-multiline": true, - "no-else-return": true -}; +"use strict"; -var hasPatched = false; -var eslintOptions = {}; +var Module = require("module"); +var path = require("path"); +var t = require("@babel/types"); function getModules() { try { @@ -39,10 +24,11 @@ function getModules() { try { var escope = eslintMod.require("eslint-scope"); - var Definition = eslintMod.require("eslint-scope/lib/definition").Definition; + var Definition = eslintMod.require("eslint-scope/lib/definition") + .Definition; var referencer = eslintMod.require("eslint-scope/lib/referencer"); } catch (err) { - escope = eslintMod.require("escope"); + escope = eslintMod.require("escope"); Definition = eslintMod.require("escope/lib/definition").Definition; referencer = eslintMod.require("escope/lib/referencer"); } @@ -52,7 +38,6 @@ function getModules() { if (referencer.__esModule) referencer = referencer.default; return { - eslintMod, Definition, escope, estraverse, @@ -61,7 +46,6 @@ function getModules() { } function monkeypatch(modules) { - var eslintMod = modules.eslintMod; var Definition = modules.Definition; var escope = modules.escope; var estraverse = modules.estraverse; @@ -71,18 +55,6 @@ function monkeypatch(modules) { estraverse.VisitorKeys.MethodDefinition.push("decorators"); estraverse.VisitorKeys.Property.push("decorators"); - var analyze = escope.analyze; - escope.analyze = function (ast, opts) { - opts.ecmaVersion = eslintOptions.ecmaVersion; - opts.sourceType = eslintOptions.sourceType; - if (eslintOptions.globalReturn !== undefined) { - opts.nodejsScope = eslintOptions.globalReturn; - } - - var results = analyze.call(this, ast, opts); - return results; - }; - // if there are decorators, then visit each function visitDecorators(node) { if (!node.decorators) { @@ -104,7 +76,7 @@ function monkeypatch(modules) { "FunctionExpression", "Identifier", "ObjectPattern", - "RestElement" + "RestElement", ]); var visitorKeysMap = Object.keys(t.VISITOR_KEYS).reduce(function(acc, key) { var value = t.VISITOR_KEYS[key]; @@ -130,7 +102,7 @@ function monkeypatch(modules) { // others typeAnnotation: { type: "typeAnnotation" }, typeParameters: { type: "typeParameters" }, - id: { type: "id" } + id: { type: "id" }, }; function visitTypeAnnotation(node) { @@ -192,7 +164,13 @@ function monkeypatch(modules) { function nestTypeParamScope(manager, node) { var parentScope = manager.__currentScope; - var scope = new escope.Scope(manager, "type-parameters", parentScope, node, false); + var scope = new escope.Scope( + manager, + "type-parameters", + parentScope, + node, + false + ); manager.__nestScope(scope); for (var j = 0; j < node.typeParameters.params.length; j++) { var name = node.typeParameters.params[j]; @@ -242,13 +220,22 @@ function monkeypatch(modules) { visitProperty.call(this, node); }; - // visit ClassProperty as a Property. - referencer.prototype.ClassProperty = function(node) { + function visitClassProperty(node) { if (node.typeAnnotation) { visitTypeAnnotation.call(this, node.typeAnnotation); } this.visitProperty(node); - }; + } + + // visit ClassProperty as a Property. + referencer.prototype.ClassProperty = visitClassProperty; + + // visit ClassPrivateProperty as a Property. + referencer.prototype.ClassPrivateProperty = visitClassProperty; + + // visit OptionalMemberExpression as a MemberExpression. + referencer.prototype.OptionalMemberExpression = + referencer.prototype.MemberExpression; // visit flow type in FunctionDeclaration, FunctionExpression, ArrowFunctionExpression var visitFunction = referencer.prototype.visitFunction; @@ -301,16 +288,10 @@ function monkeypatch(modules) { variableDeclaration.call(this, node); }; - function createScopeVariable (node, name) { - this.currentScope().variableScope.__define(name, - new Definition( - "Variable", - name, - node, - null, - null, - null - ) + function createScopeVariable(node, name) { + this.currentScope().variableScope.__define( + name, + new Definition("Variable", name, node, null, null, null) ); } @@ -344,10 +325,9 @@ function monkeypatch(modules) { } }; - referencer.prototype.DeclareModule = - referencer.prototype.DeclareFunction = - referencer.prototype.DeclareVariable = - referencer.prototype.DeclareClass = function(node) { + referencer.prototype.DeclareModule = referencer.prototype.DeclareFunction = referencer.prototype.DeclareVariable = referencer.prototype.DeclareClass = function( + node + ) { if (node.id) { createScopeVariable.call(this, node, node.id); } @@ -361,170 +341,34 @@ function monkeypatch(modules) { } }; - // monkeypatch eslint/tokenstore - var ts = getModule(eslintMod, "./token-store"); - ts.prototype.getTokenAfter = returnNonceTokenPatch(ts.prototype.getTokenAfter); - ts.prototype.getTokenBefore = returnNonceTokenPatch(ts.prototype.getTokenBefore); - ts.prototype.getFirstToken = returnNonceTokenPatch(ts.prototype.getFirstToken); - ts.prototype.getLastToken = returnNonceTokenPatch(ts.prototype.getLastToken); - var origGetFirstTokens = ts.prototype.getFirstTokens; - ts.prototype.getFirstTokens = function() { - if (!arguments[0] || arguments[0].type === "Nonce") return [createNonceToken()]; - var toks = origGetFirstTokens.apply(this, arguments); - if (toks == null || toks[0] == null) return [createNonceToken()]; else return toks; - }; - - // monkeypatch rules - // in eslint 4, rule getter is a class whereas it was an object in 3... - var emptyRule = function() { return {}; }; - emptyRule.create = function() { return {}; }; - var rules = getModule(eslintMod, "./rules"); - var _get = rules.get || rules.prototype.get; - var nextGet = function get(ruleId) { - // disable invalid or broken rules - if (ruleId && lightScriptDisabledRulesTable[ruleId]) { - return emptyRule; - } else { - return _get.call(this || rules, ruleId); - } - }; - - if (rules.get) rules.get = nextGet; else rules.prototype.get = nextGet; + referencer._babelEslintPatched = true; } -function createNonceToken() { - return { - type: "Nonce", - start: 0, - end: 1, - range: [0, 1], - loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 1 } } - }; -} +// To patch for each call. +var escope = null; +var escopeAnalyze = null; -function returnNonceTokenPatch(orig) { - return function(node, options) { - if (!node || node.type === "Nonce") return createNonceToken(); - var tok = orig.call(this, node, options); - if (tok === null) return createNonceToken(); else return tok; - }; -} +module.exports = function(parserOptions) { + // Patch `Referencer.prototype` once. + if (!escope) { + const modules = getModules(); + monkeypatch(modules); -function getModule(baseMod, path) { - var loc; - try { - loc = Module._resolveFilename(path, baseMod); - } catch (err) { - throw new ReferenceError("couldn't resolve " + path); - } - var mod = require(loc); - if (mod.__esModule) { - mod = mod.default; - } - return mod; -} - -exports.parse = function (code, options) { - options = options || {}; - eslintOptions.ecmaVersion = options.ecmaVersion = options.ecmaVersion || 6; - eslintOptions.sourceType = options.sourceType = options.sourceType || "module"; - eslintOptions.allowImportExportEverywhere = options.allowImportExportEverywhere = options.allowImportExportEverywhere || false; - if (options.sourceType === "module") { - eslintOptions.globalReturn = false; - } else { - delete eslintOptions.globalReturn; - } - - if (!hasPatched) { - hasPatched = true; - try { - monkeypatch(getModules()); - } catch (err) { - console.error(err.stack); - process.exit(1); - } + // Store to patch for each call. + escope = modules.escope; + escopeAnalyze = modules.escope.analyze; } - return exports.parseNoPatch(code, options); -}; - -exports.parseNoPatch = function (code, options) { - var opts = { - codeFrame: options.hasOwnProperty("codeFrame") ? options.codeFrame : true, - sourceType: options.sourceType, - allowImportExportEverywhere: options.allowImportExportEverywhere, // consistent with espree - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true, - plugins: [ - "flow", - "jsx", - "asyncFunctions", - "asyncGenerators", - "classConstructorCall", - "classProperties", - "decorators", - "doExpressions", - "exponentiationOperator", - "exportExtensions", - "functionBind", - "functionSent", - "objectRestSpread", - "trailingFunctionCommas", - "dynamicImport" - ] + // Patch `escope.analyze` based on the current parserOptions. + escope.analyze = function(ast, opts) { + opts = opts || {}; + opts.ecmaVersion = parserOptions.ecmaVersion; + opts.sourceType = parserOptions.sourceType; + opts.nodejsScope = + ast.sourceType === "script" && + (parserOptions.ecmaFeatures && + parserOptions.ecmaFeatures.globalReturn) === true; + + return escopeAnalyze.call(this, ast, opts); }; - - // TODO: centralize this in plugin-lightscript - // Should be exported methods to analyze file path, directives, shebangs etc - // and come up with all this stuff. - // (This setup step should also read .babelrc) - var filePath = options.filePath; - var compilerConfig = lscTooling.getCompilerConfiguration(filePath, code, { __linter: true }); - var useLsc = compilerConfig.isLightScript; - - var ast; - try { - if (useLsc) { - tt = lscTooling.babylon.tokTypes; - - ast = lscTooling.parse(compilerConfig, code, { - sourceType: options.sourceType, - allowImportExportEverywhere: options.allowImportExportEverywhere, - allowReturnOutsideFunction: true, - allowSuperOutsideMethod: true - }); - - // run it through babel-plugin-lightscript to throw errors - const { ast: nextAst } = babel.transformFromAst(ast, code, { - code: false, - plugins: [[lscPlugin, compilerConfig]], - }); - nextAst.tokens = ast.tokens; - ast = nextAst; - } else { - ast = jsParse(code, opts); - } - } catch (err) { - if (err.loc) { - err.lineNumber = err.loc.line; - err.column = err.loc.column; - - if (opts.codeFrame) { - err.lineNumber = err.loc.line; - err.column = err.loc.column + 1; - - // remove trailing "(LINE:COLUMN)" acorn message and add in esprima syntax error message start - err.message = "Line " + err.lineNumber + ": " + err.message.replace(/ \((\d+):(\d+)\)$/, "") + - // add codeframe - "\n\n" + - codeFrame(code, err.lineNumber, err.column, { highlightCode: true }); - } - } - - throw err; - } - - babylonToEspree(ast, traverse, tt, code); - - return ast; }; diff --git a/lib/visitor-keys.js b/lib/visitor-keys.js new file mode 100644 index 00000000..921a0bb0 --- /dev/null +++ b/lib/visitor-keys.js @@ -0,0 +1,15 @@ +"use strict"; + +const BABEL_VISITOR_KEYS = require("@babel/types").VISITOR_KEYS; +const ESLINT_VISITOR_KEYS = require("eslint-visitor-keys").KEYS; + +module.exports = Object.assign( + { + Literal: ESLINT_VISITOR_KEYS.Literal, + MethodDefinition: ["decorators"].concat( + ESLINT_VISITOR_KEYS.MethodDefinition + ), + Property: ["decorators"].concat(ESLINT_VISITOR_KEYS.Property), + }, + BABEL_VISITOR_KEYS +); diff --git a/package.json b/package.json index 7330b318..39d07f07 100644 --- a/package.json +++ b/package.json @@ -1,52 +1,59 @@ { "name": "@oigroup/lightscript-eslint", - "version": "3.1.1", + "version": "4.0.0-alpha.1", "description": "LightScript parser for ESLint, based on babel-eslint", - "main": "index.js", + "main": "lib/index.js", "files": [ - "index.js", - "babylon-to-espree" + "lib" ], "repository": { "type": "git", "url": "https://github.com/wcjohnson/lightscript-eslint.git" }, "dependencies": { - "@oigroup/babel-plugin-lightscript": "3.1.1", - "babel-code-frame": "^6.26.0", - "babel-core": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - }, - "peerDependencies": { - "eslint": "4.8.0" + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "^1.0.0" }, "scripts": { "test": "npm run lint && npm run test-only", - "test-only": "mocha", - "test:debug": "node --inspect --debug-brk node_modules/.bin/_mocha", + "test-only": "mocha && mocha --require test/fixtures/preprocess-to-patch.js && mocha --require test/fixtures/use-eslint-old.js", "lint": "eslint index.js babylon-to-espree test", "fix": "eslint index.js babylon-to-espree test --fix", + "precommit": "lint-staged", "preversion": "npm test", "changelog": "git log `git describe --tags --abbrev=0`..HEAD --pretty=format:' * %s (%an)' | grep -v 'Merge pull request'" }, "homepage": "http://wcjohnson.github.io/lightscript", "license": "MIT", "engines": { - "node": ">=4" + "node": ">=6" }, "bugs": { "url": "https://github.com/wcjohnson/lightscript/issues" }, "devDependencies": { - "babel-eslint": "^7.2.1", - "eslint": "4.8.0", - "eslint-config-babel": "^6.0.0", - "eslint-plugin-babel": "^4.0.0", + "babel-eslint": "^8.2.6", + "dedent": "^0.7.0", + "eslint": "npm:eslint@4.19.1", + "eslint-config-babel": "^7.0.1", + "eslint-old": "npm:eslint@4.13.1", "eslint-plugin-flowtype": "^2.30.3", - "espree": "^3.4.0", - "mocha": "^3.2.0" + "eslint-plugin-import": "^2.8.0", + "eslint-plugin-prettier": "^2.1.2", + "espree": "^3.5.2", + "husky": "^1.0.0-rc.13", + "lint-staged": "^7.2.2", + "mocha": "^5.0.1", + "prettier": "^1.4.4" + }, + "lint-staged": { + "*.js": [ + "eslint --format=codeframe --fix", + "git add" + ] } } diff --git a/test/babel-eslint.js b/test/babel-eslint.js index c09c9e08..99b03f25 100644 --- a/test/babel-eslint.js +++ b/test/babel-eslint.js @@ -1,90 +1,88 @@ -var assert = require("assert"); +var assert = require("assert"); var babelEslint = require(".."); -var espree = require("espree"); -var util = require("util"); -var unpad = require("dedent"); - -// Checks if the source ast implements the target ast. Ignores extra keys on source ast -function assertImplementsAST(target, source, path) { - if (!path) { - path = []; - } - - function error(text) { - var err = new Error(`At ${path.join(".")}: ${text}:`); - err.depth = path.length + 1; - throw err; - } - - var typeA = target === null ? "null" : typeof target; - var typeB = source === null ? "null" : typeof source; - if (typeA !== typeB) { - error(`have different types (${typeA} !== ${typeB}) (${target} !== ${source})`); - } else if (typeA === "object" && ["RegExp"].indexOf(target.constructor.name) !== -1 && target.constructor.name !== source.constructor.name) { - error(`object have different constructors (${target.constructor.name} !== ${source.constructor.name}`); - } else if (typeA === "object") { - var keysTarget = Object.keys(target); - for (var i in keysTarget) { - var key = keysTarget[i]; - path.push(key); - assertImplementsAST(target[key], source[key], path); - path.pop(); - } - } else if (target !== source) { - error(`are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})`); - } -} +var espree = require("espree"); +var escope = require("eslint-scope"); +var util = require("util"); +var unpad = require("dedent"); +var assertImplementsAST = require("./fixtures/assert-implements-ast"); function lookup(obj, keypath, backwardsDepth) { - if (!keypath) { return obj; } + if (!keypath) { + return obj; + } - return keypath.split(".").slice(0, -1 * backwardsDepth) - .reduce((base, segment) => { return base && base[segment], obj; }); + return keypath + .split(".") + .slice(0, -1 * backwardsDepth) + .reduce((base, segment) => { + return base && base[segment], obj; + }); } function parseAndAssertSame(code) { + code = unpad(code); var esAST = espree.parse(code, { ecmaFeatures: { - // enable JSX parsing + // enable JSX parsing jsx: true, - // enable return in global scope + // enable return in global scope globalReturn: true, - // enable implied strict mode (if ecmaVersion >= 5) + // enable implied strict mode (if ecmaVersion >= 5) impliedStrict: true, - // allow experimental object rest/spread - experimentalObjectRestSpread: true + // allow experimental object rest/spread + experimentalObjectRestSpread: true, }, tokens: true, loc: true, range: true, comment: true, attachComment: true, - ecmaVersion: 8, - sourceType: "module" + ecmaVersion: 2018, + sourceType: "module", }); - var babylonAST = babelEslint.parse(code); + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; try { assertImplementsAST(esAST, babylonAST); } catch (err) { var traversal = err.message.slice(3, err.message.indexOf(":")); - if (esAST.tokens) { - delete esAST.tokens; - } - if (babylonAST.tokens) { - delete babylonAST.tokens; - } err.message += unpad(` espree: - ${util.inspect(lookup(esAST, traversal, 2), { depth: err.depth, colors: true })} + ${util.inspect(lookup(esAST, traversal, 2), { + depth: err.depth, + colors: true, + })} babel-eslint: - ${util.inspect(lookup(babylonAST, traversal, 2), { depth: err.depth, colors: true })} + ${util.inspect(lookup(babylonAST, traversal, 2), { + depth: err.depth, + colors: true, + })} `); throw err; } - // assert.equal(esAST, babylonAST); + //assert.equal(esAST, babylonAST); } -describe("babylon-to-esprima", () => { +describe("babylon-to-espree", () => { + describe("compatibility", () => { + it("should allow ast.analyze to be called without options", function() { + var esAST = babelEslint.parseForESLint("`test`", { + eslintScopeManager: true, + eslintVisitorKeys: true, + }).ast; + + assert.doesNotThrow( + () => { + escope.analyze(esAST); + }, + TypeError, + "Should allow no options argument." + ); + }); + }); + describe("templates", () => { it("empty template string", () => { parseAndAssertSame("``"); @@ -127,44 +125,63 @@ describe("babylon-to-esprima", () => { }); it("template with nested function/object", () => { - parseAndAssertSame("`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`"); + parseAndAssertSame( + "`outer${{x: {y: 10}}}bar${`nested${function(){return 1;}}endnest`}end`" + ); }); it("template with braces inside and outside of template string #96", () => { - parseAndAssertSame("if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }"); + parseAndAssertSame( + "if (a) { var target = `{}a:${webpackPort}{}}}}`; } else { app.use(); }" + ); }); it("template also with braces #96", () => { - parseAndAssertSame( - unpad(` - export default function f1() { - function f2(foo) { - const bar = 3; - return \`\${foo} \${bar}\`; - } - return f2; + parseAndAssertSame(` + export default function f1() { + function f2(foo) { + const bar = 3; + return \`\${foo} \${bar}\`; } - `) - ); + return f2; + } + `); }); it("template with destructuring #31", () => { - parseAndAssertSame( - unpad(` - module.exports = { - render() { - var {name} = this.props; - return Math.max(null, \`Name: \${name}, Name: \${name}\`); - } - }; - `) - ); + parseAndAssertSame(` + module.exports = { + render() { + var {name} = this.props; + return Math.max(null, \`Name: \${name}, Name: \${name}\`); + } + }; + `); + }); + + it("template with arrow returning template #603", () => { + parseAndAssertSame(` + var a = \`\${() => { + \`\${''}\` + }}\`; + `); + }); + + it("template string with object with template string inside", () => { + parseAndAssertSame("`${ { a:`${2}` } }`"); }); }); - // TODO: fix; for lightscript it("simple expression", () => { - parseAndAssertSame("a + 1"); + parseAndAssertSame("a = 1"); + }); + + it("logical NOT", () => { + parseAndAssertSame("!0"); + }); + + it("bitwise NOT", () => { + parseAndAssertSame("~0"); }); it("class declaration", () => { @@ -208,19 +225,19 @@ describe("babylon-to-esprima", () => { }); it("default import", () => { - parseAndAssertSame("import foo from \"foo\";"); + parseAndAssertSame('import foo from "foo";'); }); it("import specifier", () => { - parseAndAssertSame("import { foo } from \"foo\";"); + parseAndAssertSame('import { foo } from "foo";'); }); it("import specifier with name", () => { - parseAndAssertSame("import { foo as bar } from \"foo\";"); + parseAndAssertSame('import { foo as bar } from "foo";'); }); it("import bare", () => { - parseAndAssertSame("import \"foo\";"); + parseAndAssertSame('import "foo";'); }); it("export default class declaration", () => { @@ -240,7 +257,7 @@ describe("babylon-to-esprima", () => { }); it("export all", () => { - parseAndAssertSame("export * from \"foo\";"); + parseAndAssertSame('export * from "foo";'); }); it("export named", () => { @@ -251,6 +268,36 @@ describe("babylon-to-esprima", () => { parseAndAssertSame("export { foo as bar };"); }); + // Espree doesn't support the optional chaining operator yet + it("optional chaining operator (token)", () => { + const code = "foo?.bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the nullish coalescing operator yet + it("nullish coalescing operator (token)", () => { + const code = "foo ?? bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + + // Espree doesn't support the pipeline operator yet + it("pipeline operator (token)", () => { + const code = "foo |> bar"; + var babylonAST = babelEslint.parseForESLint(code, { + eslintVisitorKeys: true, + eslintScopeManager: true, + }).ast; + assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); + }); + it.skip("empty program with line comment", () => { parseAndAssertSame("// single comment"); }); @@ -260,40 +307,34 @@ describe("babylon-to-esprima", () => { }); it("line comments", () => { - parseAndAssertSame( - unpad(` - // single comment - var foo = 15; // comment next to statement - // second comment after statement - `) - ); + parseAndAssertSame(` + // single comment + var foo = 15; // comment next to statement + // second comment after statement + `); }); it("block comments", () => { - parseAndAssertSame( - unpad(` - /* single comment */ - var foo = 15; /* comment next to statement */ - /* - * multiline - * comment - */ - `) - ); + parseAndAssertSame(` + /* single comment */ + var foo = 15; /* comment next to statement */ + /* + * multiline + * comment + */ + `); }); it("block comments #124", () => { - parseAndAssertSame( - unpad(` - React.createClass({ - render() { - // return ( - //
- // ); // <-- this is the line that is reported - } - }); - `) - ); + parseAndAssertSame(` + React.createClass({ + render() { + // return ( + //
+ // ); // <-- this is the line that is reported + } + }); + `); }); it("null", () => { @@ -321,11 +362,11 @@ describe("babylon-to-esprima", () => { }); it("regexp in a template string", () => { - parseAndAssertSame("`${/\\d/.exec(\"1\")[0]}`"); + parseAndAssertSame('`${/\\d/.exec("1")[0]}`'); }); it("first line is empty", () => { - parseAndAssertSame("\nimport Immutable from \"immutable\";"); + parseAndAssertSame('\nimport Immutable from "immutable";'); }); it("empty", () => { @@ -333,87 +374,77 @@ describe("babylon-to-esprima", () => { }); it("jsdoc", () => { - parseAndAssertSame( - unpad(` - /** - * @param {object} options - * @return {number} - */ - const test = function({ a, b, c }) { - return a + b + c; - }; - module.exports = test; - `) - ); + parseAndAssertSame(` + /** + * @param {object} options + * @return {number} + */ + const test = function({ a, b, c }) { + return a + b + c; + }; + module.exports = test; + `); }); it("empty block with comment", () => { - parseAndAssertSame( - unpad(` - function a () { - try { - return b(); - } catch (e) { - // asdf - } + parseAndAssertSame(` + function a () { + try { + b(); + } catch (e) { + // asdf } - `) - ); + } + `); }); - describe("babel 6 tests", () => { + describe("babel tests", () => { it("MethodDefinition", () => { - parseAndAssertSame( - unpad(` - export default class A { - a() {} - } - `) - ); + parseAndAssertSame(` + export default class A { + a() {} + } + `); }); it("MethodDefinition 2", () => { - parseAndAssertSame("export default class Bar { get bar() { return 42; }}"); + parseAndAssertSame( + "export default class Bar { get bar() { return 42; }}" + ); }); it("ClassMethod", () => { - parseAndAssertSame( - unpad(` - class A { - constructor() { - } + parseAndAssertSame(` + class A { + constructor() { } - `) - ); + } + `); }); it("ClassMethod multiple params", () => { - parseAndAssertSame( - unpad(` - class A { - constructor(a, b, c) { - } + parseAndAssertSame(` + class A { + constructor(a, b, c) { } - `) - ); + } + `); }); it("ClassMethod multiline", () => { - parseAndAssertSame( - unpad(` - class A { - constructor ( - a, - b, - c - ) + parseAndAssertSame(` + class A { + constructor ( + a, + b, + c + ) - { + { - } } - `) - ); + } + `); }); it("ClassMethod oneline", () => { @@ -421,19 +452,17 @@ describe("babylon-to-esprima", () => { }); it("ObjectMethod", () => { - parseAndAssertSame( - unpad(` - var a = { - b(c) { - } + parseAndAssertSame(` + var a = { + b(c) { } - `) - ); + } + `); }); it("do not allow import export everywhere", () => { assert.throws(() => { - parseAndAssertSame("function F() { import a from \"a\"; }"); + parseAndAssertSame('function F() { import a from "a"; }'); }, /SyntaxError: 'import' and 'export' may only appear at the top level/); }); @@ -442,7 +471,7 @@ describe("babylon-to-esprima", () => { }); it("super outside method", () => { - parseAndAssertSame("function F() { return super(); }"); + parseAndAssertSame("function F() { super(); }"); }); it("StringLiteral", () => { @@ -453,41 +482,35 @@ describe("babylon-to-esprima", () => { it("getters and setters", () => { parseAndAssertSame("class A { get x ( ) { ; } }"); - parseAndAssertSame( - unpad(` - class A { - get x( - ) - { - ; - } + parseAndAssertSame(` + class A { + get x( + ) + { + ; } - `) - ); + } + `); parseAndAssertSame("class A { set x (a) { ; } }"); - parseAndAssertSame( - unpad(` - class A { - set x(a - ) - { - ; - } + parseAndAssertSame(` + class A { + set x(a + ) + { + ; } - `) - ); - parseAndAssertSame( - unpad(` - var B = { - get x () { - return this.ecks; - }, - set x (ecks) { - this.ecks = ecks; - } - }; - `) - ); + } + `); + parseAndAssertSame(` + var B = { + get x () { + return this.ecks; + }, + set x (ecks) { + this.ecks = ecks; + } + }; + `); }); it("RestOperator", () => { @@ -496,21 +519,27 @@ describe("babylon-to-esprima", () => { parseAndAssertSame("var a = function (...b) {}"); }); - // LightScript: safe spread operator transform breaks this test. - // it("SpreadOperator", () => { - // parseAndAssertSame("var a = { b, ...c }"); - // parseAndAssertSame("var a = [ a, ...b ]"); - // parseAndAssertSame("var a = summa(...b)"); - // }); + it("SpreadOperator", () => { + parseAndAssertSame("var a = { b, ...c }"); + parseAndAssertSame("var a = [ a, ...b ]"); + parseAndAssertSame("var a = sum(...b)"); + }); it("Async/Await", () => { - parseAndAssertSame( - unpad(` - async function a() { - return await 1; - } - `) - ); + parseAndAssertSame(` + async function a() { + await 1; + } + `); }); }); }); + +describe("Public API", () => { + it("exports a parseNoPatch function", () => { + assertImplementsAST( + espree.parse("foo"), + babelEslint.parseNoPatch("foo", {}) + ); + }); +}); diff --git a/test/fixtures/assert-implements-ast.js b/test/fixtures/assert-implements-ast.js new file mode 100644 index 00000000..61e77e21 --- /dev/null +++ b/test/fixtures/assert-implements-ast.js @@ -0,0 +1,41 @@ +// Checks if the source ast implements the target ast. Ignores extra keys on source ast +module.exports = function assertImplementsAST(target, source, path) { + if (!path) { + path = []; + } + + function error(text) { + var err = new Error(`At ${path.join(".")}: ${text}:`); + err.depth = path.length + 1; + throw err; + } + + var typeA = target === null ? "null" : typeof target; + var typeB = source === null ? "null" : typeof source; + if (typeA !== typeB) { + error( + `have different types (${typeA} !== ${typeB}) (${target} !== ${source})` + ); + } else if ( + typeA === "object" && + ["RegExp"].indexOf(target.constructor.name) !== -1 && + target.constructor.name !== source.constructor.name + ) { + error( + `object have different constructors (${target.constructor + .name} !== ${source.constructor.name}` + ); + } else if (typeA === "object") { + var keysTarget = Object.keys(target); + for (var i in keysTarget) { + var key = keysTarget[i]; + path.push(key); + assertImplementsAST(target[key], source[key], path); + path.pop(); + } + } else if (target !== source) { + error( + `are different (${JSON.stringify(target)} !== ${JSON.stringify(source)})` + ); + } +}; diff --git a/test/fixtures/eslint-plugin-import/.eslintrc.yml b/test/fixtures/eslint-plugin-import/.eslintrc.yml new file mode 100644 index 00000000..418b3d0c --- /dev/null +++ b/test/fixtures/eslint-plugin-import/.eslintrc.yml @@ -0,0 +1,11 @@ +root: true + +# babel-eslint +parser: ../../../lib/index.js + +# use eslint-plugin-import +plugins: + - import +rules: + import/no-named-as-default: error + no-unused-vars: error diff --git a/test/fixtures/eslint-plugin-import/a.js b/test/fixtures/eslint-plugin-import/a.js new file mode 100644 index 00000000..e8d96fc4 --- /dev/null +++ b/test/fixtures/eslint-plugin-import/a.js @@ -0,0 +1 @@ +export default function foo() { } diff --git a/test/fixtures/eslint-plugin-import/b.js b/test/fixtures/eslint-plugin-import/b.js new file mode 100644 index 00000000..b3a52f87 --- /dev/null +++ b/test/fixtures/eslint-plugin-import/b.js @@ -0,0 +1 @@ +import foo from './a.js'; diff --git a/test/fixtures/eslint-plugin-import/c.js b/test/fixtures/eslint-plugin-import/c.js new file mode 100644 index 00000000..2beac98f --- /dev/null +++ b/test/fixtures/eslint-plugin-import/c.js @@ -0,0 +1,4 @@ +// @flow +type Foo = {}; + +const FlowTypeButton = ({ }: Foo) => { }; diff --git a/test/fixtures/preprocess-to-patch.js b/test/fixtures/preprocess-to-patch.js new file mode 100644 index 00000000..1dbfc172 --- /dev/null +++ b/test/fixtures/preprocess-to-patch.js @@ -0,0 +1,5 @@ +"use strict" +const babelEslint = require("../..") + +// Apply monkeypatch to eslint-scope. +babelEslint.parse("var x = 0;") diff --git a/test/fixtures/use-eslint-old.js b/test/fixtures/use-eslint-old.js new file mode 100644 index 00000000..e26a39c8 --- /dev/null +++ b/test/fixtures/use-eslint-old.js @@ -0,0 +1,12 @@ +"use strict" + +var Module = require('module'); +var originalRequire = Module.prototype.require; + +// Override to eslint-old +Module.prototype.require = function () { + if (arguments[0] === "eslint") { + arguments[0] = "eslint-old"; + } + return originalRequire.apply(this, arguments); +}; diff --git a/test/integration.js b/test/integration.js index c446ed34..8e93631a 100644 --- a/test/integration.js +++ b/test/integration.js @@ -13,8 +13,8 @@ var errorLevel = 2; var baseEslintOpts = { parser: require.resolve(".."), parserOptions: { - sourceType: "script" - } + sourceType: "script", + }, }; /** @@ -23,7 +23,7 @@ var baseEslintOpts = { * @param object opts * @param function done */ -function lint (opts, done) { +function lint(opts, done) { readFixture(opts.fixture, (err, src) => { if (err) return done(err); done(null, eslint.linter.verify(src, opts.eslint)); @@ -35,14 +35,10 @@ function lint (opts, done) { * @param string|array id * @param function done */ -function readFixture (id, done) { +function readFixture(id, done) { if (Array.isArray(id)) id = path.join.apply(path, id); if (!path.extname(id)) id += ".js"; - fs.readFile( - path.join(paths.fixtures, id), - encoding, - done - ); + fs.readFile(path.join(paths.fixtures, id), encoding, done); } // readFixture @@ -51,7 +47,7 @@ describe("Rules:", () => { }); // describe -function strictSuite () { +function strictSuite() { var ruleId = "strict"; describe("when set to 'never'", () => { @@ -60,19 +56,20 @@ function strictSuite () { }); eslintOpts.rules[ruleId] = [errorLevel, "never"]; - ["global-with", "function-with"].forEach((fixture) => { - it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, - (done) => { - lint({ + ["global-with", "function-with"].forEach(fixture => { + it(`should error on ${fixture.match(/^[^-]+/)[0]} directive`, done => { + lint( + { fixture: ["strict", fixture], eslint: eslintOpts, - }, (err, report) => { + }, + (err, report) => { if (err) return done(err); assert(report[0].ruleId === ruleId); done(); - }); - } - ); + } + ); + }); // it }); }); @@ -80,63 +77,75 @@ function strictSuite () { describe("when set to 'global'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { - rules: {} + rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "global"]; - it("shouldn't error on single global directive", (done) => { - lint({ - fixture: ["strict", "global-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(!report.length); - done(); - }); + it("shouldn't error on single global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(!report.length); + done(); + } + ); }); // it - it("should error twice on global directive: no and function directive: yes", (done) => { - lint({ - fixture: ["strict", "function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - [0, 1].forEach((i) => { - assert(report[i].ruleId === ruleId); - }); - done(); - }); + it("should error twice on global directive: no and function directive: yes", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + assert(report[i].ruleId === ruleId); + }); + done(); + } + ); }); // it - it("should error on function directive", (done) => { - lint({ - fixture: ["strict", "global-with-function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - - // This is to make sure the test fails prior to adapting Babel AST - // directive representation to ESLint format. Otherwise it reports an - // error for missing global directive that masquerades as the expected - // result of the previous assertion. - assert(report[0].nodeType !== "Program"); - done(); - }); + it("should error on function directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + + // This is to make sure the test fails prior to adapting Babel AST + // directive representation to ESLint format. Otherwise it reports an + // error for missing global directive that masquerades as the expected + // result of the previous assertion. + assert(report[0].nodeType !== "Program"); + done(); + } + ); }); // it - it("should error on no directive", (done) => { - lint({ - fixture: ["strict", "none"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - done(); - }); + it("should error on no directive", done => { + lint( + { + fixture: ["strict", "none"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + } + ); }); // it }); @@ -144,108 +153,130 @@ function strictSuite () { describe("when set to 'function'", () => { var eslintOpts = Object.assign({}, baseEslintOpts, { - rules: {} + rules: {}, }); eslintOpts.rules[ruleId] = [errorLevel, "function"]; - it("shouldn't error on single function directive", (done) => { - lint({ - fixture: ["strict", "function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(!report.length); - done(); - }); + it("shouldn't error on single function directive", done => { + lint( + { + fixture: ["strict", "function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(!report.length); + done(); + } + ); }); // it - it("should error twice on function directive: no and global directive: yes", (done) => { - lint({ - fixture: ["strict", "global-with-function-without"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - [0, 1].forEach((i) => { - assert(report[i].ruleId === ruleId); - }); - done(); - }); + it("should error twice on function directive: no and global directive: yes", done => { + lint( + { + fixture: ["strict", "global-with-function-without"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + [0, 1].forEach(i => { + assert(report[i].ruleId === ruleId); + }); + done(); + } + ); }); // it - it("should error on only global directive", (done) => { - lint({ - fixture: ["strict", "global-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - done(); - }); + it("should error on only global directive", done => { + lint( + { + fixture: ["strict", "global-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + done(); + } + ); }); // it - it("should error on extraneous global directive", (done) => { - lint({ - fixture: ["strict", "global-with-function-with"], - eslint: eslintOpts, - }, (err, report) => { - if (err) return done(err); - assert(report[0].ruleId === ruleId); - assert(report[0].nodeType.indexOf("Function") === -1); - done(); - }); + it("should error on extraneous global directive", done => { + lint( + { + fixture: ["strict", "global-with-function-with"], + eslint: eslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(report[0].ruleId === ruleId); + assert(report[0].nodeType.indexOf("Function") === -1); + done(); + } + ); }); // it }); // describe - describe("When \"codeFrame\"", () => { + describe('When "codeFrame"', () => { // Strip chalk colors, these are not relevant for the test - const stripAnsi = (str) => str.replace( - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - "" - ); - - it("should display codeFrame when option is absent", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: baseEslintOpts - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - }); + const stripAnsi = str => + str.replace( + /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, + "" + ); + + it("should display codeFrame when option is absent", done => { + lint( + { + fixture: ["syntax-error"], + eslint: baseEslintOpts, + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + } + ); }); - it("should display codeFrame when option is true", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: true - } - }) - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); - done(); - }); + it("should display codeFrame when option is true", done => { + lint( + { + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: true, + }, + }), + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") > -1); + done(); + } + ); }); - it("should not display codeFrame when option is false", (done) => { - lint({ - fixture: ["syntax-error"], - eslint: Object.assign({}, baseEslintOpts, { - parserOptions: { - codeFrame: false - } - }) - }, (err, report) => { - if (err) return done(err); - assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); - done(); - }); + it("should not display codeFrame when option is false", done => { + lint( + { + fixture: ["syntax-error"], + eslint: Object.assign({}, baseEslintOpts, { + parserOptions: { + codeFrame: false, + }, + }), + }, + (err, report) => { + if (err) return done(err); + assert(stripAnsi(report[0].message).indexOf("^\n 5 |") === -1); + done(); + } + ); }); }); } diff --git a/test/non-regression.js b/test/non-regression.js index a4ad1728..4c43b29f 100644 --- a/test/non-regression.js +++ b/test/non-regression.js @@ -3,23 +3,30 @@ var eslint = require("eslint"); var unpad = require("dedent"); -function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, overrideConfig) { +function verifyAndAssertMessagesWithSpecificESLint( + code, + rules, + expectedMessages, + sourceType, + overrideConfig, + linter +) { var config = { parser: require.resolve(".."), rules, env: { node: true, - es6: true + es6: true, }, parserOptions: { - ecmaVersion: 8, + ecmaVersion: 2018, ecmaFeatures: { jsx: true, experimentalObjectRestSpread: true, - globalReturn: true + globalReturn: true, }, - sourceType - } + sourceType, + }, }; if (overrideConfig) { @@ -28,565 +35,175 @@ function verifyAndAssertMessages(code, rules, expectedMessages, sourceType, over } } - var messages = eslint.linter.verify(code, config); + var messages = linter.verify(code, config); if (messages.length !== expectedMessages.length) { - throw new Error(`Expected ${expectedMessages.length} message(s), got ${messages.length}\n${JSON.stringify(messages, null, 2)}`); + throw new Error( + `Expected ${expectedMessages.length} message(s), got ${ + messages.length + }\n${JSON.stringify(messages, null, 2)}` + ); } messages.forEach((message, i) => { - // strip code frame - var messageText = (!message.ruleId && /\n\n/.test(message.message)) - ? message.message.split("\n\n")[0] - : message.message; - - var formatedMessage = `${message.line}:${message.column} ${messageText}${(message.ruleId ? ` ${message.ruleId}` : "")}`; + var formatedMessage = `${message.line}:${message.column} ${ + message.message + }${message.ruleId ? ` ${message.ruleId}` : ""}`; if (formatedMessage !== expectedMessages[i]) { throw new Error( - unpad(` + ` Message ${i} does not match: Expected: ${expectedMessages[i]} Actual: ${formatedMessage} - `) + ` ); } }); } -describe("verify", () => { - describe("lightscript", () => { - it("basic skinny arrow", () => { - verifyAndAssertMessages( - "() -> 1", - {}, - [] - ); - }); - - it("let and now", () => { - verifyAndAssertMessages( - "let x; now x = 1;", - {}, - [] - ); - }); - - it("wrongly shadowed", () => { - verifyAndAssertMessages( - "x = 1; if (true) { x = 2 }", - {}, - [ "1:20 Parsing error: unknown: `x` is shadowed from a higher scope. If you want to reassign the variable, use `now x = ...`. If you want to declare a new shadowed `const` variable, you must use `const x = ...` explicitly." ] - ); - }); - - it("named arrow function", () => { - verifyAndAssertMessages( - "x() -> 1", - {}, - [] - ); - }); - - it("assign arrow to var", () => { - verifyAndAssertMessages( - "a = b -> b; a", - { "no-undef": 2, "no-unused-vars": 2 }, - [] - ); - }); - - it("ForInArrayStatement", () => { - verifyAndAssertMessages( - "for idx i, elem x in []: (i, x)", - { "no-undef": 2 }, - [] - ); - }); - it("ForInArrayStatement destructure", () => { - verifyAndAssertMessages( - "for idx i, elem { a, b } in []: (i, a, b)", - { "no-undef": 2 }, - [] - ); - }); - it("ForInArrayStatement no idx", () => { - verifyAndAssertMessages( - "for elem x in []: x", - { "no-undef": 2 }, - [] - ); - }); - it("ForInObjectStatement", () => { - verifyAndAssertMessages( - "for key k, val v in {}: (k, v)", - { "no-undef": 2 }, - [] - ); - }); - it("ForInObjectStatement no key", () => { - verifyAndAssertMessages( - "for val v in {}: v", - { "no-undef": 2 }, - [] - ); - }); - it("ArrayComprehension", () => { - verifyAndAssertMessages( - "[...for const x of arr: x]", - {}, - [] - ); - }); - - it("IfExpression", () => { - verifyAndAssertMessages( - unpad(` -y = if d: e -x = if a: b else: c - `), - {}, - [] - ); - }); - it("ObjectComprehension", () => { - verifyAndAssertMessages( - "{...for idx i, elem x in arr: ({[i]: x})}", - {}, - [] - ); - }); - it("TildeCallExpression", () => { - verifyAndAssertMessages( - "x~y(z)", - {}, - [] - ); - }); - it("NamedArrowDeclaration", () => { - verifyAndAssertMessages( - "x(y) -> y + 1", - {}, - [] - ); - }); - it("NamedArrowExpression", () => { - verifyAndAssertMessages( - "f(g(h) -> h)", - {}, - [] - ); - }); - it("NamedArrowMemberExpression", () => { - verifyAndAssertMessages( - "x.y(z) -> z", - {}, - [] - ); - }); - it("IfExpression", () => { - verifyAndAssertMessages( - "if true { 1 } elif false { 2 } else { 3 }", - {}, - [] - ); - }); - it("SafeAwaitExpression", () => { - verifyAndAssertMessages( - "f() =/> { x { { - verifyAndAssertMessages( - "x?.y", - {}, - [] - ); - verifyAndAssertMessages( - "a?[b]", - {}, - [] - ); - }); - - it("ExistentialExpression", () => { - verifyAndAssertMessages( - unpad(` -'use @oigroup/lightscript with existential' -x? - `), - {}, - [] - ); - }); - - it("SafeCallExpression", () => { - verifyAndAssertMessages( - "a?(b, c)", - {}, - [] - ); - }); - - it("tilde-call uses variable", () => { - verifyAndAssertMessages( - "x() -> 1; 2~x()", - { "no-unused-vars": 2 }, - [] - ); - }); - - it("MatchStatement", () => { - verifyAndAssertMessages( - unpad(` -match 1 { - | 1: true - | 2 with { x }: x - | 3 as { y } if y > 2: y - | else: false -} - `), - { "no-undef": 2, "no-unused-vars": 2 }, - [] - ); - }); - - it("MatchExpression", () => { - verifyAndAssertMessages( - unpad(` -z = match 1 { - | 1: true - | 2 with { x }: x - | 3 as { y } if y > 2: y - | else: false +function verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig +) { + verifyAndAssertMessagesWithSpecificESLint( + unpad(`${code}`), + rules || {}, + expectedMessages || [], + sourceType, + overrideConfig, + new eslint.Linter() + ); } - `), - { "no-undef": 2 }, - [] - ); - }); - - it("crash no-unexpected-multiline", () => { - verifyAndAssertMessages( - unpad(` -a = b -> c - `), - { "arrow-spacing": 1 }, - [] - ); - }); - - it("crash 2", () => { - verifyAndAssertMessages( - unpad(` - x = 3 - - Predicate() - - - match x: - | ~Predicate(): x - `), - { "no-unexpected-multiline": 1 }, - [] - ); - }); - - it("crash regex-linting", () => { - verifyAndAssertMessages( - unpad(` - // comment - import { ReduxComponent, action, selector } from 'redux-components' - { assign } = Object - - initialState = { compiler: 'latest' } - - export default class Config extends ReduxComponent: - static verbs = ['SET_COMPILER', 'SET_FEATURES', 'SET_PLUGINS', 'SET_OPTIONS'] - - reducer(state = initialState, action) -> - match action.type: - | this.SET_COMPILER: ({}~assign(state, { compiler: action.payload })) - | this.SET_FEATURES: ({}~assign(state, { features: action.payload })) - | this.SET_PLUGINS: ({}~assign(state, { plugins: action.payload })) - | this.SET_OPTIONS: ({}~assign(state, { options: action.payload })) - | else: state - - @action({isDispatcher: true}) - setCompiler(value) -> - ({ type: this.SET_COMPILER, payload: value }) - - @action({isDispatcher: true}) - setPlugins(value) -> - ({ type: this.SET_PLUGINS, payload: value }) - - @action({isDispatcher: true}) - setFeatures(value) -> - ({ type: this.SET_FEATURES, payload: value }) - - @action({isDispatcher: true}) - setOptions(value) -> - ({ type: this.SET_OPTIONS, payload: value }) - - @selector({isObservable: true}) - get(state) -> state - `), - { "no-empty-character-class": 1, "no-regex-spaces": 1 }, - [] - ); - }); - - it("crash no-extra-semi", () => { - verifyAndAssertMessages( - unpad(` - class C: - get(state) -> state - `), - { "no-extra-semi": 1 }, - [] - ); - }); - - it("for idx unused", () => { - verifyAndAssertMessages( - unpad(` - for idx i, elem e in arr: - e - `), - { "no-unused-vars": 1 }, - ["1:9 'i' is assigned a value but never used. no-unused-vars"] - ); - }); - - it("no-unexpected-multiline false positive", () => { - verifyAndAssertMessages( - unpad(` - [...for idx i, elem e in arr: - e - ] - `), - { "no-unexpected-multiline": 1 }, - [] - ); - }); - - it("false positive no-unused-vars", () => { - verifyAndAssertMessages( - unpad(` - match x: - | with [a] if a > 2: true - `), - { "no-unused-vars": 2 }, - [] - ); - }); - - it("config directives", () => { - verifyAndAssertMessages( - unpad(` - 'use @oigroup/lightscript' - a - .b - `), - {}, - ["3:1 Parsing error: Indentation required."] - ); - }); - - it("placeholder args", () => { - verifyAndAssertMessages( - unpad(` - 'use @oigroup/lightscript with placeholderArgs' - x = -> [_, ..._] - y = -> [_0, ..._] - `), - { "no-undef": 2 }, - [] - ); - }); - - it("no-else-return disabled", () => { - verifyAndAssertMessages( - unpad(` - f() -> - if true: - { three: 3 } - else: - {} - `), - { "no-else-return": 2 }, - [] - ); - }); - - //////////// end lsc tests - }); +describe("verify", () => { it("arrow function support (issue #1)", () => { - verifyAndAssertMessages( - "describe('stuff', () => {});", - {}, - [] - ); + verifyAndAssertMessages("describe('stuff', () => {});"); }); it("EOL validation (issue #2)", () => { verifyAndAssertMessages( - "module.exports = \"something\";", - { "eol-last": 1, "semi": 1 }, - [ "1:30 Newline required at end of file but not found. eol-last" ] + 'module.exports = "something";', + { "eol-last": 1, semi: 1 }, + ["1:30 Newline required at end of file but not found. eol-last"] ); }); xit("Readable error messages (issue #3)", () => { - verifyAndAssertMessages( - "{ , res }", - {}, - [ "1:3 Parsing error: Unexpected token" ] - ); + verifyAndAssertMessages("{ , res }", {}, [ + "1:3 Parsing error: Unexpected token", + ]); }); it("Modules support (issue #5)", () => { verifyAndAssertMessages( - unpad(` + ` import Foo from 'foo'; export default Foo; export const c = 'c'; export class Store {} - `), - {}, - [] + ` ); }); it("Rest parameters (issue #7)", () => { - verifyAndAssertMessages( - "function foo(...args) { return args; }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("function foo(...args) { return args; }", { + "no-undef": 1, + }); }); it("Exported classes should be used (issue #8)", () => { - verifyAndAssertMessages( - "class Foo {} module.exports = Foo;", - { "no-unused-vars": 1 }, - [] - ); + verifyAndAssertMessages("class Foo {} module.exports = Foo;", { + "no-unused-vars": 1, + }); }); it("super keyword in class (issue #10)", () => { - verifyAndAssertMessages( - "class Foo { constructor() { super() } }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("class Foo { constructor() { super() } }", { + "no-undef": 1, + }); }); it("Rest parameter in destructuring assignment (issue #11)", () => { verifyAndAssertMessages( "const [a, ...rest] = ['1', '2', '3']; module.exports = rest;", - { "no-undef": 1 }, - [] + { "no-undef": 1 } ); }); it("JSX attribute names marked as variables (issue #12)", () => { - verifyAndAssertMessages( - "module.exports =
", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages('module.exports =
', { + "no-undef": 1, + }); }); it("Multiple destructured assignment with compound properties (issue #16)", () => { - verifyAndAssertMessages( - "module.exports = { ...a.a, ...a.b };", - { "no-dupe-keys": 1 }, - [] - ); + verifyAndAssertMessages("module.exports = { ...a.a, ...a.b };", { + "no-dupe-keys": 1, + }); }); it("Arrow function with non-block bodies (issue #20)", () => { verifyAndAssertMessages( - "\"use strict\"; () => 1", - { "strict": [1, "global"] }, + '"use strict"; () => 1', + { strict: [1, "global"] }, [], "script" ); }); it("#242", () => { - verifyAndAssertMessages( - "\"use strict\"; asdf;", - { "no-irregular-whitespace": 1 }, - [], - {} - ); + verifyAndAssertMessages('"use strict"; asdf;', { + "no-irregular-whitespace": 1, + }); }); it("await keyword (issue #22)", () => { - verifyAndAssertMessages( - "async function foo() { await bar(); }", - { "no-unused-expressions": 1 }, - [] - ); + verifyAndAssertMessages("async function foo() { await bar(); }", { + "no-unused-expressions": 1, + }); }); it("arrow functions (issue #27)", () => { - verifyAndAssertMessages( - "[1, 2, 3].map(i => i * 2);", - { "func-names": 1, "space-before-blocks": 1 }, - [] - ); + verifyAndAssertMessages("[1, 2, 3].map(i => i * 2);", { + "func-names": 1, + "space-before-blocks": 1, + }); }); it("comment with padded-blocks (issue #33)", () => { verifyAndAssertMessages( - unpad(` + ` if (a) { // i'm a comment! let b = c } - `), - { "padded-blocks": [1, "never"] }, - [] + `, + { "padded-blocks": [1, "never"] } ); }); describe("flow", () => { it("check regular function", () => { verifyAndAssertMessages( - "function a(b, c) { now b += 1; now c += 1; return b + c; } a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + "function a(b, c) { b += 1; c += 1; return b + c; } a;", + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias", () => { - verifyAndAssertMessages( - "type SomeNewType = any;", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("type SomeNewType = any;", { "no-undef": 1 }); }); it("type cast expression #102", () => { - verifyAndAssertMessages( - "for (let a of (a: Array)) {}", - {}, - [] - ); + verifyAndAssertMessages("for (let a of (a: Array)) {}"); }); it("multiple nullable type annotations and return #108", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; @@ -594,198 +211,205 @@ a = b -> c console.log(foo, foo2); } log(1, 2); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("interface declaration", () => { verifyAndAssertMessages( - unpad(` + ` interface Foo {}; interface Bar { foo: Foo, }; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:11 'Bar' is defined but never used. no-unused-vars" ] + ["2:11 'Bar' is defined but never used. no-unused-vars"] ); }); it("type parameter bounds (classes)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2} from 'foo'; import Base from 'base'; class Log extends Base { messages: {[T1]: T2}; } new Log(); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "3:34 'T4' is defined but never used. no-unused-vars" ] + ["3:34 'T4' is defined but never used. no-unused-vars"] ); }); it("type parameter scope (classes)", () => { verifyAndAssertMessages( - unpad(` + ` T; class Foo {} T; new Foo(); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:11 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); it("type parameter bounds (interfaces)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2, Bar} from ''; interface Log extends Bar { messages: {[T1]: T2}; } - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:11 'Log' is defined but never used. no-unused-vars", - "2:38 'T4' is defined but never used. no-unused-vars" ] + [ + "2:11 'Log' is defined but never used. no-unused-vars", + "2:38 'T4' is defined but never used. no-unused-vars", + ] ); }); it("type parameter scope (interfaces)", () => { verifyAndAssertMessages( - unpad(` + ` T; interface Foo {}; T; Foo; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:15 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); it("type parameter bounds (type aliases)", () => { verifyAndAssertMessages( - unpad(` + ` import type {Foo, Foo2, Foo3} from 'foo'; type Log = { messages: {[T1]: T2}; delay: Foo3; }; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:6 'Log' is defined but never used. no-unused-vars", - "2:29 'T3' is defined but never used. no-unused-vars" ] + [ + "2:6 'Log' is defined but never used. no-unused-vars", + "2:29 'T3' is defined but never used. no-unused-vars", + ] ); }); it("type parameter scope (type aliases)", () => { verifyAndAssertMessages( - unpad(` + ` T; type Foo = {}; T; Foo; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:10 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); it("type parameter bounds (functions)", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; function log(a: T1, b: T2): T3 { return a + b; } log(1, 2); - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "3:37 'T4' is defined but never used. no-unused-vars" ] + ["3:37 'T4' is defined but never used. no-unused-vars"] ); }); it("type parameter scope (functions)", () => { verifyAndAssertMessages( - unpad(` + ` T; function log() {} T; log; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:1 'T' is not defined. no-undef", + [ + "1:1 'T' is not defined. no-undef", "2:14 'T' is defined but never used. no-unused-vars", - "3:1 'T' is not defined. no-undef" ] + "3:1 'T' is not defined. no-undef", + ] ); }); it("nested type annotations", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; function foo(callback: () => Foo) { return callback(); } foo(); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type in var declaration", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var x: Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("object type annotation", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: {numVal: Foo}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("object property types", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a = { circle: (null : ?{ setNativeProps(props: Foo): Foo2 }) }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("namespaced types", () => { verifyAndAssertMessages( - unpad(` + ` var React = require('react-native'); var b = { openExternalExample: (null: ?React.Component) @@ -795,798 +419,774 @@ a = b -> c }; b; c; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("ArrayTypeAnnotation", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var x: Foo[]; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("ClassImplements", () => { verifyAndAssertMessages( - unpad(` + ` import type Bar from 'foo'; export default class Foo implements Bar {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias creates declaration + usage", () => { verifyAndAssertMessages( - unpad(` + ` type Foo = any; var x : Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("type alias with type parameters", () => { verifyAndAssertMessages( - unpad(` + ` import type Bar from 'foo'; import type Foo3 from 'foo'; type Foo = Bar var x : Foo = 1; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("export type alias", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo2 from 'foo'; export type Foo = Foo2; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); - it("polymorphpic types #109", () => { + it("polymorphic types #109", () => { verifyAndAssertMessages( "export default function groupByEveryN(array: Array, n: number): Array> { n; }", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("types definition from import", () => { verifyAndAssertMessages( - unpad(` + ` import type Promise from 'bluebird'; type Operation = () => Promise; - let x = null; - (x: Operation); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + x: Operation; + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); - it("polymorphpic/generic types for class #123", () => { + it("polymorphic/generic types for class #123", () => { verifyAndAssertMessages( - unpad(` + ` class Box { value: T; } var box = new Box(); console.log(box.value); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); - it("polymorphpic/generic types for function #123", () => { + it("polymorphic/generic types for function #123", () => { verifyAndAssertMessages( - unpad(` + ` export function identity(value) { var a: T = value; a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); - it("polymorphpic/generic types for type alias #123", () => { + it("polymorphic/generic types for type alias #123", () => { verifyAndAssertMessages( - unpad(` + ` import Bar from './Bar'; type Foo = Bar; var x: Foo = 1; console.log(x); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); - it("polymorphpic/generic types - outside of fn scope #123", () => { + it("polymorphic/generic types - outside of fn scope #123", () => { verifyAndAssertMessages( - unpad(` + ` export function foo(value) { value; }; var b: T = 1; b; - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "1:21 'T' is defined but never used. no-unused-vars", - "2:8 'T' is not defined. no-undef" ] + [ + "1:21 'T' is defined but never used. no-unused-vars", + "2:8 'T' is not defined. no-undef", + ] ); }); - it("polymorphpic/generic types - extending unknown #123", () => { + it("polymorphic/generic types - extending unknown #123", () => { verifyAndAssertMessages( - unpad(` + ` import Bar from 'bar'; export class Foo extends Bar {} - `), + `, { "no-unused-vars": 1, "no-undef": 1 }, - [ "2:30 'T' is not defined. no-undef" ] + ["2:30 'T' is not defined. no-undef"] + ); + }); + + it("polymorphic/generic types - function calls", () => { + verifyAndAssertMessages( + ` + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 }, + ["2:3 'T' is not defined. no-undef"] + ); + }); + + it("polymorphic/generic types - function calls #644", () => { + verifyAndAssertMessages( + ` + import type {Type} from 'Type'; + function f(): T {} + f(); + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("support declarations #132", () => { verifyAndAssertMessages( - unpad(` + ` declare class A { static () : number } declare module B { declare var x: number; } declare function foo(): void; declare var bar A; B; foo(); bar; - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("supports type spreading", () => { verifyAndAssertMessages( - unpad(` + ` type U = {}; type T = {a: number, ...U, ...V}; - `), + `, { "no-undef": 1, "no-unused-vars": 1 }, - [ "2:6 'T' is defined but never used. no-unused-vars", - "2:31 'V' is not defined. no-undef" ] + [ + "2:6 'T' is defined but never used. no-unused-vars", + "2:31 'V' is not defined. no-undef", + ] ); }); it("1", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: Foo, b: ?Foo2, c){ a; b; c; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("2", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function(a: () => Foo){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("3", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_:Foo) => Foo2){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("4", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; export default function(a: (_1:Foo, _2:Foo2) => Foo3){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("5", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function(a: (_1:Foo, ...foo:Array) => number){ a; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("6", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function(): Foo {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("7", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function():() => Foo {} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("8", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default function():(_?:Foo) => Foo2{} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("9", () => { verifyAndAssertMessages( "export default function (a: T1, b: T2) { b; }", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("10", () => { verifyAndAssertMessages( "var a=function(a: T1, b: T2) {return a + b;}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("11", () => { - verifyAndAssertMessages( - "var a={*id(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={*id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("12", () => { - verifyAndAssertMessages( - "var a={async id(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={async id(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("13", () => { - verifyAndAssertMessages( - "var a={123(x: T): T { x; }}; a;", - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("var a={123(x: T): T { x; }}; a;", { + "no-unused-vars": 1, + "no-undef": 1, + }); }); it("14", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar {set fooProp(value:Foo):Foo2{ value; }} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("15", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo2 from 'foo'; export default class Foo {get fooProp(): Foo2{}} - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("16", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var numVal:Foo; numVal; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("17", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: {numVal: Foo;}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("18", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: ?{numVal: Foo; [indexer: Foo2]: Foo3}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("19", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: {numVal: Foo; subObj?: ?{strVal: Foo2}}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("20", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: { [a: Foo]: Foo2; [b: Foo3]: Foo4; }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("21", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: {add(x:Foo, ...y:Array): Foo3}; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("22", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a: { id(x: Foo2): Foo3; }; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("23", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a:Array = [1, 2, 3]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("24", () => { verifyAndAssertMessages( - unpad(` + ` import type Baz from 'baz'; export default class Bar extends Baz { }; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("25", () => { verifyAndAssertMessages( "export default class Bar { bar(): T { return 42; }}", - { "no-unused-vars": 1, "no-undef": 1 }, - [] + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("26", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; export default class Bar { static prop1:Foo; prop2:Foo2; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("27", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : Foo | Foo2 = 4; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("28", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x : () => Foo | () => Foo2; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("29", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var x: typeof Foo | number = Foo2; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("30", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var {x}: {x: Foo; } = { x: 'hello' }; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("31", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var [x]: Array = [ 'hello' ]; x; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("32", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; export default function({x}: { x: Foo; }) { x; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("33", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; function foo([x]: Array) { x; } foo(); - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("34", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a: Map >; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("35", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: ?Promise[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("36", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; var a:(...rest:Array) => Foo2; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("37", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; import type Foo4 from 'foo'; var a: (x: Foo2, ...y:Foo3[]) => Foo4; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("38", () => { verifyAndAssertMessages( - unpad(` + ` import type {foo, bar} from 'baz'; foo; bar; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("39", () => { verifyAndAssertMessages( - unpad(` + ` import type {foo as bar} from 'baz'; bar; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("40", () => { verifyAndAssertMessages( - unpad(` + ` import type from 'foo'; type; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("41", () => { verifyAndAssertMessages( - unpad(` + ` import type, {foo} from 'bar'; type; foo; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] - ); - }); - - it("42", () => { - verifyAndAssertMessages( - unpad(` - import type * as namespace from 'bar'; - namespace; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("43", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("44", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: ?Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("45", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: (?Foo)[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("46", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: () => Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("47", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: (() => Foo)[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("48", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; var a: typeof Foo[]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("49", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'foo'; import type Foo2 from 'foo'; import type Foo3 from 'foo'; var a : [Foo, Foo2,] = [123, 'duck',]; a; - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); }); it("class usage", () => { - verifyAndAssertMessages( - "class Lol {} module.exports = Lol;", - { "no-unused-vars": 1 }, - [] - ); + verifyAndAssertMessages("class Lol {} module.exports = Lol;", { + "no-unused-vars": 1, + }); }); it("class definition: gaearon/redux#24", () => { verifyAndAssertMessages( - unpad(` + ` export default function root(stores) { return DecoratedComponent => class ReduxRootDecorator { a() { DecoratedComponent; stores; } }; } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("class properties #71", () => { - verifyAndAssertMessages( - "class Lol { foo = 'bar'; }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("class Lol { foo = 'bar'; }", { "no-undef": 1 }); }); it("template strings #31", () => { - verifyAndAssertMessages( - "console.log(`${a}, b`);", - { "comma-spacing": 1 }, - [] - ); + verifyAndAssertMessages("console.log(`${a}, b`);", { "comma-spacing": 1 }); }); it("template with destructuring #31", () => { verifyAndAssertMessages( - unpad(` + ` module.exports = { render() { var {name} = this.props; return Math.max(null, \`Name: \${name}, Name: \${name}\`); } }; - `), - { "comma-spacing": 1 }, + `, + { "comma-spacing": 1 } + ); + }); + + it("template with arrow returning template #603", () => { + verifyAndAssertMessages( + ` + var a = \`\${() => { + \`\${''}\` + }}\`; + `, + { indent: 1 }, [] ); }); - describe("decorators #72", () => { + describe("decorators #72 (legacy)", () => { + function verifyDecoratorsLegacyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType + ) { + const overrideConfig = { + parserOptions: { + ecmaFeatures: { + legacyDecorators: true, + }, + sourceType, + }, + }; + return verifyAndAssertMessages( + code, + rules, + expectedMessages, + sourceType, + overrideConfig + ); + } + it("class declaration", () => { - verifyAndAssertMessages( - unpad(` + verifyDecoratorsLegacyAndAssertMessages( + ` import classDeclaration from 'decorator'; import decoratorParameter from 'decorator'; @classDeclaration((parameter) => parameter) @classDeclaration(decoratorParameter) @classDeclaration export class TextareaAutosize {} - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("method definition", () => { - verifyAndAssertMessages( - unpad(` + verifyDecoratorsLegacyAndAssertMessages( + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @@ -1597,15 +1197,14 @@ a = b -> c e(); } } - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("method definition get/set", () => { - verifyAndAssertMessages( - unpad(` + verifyDecoratorsLegacyAndAssertMessages( + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; export class TextareaAutosize { @@ -1618,15 +1217,14 @@ a = b -> c @classMethodDeclarationA set bar(val) { val; } } - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("object property", () => { - verifyAndAssertMessages( - unpad(` + verifyDecoratorsLegacyAndAssertMessages( + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @@ -1638,15 +1236,14 @@ a = b -> c } }; obj; - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } ); }); it("object property get/set", () => { - verifyAndAssertMessages( - unpad(` + verifyDecoratorsLegacyAndAssertMessages( + ` import classMethodDeclarationA from 'decorator'; import decoratorParameter from 'decorator'; var obj = { @@ -1660,19 +1257,71 @@ a = b -> c set bar(val) { val; } }; obj; - `), - { "no-unused-vars": 1 }, - [] + `, + { "no-unused-vars": 1 } + ); + }); + }); + + describe("decorators #72", () => { + it("class declaration", () => { + verifyAndAssertMessages( + ` + import classDeclaration from 'decorator'; + import decoratorParameter from 'decorator'; + export + @classDeclaration((parameter) => parameter) + @classDeclaration(decoratorParameter) + @classDeclaration + class TextareaAutosize {} + `, + { "no-unused-vars": 1 } + ); + }); + + it("method definition", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + methodDeclaration(e) { + e(); + } + } + `, + { "no-unused-vars": 1 } + ); + }); + + it("method definition get/set", () => { + verifyAndAssertMessages( + ` + import classMethodDeclarationA from 'decorator'; + import decoratorParameter from 'decorator'; + export class TextareaAutosize { + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + get bar() { } + @classMethodDeclarationA((parameter) => parameter) + @classMethodDeclarationA(decoratorParameter) + @classMethodDeclarationA + set bar(val) { val; } + } + `, + { "no-unused-vars": 1 } ); }); }); it("detects minimal no-unused-vars case #120", () => { - verifyAndAssertMessages( - "var unused;", - { "no-unused-vars": 1 }, - [ "1:5 'unused' is defined but never used. no-unused-vars" ] - ); + verifyAndAssertMessages("var unused;", { "no-unused-vars": 1 }, [ + "1:5 'unused' is defined but never used. no-unused-vars", + ]); }); // This two tests are disabled, as the feature to visit properties when @@ -1681,40 +1330,35 @@ a = b -> c it.skip("visits excluded properties left of spread #95", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-unused-vars": 1 }, - [] + { "no-unused-vars": 1 } ); }); it.skip("visits excluded properties left of spread #210", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-unused-vars": 1 }, - [] + { "no-unused-vars": 1 } ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-undef": 1, "no-redeclare": 1 }, - [] + { "no-undef": 1, "no-redeclare": 1 } ); }); it("does not mark spread variables false-positive", () => { verifyAndAssertMessages( "const props = { yo: 'yo' }; const { ...otherProps } = props;", - { "no-undef": 1, "no-redeclare": 1 }, - [] + { "no-undef": 1, "no-redeclare": 1 } ); }); it("does not mark spread variables as use-before-define #249", () => { verifyAndAssertMessages( "var originalObject = {}; var {field1, field2, ...clone} = originalObject;", - { "no-use-before-define": 1 }, - [] + { "no-use-before-define": 1 } ); }); @@ -1722,61 +1366,54 @@ a = b -> c verifyAndAssertMessages( "const {Bacona} = require('baconjs')", { "no-undef": 1, "no-unused-vars": 1 }, - [ "1:8 'Bacona' is assigned a value but never used. no-unused-vars" ] + ["1:8 'Bacona' is assigned a value but never used. no-unused-vars"] ); }); it("don't warn no-unused-vars with spread #142", () => { verifyAndAssertMessages( - unpad(` + ` export default function test(data) { return { foo: 'bar', ...data }; } - `), - { "no-undef": 1, "no-unused-vars": 1 }, - [] + `, + { "no-undef": 1, "no-unused-vars": 1 } ); }); it("excludes comment tokens #153", () => { verifyAndAssertMessages( - unpad(` + ` var a = [ 1, 2, // a trailing comment makes this line fail comma-dangle (always-multiline) ]; - `), - { "comma-dangle": [2, "always-multiline"] }, - [] + `, + { "comma-dangle": [2, "always-multiline"] } ); verifyAndAssertMessages( - unpad(` + ` switch (a) { // A comment here makes the above line fail brace-style case 1: console.log(a); } - `), - { "brace-style": 2 }, - [] + `, + { "brace-style": 2 } ); }); it("ternary and parens #149", () => { - verifyAndAssertMessages( - "true ? (true) : false;", - { "space-infix-ops": 1 }, - [] - ); + verifyAndAssertMessages("true ? (true) : false;", { "space-infix-ops": 1 }); }); it("line comment space-in-parens #124", () => { verifyAndAssertMessages( - unpad(` + ` React.createClass({ render() { // return ( @@ -1784,15 +1421,14 @@ a = b -> c // ); // <-- this is the line that is reported } }); - `), - { "space-in-parens": 1 }, - [ ] + `, + { "space-in-parens": 1 } ); }); it("block comment space-in-parens #124", () => { verifyAndAssertMessages( - unpad(` + ` React.createClass({ render() { /* @@ -1802,29 +1438,27 @@ a = b -> c */ } }); - `), - { "space-in-parens": 1 }, - [ ] + `, + { "space-in-parens": 1 } ); }); it("no no-undef error with rest #11", () => { - verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", - { "no-undef": 1, "no-unused-vars": 1 }, - [ ] - ); + verifyAndAssertMessages("const [a, ...rest] = ['1', '2', '3']; a; rest;", { + "no-undef": 1, + "no-unused-vars": 1, + }); }); it("async function with space-before-function-paren #168", () => { - verifyAndAssertMessages("it('handles updates', async function() {});", - { "space-before-function-paren": [1, "never"] }, - [ ] - ); + verifyAndAssertMessages("it('handles updates', async function() {});", { + "space-before-function-paren": [1, "never"], + }); }); it("default param flow type no-unused-vars #184", () => { verifyAndAssertMessages( - unpad(` + ` type ResolveOptionType = { depth?: number, identifier?: string @@ -1835,46 +1469,44 @@ a = b -> c ): Object { options; } - `), - { "no-unused-vars": 1, "no-undef": 1 }, - [ ] + `, + { "no-unused-vars": 1, "no-undef": 1 } ); }); it("no-use-before-define #192", () => { verifyAndAssertMessages( - unpad(` + ` console.log(x); var x = 1; - `), + `, { "no-use-before-define": 1 }, - [ "1:13 'x' was used before it was defined. no-use-before-define" ] + ["1:13 'x' was used before it was defined. no-use-before-define"] ); }); it("jsx and stringliteral #216", () => { - verifyAndAssertMessages( - "
", - {}, - [] - ); + verifyAndAssertMessages("
"); }); it("getter/setter #218", () => { verifyAndAssertMessages( - unpad(` + ` class Person { set a (v) { } } - `), - { "space-before-function-paren": 1, "keyword-spacing": [1, { "before": true }], "indent": 1 }, - [] + `, + { + "space-before-function-paren": 1, + "keyword-spacing": [1, { before: true }], + indent: 1, + } ); }); it("getter/setter #220", () => { verifyAndAssertMessages( - unpad(` + ` var B = { get x () { return this.ecks; @@ -1883,46 +1515,44 @@ a = b -> c this.ecks = ecks; } }; - `), - { "no-dupe-keys": 1 }, - [] + `, + { "no-dupe-keys": 1 } ); }); it("fixes issues with flow types and ObjectPattern", () => { verifyAndAssertMessages( - unpad(` + ` import type Foo from 'bar'; export default class Foobar { foo({ bar }: Foo) { bar; } bar({ foo }: Foo) { foo; } } - `), - { "no-unused-vars": 1, "no-shadow": 1 }, - [] + `, + { "no-unused-vars": 1, "no-shadow": 1 } ); }); it("correctly detects redeclares if in script mode #217", () => { verifyAndAssertMessages( - unpad(` + ` var a = 321; var a = 123; - `), + `, { "no-redeclare": 1 }, - [ "2:5 'a' is already defined. no-redeclare" ], + ["2:5 'a' is already defined. no-redeclare"], "script" ); }); it("correctly detects redeclares if in module mode #217", () => { verifyAndAssertMessages( - unpad(` + ` var a = 321; var a = 123; - `), + `, { "no-redeclare": 1 }, - [ "2:5 'a' is already defined. no-redeclare" ], + ["2:5 'a' is already defined. no-redeclare"], "module" ); }); @@ -1931,11 +1561,13 @@ a = b -> c verifyAndAssertMessages( "var leakedGlobal = 1;", { "no-implicit-globals": 1 }, - [ "1:5 Implicit global variable, assign as global property instead. no-implicit-globals" ], + [ + "1:5 Implicit global variable, assign as global property instead. no-implicit-globals", + ], "script", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "script" } + parserOptions: { ecmaVersion: 6, sourceType: "script" }, } ); }); @@ -1948,7 +1580,7 @@ a = b -> c "module", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module" } + parserOptions: { ecmaVersion: 6, sourceType: "module" }, } ); }); @@ -1961,80 +1593,74 @@ a = b -> c null, { env: {}, - parserOptions: { ecmaVersion: 6 } + parserOptions: { ecmaVersion: 6 }, } ); }); it("allowImportExportEverywhere option (#327)", () => { verifyAndAssertMessages( - unpad(` + ` if (true) { import Foo from 'foo'; } function foo() { import Bar from 'bar'; } switch (a) { case 1: import FooBar from 'foobar'; } - `), + `, {}, [], "module", { env: {}, - parserOptions: { ecmaVersion: 6, sourceType: "module", allowImportExportEverywhere: true } + parserOptions: { + ecmaVersion: 6, + sourceType: "module", + allowImportExportEverywhere: true, + }, } ); }); it("with does not crash parsing in script mode (strict off) #171", () => { - verifyAndAssertMessages( - "with (arguments) { length; }", - {}, - [], - "script" - ); + verifyAndAssertMessages("with (arguments) { length; }", {}, [], "script"); }); xit("with does crash parsing in module mode (strict on) #171", () => { - verifyAndAssertMessages( - "with (arguments) { length; }", - {}, - [ "1:1 Parsing error: 'with' in strict mode" ] - ); + verifyAndAssertMessages("with (arguments) { length; }", {}, [ + "1:1 Parsing error: 'with' in strict mode", + ]); }); it("new.target is not reported as undef #235", () => { - verifyAndAssertMessages( - "function foo () { return new.target }", - { "no-undef": 1 }, - [] - ); + verifyAndAssertMessages("function foo () { return new.target }", { + "no-undef": 1, + }); }); it("decorator does not create TypeError #229", () => { verifyAndAssertMessages( - unpad(` + ` class A { @test f() {} } - `), + `, { "no-undef": 1 }, - [ "2:4 'test' is not defined. no-undef" ] + ["2:4 'test' is not defined. no-undef"] ); }); it("Flow definition does not trigger warnings #223", () => { verifyAndAssertMessages( - unpad(` + ` import { Map as $Map } from 'immutable'; function myFunction($state: $Map, { a, b, c } : { a: ?Object, b: ?Object, c: $Map }) {} - `), - { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 }, - [] + `, + { "no-dupe-args": 1, "no-redeclare": 1, "no-shadow": 1 } ); }); it("newline-before-return with comments #289", () => { verifyAndAssertMessages( - unpad(` + ` function a() { if (b) { /* eslint-disable no-console */ @@ -2044,55 +1670,51 @@ a = b -> c return hasGlobal; } - `), - { "newline-before-return": 1 }, - [] + `, + { "newline-before-return": 1 } ); }); it("spaced-comment with shebang #163", () => { verifyAndAssertMessages( - unpad(` + ` #!/usr/bin/env babel-node import {spawn} from 'foobar'; - `), - { "spaced-comment": 1 }, - [] + `, + { "spaced-comment": 1 } ); }); describe("Class Property Declarations", () => { it("no-redeclare false positive 1", () => { verifyAndAssertMessages( - unpad(` + ` class Group { static propTypes = {}; } class TypicalForm { static propTypes = {}; } - `), - { "no-redeclare": 1 }, - [] + `, + { "no-redeclare": 1 } ); }); it("no-redeclare false positive 2", () => { verifyAndAssertMessages( - unpad(` + ` function validate() {} class MyComponent { static validate = validate; } - `), - { "no-redeclare": 1 }, - [] + `, + { "no-redeclare": 1 } ); }); it("check references", () => { verifyAndAssertMessages( - unpad(` + ` var a; class A { prop1; @@ -2100,28 +1722,146 @@ a = b -> c prop3 = b; } new A - `), + `, { "no-undef": 1, "no-unused-vars": 1, "no-redeclare": 1 }, - [ - "5:11 'b' is not defined. no-undef" - ] + ["5:11 'b' is not defined. no-undef"] ); }); }); it("dynamic import support", () => { + verifyAndAssertMessages("import('test-module').then(() => {})"); + }); + + it("regex with es6 unicodeCodePointEscapes", () => { verifyAndAssertMessages( - "import('test-module').then(() => {})", - {}, - [] + "string.replace(/[\u{0000A0}-\u{10FFFF}<>&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);" + ); + }); + + describe("private class properties", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d = 1; + } + `, + { "no-undef": 1 } + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d = 1; + } + `, + { "no-unused-vars": 1 } + ); + }); + }); + + describe("optional chaining operator", () => { + it("should not be undefined #595", () => { + verifyAndAssertMessages( + ` + const foo = {}; + foo?.bar; + `, + { "no-undef": 1 } + ); + }); + }); + + it("flow types on class method should be visited correctly", () => { + verifyAndAssertMessages( + ` + import type NodeType from 'foo'; + class NodeUtils { + finishNodeAt(node: T): T { return node; } + } + + new NodeUtils(); + `, + { "no-unused-vars": 1 } + ); + }); + + it("works with dynamicImport", () => { + verifyAndAssertMessages( + ` + import('a'); + ` + ); + }); + + it("works with numericSeparator", () => { + verifyAndAssertMessages( + ` + 1_000 + ` + ); + }); + + it("works with optionalChaining", () => { + verifyAndAssertMessages( + ` + a?.b + ` + ); + }); + + it("works with import.meta", () => { + verifyAndAssertMessages( + ` + import.meta + ` + ); + }); + + it("works with classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = 1; } + ` + ); + }); + + it("works with optionalCatchBinding", () => { + verifyAndAssertMessages( + ` + try {} catch {} + try {} catch {} finally {} + ` + ); + }); + + it("exportDefaultFrom", () => { + verifyAndAssertMessages( + ` + export v from "mod" + ` ); }); - // it("regex with es6 unicodeCodePointEscapes", function () { - // verifyAndAssertMessages( - // "string.replace(/[\u{0000A0}-\u{10FFFF}<>\&]/gmiu, (char) => `&#x${char.codePointAt(0).toString(16)};`);", - // {}, - // [] - // ); - // }); + it("exportNamespaceFrom", () => { + verifyAndAssertMessages( + ` + export * as ns from "mod" + ` + ); + }); + + it("ignore eval in scope analysis", () => { + verifyAndAssertMessages( + ` + const a = 1; + console.log(a); + eval(''); + `, + { "no-unused-vars": 1, "no-undef": 1 } + ); + }); }); diff --git a/test/z_parser-for-eslint-after-patched.js b/test/z_parser-for-eslint-after-patched.js new file mode 100644 index 00000000..a7d6882d --- /dev/null +++ b/test/z_parser-for-eslint-after-patched.js @@ -0,0 +1,45 @@ +"use strict"; + +const eslint = require("eslint"); +const assert = require("assert"); +const babelEslint = require(".."); +const espree = require("espree"); +var assertImplementsAST = require("./fixtures/assert-implements-ast"); + +describe("https://github.com/babel/babel-eslint/issues/558", () => { + it("don't crash with eslint-plugin-import", () => { + const engine = new eslint.CLIEngine({ ignore: false }); + engine.executeOnFiles([ + "test/fixtures/eslint-plugin-import/a.js", + "test/fixtures/eslint-plugin-import/b.js", + "test/fixtures/eslint-plugin-import/c.js", + ]); + }); + + /* + * This test ensures that the enhanced referencer does not get used if eslint-scope has already been + * monkeypatched, because this causes some correctness issues. For example, if the enhanced referencer + * is used after the original referencer is monkeypatched, type annotation references are counted twice. + */ + it("does not visit type annotations multiple times after monkeypatching and calling parseForESLint()", () => { + assertImplementsAST( + espree.parse("foo", { sourceType: "module" }), + babelEslint.parse("foo", {}) + ); + const parseResult = babelEslint.parseForESLint( + "type Foo = {}; function x(): Foo {}", + { + eslintVisitorKeys: true, + eslintScopeManager: true, + } + ); + assert(parseResult.visitorKeys); + assert(parseResult.scopeManager); + + const fooVariable = parseResult.scopeManager.getDeclaredVariables( + parseResult.ast.body[0] + )[0]; + + assert.strictEqual(fooVariable.references.length, 1); + }); +}); diff --git a/yarn.lock b/yarn.lock index f75d2314..d6f8fae1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,49 +2,245 @@ # yarn lockfile v1 +"@babel/code-frame@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz#2a02643368de80916162be70865c97774f3adbd9" + dependencies: + "@babel/highlight" "7.0.0-beta.44" + +"@babel/code-frame@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0.tgz#06e2ab19bdb535385559aabb5ba59729482800f8" + dependencies: + "@babel/highlight" "^7.0.0" + +"@babel/generator@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0-beta.44.tgz#c7e67b9b5284afcf69b309b50d7d37f3e5033d42" + dependencies: + "@babel/types" "7.0.0-beta.44" + jsesc "^2.5.1" + lodash "^4.2.0" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/generator@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.0.0.tgz#1efd58bffa951dc846449e58ce3a1d7f02d393aa" + dependencies: + "@babel/types" "^7.0.0" + jsesc "^2.5.1" + lodash "^4.17.10" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/helper-function-name@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz#e18552aaae2231100a6e485e03854bc3532d44dd" + dependencies: + "@babel/helper-get-function-arity" "7.0.0-beta.44" + "@babel/template" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + +"@babel/helper-function-name@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.0.0.tgz#a68cc8d04420ccc663dd258f9cc41b8261efa2d4" + dependencies: + "@babel/helper-get-function-arity" "^7.0.0" + "@babel/template" "^7.0.0" + "@babel/types" "^7.0.0" + +"@babel/helper-get-function-arity@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz#d03ca6dd2b9f7b0b1e6b32c56c72836140db3a15" + dependencies: + "@babel/types" "7.0.0-beta.44" + +"@babel/helper-get-function-arity@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" + dependencies: + "@babel/types" "^7.0.0" + +"@babel/helper-split-export-declaration@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz#c0b351735e0fbcb3822c8ad8db4e583b05ebd9dc" + dependencies: + "@babel/types" "7.0.0-beta.44" + +"@babel/helper-split-export-declaration@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0.tgz#3aae285c0311c2ab095d997b8c9a94cad547d813" + dependencies: + "@babel/types" "^7.0.0" + +"@babel/highlight@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0-beta.44.tgz#18c94ce543916a80553edcdcf681890b200747d5" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^3.0.0" + +"@babel/highlight@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.0.0.tgz#f710c38c8d458e6dd9a201afb637fcb781ce99e4" + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/parser@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.0.0.tgz#697655183394facffb063437ddf52c0277698775" + +"@babel/template@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0-beta.44.tgz#f8832f4fdcee5d59bf515e595fc5106c529b394f" + dependencies: + "@babel/code-frame" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + lodash "^4.2.0" + +"@babel/template@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.0.0.tgz#c2bc9870405959c89a9c814376a2ecb247838c80" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" + +"@babel/traverse@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0-beta.44.tgz#a970a2c45477ad18017e2e465a0606feee0d2966" + dependencies: + "@babel/code-frame" "7.0.0-beta.44" + "@babel/generator" "7.0.0-beta.44" + "@babel/helper-function-name" "7.0.0-beta.44" + "@babel/helper-split-export-declaration" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + debug "^3.1.0" + globals "^11.1.0" + invariant "^2.2.0" + lodash "^4.2.0" + +"@babel/traverse@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.0.0.tgz#b1fe9b6567fdf3ab542cfad6f3b31f854d799a61" + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/generator" "^7.0.0" + "@babel/helper-function-name" "^7.0.0" + "@babel/helper-split-export-declaration" "^7.0.0" + "@babel/parser" "^7.0.0" + "@babel/types" "^7.0.0" + debug "^3.1.0" + globals "^11.1.0" + lodash "^4.17.10" + +"@babel/types@7.0.0-beta.44": + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0-beta.44.tgz#6b1b164591f77dec0a0342aca995f2d046b3a757" + dependencies: + esutils "^2.0.2" + lodash "^4.2.0" + to-fast-properties "^2.0.0" + +"@babel/types@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.0.0.tgz#6e191793d3c854d19c6749989e3bc55f0e962118" + dependencies: + esutils "^2.0.2" + lodash "^4.17.10" + to-fast-properties "^2.0.0" + +"@samverschueren/stream-to-observable@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f" + dependencies: + any-observable "^0.3.0" + acorn-jsx@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" dependencies: acorn "^3.0.4" -acorn@4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" - acorn@^3.0.4: version "3.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" -ajv-keywords@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" +acorn@^5.4.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.4.1.tgz#fdc58d9d17f4a4e98d102ded826a9b9759125102" -ajv@^4.7.0: - version "4.11.5" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.5.tgz#b6ee74657b993a01dce44b7944d56f485828d5bd" +acorn@^5.5.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" + +ajv-keywords@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762" + +ajv@^5.2.3, ajv@^5.3.0: + version "5.5.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: co "^4.6.0" - json-stable-stringify "^1.0.1" + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" -ansi-escapes@^1.1.0: +ansi-escapes@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" +ansi-escapes@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92" + ansi-regex@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" +ansi-styles@^3.2.0, ansi-styles@^3.2.1: + version "3.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + dependencies: + color-convert "^1.9.0" + +any-observable@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/any-observable/-/any-observable-0.3.0.tgz#af933475e5806a67d0d7df090dd5e8bef65d119b" + argparse@^1.0.7: - version "1.0.9" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.9.tgz#73d83bc263f86e97f8cc4f6bae1b0e90a7d22c86" + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" dependencies: sprintf-js "~1.0.2" +arr-diff@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + +arr-union@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + array-union@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" @@ -55,86 +251,104 @@ array-uniq@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6" +array-unique@^0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + arrify@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" -babel-code-frame@^6.16.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" - dependencies: - chalk "^1.1.0" - esutils "^2.0.2" - js-tokens "^3.0.0" - -babel-eslint@^7.0.0: - version "7.1.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.1.1.tgz#8a6a884f085aa7060af69cfc77341c2f99370fb2" - dependencies: - babel-code-frame "^6.16.0" - babel-traverse "^6.15.0" - babel-types "^6.15.0" - babylon "^6.13.0" - lodash.pickby "^4.6.0" +assign-symbols@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" -babel-messages@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" - dependencies: - babel-runtime "^6.22.0" +atob@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" -babel-runtime@^6.22.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" +babel-code-frame@^6.22.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" -babel-traverse@^6.15.0, babel-traverse@^6.23.1: - version "6.23.1" - resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48" +babel-eslint@^8.2.6: + version "8.2.6" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.6.tgz#6270d0c73205628067c0f7ae1693a9e797acefd9" dependencies: - babel-code-frame "^6.22.0" - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.23.0" - babylon "^6.15.0" - debug "^2.2.0" - globals "^9.0.0" - invariant "^2.2.0" - lodash "^4.2.0" + "@babel/code-frame" "7.0.0-beta.44" + "@babel/traverse" "7.0.0-beta.44" + "@babel/types" "7.0.0-beta.44" + babylon "7.0.0-beta.44" + eslint-scope "3.7.1" + eslint-visitor-keys "^1.0.0" -babel-types@^6.15.0, babel-types@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" +babylon@7.0.0-beta.44: + version "7.0.0-beta.44" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.44.tgz#89159e15e6e30c5096e22d738d8c0af8a0e8ca1d" -babylon@^6.13.0, babylon@^6.15.0, babylon@^6.17.0: - version "6.17.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" -balanced-match@^0.4.1: - version "0.4.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838" +base@^0.11.1: + version "0.11.2" + resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + dependencies: + cache-base "^1.0.1" + class-utils "^0.3.5" + component-emitter "^1.2.1" + define-property "^1.0.0" + isobject "^3.0.1" + mixin-deep "^1.2.0" + pascalcase "^0.1.1" -brace-expansion@^1.0.0: - version "1.1.6" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.6.tgz#7197d7eaa9b87e648390ea61fc66c84427420df9" +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" dependencies: - balanced-match "^0.4.1" + balanced-match "^1.0.0" concat-map "0.0.1" +braces@^2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + dependencies: + arr-flatten "^1.1.0" + array-unique "^0.3.2" + extend-shallow "^2.0.1" + fill-range "^4.0.0" + isobject "^3.0.1" + repeat-element "^1.1.2" + snapdragon "^0.8.1" + snapdragon-node "^2.0.1" + split-string "^3.0.2" + to-regex "^3.0.1" + browser-stdout@1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.0.tgz#f351d32969d32fa5d7a5567154263d928ae3bd1f" -buffer-shims@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/buffer-shims/-/buffer-shims-1.0.0.tgz#9978ce317388c649ad8793028c3477ef044a8b51" +builtin-modules@^1.0.0, builtin-modules@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" + +cache-base@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + dependencies: + collection-visit "^1.0.0" + component-emitter "^1.2.1" + get-value "^2.0.6" + has-value "^1.0.0" + isobject "^3.0.1" + set-value "^2.0.0" + to-object-path "^0.3.0" + union-value "^1.0.0" + unset-value "^1.0.0" caller-path@^0.1.0: version "0.1.0" @@ -146,7 +360,7 @@ callsites@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" -chalk@^1.0.0, chalk@^1.1.0, chalk@^1.1.1, chalk@^1.1.3: +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" dependencies: @@ -156,19 +370,61 @@ 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.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e" + dependencies: + ansi-styles "^3.2.1" + escape-string-regexp "^1.0.5" + supports-color "^5.3.0" + +chardet@^0.4.0: + version "0.4.2" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2" + +ci-info@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.4.0.tgz#4841d53cad49f11b827b648ebde27a6e189b412f" + circular-json@^0.3.1: - version "0.3.1" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.1.tgz#be8b36aefccde8b3ca7aa2d6afc07a37242c0d2d" + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" -cli-cursor@^1.0.1: +class-utils@^0.3.5: + version "0.3.6" + resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + dependencies: + arr-union "^3.1.0" + define-property "^0.2.5" + isobject "^3.0.0" + static-extend "^0.1.1" + +cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: restore-cursor "^1.0.1" -cli-width@^2.0.0: +cli-cursor@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.1.0.tgz#b234ca209b29ef66fc518d9b98d5847b00edf00a" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5" + dependencies: + restore-cursor "^2.0.0" + +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" co@^4.6.0: version "4.6.0" @@ -178,17 +434,40 @@ code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" -commander@2.9.0: - version "2.9.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +color-convert@^1.9.0: + version "1.9.2" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147" dependencies: - graceful-readlink ">= 1.0.0" + color-name "1.1.1" + +color-name@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689" + +commander@2.11.0: + version "2.11.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563" + +commander@^2.14.1, commander@^2.9.0: + version "2.17.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf" + +component-emitter@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.5.2: +concat-stream@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -196,31 +475,53 @@ concat-stream@^1.5.2: readable-stream "^2.2.2" typedarray "^0.0.6" -core-js@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.4.1.tgz#4de911e667b0eae9124e34254b53aea6fc618d3e" +contains-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/contains-path/-/contains-path-0.1.0.tgz#fe8cf184ff6670b6baef01a9d4861a5cbec4120a" + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -d@1: - version "1.0.0" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.0.tgz#754bb5bfe55451da69a58b94d45f4c5b0462d58f" +cosmiconfig@^5.0.2: + version "5.0.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-5.0.6.tgz#dca6cf680a0bd03589aff684700858c81abeeb39" dependencies: - es5-ext "^0.10.9" + is-directory "^0.3.1" + js-yaml "^3.9.0" + parse-json "^4.0.0" -debug@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da" +cross-spawn@^5.0.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: - ms "0.7.1" + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" -debug@^2.1.1, debug@^2.2.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d" +date-fns@^1.27.2: + version "1.29.0" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" + +debug@3.1.0, debug@^3.0.1, debug@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + dependencies: + ms "2.0.0" + +debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: - ms "0.7.2" + ms "2.0.0" + +decode-uri-component@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" dedent@^0.7.0: version "0.7.0" @@ -230,6 +531,25 @@ deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + del@^2.0.2: version "2.2.2" resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8" @@ -242,142 +562,202 @@ del@^2.0.2: pinkie-promise "^2.0.0" rimraf "^2.2.8" -diff@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-1.4.0.tgz#7f28d2eb9ee7b15a97efd89ce63dcfdaa3ccbabf" +diff@3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-3.3.1.tgz#aa8567a6eed03c531fc89d3f711cd0e5259dec75" -doctrine@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" +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" -es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.15" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.15.tgz#c330a5934c1ee21284a7c081a86e5fd937c91ea6" +doctrine@^2.0.2, doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" dependencies: - es6-iterator "2" - es6-symbol "~3.1" + esutils "^2.0.2" -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" - dependencies: - d "1" - es5-ext "^0.10.14" - es6-symbol "^3.1" - -es6-map@^0.1.3: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" - 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" - -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" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + +error-ex@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.1.tgz#f855a86ce61adc4e8621c3cda21e7a7612c3a8dc" dependencies: - d "1" - es5-ext "~0.10.14" + is-arrayish "^0.2.1" -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" +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" dependencies: - d "1" - es5-ext "^0.10.14" - es6-iterator "^2.0.1" - es6-symbol "^3.1.1" + is-arrayish "^0.2.1" escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" -escope@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" +eslint-config-babel@^7.0.1: + version "7.0.2" + resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-7.0.2.tgz#cbde74f61cee087d8cd6e607fcfa087869a02d99" + +eslint-import-resolver-node@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a" dependencies: - es6-map "^0.1.3" - es6-weak-map "^2.0.1" - esrecurse "^4.1.0" - estraverse "^4.1.1" + debug "^2.6.9" + resolve "^1.5.0" -eslint-config-babel@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/eslint-config-babel/-/eslint-config-babel-6.0.0.tgz#66feedf6ce6e04abe585cec1a65b5bcc96bed50a" +eslint-module-utils@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz#abaec824177613b8a95b299639e1b6facf473449" + dependencies: + debug "^2.6.8" + pkg-dir "^1.0.0" + +"eslint-old@npm:eslint@4.13.1": + version "4.13.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.13.1.tgz#0055e0014464c7eb7878caf549ef2941992b444f" + dependencies: + ajv "^5.3.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.2" + eslint-scope "^3.7.1" + espree "^3.5.2" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + ignore "^3.3.3" + imurmurhash "^0.1.4" + inquirer "^3.0.6" + is-resolvable "^1.0.0" + js-yaml "^3.9.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.4" + minimatch "^3.0.2" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + 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" eslint-plugin-flowtype@^2.30.3: - version "2.30.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.30.3.tgz#57835d2c0ed388da7a2725803ec32af2f437c301" + version "2.45.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.45.0.tgz#20d8b15d1e1e71ea4e9498e8be3fc62c0752fcbf" dependencies: lodash "^4.15.0" -eslint@^3.18.0: - version "3.18.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.18.0.tgz#647e985c4ae71502d20ac62c109f66d5104c8a4b" +eslint-plugin-import@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz#fa1b6ef31fcb3c501c09859c1b86f1fc5b986894" dependencies: - babel-code-frame "^6.16.0" - chalk "^1.1.3" - concat-stream "^1.5.2" - debug "^2.1.1" - doctrine "^2.0.0" - escope "^3.6.0" - espree "^3.4.0" + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.6.8" + doctrine "1.5.0" + eslint-import-resolver-node "^0.3.1" + eslint-module-utils "^2.1.1" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + read-pkg-up "^2.0.0" + +eslint-plugin-prettier@^2.1.2: + version "2.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-2.6.0.tgz#33e4e228bdb06142d03c560ce04ec23f6c767dd7" + dependencies: + fast-diff "^1.1.1" + jest-docblock "^21.0.0" + +eslint-scope@3.7.1, eslint-scope@^3.7.1: + version "3.7.1" + resolved "http://registry.npm.taobao.org/eslint-scope/download/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-visitor-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" + +"eslint@npm:eslint@4.19.1": + version "4.19.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300" + dependencies: + ajv "^5.3.0" + babel-code-frame "^6.22.0" + chalk "^2.1.0" + concat-stream "^1.6.0" + cross-spawn "^5.1.0" + debug "^3.1.0" + doctrine "^2.1.0" + eslint-scope "^3.7.1" + eslint-visitor-keys "^1.0.0" + espree "^3.5.4" esquery "^1.0.0" - estraverse "^4.2.0" esutils "^2.0.2" file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.14.0" - ignore "^3.2.0" + functional-red-black-tree "^1.0.1" + glob "^7.1.2" + globals "^11.0.1" + 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-without-jsonify "^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.2" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.7.5" - strip-bom "^3.0.0" + path-is-inside "^1.0.2" + pluralize "^7.0.0" + progress "^2.0.0" + regexpp "^1.0.1" + require-uncached "^1.0.3" + semver "^5.3.0" + strip-ansi "^4.0.0" strip-json-comments "~2.0.1" - table "^3.7.8" + table "4.0.2" text-table "~0.2.0" - user-home "^2.0.0" -espree@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.0.tgz#41656fa5628e042878025ef467e78f125cb86e1d" +espree@^3.5.2: + version "3.5.3" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.3.tgz#931e0af64e7fbbed26b050a29daad1fc64799fa6" + dependencies: + acorn "^5.4.0" + acorn-jsx "^3.0.0" + +espree@^3.5.4: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" dependencies: - acorn "4.0.4" + acorn "^5.5.0" acorn-jsx "^3.0.0" -esprima@^3.1.1: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" esquery@^1.0.0: version "1.0.0" @@ -386,46 +766,110 @@ esquery@^1.0.0: estraverse "^4.0.0" esrecurse@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" dependencies: - estraverse "~4.1.0" - object-assign "^4.0.1" + estraverse "^4.1.0" -estraverse@^4.0.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" -estraverse@~4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" - esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" -event-emitter@~0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" +execa@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.9.0.tgz#adb7ce62cf985071f60580deb4a88b9e34712d01" dependencies: - d "1" - es5-ext "~0.10.14" + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" +expand-brackets@^2.1.4: + version "2.1.4" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + dependencies: + debug "^2.3.3" + define-property "^0.2.5" + extend-shallow "^2.0.1" + posix-character-classes "^0.1.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + dependencies: + is-extendable "^0.1.0" + +extend-shallow@^3.0.0, extend-shallow@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + dependencies: + assign-symbols "^1.0.0" + is-extendable "^1.0.1" + +external-editor@^2.0.4: + version "2.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.1.0.tgz#3d026a21b7f95b5726387d4200ac160d372c3b48" + dependencies: + chardet "^0.4.0" + iconv-lite "^0.4.17" + tmp "^0.0.33" + +extglob@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + dependencies: + array-unique "^0.3.2" + define-property "^1.0.0" + expand-brackets "^2.1.4" + extend-shallow "^2.0.1" + fragment-cache "^0.2.1" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" + +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-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" -figures@^1.3.5: +figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: 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" @@ -433,54 +877,103 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +fill-range@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + dependencies: + extend-shallow "^2.0.1" + is-number "^3.0.0" + repeat-string "^1.6.1" + to-regex-range "^2.1.0" + +find-parent-dir@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/find-parent-dir/-/find-parent-dir-0.3.0.tgz#33c44b429ab2b2f0646299c5f9f718f376ff8d54" + +find-up@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-1.1.2.tgz#6b2e9822b1a2ce0a60ab64d610eccad53cb24d0f" + dependencies: + path-exists "^2.0.0" + pinkie-promise "^2.0.0" + +find-up@^2.0.0: + version "2.1.0" + resolved "http://registry.npm.taobao.org/find-up/download/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + dependencies: + locate-path "^2.0.0" + +find-up@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" + dependencies: + locate-path "^3.0.0" + flat-cache@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.2.tgz#fa86714e72c21db88601761ecf2f555d1abc6b96" + version "1.3.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481" dependencies: circular-json "^0.3.1" del "^2.0.2" graceful-fs "^4.1.2" write "^0.2.1" +for-in@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + +fragment-cache@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + dependencies: + map-cache "^0.2.2" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" -generate-function@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.0.0.tgz#6858fe7c0969b7d4e9093337647ac79f60dfbe74" +function-bind@^1.0.2: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - dependencies: - is-property "^1.0.0" +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" + +get-own-enumerable-property-symbols@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz#5c4ad87f2834c4b9b4e84549dc1e0650fb38c24b" + +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + +get-value@^2.0.3, get-value@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" -glob@7.0.5: - version "7.0.5" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.0.5.tgz#b4202a69099bbb4d292a7c1b95b6682b67ebdc95" +glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.2" + minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5: - version "7.1.1" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.2" - once "^1.3.0" - path-is-absolute "^1.0.0" +globals@^11.0.1: + version "11.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0" -globals@^9.0.0, globals@^9.14.0: - version "9.16.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.16.0.tgz#63e903658171ec2d9f51b1d31de5e2b8dc01fb80" +globals@^11.1.0: + version "11.7.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-11.7.0.tgz#a583faa43055b1aca771914bf68258e2fc125673" globby@^5.0.0: version "5.0.0" @@ -497,13 +990,9 @@ graceful-fs@^4.1.2: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" -"graceful-readlink@>= 1.0.0": - version "1.0.1" - resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" - -growl@1.9.2: - version "1.9.2" - resolved "https://registry.yarnpkg.com/growl/-/growl-1.9.2.tgz#0ea7743715db8d8de2c5ede1775e1b45ac85c02f" +growl@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f" has-ansi@^2.0.0: version "2.0.0" @@ -511,18 +1000,92 @@ has-ansi@^2.0.0: dependencies: ansi-regex "^2.0.0" -has-flag@^1.0.0: +has-flag@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + +has-value@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + dependencies: + get-value "^2.0.3" + has-values "^0.1.4" + isobject "^2.0.0" + +has-value@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" + resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + dependencies: + get-value "^2.0.6" + has-values "^1.0.0" + isobject "^3.0.0" -ignore@^3.2.0: - version "3.2.6" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.6.tgz#26e8da0644be0bb4cb39516f6c79f0e0f4ffe48c" +has-values@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + +has-values@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + dependencies: + is-number "^3.0.0" + kind-of "^4.0.0" + +has@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" + dependencies: + function-bind "^1.0.2" + +he@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" + +hosted-git-info@^2.1.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.5.0.tgz#6d60e34b3abbc8313062c3b798ef8d901a07af3c" + +husky@^1.0.0-rc.13: + version "1.0.0-rc.13" + resolved "https://registry.yarnpkg.com/husky/-/husky-1.0.0-rc.13.tgz#49c3cc210bfeac24d4ad272f770b7505c9091828" + dependencies: + cosmiconfig "^5.0.2" + execa "^0.9.0" + find-up "^3.0.0" + get-stdin "^6.0.0" + is-ci "^1.1.0" + pkg-dir "^3.0.0" + please-upgrade-node "^3.1.1" + read-pkg "^4.0.1" + run-node "^1.0.0" + slash "^2.0.0" + +iconv-lite@^0.4.17: + version "0.4.19" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" + +ignore@^3.3.3: + version "3.3.7" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.7.tgz#612289bfb3c220e186a58118618d5be8c1bab021" imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +indent-string@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.2.0.tgz#4a5fd6d27cc332f37e5419a504dbb837105c9289" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -530,38 +1093,119 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3, inherits@~2.0.1: +inherits@2, inherits@^2.0.3, inherits@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" -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.3.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9" dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" + ansi-escapes "^3.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@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.1.tgz#d579fb7f693b858004947af39fa0db49f795602c" - invariant@^2.2.0: - version "2.2.2" - resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: loose-envify "^1.0.0" +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + dependencies: + kind-of "^6.0.0" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + +is-builtin-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-builtin-module/-/is-builtin-module-1.0.0.tgz#540572d34f7ac3119f8f76c30cbc1b1e037affbe" + dependencies: + builtin-modules "^1.0.0" + +is-ci@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.0.tgz#3f4a08d6303a09882cef3f0fb97439c5f5ce2d53" + dependencies: + ci-info "^1.3.0" + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-directory@^0.3.1: + version "0.3.1" + resolved "https://registry.yarnpkg.com/is-directory/-/is-directory-0.3.1.tgz#61339b6f2475fc772fd9c9d83f5c8575dc154ae1" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + +is-extendable@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + dependencies: + is-plain-object "^2.0.4" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + +is-finite@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" + dependencies: + number-is-nan "^1.0.0" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" @@ -572,14 +1216,27 @@ is-fullwidth-code-point@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" -is-my-json-valid@^2.10.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz#f079dd9bfdae65ee2038aae8acbc86ab109e3693" +is-glob@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.0.tgz#9521c76845cc2610a85203ddf080a958c2ffabc0" + dependencies: + is-extglob "^2.1.1" + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + dependencies: + kind-of "^3.0.2" + +is-obj@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" + +is-observable@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-observable/-/is-observable-1.1.0.tgz#b3e986c8f44de950867cab5403f5a3465005975e" dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" + symbol-observable "^1.1.0" is-path-cwd@^1.0.0: version "1.0.0" @@ -592,53 +1249,133 @@ is-path-in-cwd@^1.0.0: is-path-inside "^1.0.0" is-path-inside@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.0.tgz#fc06e5a1683fbda13de667aff717bbc10a48f37f" + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036" dependencies: path-is-inside "^1.0.1" -is-property@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" +is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + dependencies: + isobject "^3.0.1" -is-resolvable@^1.0.0: +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + +is-regexp@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.0.0.tgz#8df57c61ea2e3c501408d100fb013cf8d6e0cc62" - dependencies: - tryit "^1.0.1" + resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" -isarray@^1.0.0, isarray@~1.0.0: +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + +is-stream@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + +is-windows@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + +isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -js-tokens@^3.0.0: +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + +isobject@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + dependencies: + isarray "1.0.0" + +isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + +jest-docblock@^21.0.0: + version "21.2.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-21.2.0.tgz#51529c3b30d5fd159da60c27ceedc195faf8d414" -js-yaml@^3.5.1: - version "3.8.2" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.2.tgz#02d3e2c0f6beab20248d412c352203827d786721" +jest-get-type@^22.1.0: + version "22.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" + +jest-validate@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" + dependencies: + chalk "^2.0.1" + jest-get-type "^22.1.0" + leven "^2.1.0" + pretty-format "^23.5.0" + +js-tokens@^3.0.0, js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + +"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + +js-yaml@^3.9.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1" + 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 "^3.1.1" + esprima "^4.0.0" + +jsesc@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.1.tgz#e421a2a8e20d6b0819df28908f782526b96dd1fe" + +json-parse-better-errors@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" + +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-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: +json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + +kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + dependencies: + is-buffer "^1.1.5" + +kind-of@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" dependencies: - jsonify "~0.0.0" + is-buffer "^1.1.5" -json3@3.3.2: - version "3.3.2" - resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1" +kind-of@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" +leven@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" levn@^0.3.0, levn@~0.3.0: version "0.3.0" @@ -647,115 +1384,274 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -lodash._baseassign@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz#8c38a099500f215ad09e59f1722fd0c52bfe0a4e" +lint-staged@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-7.2.2.tgz#0983d55d497f19f36d11ff2c8242b2f56cc2dd05" + dependencies: + chalk "^2.3.1" + commander "^2.14.1" + cosmiconfig "^5.0.2" + debug "^3.1.0" + dedent "^0.7.0" + execa "^0.9.0" + find-parent-dir "^0.3.0" + is-glob "^4.0.0" + is-windows "^1.0.2" + jest-validate "^23.5.0" + listr "^0.14.1" + lodash "^4.17.5" + log-symbols "^2.2.0" + micromatch "^3.1.8" + npm-which "^3.0.1" + p-map "^1.1.1" + path-is-inside "^1.0.2" + pify "^3.0.0" + please-upgrade-node "^3.0.2" + staged-git-files "1.1.1" + string-argv "^0.0.2" + stringify-object "^3.2.2" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.4.0.tgz#344d980da2ca2e8b145ba305908f32ae3f4cc8a7" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.1.tgz#8206f4cf6d52ddc5827e5fd14989e0e965933a35" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.14.1: + version "0.14.1" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.14.1.tgz#8a7afa4a7135cee4c921d128e0b7dfc6e522d43d" + dependencies: + "@samverschueren/stream-to-observable" "^0.3.0" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-observable "^1.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.4.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^6.1.0" + strip-ansi "^3.0.1" + +load-json-file@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" dependencies: - lodash._basecopy "^3.0.0" - lodash.keys "^3.0.0" + graceful-fs "^4.1.2" + parse-json "^2.2.0" + pify "^2.0.0" + strip-bom "^3.0.0" -lodash._basecopy@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36" +locate-path@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + dependencies: + p-locate "^2.0.0" + path-exists "^3.0.0" + +locate-path@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" + dependencies: + p-locate "^3.0.0" + path-exists "^3.0.0" -lodash._basecreate@^3.0.0: - version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz#1bc661614daa7fc311b7d03bf16806a0213cf821" +lodash.cond@^4.3.0: + version "4.5.2" + resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5" -lodash._getnative@^3.0.0: - version "3.9.1" - resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" +lodash@^4.15.0, lodash@^4.3.0: + version "4.17.5" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511" -lodash._isiterateecall@^3.0.0: - version "3.0.9" - resolved "https://registry.yarnpkg.com/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz#5203ad7ba425fae842460e696db9cf3e6aac057c" +lodash@^4.17.10, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.2.0: + version "4.17.10" + resolved "http://registry.npm.taobao.org/lodash/download/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7" -lodash.create@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/lodash.create/-/lodash.create-3.1.1.tgz#d7f2849f0dbda7e04682bb8cd72ab022461debe7" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" dependencies: - lodash._baseassign "^3.0.0" - lodash._basecreate "^3.0.0" - lodash._isiterateecall "^3.0.0" + chalk "^1.0.0" -lodash.isarguments@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" +log-symbols@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" + dependencies: + chalk "^2.0.1" -lodash.isarray@^3.0.0: - version "3.0.4" - resolved "https://registry.yarnpkg.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55" +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" -lodash.keys@^3.0.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a" +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" dependencies: - lodash._getnative "^3.0.0" - lodash.isarguments "^3.0.0" - lodash.isarray "^3.0.0" + js-tokens "^3.0.0 || ^4.0.0" -lodash.pickby@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.pickby/-/lodash.pickby-4.6.0.tgz#7dea21d8c18d7703a27c704c15d3b84a67e33aff" +lru-cache@^4.0.1: + version "4.1.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c" + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" -lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.3.0: - version "4.17.4" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +map-cache@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" -loose-envify@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" - dependencies: - js-tokens "^3.0.0" +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + dependencies: + object-visit "^1.0.0" + +micromatch@^3.1.8: + version "3.1.10" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + braces "^2.3.1" + define-property "^2.0.2" + extend-shallow "^3.0.2" + extglob "^2.0.4" + fragment-cache "^0.2.1" + kind-of "^6.0.2" + nanomatch "^1.2.9" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.2" + +mimic-fn@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" -minimatch@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" +minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: - brace-expansion "^1.0.0" + brace-expansion "^1.1.7" minimist@0.0.8: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -mkdirp@0.5.1, mkdirp@^0.5.0, mkdirp@^0.5.1: +mixin-deep@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + dependencies: + for-in "^1.0.2" + is-extendable "^1.0.1" + +mkdirp@0.5.1, mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: minimist "0.0.8" -mocha@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-3.2.0.tgz#7dc4f45e5088075171a68896814e6ae9eb7a85e3" +mocha@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.0.1.tgz#759b62c836b0732382a62b6b1fb245ec1bc943ac" dependencies: browser-stdout "1.3.0" - commander "2.9.0" - debug "2.2.0" - diff "1.4.0" + commander "2.11.0" + debug "3.1.0" + diff "3.3.1" escape-string-regexp "1.0.5" - glob "7.0.5" - growl "1.9.2" - json3 "3.3.2" - lodash.create "3.1.1" + glob "7.1.2" + growl "1.10.3" + he "1.1.1" mkdirp "0.5.1" - supports-color "3.1.2" - -ms@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098" + supports-color "4.4.0" -ms@0.7.2: - version "0.7.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765" - -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + +mute-stream@0.0.7: + version "0.0.7" + resolved "http://registry.npm.taobao.org/mute-stream/download/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + +nanomatch@^1.2.9: + version "1.2.13" + resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + dependencies: + arr-diff "^4.0.0" + array-unique "^0.3.2" + define-property "^2.0.2" + extend-shallow "^3.0.2" + fragment-cache "^0.2.1" + is-windows "^1.0.2" + kind-of "^6.0.2" + object.pick "^1.3.0" + regex-not "^1.0.0" + snapdragon "^0.8.1" + to-regex "^3.0.1" natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" +normalize-package-data@^2.3.2: + version "2.4.0" + resolved "http://registry.npm.taobao.org/normalize-package-data/download/normalize-package-data-2.4.0.tgz#12f95a307d58352075a04907b84ac8be98ac012f" + dependencies: + hosted-git-info "^2.1.4" + is-builtin-module "^1.0.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +npm-path@^2.0.2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.4.tgz#c641347a5ff9d6a09e4d9bce5580c4f505278e64" + dependencies: + which "^1.2.10" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" @@ -764,6 +1660,26 @@ object-assign@^4.0.1, object-assign@^4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + dependencies: + isobject "^3.0.0" + +object.pick@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + dependencies: + isobject "^3.0.1" + once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" @@ -772,7 +1688,13 @@ once@^1.3.0: onetime@^1.0.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + resolved "http://registry.npmjs.org/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" optionator@^0.8.2: version "0.8.2" @@ -785,26 +1707,116 @@ optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" -os-homedir@^1.0.0: +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + +os-tmpdir@~1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + resolved "http://registry.npm.taobao.org/os-tmpdir/download/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-limit@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.2.0.tgz#0e92b6bedcb59f022c13d0f1949dc82d15909f1c" + dependencies: + p-try "^1.0.0" + +p-limit@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.0.0.tgz#e624ed54ee8c460a778b3c9f3670496ff8a57aec" + dependencies: + p-try "^2.0.0" + +p-locate@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + dependencies: + p-limit "^1.1.0" + +p-locate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" + dependencies: + p-limit "^2.0.0" + +p-map@^1.1.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" + +p-try@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + +p-try@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + +parse-json@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" + dependencies: + error-ex "^1.2.0" + +parse-json@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" + dependencies: + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + +pascalcase@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + +path-exists@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-2.1.0.tgz#0feb6c64f0fc518d9a754dd5efb62c7022761f4b" + dependencies: + pinkie-promise "^2.0.0" + +path-exists@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" 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" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" +path-type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-2.0.0.tgz#f012ccb8415b7096fc2daa1054c3d72389594c73" + dependencies: + pify "^2.0.0" + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" +pify@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-3.0.0.tgz#e5a4acd2c101fdf3d9a4d07f0dbc4db49dd28176" + pinkie-promise@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa" @@ -815,53 +1827,120 @@ pinkie@^2.0.0: version "2.0.4" resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +pkg-dir@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4" + dependencies: + find-up "^1.0.0" + +pkg-dir@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-3.0.0.tgz#2749020f239ed990881b1f71210d51eb6523bea3" + dependencies: + find-up "^3.0.0" + +please-upgrade-node@^3.0.2, please-upgrade-node@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz#ed320051dfcc5024fae696712c8288993595e8ac" + dependencies: + semver-compare "^1.0.0" + +pluralize@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777" + +posix-character-classes@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -process-nextick-args@~1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" +prettier@^1.4.4: + version "1.14.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" + +pretty-format@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" + dependencies: + ansi-regex "^3.0.0" + ansi-styles "^3.2.0" + +process-nextick-args@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa" + +progress@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" + +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + +read-pkg-up@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-2.0.0.tgz#6b72a8048984e0c41e79510fd5e9fa99b3b549be" + dependencies: + find-up "^2.0.0" + read-pkg "^2.0.0" + +read-pkg@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-2.0.0.tgz#8ef1c0623c6a6db0dc6713c4bfac46332b2368f8" + dependencies: + load-json-file "^2.0.0" + normalize-package-data "^2.3.2" + path-type "^2.0.0" -progress@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" +read-pkg@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-4.0.1.tgz#963625378f3e1c4d48c85872b5a6ec7d5d093237" + dependencies: + normalize-package-data "^2.3.2" + parse-json "^4.0.0" + pify "^3.0.0" readable-stream@^2.2.2: - version "2.2.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.6.tgz#8b43aed76e71483938d12a8d46c6cf1a00b1f816" + version "2.3.4" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.4.tgz#c946c3f47fa7d8eabc0b6150f4a12f69a4574071" dependencies: - buffer-shims "^1.0.0" core-util-is "~1.0.0" - inherits "~2.0.1" + inherits "~2.0.3" isarray "~1.0.0" - process-nextick-args "~1.0.6" - string_decoder "~0.10.x" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.0.3" util-deprecate "~1.0.1" -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" +regex-not@^1.0.0, regex-not@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" + extend-shallow "^3.0.2" + safe-regex "^1.1.0" -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - dependencies: - resolve "^1.1.6" +regexpp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab" -regenerator-runtime@^0.10.0: - version "0.10.3" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.3.tgz#8c4367a904b51ea62a908ac310bf99ff90a82a3e" +repeat-element@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + +repeat-string@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + +repeating@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/repeating/-/repeating-2.0.1.tgz#5214c53a926d3552707527fbab415dbc08d06dda" + dependencies: + is-finite "^1.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: @@ -872,9 +1951,13 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" -resolve@^1.1.6: - version "1.3.2" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.3.2.tgz#1f0442c9e0cbb8136e87b9305f932f46c7f28235" +resolve-url@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + +resolve@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" dependencies: path-parse "^1.0.5" @@ -885,38 +1968,197 @@ 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" + +ret@~0.1.10: + version "0.1.15" + resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + rimraf@^2.2.8: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" + version "2.6.2" + resolved "http://registry.npm.taobao.org/rimraf/download/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: glob "^7.0.5" -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" +run-async@^2.2.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" dependencies: - once "^1.3.0" + is-promise "^2.1.0" + +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + +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" + +rxjs@^6.1.0: + version "6.2.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.2.2.tgz#eb75fa3c186ff5289907d06483a77884586e1cf9" + dependencies: + tslib "^1.9.0" + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" + +safe-regex@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + dependencies: + ret "~0.1.10" + +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + +"semver@2 || 3 || 4 || 5", semver@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab" + +set-value@^0.4.3: + version "0.4.3" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.1" + to-object-path "^0.3.0" -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +set-value@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + dependencies: + extend-shallow "^2.0.1" + is-extendable "^0.1.1" + is-plain-object "^2.0.3" + split-string "^3.0.1" -shelljs@^0.7.5: - version "0.7.7" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" + 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" + +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" + +slash@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" slice-ansi@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" +slice-ansi@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d" + dependencies: + is-fullwidth-code-point "^2.0.0" + +snapdragon-node@^2.0.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + dependencies: + define-property "^1.0.0" + isobject "^3.0.0" + snapdragon-util "^3.0.1" + +snapdragon-util@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + dependencies: + kind-of "^3.2.0" + +snapdragon@^0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + dependencies: + base "^0.11.1" + debug "^2.2.0" + define-property "^0.2.5" + extend-shallow "^2.0.1" + map-cache "^0.2.2" + source-map "^0.5.6" + source-map-resolve "^0.5.0" + use "^3.1.0" + +source-map-resolve@^0.5.0: + version "0.5.2" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + dependencies: + atob "^2.1.1" + decode-uri-component "^0.2.0" + resolve-url "^0.2.1" + source-map-url "^0.4.0" + urix "^0.1.0" + +source-map-url@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + +source-map@^0.5.0, source-map@^0.5.6: + version "0.5.7" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + +spdx-correct@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" + dependencies: + spdx-license-ids "^1.0.2" + +spdx-expression-parse@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" + +spdx-license-ids@^1.0.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" + +split-string@^3.0.1, split-string@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + dependencies: + extend-shallow "^3.0.0" + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" +staged-git-files@1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-1.1.1.tgz#37c2218ef0d6d26178b1310719309a16a59f8f7b" + +static-extend@^0.1.1: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-argv@^0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.0.2.tgz#dac30408690c21f3c3630a3ff3a05877bdcbd736" + string-width@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" @@ -925,51 +2167,81 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.0.0.tgz#635c5436cc72a6e0c387ceca278d4e2eec52687e" +string-width@^2.1.0, string-width@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" dependencies: is-fullwidth-code-point "^2.0.0" - strip-ansi "^3.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" + dependencies: + safe-buffer "~5.1.0" -string_decoder@~0.10.x: - version "0.10.31" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" +stringify-object@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/stringify-object/-/stringify-object-3.2.2.tgz#9853052e5a88fb605a44cd27445aa257ad7ffbcd" + dependencies: + get-own-enumerable-property-symbols "^2.0.1" + is-obj "^1.0.1" + is-regexp "^1.0.0" -strip-ansi@^3.0.0: +strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" dependencies: ansi-regex "^2.0.0" +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + dependencies: + ansi-regex "^3.0.0" + strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + 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" -supports-color@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.1.2.tgz#72a262894d9d408b956ca05ff37b2ed8a6e2a2d5" +supports-color@4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.4.0.tgz#883f7ddabc165142b2a61427f3352ded195d1a3e" dependencies: - has-flag "^1.0.0" + has-flag "^2.0.0" supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" +supports-color@^5.3.0: + version "5.5.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" dependencies: - ajv "^4.7.0" - ajv-keywords "^1.0.0" - chalk "^1.1.1" - lodash "^4.0.0" - slice-ansi "0.0.4" - string-width "^2.0.0" + has-flag "^3.0.0" + +symbol-observable@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" + +table@4.0.2, table@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36" + dependencies: + ajv "^5.2.3" + ajv-keywords "^2.1.0" + chalk "^2.1.0" + lodash "^4.17.4" + slice-ansi "1.0.0" + string-width "^2.1.1" text-table@~0.2.0: version "0.2.0" @@ -977,15 +2249,47 @@ text-table@~0.2.0: through@^2.3.6: version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + resolved "http://registry.npm.taobao.org/through/download/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" -to-fast-properties@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.2.tgz#f3f5c0c3ba7299a7ef99427e44633257ade43320" +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + dependencies: + os-tmpdir "~1.0.2" -tryit@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/tryit/-/tryit-1.0.3.tgz#393be730a9446fd1ead6da59a014308f36c289cb" +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" + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + dependencies: + kind-of "^3.0.2" + +to-regex-range@^2.1.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + dependencies: + is-number "^3.0.0" + repeat-string "^1.6.1" + +to-regex@^3.0.1, to-regex@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + dependencies: + define-property "^2.0.2" + extend-shallow "^3.0.2" + regex-not "^1.0.2" + safe-regex "^1.1.0" + +trim-right@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" + +tslib@^1.9.0: + version "1.9.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" type-check@~0.3.2: version "0.3.2" @@ -997,16 +2301,47 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" +union-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + dependencies: + arr-union "^3.1.0" + get-value "^2.0.6" + is-extendable "^0.1.1" + set-value "^0.4.3" + +unset-value@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" dependencies: - os-homedir "^1.0.0" + has-value "^0.3.1" + isobject "^3.0.0" + +urix@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + +use@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" +validate-npm-package-license@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz#2804babe712ad3379459acfbe24746ab2c303fbc" + dependencies: + spdx-correct "~1.0.0" + spdx-expression-parse "~1.0.0" + +which@^1.2.10, which@^1.2.9: + version "1.3.1" + resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + dependencies: + isexe "^2.0.0" + wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" @@ -1021,6 +2356,6 @@ write@^0.2.1: dependencies: mkdirp "^0.5.1" -xtend@^4.0.0: - 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"