From 0b5f6f50840682b581a354b769d2890137305235 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 21 Jan 2020 01:03:21 +0100 Subject: [PATCH 01/30] chore: upgrade commitlint and add config-lerna-scopes (#1470) --- package.json | 9 +- yarn.lock | 357 ++++++++++++++++++++++++--------------------------- 2 files changed, 170 insertions(+), 196 deletions(-) diff --git a/package.json b/package.json index 76fed22655ac..6ae87643628a 100644 --- a/package.json +++ b/package.json @@ -44,16 +44,17 @@ }, "commitlint": { "extends": [ - "@commitlint/config-conventional" + "@commitlint/config-conventional", + "@commitlint/config-lerna-scopes" ] }, "engines": { "node": "^8.10.0 || ^10.13.0 || >=11.10.1" }, "devDependencies": { - "@commitlint/cli": "^8.1.0", - "@commitlint/config-conventional": "^8.1.0", - "@commitlint/travis-cli": "^8.1.0", + "@commitlint/cli": "^8.3.5", + "@commitlint/config-conventional": "^8.3.4", + "@commitlint/config-lerna-scopes": "^8.3.4", "@types/jest": "^24.0.23", "@types/node": "^12.12.7", "all-contributors-cli": "^6.11.0", diff --git a/yarn.lock b/yarn.lock index a80b58ca2c51..40840f1150f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -145,145 +145,145 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@commitlint/cli@^8.1.0", "@commitlint/cli@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-8.2.0.tgz#fbf9969e04e2162d985eaa644fdad6ce807aadb6" - integrity sha512-8fJ5pmytc38yw2QWbTTJmXLfSiWPwMkHH4govo9zJ/+ERPBF2jvlxD/dQvk24ezcizjKc6LFka2edYC4OQ+Dgw== - dependencies: - "@commitlint/format" "^8.2.0" - "@commitlint/lint" "^8.2.0" - "@commitlint/load" "^8.2.0" - "@commitlint/read" "^8.2.0" +"@commitlint/cli@^8.3.5": + version "8.3.5" + resolved "https://registry.yarnpkg.com/@commitlint/cli/-/cli-8.3.5.tgz#6d93a3a8b2437fa978999d3f6a336bcc70be3fd3" + integrity sha512-6+L0vbw55UEdht71pgWOE55SRgb+8OHcEwGDB234VlIBFGK9P2QOBU7MHiYJ5cjdjCQ0rReNrGjOHmJ99jwf0w== + dependencies: + "@commitlint/format" "^8.3.4" + "@commitlint/lint" "^8.3.5" + "@commitlint/load" "^8.3.5" + "@commitlint/read" "^8.3.4" babel-polyfill "6.26.0" chalk "2.4.2" get-stdin "7.0.0" - lodash "4.17.14" + lodash "4.17.15" meow "5.0.0" resolve-from "5.0.0" resolve-global "1.0.0" -"@commitlint/config-conventional@^8.1.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-8.2.0.tgz#886a5538e3708e017ec2871e0cbce00f635d3102" - integrity sha512-HuwlHQ3DyVhpK9GHgTMhJXD8Zp8PGIQVpQGYh/iTrEU6TVxdRC61BxIDZvfWatCaiG617Z/U8maRAFrqFM4TqA== +"@commitlint/config-conventional@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/config-conventional/-/config-conventional-8.3.4.tgz#fed13b3711690663b176c1f6b39c205a565618d2" + integrity sha512-w0Yc5+aVAjZgjYqx29igBOnVCj8O22gy3Vo6Fyp7PwoS7+AYS1x3sN7IBq6i7Ae15Mv5P+rEx1pkxXo5zOMe4g== + dependencies: + conventional-changelog-conventionalcommits "4.2.1" -"@commitlint/ensure@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-8.2.0.tgz#fad0c81c3d3bd09aa5fbcbcc483ae1f39bc8af8f" - integrity sha512-XZZih/kcRrqK7lEORbSYCfqQw6byfsFbLygRGVdJMlCPGu9E2MjpwCtoj5z7y/lKfUB3MJaBhzn2muJqS1gC6A== +"@commitlint/config-lerna-scopes@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/config-lerna-scopes/-/config-lerna-scopes-8.3.4.tgz#4e977cb39114664ce7db502b1d8e5d77f1a92340" + integrity sha512-kaSZ4i9uA/v0AS4Nt4E0D+qYtnPEnkYqOYvgxee16rUxP8uCgBbiv6oNnF3Tk/eHxopHzbG80n1YVYcb2s7edw== dependencies: - lodash "4.17.14" + import-from "3.0.0" + resolve-pkg "2.0.0" + semver "6.3.0" + +"@commitlint/ensure@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/ensure/-/ensure-8.3.4.tgz#6931677e4ca0fde71686ae3b7a367261647a341d" + integrity sha512-8NW77VxviLhD16O3EUd02lApMFnrHexq10YS4F4NftNoErKbKaJ0YYedktk2boKrtNRf/gQHY/Qf65edPx4ipw== + dependencies: + lodash "4.17.15" -"@commitlint/execute-rule@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-8.2.0.tgz#aefb3744e22613660adefb7ebcccaa60bd24e78d" - integrity sha512-9MBRthHaulbWTa8ReG2Oii2qc117NuvzhZdnkuKuYLhker7sUXGFcVhLanuWUKGyfyI2o9zVr/NHsNbCCsTzAA== +"@commitlint/execute-rule@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/execute-rule/-/execute-rule-8.3.4.tgz#1b63f0713b197889d90b76f9eea1abc010d256b1" + integrity sha512-f4HigYjeIBn9f7OuNv5zh2y5vWaAhNFrfeul8CRJDy82l3Y+09lxOTGxfF3uMXKrZq4LmuK6qvvRCZ8mUrVvzQ== -"@commitlint/format@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-8.2.0.tgz#0a2447fadac7c0421ce8a8d7e27dfa2172c737d4" - integrity sha512-sA77agkDEMsEMrlGhrLtAg8vRexkOofEEv/CZX+4xlANyAz2kNwJvMg33lcL65CBhqKEnRRJRxfZ1ZqcujdKcQ== +"@commitlint/format@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/format/-/format-8.3.4.tgz#7cd1f0ba5a3289c8d14d7dac29ee1fc1597fe1d9" + integrity sha512-809wlQ/ND6CLZON+w2Rb3YM2TLNDfU2xyyqpZeqzf2reJNpySMSUAeaO/fNDJSOKIsOsR3bI01rGu6hv28k+Nw== dependencies: chalk "^2.0.1" -"@commitlint/is-ignored@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-8.2.0.tgz#b6409ab28bf5a80f25e14da17da3916adb230a89" - integrity sha512-ADaGnKfbfV6KD1pETp0Qf7XAyc75xTy3WJlbvPbwZ4oPdBMsXF0oXEEGMis6qABfU2IXan5/KAJgAFX3vdd0jA== +"@commitlint/is-ignored@^8.3.5": + version "8.3.5" + resolved "https://registry.yarnpkg.com/@commitlint/is-ignored/-/is-ignored-8.3.5.tgz#e6f59496e1b1ce58020d519cd578ad0f43169199" + integrity sha512-Zo+8a6gJLFDTqyNRx53wQi/XTiz8mncvmWf/4oRG+6WRcBfjSSHY7KPVj5Y6UaLy2EgZ0WQ2Tt6RdTDeQiQplA== dependencies: - "@types/semver" "^6.0.1" - semver "6.2.0" + semver "6.3.0" -"@commitlint/lint@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-8.2.0.tgz#aadc606379f3550eb877f16d4f5b103639cbf92a" - integrity sha512-ch9JN8aR37ufdjoWv50jLfvFz9rWMgLW5HEkMGLsM/51gjekmQYS5NJg8S2+6F5+jmralAO7VkUMI6FukXKX0A== +"@commitlint/lint@^8.3.5": + version "8.3.5" + resolved "https://registry.yarnpkg.com/@commitlint/lint/-/lint-8.3.5.tgz#627e75adb1cc803cc723e33cc2ba4aa27cbb9f0c" + integrity sha512-02AkI0a6PU6rzqUvuDkSi6rDQ2hUgkq9GpmdJqfai5bDbxx2939mK4ZO+7apbIh4H6Pae7EpYi7ffxuJgm+3hQ== dependencies: - "@commitlint/is-ignored" "^8.2.0" - "@commitlint/parse" "^8.2.0" - "@commitlint/rules" "^8.2.0" + "@commitlint/is-ignored" "^8.3.5" + "@commitlint/parse" "^8.3.4" + "@commitlint/rules" "^8.3.4" babel-runtime "^6.23.0" - lodash "4.17.14" + lodash "4.17.15" -"@commitlint/load@>6.1.1", "@commitlint/load@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-8.2.0.tgz#9ca53a0c795e4f63d796b4d42279e856549add1a" - integrity sha512-EV6PfAY/p83QynNd1llHxJiNxKmp43g8+7dZbyfHFbsGOdokrCnoelAVZ+WGgktXwLN/uXyfkcIAxwac015UYw== +"@commitlint/load@>6.1.1", "@commitlint/load@^8.3.5": + version "8.3.5" + resolved "https://registry.yarnpkg.com/@commitlint/load/-/load-8.3.5.tgz#3f059225ede92166ba94cf4c48e3d67c8b08b18a" + integrity sha512-poF7R1CtQvIXRmVIe63FjSQmN9KDqjRtU5A6hxqXBga87yB2VUJzic85TV6PcQc+wStk52cjrMI+g0zFx+Zxrw== dependencies: - "@commitlint/execute-rule" "^8.2.0" - "@commitlint/resolve-extends" "^8.2.0" + "@commitlint/execute-rule" "^8.3.4" + "@commitlint/resolve-extends" "^8.3.5" babel-runtime "^6.23.0" chalk "2.4.2" cosmiconfig "^5.2.0" - lodash "4.17.14" + lodash "4.17.15" resolve-from "^5.0.0" -"@commitlint/message@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-8.2.0.tgz#bdc0388183f6bc6006c7e7e197a721683011907a" - integrity sha512-LNsSwDLIFgE3nb/Sb1PIluYNy4Q8igdf4tpJCdv5JJDf7CZCZt3ZTglj0YutZZorpRRuHJsVIB2+dI4bVH3bFw== +"@commitlint/message@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/message/-/message-8.3.4.tgz#b4e50d14aa6e15a5ad0767b952a7953f3681d768" + integrity sha512-nEj5tknoOKXqBsaQtCtgPcsAaf5VCg3+fWhss4Vmtq40633xLq0irkdDdMEsYIx8rGR0XPBTukqzln9kAWCkcA== -"@commitlint/parse@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-8.2.0.tgz#de80137e89ee5a2d3029656c9b33e90c88c6f56c" - integrity sha512-vzouqroTXG6QXApkrps0gbeSYW6w5drpUk7QAeZIcaCSPsQXDM8eqqt98ZzlzLJHo5oPNXPX1AAVSTrssvHemA== +"@commitlint/parse@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/parse/-/parse-8.3.4.tgz#d741f8b9104b35d0f4c10938165b20cbf167f81e" + integrity sha512-b3uQvpUQWC20EBfKSfMRnyx5Wc4Cn778bVeVOFErF/cXQK725L1bYFvPnEjQO/GT8yGVzq2wtLaoEqjm1NJ/Bw== dependencies: conventional-changelog-angular "^1.3.3" - conventional-commits-parser "^2.1.0" + conventional-commits-parser "^3.0.0" lodash "^4.17.11" -"@commitlint/read@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-8.2.0.tgz#54c6549723d532c74434ee0d74e0459032dc9159" - integrity sha512-1tBai1VuSQmsOTsvJr3Fi/GZqX3zdxRqYe/yN4i3cLA5S2Y4QGJ5I3l6nGZlKgm/sSelTCVKHltrfWU8s5H7SA== +"@commitlint/read@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/read/-/read-8.3.4.tgz#81a34283d8cd7b2acdf57829a91761e9c7791455" + integrity sha512-FKv1kHPrvcAG5j+OSbd41IWexsbLhfIXpxVC/YwQZO+FR0EHmygxQNYs66r+GnhD1EfYJYM4WQIqd5bJRx6OIw== dependencies: - "@commitlint/top-level" "^8.2.0" + "@commitlint/top-level" "^8.3.4" "@marionebl/sander" "^0.6.0" babel-runtime "^6.23.0" - git-raw-commits "^1.3.0" + git-raw-commits "^2.0.0" -"@commitlint/resolve-extends@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-8.2.0.tgz#b7f2f0c71c10f24b98a199ed11d2c14cfd7a318f" - integrity sha512-cwi0HUsDcD502HBP8huXfTkVuWmeo1Fiz3GKxNwMBBsJV4+bKa7QrtxbNpXhVuarX7QjWfNTvmW6KmFS7YK9uw== +"@commitlint/resolve-extends@^8.3.5": + version "8.3.5" + resolved "https://registry.yarnpkg.com/@commitlint/resolve-extends/-/resolve-extends-8.3.5.tgz#8fff800f292ac217ae30b1862f5f9a84b278310a" + integrity sha512-nHhFAK29qiXNe6oH6uG5wqBnCR+BQnxlBW/q5fjtxIaQALgfoNLHwLS9exzbIRFqwJckpR6yMCfgMbmbAOtklQ== dependencies: - "@types/node" "^12.0.2" import-fresh "^3.0.0" - lodash "4.17.14" + lodash "4.17.15" resolve-from "^5.0.0" resolve-global "^1.0.0" -"@commitlint/rules@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-8.2.0.tgz#4cd6a323ca1a3f3d33ae6dc723f8c88f3dcde347" - integrity sha512-FlqSBBP2Gxt5Ibw+bxdYpzqYR6HI8NIBpaTBhAjSEAduQtdWFMOhF0zsgkwH7lHN7opaLcnY2fXxAhbzTmJQQA== +"@commitlint/rules@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/rules/-/rules-8.3.4.tgz#41da7e16c6b89af268fe81c87a158c1fd2ac82b1" + integrity sha512-xuC9dlqD5xgAoDFgnbs578cJySvwOSkMLQyZADb1xD5n7BNcUJfP8WjT9W1Aw8K3Wf8+Ym/ysr9FZHXInLeaRg== dependencies: - "@commitlint/ensure" "^8.2.0" - "@commitlint/message" "^8.2.0" - "@commitlint/to-lines" "^8.2.0" + "@commitlint/ensure" "^8.3.4" + "@commitlint/message" "^8.3.4" + "@commitlint/to-lines" "^8.3.4" babel-runtime "^6.23.0" -"@commitlint/to-lines@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-8.2.0.tgz#dddb5916a457e1a79e437115a9b8eac7bf9ad52a" - integrity sha512-LXTYG3sMenlN5qwyTZ6czOULVcx46uMy+MEVqpvCgptqr/MZcV/C2J+S2o1DGwj1gOEFMpqrZaE3/1R2Q+N8ng== +"@commitlint/to-lines@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/to-lines/-/to-lines-8.3.4.tgz#ce24963b6d86dbe51d88d5e3028ab28f38562e2e" + integrity sha512-5AvcdwRsMIVq0lrzXTwpbbG5fKRTWcHkhn/hCXJJ9pm1JidsnidS1y0RGkb3O50TEHGewhXwNoavxW9VToscUA== -"@commitlint/top-level@^8.2.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-8.2.0.tgz#206e7cbc54dbe9494190677f887dd60943fed5b0" - integrity sha512-Yaw4KmYNy31/HhRUuZ+fupFcDalnfpdu4JGBgGAqS9aBHdMSSWdWqtAaDaxdtWjTZeN3O0sA2gOhXwvKwiDwvw== +"@commitlint/top-level@^8.3.4": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@commitlint/top-level/-/top-level-8.3.4.tgz#803fc6e8f5be5efa5f3551761acfca961f1d8685" + integrity sha512-nOaeLBbAqSZNpKgEtO6NAxmui1G8ZvLG+0wb4rvv6mWhPDzK1GNZkCd8FUZPahCoJ1iHDoatw7F8BbJLg4nDjg== dependencies: find-up "^4.0.0" -"@commitlint/travis-cli@^8.1.0": - version "8.2.0" - resolved "https://registry.yarnpkg.com/@commitlint/travis-cli/-/travis-cli-8.2.0.tgz#ad916afee6c3cb4c120119e7acc6aca35a911cfe" - integrity sha512-SXZh9qpAWwvzW2KlG5HOxnci1KMkUZOqr2wKMzgXuV+BS5jhkZaPsKvrrs85FZtUWdJuqFNHTVXKoetgWgMXpQ== - dependencies: - "@commitlint/cli" "^8.2.0" - babel-runtime "6.26.0" - execa "0.11.0" - "@evocateur/libnpmaccess@^3.1.2": version "3.1.2" resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845" @@ -1391,12 +1391,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^12.0.2": - version "12.7.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" - integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== - -"@types/node@^12.12.7": +"@types/node@*", "@types/node@^12.12.7": version "12.12.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== @@ -1411,11 +1406,6 @@ resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-1.18.3.tgz#64ff53329ce16139f17c3db9d3e0487199972cd8" integrity sha512-48rnerQdcZ26odp+HOvDGX8IcUkYOCuMc2BodWYTe956MqkHlOGAG4oFQ83cjZ0a4GAgj7mb4GUClxYd2Hlodg== -"@types/semver@^6.0.1": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.0.2.tgz#5e8b09f0e4af53034b1d0fb9977a277847836205" - integrity sha512-G1Ggy7/9Nsa1Jt2yiBR2riEuyK2DFNnqow6R7cromXPMNynackRY1vqFTLz/gwnef1LHokbXThcPhqMRjUbkpQ== - "@types/semver@^6.2.0": version "6.2.0" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.0.tgz#d688d574400d96c5b0114968705366f431831e1a" @@ -1837,7 +1827,7 @@ babel-preset-jest@^24.9.0: "@babel/plugin-syntax-object-rest-spread" "^7.0.0" babel-plugin-jest-hoist "^24.9.0" -babel-runtime@6.26.0, babel-runtime@^6.23.0, babel-runtime@^6.26.0: +babel-runtime@^6.23.0, babel-runtime@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= @@ -2366,6 +2356,15 @@ conventional-changelog-angular@^5.0.3: compare-func "^1.3.1" q "^1.5.1" +conventional-changelog-conventionalcommits@4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.2.1.tgz#d6cb2e2c5d7bfca044a08b9dba84b4082e1a1bd9" + integrity sha512-vC02KucnkNNap+foDKFm7BVUSDAXktXrUJqGszUuYnt6T0J2azsbYz/w9TDc3VsrW2v6JOtiQWVcgZnporHr4Q== + dependencies: + compare-func "^1.3.1" + lodash "^4.2.1" + q "^1.5.1" + conventional-changelog-core@^3.1.6: version "3.2.3" resolved "https://registry.yarnpkg.com/conventional-changelog-core/-/conventional-changelog-core-3.2.3.tgz#b31410856f431c847086a7dcb4d2ca184a7d88fb" @@ -2407,9 +2406,9 @@ conventional-changelog-writer@^4.0.6: through2 "^3.0.0" conventional-commit-types@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.1.1.tgz#352eb53f56fbc7c1a6c1ba059c2b6670c90b2a8a" - integrity sha512-0Ts+fEdmjqYDOQ1yZ+LNgdSPO335XZw9qC10M7CxtLP3nIMGmeMhmkM8Taffa4+MXN13bRPlp0CtH+QfOzKTzw== + version "2.3.0" + resolved "https://registry.yarnpkg.com/conventional-commit-types/-/conventional-commit-types-2.3.0.tgz#bc3c8ebba0a9e4b3ecc548f1d0674e251ab8be22" + integrity sha512-6iB39PrcGYdz0n3z31kj6/Km6mK9hm9oMRhwcLnKxE7WNoeRKZbTAobliKrbYZ5jqyCvtcVEfjCiaEzhL3AVmQ== conventional-commits-filter@^2.0.2: version "2.0.2" @@ -2419,17 +2418,17 @@ conventional-commits-filter@^2.0.2: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^2.1.0: - version "2.1.7" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz#eca45ed6140d72ba9722ee4132674d639e644e8e" - integrity sha512-BoMaddIEJ6B4QVMSDu9IkVImlGOSGA1I2BQyOZHeLQ6qVOJLcLKn97+fL6dGbzWEiqDzfH4OkcveULmeq2MHFQ== +conventional-commits-parser@^3.0.0: + version "3.0.8" + resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.8.tgz#23310a9bda6c93c874224375e72b09fb275fe710" + integrity sha512-YcBSGkZbYp7d+Cr3NWUeXbPDFUN6g3SaSIzOybi8bjHL5IJ5225OSCxJJ4LgziyEJ7AaJtE9L2/EU6H7Nt/DDQ== dependencies: JSONStream "^1.0.4" - is-text-path "^1.0.0" - lodash "^4.2.1" - meow "^4.0.0" + is-text-path "^1.0.1" + lodash "^4.17.15" + meow "^5.0.0" split2 "^2.0.0" - through2 "^2.0.0" + through2 "^3.0.0" trim-off-newlines "^1.0.0" conventional-commits-parser@^3.0.3: @@ -2484,9 +2483,9 @@ copy-descriptor@^0.1.0: integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js@^2.4.0, core-js@^2.5.0: - version "2.6.9" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.9.tgz#6b4b214620c834152e179323727fc19741b084f2" - integrity sha512-HOpZf6eXmnl7la+cUdMnLvUxKNqLUzJvgIziQ0DiF3JwSImNphIqdGqzj6hIKyX04MmV0poclQ7+wjWvxQyR2A== + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== core-util-is@1.0.2, core-util-is@~1.0.0: version "1.0.2" @@ -3377,19 +3376,6 @@ exec-sh@^0.3.2: resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.4.tgz#3a018ceb526cc6f6df2bb504b2bfe8e3a4934ec5" integrity sha512-sEFIkc61v75sWeOe72qyrqg2Qg0OuLESziUDk/O/z2qgS15y2gWVFrI6f2Qn/qw/0/NCfCEsmNA4zOjkwEZT1A== -execa@0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.11.0.tgz#0b3c71daf9b9159c252a863cd981af1b4410d97a" - integrity sha512-k5AR22vCt1DcfeiRixW46U5tMLtBg44ssdJM9PiXw3D8Bn5qyxFCSnKY/eR22y+ctFDGPqafpaXg2G4Emyua4A== - dependencies: - cross-spawn "^6.0.0" - get-stream "^4.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" - execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -3872,16 +3858,16 @@ git-raw-commits@2.0.0: split2 "^2.0.0" through2 "^2.0.0" -git-raw-commits@^1.3.0: - version "1.3.6" - resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-1.3.6.tgz#27c35a32a67777c1ecd412a239a6c19d71b95aff" - integrity sha512-svsK26tQ8vEKnMshTDatSIQSMDdz8CxIIqKsvPqbtV23Etmw6VNaFAitu8zwZ0VrOne7FztwPyRLxK7/DIUTQg== +git-raw-commits@^2.0.0: + version "2.0.3" + resolved "https://registry.yarnpkg.com/git-raw-commits/-/git-raw-commits-2.0.3.tgz#f040e67b8445962d4d168903a9e84c4240c17655" + integrity sha512-SoSsFL5lnixVzctGEi2uykjA7B5I0AhO9x6kdzvGRHbxsa6JSEgrgy1esRKsfOKE1cgyOJ/KDR2Trxu157sb8w== dependencies: dargs "^4.0.1" lodash.template "^4.0.2" - meow "^4.0.0" + meow "^5.0.0" split2 "^2.0.0" - through2 "^2.0.0" + through2 "^3.0.0" git-remote-origin-url@^2.0.0: version "2.0.0" @@ -3941,7 +3927,7 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@*, glob@^7.1.2, glob@^7.1.6: +glob@*, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -3953,7 +3939,7 @@ glob@*, glob@^7.1.2, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" -glob@7.1.4, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.3, glob@^7.1.4: +glob@7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== @@ -4033,9 +4019,9 @@ globby@^9.2.0: slash "^2.0.0" graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2: - version "4.2.2" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.2.tgz#6f0952605d0140c1cfdb138ed005775b92d67b02" - integrity sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q== + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== growly@^1.3.0: version "1.3.0" @@ -4139,9 +4125,9 @@ homedir-polyfill@^1.0.1: parse-passwd "^1.0.0" hosted-git-info@^2.1.4, hosted-git-info@^2.7.1: - version "2.8.4" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.4.tgz#44119abaf4bc64692a16ace34700fed9c03e2546" - integrity sha512-pzXIvANXEFrc5oFFXRMkbLPQ2rXRoDERwDLyrcUxGhaZhgP54BBSl9Oheh7Vv0T090cszWBxPjkQQ5Sq1PbBRQ== + version "2.8.5" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" + integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== html-encoding-sniffer@^1.0.2: version "1.0.2" @@ -4242,13 +4228,20 @@ import-fresh@^2.0.0: resolve-from "^3.0.0" import-fresh@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" - integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + version "3.2.1" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66" + integrity sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" +import-from@3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" + integrity sha512-CiuXOFFSzkU5x/CR0+z7T91Iht4CXgfCxVOFRhh2Zyhg5wOpWvvDLQUsWl+gcN+QscYBjez8hDCt85O7RLDttQ== + dependencies: + resolve-from "^5.0.0" + import-local@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-2.0.0.tgz#55070be38a5993cf18ef6db7e961f5bee5c5a09d" @@ -4627,7 +4620,7 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" -is-text-path@^1.0.0: +is-text-path@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-1.0.1.tgz#4e1aa0fb51bfbcb3e92688001397202c1775b66e" integrity sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4= @@ -5494,11 +5487,6 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.14: - version "4.17.14" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.14.tgz#9ce487ae66c96254fe20b599f21b6816028078ba" - integrity sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw== - lodash@4.17.15, lodash@^4.11.2, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.2.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" @@ -5637,7 +5625,7 @@ marked@^0.7.0: resolved "https://registry.yarnpkg.com/marked/-/marked-0.7.0.tgz#b64201f051d271b1edc10a04d1ae9b74bb8e5c0e" integrity sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg== -meow@5.0.0: +meow@5.0.0, meow@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/meow/-/meow-5.0.0.tgz#dfc73d63a9afc714a5e371760eb5c88b91078aa4" integrity sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig== @@ -6260,9 +6248,9 @@ p-limit@^1.1.0: p-try "^1.0.0" p-limit@^2.0.0, p-limit@^2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" - integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== + version "2.2.2" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e" + integrity sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ== dependencies: p-try "^2.0.0" @@ -6821,9 +6809,9 @@ read@1, read@~1.0.1: mute-stream "~0.0.4" "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.6, readable-stream@~2.3.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -6834,9 +6822,9 @@ read@1, read@~1.0.1: util-deprecate "~1.0.1" "readable-stream@2 || 3", readable-stream@^3.0.2: - version "3.4.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.4.0.tgz#a51c26754658e0a3c21dbf59163bd45ba6f447fc" - integrity sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ== + version "3.5.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.5.0.tgz#465d70e6d1087f6162d079cd0b5db7fbebfd1606" + integrity sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -7026,6 +7014,13 @@ resolve-global@1.0.0, resolve-global@^1.0.0: dependencies: global-dirs "^0.1.1" +resolve-pkg@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/resolve-pkg/-/resolve-pkg-2.0.0.tgz#ac06991418a7623edc119084edc98b0e6bf05a41" + integrity sha512-+1lzwXehGCXSeryaISr6WujZzowloigEofRB+dj75y9RRa/obVcYgbHJd53tdYw8pvZj8GojXaaENws8Ktw/hQ== + dependencies: + resolve-from "^5.0.0" + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -7037,9 +7032,9 @@ resolve@1.1.7: integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= resolve@1.x, resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0, resolve@^1.3.2, resolve@^1.5.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" - integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + version "1.14.2" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.2.tgz#dbf31d0fa98b1f29aa5169783b9c290cb865fea2" + integrity sha512-EjlOBLBO1kxsUxsKjLt7TAECyKW6fOh1VRkykQkKGzcBbjjPIxBqGh0jf7GJ3k/f5mxMqW3htMD3WdTUVtW8HQ== dependencies: path-parse "^1.0.6" @@ -7188,12 +7183,7 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== -semver@6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" - integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== - -semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@6.3.0, semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -8410,24 +8400,7 @@ yargs@^13.3.0: y18n "^4.0.0" yargs-parser "^13.1.1" -yargs@^14.0.0: - version "14.0.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.0.0.tgz#ba4cacc802b3c0b3e36a9e791723763d57a85066" - integrity sha512-ssa5JuRjMeZEUjg7bEL99AwpitxU/zWGAGpdj0di41pOEmJti8NR6kyUIJBkR78DTYNPZOU08luUo0GTHuB+ow== - dependencies: - cliui "^5.0.0" - decamelize "^1.2.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" - require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.1" - -yargs@^14.2.0: +yargs@^14.0.0, yargs@^14.2.0: version "14.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.0.tgz#f116a9242c4ed8668790b40759b4906c276e76c3" integrity sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg== From 2a83d138a966cd5ce787d1eecf595b59b78232d4 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Tue, 21 Jan 2020 13:56:00 +1300 Subject: [PATCH 02/30] feat(eslint-plugin): create `ban-ts-comment` rule (#1361) --- .cspell.json | 1 + packages/eslint-plugin/README.md | 2 +- .../docs/rules/ban-ts-comment.md | 65 +++++ .../eslint-plugin/docs/rules/ban-ts-ignore.md | 2 + packages/eslint-plugin/src/configs/all.json | 2 +- .../eslint-plugin/src/rules/ban-ts-comment.ts | 82 ++++++ .../eslint-plugin/src/rules/ban-ts-ignore.ts | 2 + packages/eslint-plugin/src/rules/index.ts | 2 + .../tests/rules/ban-ts-comment.test.ts | 233 ++++++++++++++++++ 9 files changed, 389 insertions(+), 2 deletions(-) create mode 100644 packages/eslint-plugin/docs/rules/ban-ts-comment.md create mode 100644 packages/eslint-plugin/src/rules/ban-ts-comment.ts create mode 100644 packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts diff --git a/.cspell.json b/.cspell.json index 0c045aaa4bc7..d2061775d83f 100644 --- a/.cspell.json +++ b/.cspell.json @@ -61,6 +61,7 @@ "estree", "linebreaks", "necroing", + "nocheck", "nullish", "parameterised", "performant", diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index f2418485d521..77709f77832a 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -98,7 +98,7 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int | [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | | [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | | [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/ban-ts-ignore`](./docs/rules/ban-ts-ignore.md) | Bans “// @ts-ignore” comments from being used | :heavy_check_mark: | | | +| [`@typescript-eslint/ban-ts-comment`](./docs/rules/ban-ts-comment.md) | Bans `// @ts-` comments from being used | | | | | [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions | :heavy_check_mark: | | | | [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | diff --git a/packages/eslint-plugin/docs/rules/ban-ts-comment.md b/packages/eslint-plugin/docs/rules/ban-ts-comment.md new file mode 100644 index 000000000000..58f99dc048a5 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/ban-ts-comment.md @@ -0,0 +1,65 @@ +# Bans `// @ts-` comments from being used (`ban-ts-comment`) + +TypeScript provides several directive comments that can be used to alter how it processes files. +Using these to suppress TypeScript Compiler Errors reduces the effectiveness of TypeScript overall. + +The directive comments supported by TypeScript are: + +``` +// @ts-ignore +// @ts-nocheck +// @ts-check +``` + +## Rule Details + +This rule lets you set which directive comments you want to allow in your codebase. +By default, only `@ts-check` is allowed, as it enables rather then suppresses errors. + +The configuration looks like this: + +``` +interface Options { + 'ts-ignore'?: boolean; + 'ts-nocheck'?: boolean; + 'ts-check'?: boolean; +} + +const defaultOptions: Options = { + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false +} +``` + +A value of `true` for a particular directive means that this rule will report if it finds any usage of said directive. + +For example, with the defaults above the following patterns are considered warnings: + +```ts +if (false) { + // @ts-ignore: Unreachable code error + console.log('hello'); +} +``` + +The following patterns are not warnings: + +```ts +if (false) { + // Compiler warns about unreachable code error + console.log('hello'); +} +``` + +## When Not To Use It + +If you want to use all of the TypeScript directives. + +## Further Reading + +- TypeScript [Type Checking JavaScript Files](https://www.typescriptlang.org/docs/handbook/type-checking-javascript-files.html) + +## Compatibility + +- TSLint: [ban-ts-ignore](https://palantir.github.io/tslint/rules/ban-ts-ignore/) diff --git a/packages/eslint-plugin/docs/rules/ban-ts-ignore.md b/packages/eslint-plugin/docs/rules/ban-ts-ignore.md index d8d987a95ed0..8f69c864669b 100644 --- a/packages/eslint-plugin/docs/rules/ban-ts-ignore.md +++ b/packages/eslint-plugin/docs/rules/ban-ts-ignore.md @@ -1,5 +1,7 @@ # Bans “// @ts-ignore” comments from being used (`ban-ts-ignore`) +This rule has been deprecated in favor of [`ban-ts-comment`](./ban-ts-comment.md) + Suppressing TypeScript Compiler Errors can be hard to discover. ## Rule Details diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 91380db19320..1ee81fe91ca7 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -4,7 +4,7 @@ "@typescript-eslint/adjacent-overload-signatures": "error", "@typescript-eslint/array-type": "error", "@typescript-eslint/await-thenable": "error", - "@typescript-eslint/ban-ts-ignore": "error", + "@typescript-eslint/ban-ts-comment": "error", "@typescript-eslint/ban-types": "error", "brace-style": "off", "@typescript-eslint/brace-style": "error", diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts new file mode 100644 index 000000000000..6370ef029f58 --- /dev/null +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -0,0 +1,82 @@ +import * as util from '../util'; + +interface Options { + 'ts-ignore'?: boolean; + 'ts-nocheck'?: boolean; + 'ts-check'?: boolean; +} + +const defaultOptions: [Options] = [ + { + 'ts-ignore': true, + 'ts-nocheck': true, + 'ts-check': false, + }, +]; + +type MessageIds = 'tsDirectiveComment'; + +export default util.createRule<[Options], MessageIds>({ + name: 'ban-ts-comment', + meta: { + type: 'problem', + docs: { + description: 'Bans `// @ts-` comments from being used', + category: 'Best Practices', + recommended: false, + }, + messages: { + tsDirectiveComment: + 'Do not use "// @ts-{directive}" because it alters compilation errors.', + }, + schema: [ + { + type: 'object', + properties: { + 'ts-ignore': { + type: 'boolean', + default: true, + }, + 'ts-nocheck': { + type: 'boolean', + default: true, + }, + 'ts-check': { + type: 'boolean', + default: false, + }, + }, + additionalProperties: false, + }, + ], + }, + defaultOptions, + create(context, [options]) { + const tsCommentRegExp = /^\/*\s*@ts-(ignore|check|nocheck)/; + const sourceCode = context.getSourceCode(); + + return { + Program(): void { + const comments = sourceCode.getAllComments(); + + comments.forEach(comment => { + if (comment.type !== 'Line') { + return; + } + + const [, directive] = tsCommentRegExp.exec(comment.value) ?? []; + + const fullDirective = `ts-${directive}` as keyof Options; + + if (options[fullDirective]) { + context.report({ + data: { directive }, + node: comment, + messageId: 'tsDirectiveComment', + }); + } + }); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts index 7d7a32e6cfc9..a00b4a4f67d0 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts @@ -14,6 +14,8 @@ export default util.createRule({ tsIgnoreComment: 'Do not use "// @ts-ignore" comments because they suppress compilation errors.', }, + deprecated: true, + replacedBy: ['@typescript-eslint/ban-ts-comment'], }, defaultOptions: [], create(context) { diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index ac12f27e8ba3..7f9f47e538a8 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -2,6 +2,7 @@ import adjacentOverloadSignatures from './adjacent-overload-signatures'; import arrayType from './array-type'; import awaitThenable from './await-thenable'; import banTsIgnore from './ban-ts-ignore'; +import banTsComment from './ban-ts-comment'; import banTypes from './ban-types'; import braceStyle from './brace-style'; import camelcase from './camelcase'; @@ -85,6 +86,7 @@ export default { 'array-type': arrayType, 'await-thenable': awaitThenable, 'ban-ts-ignore': banTsIgnore, + 'ban-ts-comment': banTsComment, 'ban-types': banTypes, 'brace-style': braceStyle, camelcase: camelcase, diff --git a/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts b/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts new file mode 100644 index 000000000000..3a59be879f95 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/ban-ts-comment.test.ts @@ -0,0 +1,233 @@ +import rule from '../../src/rules/ban-ts-comment'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('ts-ignore', rule, { + valid: [ + `// just a comment containing @ts-ignore somewhere`, + `/* @ts-ignore */`, + `/** @ts-ignore */`, + `/* +// @ts-ignore in a block +*/`, + { + code: '// @ts-ignore', + options: [{ 'ts-ignore': false }], + }, + ], + invalid: [ + { + code: '// @ts-ignore', + options: [{ 'ts-ignore': true }], + errors: [ + { + data: { directive: 'ignore' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '// @ts-ignore', + errors: [ + { + data: { directive: 'ignore' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '// @ts-ignore: Suppress next line', + errors: [ + { + data: { directive: 'ignore' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '/////@ts-ignore: Suppress next line', + errors: [ + { + data: { directive: 'ignore' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +if (false) { + // @ts-ignore: Unreachable code error + console.log("hello"); +} + `, + errors: [ + { + data: { directive: 'ignore' }, + messageId: 'tsDirectiveComment', + line: 3, + column: 3, + }, + ], + }, + ], +}); + +ruleTester.run('ts-nocheck', rule, { + valid: [ + `// just a comment containing @ts-nocheck somewhere`, + `/* @ts-nocheck */`, + `/** @ts-nocheck */`, + `/* +// @ts-nocheck in a block +*/`, + { + code: '// @ts-nocheck', + options: [{ 'ts-nocheck': false }], + }, + ], + invalid: [ + { + code: '// @ts-nocheck', + options: [{ 'ts-nocheck': true }], + errors: [ + { + data: { directive: 'nocheck' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '// @ts-nocheck', + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '// @ts-nocheck: Suppress next line', + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '/////@ts-nocheck: Suppress next line', + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +if (false) { + // @ts-nocheck: Unreachable code error + console.log("hello"); +} + `, + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 3, + column: 3, + }, + ], + }, + ], +}); + +ruleTester.run('ts-check', rule, { + valid: [ + `// just a comment containing @ts-check somewhere`, + `/* @ts-check */`, + `/** @ts-check */`, + `/* +// @ts-check in a block +*/`, + { + code: '// @ts-check', + options: [{ 'ts-check': false }], + }, + ], + invalid: [ + { + code: '// @ts-check', + options: [{ 'ts-check': true }], + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '// @ts-check: Suppress next line', + options: [{ 'ts-check': true }], + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: '/////@ts-check: Suppress next line', + options: [{ 'ts-check': true }], + + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 1, + column: 1, + }, + ], + }, + { + code: ` +if (false) { + // @ts-check: Unreachable code error + console.log("hello"); +} + `, + options: [{ 'ts-check': true }], + errors: [ + { + data: { directive: 'check' }, + messageId: 'tsDirectiveComment', + line: 3, + column: 3, + }, + ], + }, + ], +}); From 7fabd97f4e483a317f84b0f3a537e794de313167 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 20 Jan 2020 19:01:37 -0800 Subject: [PATCH 03/30] docs: fix broken TOC in FAQ --- docs/getting-started/linting/FAQ.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting-started/linting/FAQ.md b/docs/getting-started/linting/FAQ.md index f5585b170742..5d21a9f023ec 100644 --- a/docs/getting-started/linting/FAQ.md +++ b/docs/getting-started/linting/FAQ.md @@ -2,10 +2,10 @@ ## Table of Contents -- [My linting seems really slow](#my-linting-seems-really-slow) -- [I get errors telling me "The file must be included in at least one of the projects provided"](#i-get-errors-telling-me-"the-file-must-be-included-in-at-least-one-of-the-projects-provided") -- [I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config"](<#i-use-a-framework-(like-vue)-that-requires-custom-file-extensions,-and-i-get-errors-like-"you-should-add-`parserOptions.extraFileExtensions`-to-your-config">) -- [I am using a rule from ESLint core, and it doesn't work correctly with TypeScript code](#i-am-using-a-rule-from-eslint-core,-and-it-doesn't-work-correctly-with-typescript-code) +- [My linting feels really slow](#my-linting-feels-really-slow) +- [I get errors telling me "The file must be included in at least one of the projects provided"](#i-get-errors-telling-me-the-file-must-be-included-in-at-least-one-of-the-projects-provided) +- [I use a framework (like Vue) that requires custom file extensions, and I get errors like "You should add `parserOptions.extraFileExtensions` to your config"](#i-use-a-framework-like-vue-that-requires-custom-file-extensions-and-i-get-errors-like-you-should-add-parseroptionsextrafileextensions-to-your-config) +- [I am using a rule from ESLint core, and it doesn't work correctly with TypeScript code](#i-am-using-a-rule-from-eslint-core-and-it-doesnt-work-correctly-with-typescript-code) --- From 420db96921435e8bf7fb484ae74552a912a6adde Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 21 Jan 2020 04:03:31 +0100 Subject: [PATCH 04/30] feat(eslint-plugin): add new rule prefer-as-const (#1431) --- .eslintrc.js | 1 + packages/eslint-plugin/README.md | 1 + .../docs/rules/prefer-as-const.md | 28 ++++ packages/eslint-plugin/src/configs/all.json | 1 + packages/eslint-plugin/src/rules/indent.ts | 4 +- packages/eslint-plugin/src/rules/index.ts | 2 + .../src/rules/prefer-as-const.ts | 78 +++++++++ .../tests/rules/no-array-constructor.test.ts | 2 +- .../tests/rules/no-extraneous-class.test.ts | 6 +- .../tests/rules/no-this-alias.test.ts | 6 +- .../tests/rules/no-use-before-define.test.ts | 2 +- .../tests/rules/prefer-as-const.test.ts | 156 ++++++++++++++++++ packages/parser/tests/lib/parser.ts | 2 +- packages/typescript-estree/src/node-utils.ts | 128 +++++++------- 14 files changed, 342 insertions(+), 75 deletions(-) create mode 100644 packages/eslint-plugin/docs/rules/prefer-as-const.md create mode 100644 packages/eslint-plugin/src/rules/prefer-as-const.ts create mode 100644 packages/eslint-plugin/tests/rules/prefer-as-const.test.ts diff --git a/.eslintrc.js b/.eslintrc.js index 4aa35ae4305f..3271a33e83ed 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -33,6 +33,7 @@ module.exports = { '@typescript-eslint/prefer-nullish-coalescing': 'error', '@typescript-eslint/prefer-optional-chain': 'error', '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/prefer-as-const': 'error', 'no-empty-function': 'off', '@typescript-eslint/no-empty-function': [ diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 77709f77832a..b91ab9182f4f 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -133,6 +133,7 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int | [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | | [`@typescript-eslint/no-unused-vars-experimental`](./docs/rules/no-unused-vars-experimental.md) | Disallow unused variables and arguments | | | :thought_balloon: | | [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | +| [`@typescript-eslint/prefer-as-const`](./docs/rules/prefer-as-const.md) | Prefer usage of `as const` over literal type | | :wrench: | | | [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | | [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | | [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | :heavy_check_mark: | :wrench: | :thought_balloon: | diff --git a/packages/eslint-plugin/docs/rules/prefer-as-const.md b/packages/eslint-plugin/docs/rules/prefer-as-const.md new file mode 100644 index 000000000000..bb288192d267 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/prefer-as-const.md @@ -0,0 +1,28 @@ +# Prefer usage of `as const` over literal type (`prefer-as-const`) + +This rule recommends usage of `const` assertion when type primitive value is equal to type. + +## Rule Details + +Examples of **incorrect** code for this rule: + +```ts +let bar: 2 = 2; +let foo = <'bar'>'bar'; +let foo = { bar: 'baz' as 'baz' }; +``` + +Examples of **correct** code for this rule: + +```ts +let foo = 'bar'; +let foo = 'bar' as const; +let foo: 'bar' = 'bar' as const; +let bar = 'bar' as string; +let foo = 'bar'; +let foo = { bar: 'baz' }; +``` + +## When Not To Use It + +If you are using typescript < 3.4 diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 1ee81fe91ca7..916d9a0238f4 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -65,6 +65,7 @@ "no-useless-constructor": "off", "@typescript-eslint/no-useless-constructor": "error", "@typescript-eslint/no-var-requires": "error", + "@typescript-eslint/prefer-as-const": "error", "@typescript-eslint/prefer-for-of": "error", "@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-includes": "error", diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index 46cca6acd151..0a8d3196ab62 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -260,7 +260,7 @@ export default util.createRule({ return rules.VariableDeclaration({ type: AST_NODE_TYPES.VariableDeclaration, - kind: 'const' as 'const', + kind: 'const' as const, declarations: [ { type: AST_NODE_TYPES.VariableDeclarator, @@ -389,7 +389,7 @@ export default util.createRule({ ? node.typeAnnotation.loc.end : squareBracketStart.loc.end, }, - kind: 'init' as 'init', + kind: 'init' as const, computed: false, method: false, shorthand: false, diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 7f9f47e538a8..2079ccc4e401 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -56,6 +56,7 @@ import noUnusedVarsExperimental from './no-unused-vars-experimental'; import noUseBeforeDefine from './no-use-before-define'; import noUselessConstructor from './no-useless-constructor'; import noVarRequires from './no-var-requires'; +import preferAsConst from './prefer-as-const'; import preferForOf from './prefer-for-of'; import preferFunctionType from './prefer-function-type'; import preferIncludes from './prefer-includes'; @@ -140,6 +141,7 @@ export default { 'no-use-before-define': noUseBeforeDefine, 'no-useless-constructor': noUselessConstructor, 'no-var-requires': noVarRequires, + 'prefer-as-const': preferAsConst, 'prefer-for-of': preferForOf, 'prefer-function-type': preferFunctionType, 'prefer-includes': preferIncludes, diff --git a/packages/eslint-plugin/src/rules/prefer-as-const.ts b/packages/eslint-plugin/src/rules/prefer-as-const.ts new file mode 100644 index 000000000000..1cf21af7580c --- /dev/null +++ b/packages/eslint-plugin/src/rules/prefer-as-const.ts @@ -0,0 +1,78 @@ +import { + AST_NODE_TYPES, + TSESLint, + TSESTree, +} from '@typescript-eslint/experimental-utils'; +import * as util from '../util'; + +export default util.createRule({ + name: 'prefer-as-const', + meta: { + type: 'suggestion', + docs: { + description: 'Prefer usage of `as const` over literal type', + category: 'Best Practices', + recommended: false, + }, + fixable: 'code', + messages: { + preferConstAssertion: + 'Expected a `const` instead of a literal type assertion', + variableConstAssertion: + 'Expected a `const` assertion instead of a literal type annotation', + variableSuggest: 'You should use `as const` instead of type annotation.', + }, + schema: [], + }, + defaultOptions: [], + create(context) { + function compareTypes( + valueNode: TSESTree.Expression, + typeNode: TSESTree.TypeNode, + canFix: boolean, + ): void { + if ( + valueNode.type === AST_NODE_TYPES.Literal && + typeNode.type === AST_NODE_TYPES.TSLiteralType && + 'raw' in typeNode.literal && + valueNode.raw === typeNode.literal.raw + ) { + if (canFix) { + context.report({ + node: typeNode, + messageId: 'preferConstAssertion', + fix: fixer => fixer.replaceText(typeNode, 'const'), + }); + } else { + context.report({ + node: typeNode, + messageId: 'variableConstAssertion', + suggest: [ + { + messageId: 'variableSuggest', + fix: (fixer): TSESLint.RuleFix[] => [ + fixer.remove(typeNode.parent!), + fixer.insertTextAfter(valueNode, ' as const'), + ], + }, + ], + }); + } + } + } + + return { + TSAsExpression(node): void { + compareTypes(node.expression, node.typeAnnotation, true); + }, + TSTypeAssertion(node): void { + compareTypes(node.expression, node.typeAnnotation, true); + }, + VariableDeclarator(node): void { + if (node.init && node.id.typeAnnotation) { + compareTypes(node.init, node.id.typeAnnotation.typeAnnotation, false); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts index ca3da767f80c..cc6530085ddf 100644 --- a/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-array-constructor.test.ts @@ -6,7 +6,7 @@ const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const messageId = 'useLiteral' as 'useLiteral'; +const messageId = 'useLiteral' as const; ruleTester.run('no-array-constructor', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts index e009aa153ae8..88d558e711a8 100644 --- a/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts +++ b/packages/eslint-plugin/tests/rules/no-extraneous-class.test.ts @@ -3,13 +3,13 @@ import rule from '../../src/rules/no-extraneous-class'; import { RuleTester } from '../RuleTester'; const empty = { - messageId: 'empty' as 'empty', + messageId: 'empty' as const, }; const onlyStatic = { - messageId: 'onlyStatic' as 'onlyStatic', + messageId: 'onlyStatic' as const, }; const onlyConstructor = { - messageId: 'onlyConstructor' as 'onlyConstructor', + messageId: 'onlyConstructor' as const, }; const ruleTester = new RuleTester({ diff --git a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts index 03723eb9515d..0cbd35dae19f 100644 --- a/packages/eslint-plugin/tests/rules/no-this-alias.test.ts +++ b/packages/eslint-plugin/tests/rules/no-this-alias.test.ts @@ -3,15 +3,15 @@ import rule from '../../src/rules/no-this-alias'; import { RuleTester } from '../RuleTester'; const idError = { - messageId: 'thisAssignment' as 'thisAssignment', + messageId: 'thisAssignment' as const, type: AST_NODE_TYPES.Identifier, }; const destructureError = { - messageId: 'thisDestructure' as 'thisDestructure', + messageId: 'thisDestructure' as const, type: AST_NODE_TYPES.ObjectPattern, }; const arrayDestructureError = { - messageId: 'thisDestructure' as 'thisDestructure', + messageId: 'thisDestructure' as const, type: AST_NODE_TYPES.ArrayPattern, }; diff --git a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts index 8b375aef075d..9d9434397fd4 100644 --- a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts +++ b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts @@ -6,7 +6,7 @@ const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', }); -const parserOptions = { ecmaVersion: 6 as 6 }; +const parserOptions = { ecmaVersion: 6 as const }; ruleTester.run('no-use-before-define', rule, { valid: [ diff --git a/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts new file mode 100644 index 000000000000..c18ac5d7f14b --- /dev/null +++ b/packages/eslint-plugin/tests/rules/prefer-as-const.test.ts @@ -0,0 +1,156 @@ +import rule from '../../src/rules/prefer-as-const'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('prefer-as-const', rule, { + valid: [ + "let foo = 'baz' as const", + 'let foo = 1 as const', + "let foo = { bar: 'baz' as const }", + 'let foo = { bar: 1 as const }', + "let foo = { bar: 'baz' }", + 'let foo = { bar: 2 }', + "let foo = 'bar';", + "let foo = 'bar';", + "let foo = 'bar' as string;", + 'let foo = `bar` as `bar`;', + 'let foo = `bar` as `foo`;', + "let foo = `bar` as 'bar';", + "let foo: string = 'bar';", + 'let foo: number = 1;', + "let foo: 'bar' = baz;", + "let foo = 'bar';", + 'class foo { bar: "baz" = "baz" }', + 'class foo { bar = "baz" }', + "let foo: 'bar'", + 'let foo = { bar }', + "let foo: 'baz' = 'baz' as const", + ], + invalid: [ + { + code: "let foo = { bar: 'baz' as 'baz' }", + output: "let foo = { bar: 'baz' as const }", + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 27, + }, + ], + }, + { + code: 'let foo = { bar: 1 as 1 }', + output: 'let foo = { bar: 1 as const }', + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 23, + }, + ], + }, + { + code: "let []: 'bar' = 'bar';", + output: "let []: 'bar' = 'bar';", + errors: [ + { + messageId: 'variableConstAssertion', + line: 1, + column: 9, + }, + ], + }, + { + code: "let foo: 'bar' = 'bar';", + output: "let foo: 'bar' = 'bar';", + errors: [ + { + messageId: 'variableConstAssertion', + line: 1, + column: 10, + suggestions: [ + { + messageId: 'variableSuggest', + output: "let foo = 'bar' as const;", + }, + ], + }, + ], + }, + { + code: 'let foo: 2 = 2;', + output: 'let foo: 2 = 2;', + errors: [ + { + messageId: 'variableConstAssertion', + line: 1, + column: 10, + suggestions: [ + { + messageId: 'variableSuggest', + output: 'let foo = 2 as const;', + }, + ], + }, + ], + }, + { + code: "let foo: 'bar' = 'bar' as 'bar';", + output: "let foo: 'bar' = 'bar' as const;", + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 27, + }, + ], + }, + { + code: "let foo = <'bar'>'bar';", + output: "let foo = 'bar';", + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 12, + }, + ], + }, + { + code: 'let foo = <4>4;', + output: 'let foo = 4;', + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 12, + }, + ], + }, + { + code: "let foo = 'bar' as 'bar';", + output: "let foo = 'bar' as const;", + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 20, + }, + ], + }, + { + code: 'let foo = 5 as 5;', + output: 'let foo = 5 as const;', + errors: [ + { + messageId: 'preferConstAssertion', + line: 1, + column: 16, + }, + ], + }, + ], +}); diff --git a/packages/parser/tests/lib/parser.ts b/packages/parser/tests/lib/parser.ts index 56ce08b67862..3881456d2ffd 100644 --- a/packages/parser/tests/lib/parser.ts +++ b/packages/parser/tests/lib/parser.ts @@ -43,7 +43,7 @@ describe('parser', () => { comment: false, range: false, tokens: false, - sourceType: 'module' as 'module', + sourceType: 'module' as const, ecmaVersion: 2018, ecmaFeatures: { globalReturn: false, diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 77ffca87cc47..ffcd0af0b579 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -30,70 +30,70 @@ const LOGICAL_OPERATORS: ( ]; const TOKEN_TO_TEXT = { - [SyntaxKind.OpenBraceToken]: '{' as '{', - [SyntaxKind.CloseBraceToken]: '}' as '}', - [SyntaxKind.OpenParenToken]: '(' as '(', - [SyntaxKind.CloseParenToken]: ')' as ')', - [SyntaxKind.OpenBracketToken]: '[' as '[', - [SyntaxKind.CloseBracketToken]: ']' as ']', - [SyntaxKind.DotToken]: '.' as '.', - [SyntaxKind.DotDotDotToken]: '...' as '...', - [SyntaxKind.SemicolonToken]: ';' as ';', - [SyntaxKind.CommaToken]: ',' as ',', - [SyntaxKind.LessThanToken]: '<' as '<', - [SyntaxKind.GreaterThanToken]: '>' as '>', - [SyntaxKind.LessThanEqualsToken]: '<=' as '<=', - [SyntaxKind.GreaterThanEqualsToken]: '>=' as '>=', - [SyntaxKind.EqualsEqualsToken]: '==' as '==', - [SyntaxKind.ExclamationEqualsToken]: '!=' as '!=', - [SyntaxKind.EqualsEqualsEqualsToken]: '===' as '===', - [SyntaxKind.InstanceOfKeyword]: 'instanceof' as 'instanceof', - [SyntaxKind.ExclamationEqualsEqualsToken]: '!==' as '!==', - [SyntaxKind.EqualsGreaterThanToken]: '=>' as '=>', - [SyntaxKind.PlusToken]: '+' as '+', - [SyntaxKind.MinusToken]: '-' as '-', - [SyntaxKind.AsteriskToken]: '*' as '*', - [SyntaxKind.AsteriskAsteriskToken]: '**' as '**', - [SyntaxKind.SlashToken]: '/' as '/', - [SyntaxKind.PercentToken]: '%' as '%', - [SyntaxKind.PlusPlusToken]: '++' as '++', - [SyntaxKind.MinusMinusToken]: '--' as '--', - [SyntaxKind.LessThanLessThanToken]: '<<' as '<<', - [SyntaxKind.LessThanSlashToken]: '>' as '>>', - [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>' as '>>>', - [SyntaxKind.AmpersandToken]: '&' as '&', - [SyntaxKind.BarToken]: '|' as '|', - [SyntaxKind.CaretToken]: '^' as '^', - [SyntaxKind.ExclamationToken]: '!' as '!', - [SyntaxKind.TildeToken]: '~' as '~', - [SyntaxKind.AmpersandAmpersandToken]: '&&' as '&&', - [SyntaxKind.BarBarToken]: '||' as '||', - [SyntaxKind.QuestionToken]: '?' as '?', - [SyntaxKind.ColonToken]: ':' as ':', - [SyntaxKind.EqualsToken]: '=' as '=', - [SyntaxKind.PlusEqualsToken]: '+=' as '+=', - [SyntaxKind.MinusEqualsToken]: '-=' as '-=', - [SyntaxKind.AsteriskEqualsToken]: '*=' as '*=', - [SyntaxKind.AsteriskAsteriskEqualsToken]: '**=' as '**=', - [SyntaxKind.SlashEqualsToken]: '/=' as '/=', - [SyntaxKind.PercentEqualsToken]: '%=' as '%=', - [SyntaxKind.LessThanLessThanEqualsToken]: '<<=' as '<<=', - [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=' as '>>=', - [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=' as '>>>=', - [SyntaxKind.AmpersandEqualsToken]: '&=' as '&=', - [SyntaxKind.BarEqualsToken]: '|=' as '|=', - [SyntaxKind.CaretEqualsToken]: '^=' as '^=', - [SyntaxKind.AtToken]: '@' as '@', - [SyntaxKind.InKeyword]: 'in' as 'in', - [SyntaxKind.UniqueKeyword]: 'unique' as 'unique', - [SyntaxKind.KeyOfKeyword]: 'keyof' as 'keyof', - [SyntaxKind.NewKeyword]: 'new' as 'new', - [SyntaxKind.ImportKeyword]: 'import' as 'import', - [SyntaxKind.ReadonlyKeyword]: 'readonly' as 'readonly', - [SyntaxKind.QuestionQuestionToken]: '??' as '??', - [SyntaxKind.QuestionDotToken]: '?.' as '?.', -}; + [SyntaxKind.OpenBraceToken]: '{', + [SyntaxKind.CloseBraceToken]: '}', + [SyntaxKind.OpenParenToken]: '(', + [SyntaxKind.CloseParenToken]: ')', + [SyntaxKind.OpenBracketToken]: '[', + [SyntaxKind.CloseBracketToken]: ']', + [SyntaxKind.DotToken]: '.', + [SyntaxKind.DotDotDotToken]: '...', + [SyntaxKind.SemicolonToken]: ';', + [SyntaxKind.CommaToken]: ',', + [SyntaxKind.LessThanToken]: '<', + [SyntaxKind.GreaterThanToken]: '>', + [SyntaxKind.LessThanEqualsToken]: '<=', + [SyntaxKind.GreaterThanEqualsToken]: '>=', + [SyntaxKind.EqualsEqualsToken]: '==', + [SyntaxKind.ExclamationEqualsToken]: '!=', + [SyntaxKind.EqualsEqualsEqualsToken]: '===', + [SyntaxKind.InstanceOfKeyword]: 'instanceof', + [SyntaxKind.ExclamationEqualsEqualsToken]: '!==', + [SyntaxKind.EqualsGreaterThanToken]: '=>', + [SyntaxKind.PlusToken]: '+', + [SyntaxKind.MinusToken]: '-', + [SyntaxKind.AsteriskToken]: '*', + [SyntaxKind.AsteriskAsteriskToken]: '**', + [SyntaxKind.SlashToken]: '/', + [SyntaxKind.PercentToken]: '%', + [SyntaxKind.PlusPlusToken]: '++', + [SyntaxKind.MinusMinusToken]: '--', + [SyntaxKind.LessThanLessThanToken]: '<<', + [SyntaxKind.LessThanSlashToken]: '>', + [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>', + [SyntaxKind.AmpersandToken]: '&', + [SyntaxKind.BarToken]: '|', + [SyntaxKind.CaretToken]: '^', + [SyntaxKind.ExclamationToken]: '!', + [SyntaxKind.TildeToken]: '~', + [SyntaxKind.AmpersandAmpersandToken]: '&&', + [SyntaxKind.BarBarToken]: '||', + [SyntaxKind.QuestionToken]: '?', + [SyntaxKind.ColonToken]: ':', + [SyntaxKind.EqualsToken]: '=', + [SyntaxKind.PlusEqualsToken]: '+=', + [SyntaxKind.MinusEqualsToken]: '-=', + [SyntaxKind.AsteriskEqualsToken]: '*=', + [SyntaxKind.AsteriskAsteriskEqualsToken]: '**=', + [SyntaxKind.SlashEqualsToken]: '/=', + [SyntaxKind.PercentEqualsToken]: '%=', + [SyntaxKind.LessThanLessThanEqualsToken]: '<<=', + [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=', + [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=', + [SyntaxKind.AmpersandEqualsToken]: '&=', + [SyntaxKind.BarEqualsToken]: '|=', + [SyntaxKind.CaretEqualsToken]: '^=', + [SyntaxKind.AtToken]: '@', + [SyntaxKind.InKeyword]: 'in', + [SyntaxKind.UniqueKeyword]: 'unique', + [SyntaxKind.KeyOfKeyword]: 'keyof', + [SyntaxKind.NewKeyword]: 'new', + [SyntaxKind.ImportKeyword]: 'import', + [SyntaxKind.ReadonlyKeyword]: 'readonly', + [SyntaxKind.QuestionQuestionToken]: '??', + [SyntaxKind.QuestionDotToken]: '?.', +} as const; /** * Returns true if the given ts.Token is the assignment operator From fcff5b430c669b7ec27705aa18211e0eedfb486a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Mon, 20 Jan 2020 19:14:48 -0800 Subject: [PATCH 05/30] docs: fix spellchecker checking # urls --- .cspell.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.cspell.json b/.cspell.json index d2061775d83f..4931ff3a5d97 100644 --- a/.cspell.json +++ b/.cspell.json @@ -29,7 +29,8 @@ "/\\.\\/docs\\/rules\\/[^.]*.md/", "/@typescript-eslint\\/[a-z-]+/", "/\\.all-contributorsrc/", - "/TS[^\\s]+/" + "/TS[^\\s]+/", + "\\(#.+?\\)" ], "words": [ "ASTs", From cde97aca24df5a0f28f37006ed130ebc217fb2ad Mon Sep 17 00:00:00 2001 From: Michael McDonald Date: Tue, 21 Jan 2020 10:35:50 -0600 Subject: [PATCH 06/30] feat(experimental-utils): make RuleMetaData.docs optional (#1462) --- packages/eslint-plugin/tests/configs.test.ts | 16 ++++++++-------- packages/eslint-plugin/tests/docs.test.ts | 18 +++++++++--------- .../eslint-plugin/tools/generate-configs.ts | 16 ++++++++-------- .../experimental-utils/src/ts-eslint/Rule.ts | 4 ++-- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/eslint-plugin/tests/configs.test.ts b/packages/eslint-plugin/tests/configs.test.ts index f034fd86ccfd..f8fc068ad642 100644 --- a/packages/eslint-plugin/tests/configs.test.ts +++ b/packages/eslint-plugin/tests/configs.test.ts @@ -3,12 +3,12 @@ import plugin from '../src/index'; const RULE_NAME_PREFIX = '@typescript-eslint/'; const EXTENSION_RULES = Object.entries(rules) - .filter(([, rule]) => rule.meta.docs.extendsBaseRule) + .filter(([, rule]) => rule.meta.docs?.extendsBaseRule) .map( ([ruleName, rule]) => [ `${RULE_NAME_PREFIX}${ruleName}`, - typeof rule.meta.docs.extendsBaseRule === 'string' + typeof rule.meta.docs?.extendsBaseRule === 'string' ? rule.meta.docs.extendsBaseRule : ruleName, ] as const, @@ -68,12 +68,12 @@ describe('recommended.json config', () => { const ruleConfigs = Object.entries(rules) .filter( ([, rule]) => - rule.meta.docs.recommended !== false && - rule.meta.docs.requiresTypeChecking !== true, + rule.meta.docs?.recommended !== false && + rule.meta.docs?.requiresTypeChecking !== true, ) .map<[string, string]>(([name, rule]) => [ `${RULE_NAME_PREFIX}${name}`, - rule.meta.docs.recommended || 'off', + rule.meta.docs?.recommended ? rule.meta.docs.recommended : 'off', ]); it("contains all recommended rules that don't require typechecking, excluding the deprecated ones", () => { @@ -91,12 +91,12 @@ describe('recommended-requiring-type-checking.json config', () => { const ruleConfigs = Object.entries(rules) .filter( ([, rule]) => - rule.meta.docs.recommended !== false && - rule.meta.docs.requiresTypeChecking === true, + rule.meta.docs?.recommended !== false && + rule.meta.docs?.requiresTypeChecking === true, ) .map<[string, string]>(([name, rule]) => [ `${RULE_NAME_PREFIX}${name}`, - rule.meta.docs.recommended || 'off', + rule.meta.docs?.recommended ? rule.meta.docs.recommended : 'off', ]); it('contains all recommended rules that require type checking, excluding the deprecated ones', () => { diff --git a/packages/eslint-plugin/tests/docs.test.ts b/packages/eslint-plugin/tests/docs.test.ts index 56a9e50002d1..68cbeed01878 100644 --- a/packages/eslint-plugin/tests/docs.test.ts +++ b/packages/eslint-plugin/tests/docs.test.ts @@ -63,7 +63,7 @@ describe('Validating rule docs', () => { expect(tokens[0]).toEqual({ type: 'heading', depth: 1, - text: `${rule.meta.docs.description} (\`${ruleName}\`)`, + text: `${rule.meta.docs?.description} (\`${ruleName}\`)`, }); }); } @@ -76,7 +76,7 @@ describe('Validating rule metadata', () => { // validate if rule name is same as url // there is no way to access this field but its used only in generation of docs url expect( - rule.meta.docs.url.endsWith(`rules/${ruleName}.md`), + rule.meta.docs?.url.endsWith(`rules/${ruleName}.md`), ).toBeTruthy(); }); @@ -88,7 +88,7 @@ describe('Validating rule metadata', () => { ); expect(ruleFileContents.includes('getParserServices')).toEqual( - rule.meta.docs.requiresTypeChecking ?? false, + rule.meta.docs?.requiresTypeChecking ?? false, ); }); }); @@ -99,10 +99,10 @@ describe('Validating README.md', () => { const rulesTables = parseReadme(); const notDeprecated = rulesData.filter(([, rule]) => !rule.meta.deprecated); const baseRules = notDeprecated.filter( - ([, rule]) => !rule.meta.docs.extendsBaseRule, + ([, rule]) => !rule.meta.docs?.extendsBaseRule, ); const extensionRules = notDeprecated.filter( - ([, rule]) => rule.meta.docs.extendsBaseRule, + ([, rule]) => rule.meta.docs?.extendsBaseRule, ); it('All non-deprecated base rules should have a row in the base rules table, and the table should be ordered alphabetically', () => { @@ -128,7 +128,7 @@ describe('Validating README.md', () => { for (const [ruleName, rule] of notDeprecated) { describe(`Checking rule ${ruleName}`, () => { - const ruleRow: string[] | undefined = (rule.meta.docs.extendsBaseRule + const ruleRow: string[] | undefined = (rule.meta.docs?.extendsBaseRule ? rulesTables.extension.cells : rulesTables.base.cells ).find(row => row[0].includes(`/${ruleName}.md`)); @@ -143,12 +143,12 @@ describe('Validating README.md', () => { }); it('Description column should be correct', () => { - expect(ruleRow[1]).toEqual(rule.meta.docs.description); + expect(ruleRow[1]).toEqual(rule.meta.docs?.description); }); it('Recommended column should be correct', () => { expect(ruleRow[2]).toEqual( - rule.meta.docs.recommended ? ':heavy_check_mark:' : '', + rule.meta.docs?.recommended ? ':heavy_check_mark:' : '', ); }); @@ -160,7 +160,7 @@ describe('Validating README.md', () => { it('Requiring type information column should be correct', () => { expect(ruleRow[4]).toEqual( - rule.meta.docs.requiresTypeChecking === true + rule.meta.docs?.requiresTypeChecking === true ? ':thought_balloon:' : '', ); diff --git a/packages/eslint-plugin/tools/generate-configs.ts b/packages/eslint-plugin/tools/generate-configs.ts index 33ac44c65caa..d35fd7362bcd 100644 --- a/packages/eslint-plugin/tools/generate-configs.ts +++ b/packages/eslint-plugin/tools/generate-configs.ts @@ -26,13 +26,13 @@ const MAX_RULE_NAME_LENGTH = Object.keys(rules).reduce( const DEFAULT_RULE_SETTING = 'warn'; const BASE_RULES_TO_BE_OVERRIDDEN = new Map( Object.entries(rules) - .filter(([, rule]) => rule.meta.docs.extendsBaseRule) + .filter(([, rule]) => rule.meta.docs?.extendsBaseRule) .map( ([ruleName, rule]) => [ ruleName, - typeof rule.meta.docs.extendsBaseRule === 'string' - ? rule.meta.docs.extendsBaseRule + typeof rule.meta.docs?.extendsBaseRule === 'string' + ? rule.meta.docs?.extendsBaseRule : ruleName, ] as const, ), @@ -74,7 +74,7 @@ function reducer( // Explicitly exclude rules requiring type-checking if ( settings.filterRequiresTypeChecking === 'exclude' && - value.meta.docs.requiresTypeChecking === true + value.meta.docs?.requiresTypeChecking === true ) { return config; } @@ -82,13 +82,13 @@ function reducer( // Explicitly include rules requiring type-checking if ( settings.filterRequiresTypeChecking === 'include' && - value.meta.docs.requiresTypeChecking !== true + value.meta.docs?.requiresTypeChecking !== true ) { return config; } const ruleName = `${RULE_NAME_PREFIX}${key}`; - const recommendation = value.meta.docs.recommended; + const recommendation = value.meta.docs?.recommended; const usedSetting = settings.errorLevel ? settings.errorLevel : !recommendation @@ -157,7 +157,7 @@ console.log( '------------------------------ recommended.json (should not require program) ------------------------------', ); const recommendedRules = ruleEntries - .filter(entry => !!entry[1].meta.docs.recommended) + .filter(entry => !!entry[1].meta.docs?.recommended) .reduce( (config, entry) => reducer(config, entry, { @@ -183,7 +183,7 @@ console.log( '--------------------------------- recommended-requiring-type-checking.json ---------------------------------', ); const recommendedRulesRequiringProgram = ruleEntries - .filter(entry => !!entry[1].meta.docs.recommended) + .filter(entry => !!entry[1].meta.docs?.recommended) .reduce( (config, entry) => reducer(config, entry, { diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 845560e80372..4623e8758ae0 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -46,9 +46,9 @@ interface RuleMetaData { */ deprecated?: boolean; /** - * Documentation for the rule + * Documentation for the rule, unnecessary for custom rules/plugins */ - docs: RuleMetaDataDocs; + docs?: RuleMetaDataDocs; /** * The fixer category. Omit if there is no fixer */ From 4a727fa083d749dba9eaf39322856f5f69c28cd8 Mon Sep 17 00:00:00 2001 From: Armano Date: Tue, 21 Jan 2020 18:01:43 +0100 Subject: [PATCH 07/30] feat(parser): clean up scope-analysis types (#1481) --- .../src/ts-eslint-scope/Reference.ts | 17 +++- .../src/ts-eslint-scope/Referencer.ts | 4 +- .../src/ts-eslint-scope/Scope.ts | 26 ++--- .../src/ts-eslint-scope/ScopeManager.ts | 7 +- .../src/ts-eslint-scope/Variable.ts | 4 + packages/parser/tests/tools/scope-analysis.ts | 99 ++++++++++--------- 6 files changed, 95 insertions(+), 62 deletions(-) diff --git a/packages/experimental-utils/src/ts-eslint-scope/Reference.ts b/packages/experimental-utils/src/ts-eslint-scope/Reference.ts index 15afc7dcdc14..96d2fab4df5c 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Reference.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Reference.ts @@ -3,6 +3,8 @@ import ESLintReference from 'eslint-scope/lib/reference'; import { Scope } from './Scope'; import { Variable } from './Variable'; +export type ReferenceFlag = 0x1 | 0x2 | 0x3; + interface Reference { identifier: TSESTree.Identifier; from: Scope; @@ -10,6 +12,11 @@ interface Reference { writeExpr: TSESTree.Node | null; init: boolean; + partial: boolean; + __maybeImplicitGlobal: boolean; + tainted?: boolean; + typeMode?: boolean; + isWrite(): boolean; isRead(): boolean; isWriteOnly(): boolean; @@ -17,7 +24,15 @@ interface Reference { isReadWrite(): boolean; } const Reference = ESLintReference as { - new (): Reference; + new ( + identifier: TSESTree.Identifier, + scope: Scope, + flag?: ReferenceFlag, + writeExpr?: TSESTree.Node | null, + maybeImplicitGlobal?: boolean, + partial?: boolean, + init?: boolean, + ): Reference; READ: 0x1; WRITE: 0x2; diff --git a/packages/experimental-utils/src/ts-eslint-scope/Referencer.ts b/packages/experimental-utils/src/ts-eslint-scope/Referencer.ts index aa0cbc8d3e97..6169d9def9a5 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Referencer.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Referencer.ts @@ -44,8 +44,8 @@ interface Referencer extends Visitor { AssignmentExpression(node: TSESTree.Node): void; CatchClause(node: TSESTree.Node): void; - Program(node: TSESTree.Node): void; - Identifier(node: TSESTree.Node): void; + Program(node: TSESTree.Program): void; + Identifier(node: TSESTree.Identifier): void; UpdateExpression(node: TSESTree.Node): void; MemberExpression(node: TSESTree.Node): void; Property(node: TSESTree.Node): void; diff --git a/packages/experimental-utils/src/ts-eslint-scope/Scope.ts b/packages/experimental-utils/src/ts-eslint-scope/Scope.ts index bd6455d7020e..6c5481aa4d77 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Scope.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Scope.ts @@ -15,7 +15,7 @@ import { ClassScope as ESLintClassScope, } from 'eslint-scope/lib/scope'; import { Definition } from './Definition'; -import { Reference } from './Reference'; +import { Reference, ReferenceFlag } from './Reference'; import { ScopeManager } from './ScopeManager'; import { Variable } from './Variable'; @@ -46,7 +46,9 @@ interface Scope { references: Reference[]; through: Reference[]; thisFound?: boolean; + taints: Map; functionExpressionScope: boolean; + __left: Reference[]; __shouldStaticallyClose(scopeManager: ScopeManager): boolean; __shouldStaticallyCloseForGlobal(ref: any): boolean; @@ -54,15 +56,15 @@ interface Scope { __dynamicCloseRef(ref: any): void; __globalCloseRef(ref: any): void; __close(scopeManager: ScopeManager): Scope; - __isValidResolution(ref: any, variable: any): boolean; - __resolve(ref: any): boolean; + __isValidResolution(ref: any, variable: any): variable is Variable; + __resolve(ref: Reference): boolean; __delegateToUpperScope(ref: any): void; __addDeclaredVariablesOfNode(variable: any, node: TSESTree.Node): void; __defineGeneric( - name: any, - set: any, - variables: any, - node: any, + name: string, + set: Map, + variables: Variable[], + node: TSESTree.Identifier, def: Definition, ): void; @@ -70,11 +72,11 @@ interface Scope { __referencing( node: TSESTree.Node, - assign: number, - writeExpr: TSESTree.Node, - maybeImplicitGlobal: any, - partial: any, - init: any, + assign?: ReferenceFlag, + writeExpr?: TSESTree.Node, + maybeImplicitGlobal?: any, + partial?: any, + init?: any, ): void; __detectEval(): void; diff --git a/packages/experimental-utils/src/ts-eslint-scope/ScopeManager.ts b/packages/experimental-utils/src/ts-eslint-scope/ScopeManager.ts index e90c3cf4b11f..6d05fea395f9 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/ScopeManager.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/ScopeManager.ts @@ -16,6 +16,9 @@ interface ScopeManagerOptions { interface ScopeManager { __options: ScopeManagerOptions; __currentScope: Scope; + __nodeToScope: WeakMap; + __declaredVariables: WeakMap; + scopes: Scope[]; globalScope: Scope; @@ -28,7 +31,7 @@ interface ScopeManager { isStrictModeSupported(): boolean; // Returns appropriate scope for this node. - __get(node: TSESTree.Node): Scope; + __get(node: TSESTree.Node): Scope | undefined; getDeclaredVariables(node: TSESTree.Node): Variable[]; acquire(node: TSESTree.Node, inner?: boolean): Scope | null; acquireAll(node: TSESTree.Node): Scope | null; @@ -36,7 +39,7 @@ interface ScopeManager { attach(): void; detach(): void; - __nestScope(scope: Scope): Scope; + __nestScope(scope: T): T; __nestGlobalScope(node: TSESTree.Node): Scope; __nestBlockScope(node: TSESTree.Node): Scope; __nestFunctionScope(node: TSESTree.Node, isMethodDefinition: boolean): Scope; diff --git a/packages/experimental-utils/src/ts-eslint-scope/Variable.ts b/packages/experimental-utils/src/ts-eslint-scope/Variable.ts index 306d5bfca498..49bbf3d9b4ab 100644 --- a/packages/experimental-utils/src/ts-eslint-scope/Variable.ts +++ b/packages/experimental-utils/src/ts-eslint-scope/Variable.ts @@ -2,6 +2,7 @@ import { TSESTree } from '@typescript-eslint/typescript-estree'; import ESLintVariable from 'eslint-scope/lib/variable'; import { Reference } from './Reference'; import { Definition } from './Definition'; +import { Scope } from './Scope'; interface Variable { name: string; @@ -9,6 +10,9 @@ interface Variable { references: Reference[]; defs: Definition[]; eslintUsed?: boolean; + stack?: unknown; + tainted?: boolean; + scope?: Scope; } const Variable = ESLintVariable as { diff --git a/packages/parser/tests/tools/scope-analysis.ts b/packages/parser/tests/tools/scope-analysis.ts index 373b863be818..3def6a382deb 100644 --- a/packages/parser/tests/tools/scope-analysis.ts +++ b/packages/parser/tests/tools/scope-analysis.ts @@ -1,28 +1,33 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ +import { + TSESTree, + TSESLintScope, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import { ScopeManager } from '../../src/scope/scope-manager'; /** Reference resolver. */ -export class ReferenceResolver { - map: Map; +export class ReferenceResolver { + map: Map; constructor() { this.map = new Map(); } - resolve(obj: any, properties: any): any { - const resolved = Object.assign({ $id: this.map.size }, properties); + resolve(obj: TKey, properties: T): T & { $id: number } { + const resolved = { ...properties, $id: this.map.size }; this.map.set(obj, resolved); return resolved; } - ref(obj: any): any { + ref(obj: TKey): { $ref: number } | TKey { if (typeof obj !== 'object' || obj === null) { return obj; } const map = this.map; return { - get $ref(): any { - return map.get(obj).$id; + get $ref(): number { + return map.get(obj)!.$id; }, }; } @@ -31,30 +36,38 @@ export class ReferenceResolver { /** * Convert a given node object to JSON object. * This saves only type and range to know what the node is. - * @param {ASTNode} node The AST node object. - * @returns {Object} The object that can be used for JSON.stringify. + * @param node The AST node object. + * @returns The object that can be used for JSON.stringify. */ -export function nodeToJSON(node: any): any { +export function nodeToJSON( + node: TSESTree.Node | null | undefined, +): + | { type: AST_NODE_TYPES; range: [number, number]; name?: string } + | null + | undefined { if (!node) { return node; } - const { type, name, range } = node; - if (node.type === 'Identifier') { - return { type, name, range }; + const { type, range } = node; + if (node.type === AST_NODE_TYPES.Identifier) { + return { type, name: node.name, range }; } return { type, range }; } /** * Convert a given variable object to JSON object. - * @param {Variable} variable The eslint-scope's variable object. - * @param {ReferenceResolver} resolver The reference resolver. - * @returns {Object} The object that can be used for JSON.stringify. + * @param variable The eslint-scope's variable object. + * @param resolver The reference resolver. + * @returns The object that can be used for JSON.stringify. */ -export function variableToJSON(variable: any, resolver: any): any { +export function variableToJSON( + variable: TSESLintScope.Variable, + resolver: ReferenceResolver, +): unknown { const { name, eslintUsed } = variable; - const defs = variable.defs.map((d: any) => ({ + const defs = variable.defs.map(d => ({ type: d.type, name: nodeToJSON(d.name), node: nodeToJSON(d.node), @@ -76,11 +89,14 @@ export function variableToJSON(variable: any, resolver: any): any { /** * Convert a given reference object to JSON object. - * @param {Reference} reference The eslint-scope's reference object. - * @param {ReferenceResolver} resolver The reference resolver. - * @returns {Object} The object that can be used for JSON.stringify. + * @param reference The eslint-scope's reference object. + * @param resolver The reference resolver. + * @returns The object that can be used for JSON.stringify. */ -export function referenceToJSON(reference: any, resolver: any): any { +export function referenceToJSON( + reference: TSESLintScope.Reference, + resolver: ReferenceResolver, +): unknown { const kind = `${reference.isRead() ? 'r' : ''}${ reference.isWrite() ? 'w' : '' }`; @@ -100,35 +116,28 @@ export function referenceToJSON(reference: any, resolver: any): any { /** * Convert a given scope object to JSON object. - * @param {Scope} scope The eslint-scope's scope object. - * @param {ReferenceResolver} resolver The reference resolver. + * @param scope The eslint-scope's scope object. + * @param resolver The reference resolver. * @returns {Object} The object that can be used for JSON.stringify. */ export function scopeToJSON( - scope: any, + scope: TSESLintScope.Scope, resolver = new ReferenceResolver(), -): any { +): unknown { const { type, functionExpressionScope, isStrict } = scope; const block = nodeToJSON(scope.block); - const variables = scope.variables.map((v: any) => - variableToJSON(v, resolver), - ); - const references = scope.references.map((r: any) => - referenceToJSON(r, resolver), - ); - const variableMap = Array.from(scope.set.entries()).reduce( - (map: any, [name, variable]: any) => { - map[name] = resolver.ref(variable); - return map; - }, - {}, - ); + const variables = scope.variables.map(v => variableToJSON(v, resolver)); + const references = scope.references.map(r => referenceToJSON(r, resolver)); + const variableMap = Array.from(scope.set.entries()).reduce< + Record + >((map, [name, variable]) => { + map[name] = resolver.ref(variable); + return map; + }, {}); const throughReferences = scope.through.map(resolver.ref, resolver); const variableScope = resolver.ref(scope.variableScope); const upperScope = resolver.ref(scope.upper); - const childScopes = scope.childScopes.map((c: any) => - scopeToJSON(c, resolver), - ); + const childScopes = scope.childScopes.map(c => scopeToJSON(c, resolver)); return resolver.resolve(scope, { type, @@ -145,12 +154,12 @@ export function scopeToJSON( }); } -export function getScopeTree(scopeManager: any): any { +export function getScopeTree(scopeManager: ScopeManager): unknown { const { globalScope } = scopeManager; // Do the postprocess to test. // https://github.com/eslint/eslint/blob/84ce72fdeba082b7b132e4ac6b714fb1a93831b7/lib/linter.js#L112-L129 - globalScope.through = globalScope.through.filter((reference: any) => { + globalScope.through = globalScope.through.filter(reference => { const name = reference.identifier.name; const variable = globalScope.set.get(name); if (variable) { From 0948896cc3dbb65e0fc085cf2b439d311856c1e5 Mon Sep 17 00:00:00 2001 From: Userbit <34487074+Userbit@users.noreply.github.com> Date: Wed, 22 Jan 2020 00:00:50 +0300 Subject: [PATCH 08/30] docs(eslint-plugin): correct link to FAQ.md (#1488) --- packages/eslint-plugin/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index b91ab9182f4f..fa34718fc4c7 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -11,7 +11,7 @@ ## Getting Started **[You can find our Getting Started docs here](../../docs/getting-started/linting/README.md)** -**[You can find our FAQ / Troubleshooting docs here](./docs/getting-started/linting/FAQ.md)** +**[You can find our FAQ / Troubleshooting docs here](../../docs/getting-started/linting/FAQ.md)** These docs walk you through setting up ESLint, this plugin, and our parser. If you know what you're doing and just want to quick start, read on... From 77a1caa562638645b4717449800e410107d512c8 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Tue, 21 Jan 2020 22:28:14 +0100 Subject: [PATCH 09/30] fix(typescript-estree): fix identifier tokens typed as `Keyword` (#1487) --- .../lib/__snapshots__/typescript.ts.snap | 4429 +++++++- .../basics/keyword-variables.src.ts | 72 +- packages/typescript-estree/src/node-utils.ts | 23 +- .../lib/__snapshots__/javascript.ts.snap | 8 +- .../tests/lib/__snapshots__/jsx.ts.snap | 12 +- .../lib/__snapshots__/typescript.ts.snap | 9172 +++++++++++++++-- 6 files changed, 12438 insertions(+), 1278 deletions(-) diff --git a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap index 03506477a626..e23e1fc48747 100644 --- a/packages/parser/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/typescript.ts.snap @@ -20267,31 +20267,31 @@ Object { exports[`typescript fixtures/basics/keyword-variables.src 1`] = ` Object { - "$id": 20, + "$id": 108, "block": Object { "range": Array [ 0, - 190, + 1078, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 19, + "$id": 107, "block": Object { "range": Array [ 0, - 190, + 1078, ], "type": "Program", }, "childScopes": Array [ Object { - "$id": 18, + "$id": 94, "block": Object { "range": Array [ 0, - 110, + 613, ], "type": "BlockStatement", }, @@ -20300,543 +20300,4030 @@ Object { "isStrict": true, "references": Array [ Object { - "$id": 12, + "$id": 63, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { - "name": "get", + "name": "abstract", "range": Array [ 10, - 13, + 18, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 6, + "$ref": 32, }, "writeExpr": Object { "range": Array [ - 16, - 17, + 21, + 22, ], "type": "Literal", }, }, Object { - "$id": 13, + "$id": 64, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { - "name": "set", + "name": "as", "range": Array [ - 27, - 30, + 32, + 34, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 7, + "$ref": 33, }, "writeExpr": Object { "range": Array [ - 33, - 34, + 37, + 38, ], "type": "Literal", }, }, Object { - "$id": 14, + "$id": 65, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { - "name": "module", + "name": "asserts", "range": Array [ - 44, - 50, + 48, + 55, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 8, + "$ref": 34, }, "writeExpr": Object { "range": Array [ - 53, - 54, + 58, + 59, ], "type": "Literal", }, }, Object { - "$id": 15, + "$id": 66, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { - "name": "type", + "name": "any", "range": Array [ - 64, - 68, + 69, + 72, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 9, + "$ref": 35, }, "writeExpr": Object { "range": Array [ - 71, - 72, + 75, + 76, ], "type": "Literal", }, }, Object { - "$id": 16, + "$id": 67, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { "name": "async", "range": Array [ - 82, - 87, + 86, + 91, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 10, + "$ref": 36, }, "writeExpr": Object { "range": Array [ - 90, - 91, + 94, + 95, ], "type": "Literal", }, }, Object { - "$id": 17, + "$id": 68, "from": Object { - "$ref": 18, + "$ref": 94, }, "identifier": Object { - "name": "is", + "name": "await", "range": Array [ - 101, - 103, + 105, + 110, ], "type": "Identifier", }, "kind": "w", "resolved": Object { - "$ref": 11, + "$ref": 37, }, "writeExpr": Object { "range": Array [ - 106, - 107, + 113, + 114, ], "type": "Literal", }, }, - ], - "throughReferences": Array [], - "type": "block", - "upperScope": Object { - "$ref": 19, - }, - "variableMap": Object { - "async": Object { - "$ref": 10, + Object { + "$id": 69, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "boolean", + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 38, + }, + "writeExpr": Object { + "range": Array [ + 134, + 135, + ], + "type": "Literal", + }, }, - "get": Object { - "$ref": 6, + Object { + "$id": 70, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "constructor", + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 39, + }, + "writeExpr": Object { + "range": Array [ + 159, + 160, + ], + "type": "Literal", + }, }, - "is": Object { - "$ref": 11, + Object { + "$id": 71, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "declare", + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 40, + }, + "writeExpr": Object { + "range": Array [ + 180, + 181, + ], + "type": "Literal", + }, }, - "module": Object { - "$ref": 8, + Object { + "$id": 72, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "get", + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 41, + }, + "writeExpr": Object { + "range": Array [ + 197, + 198, + ], + "type": "Literal", + }, }, - "set": Object { - "$ref": 7, + Object { + "$id": 73, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "infer", + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 42, + }, + "writeExpr": Object { + "range": Array [ + 216, + 217, + ], + "type": "Literal", + }, }, - "type": Object { - "$ref": 9, + Object { + "$id": 74, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "is", + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 43, + }, + "writeExpr": Object { + "range": Array [ + 232, + 233, + ], + "type": "Literal", + }, }, - }, - "variableScope": Object { - "$ref": 19, - }, - "variables": Array [ Object { - "$id": 6, - "defs": Array [ - Object { - "name": Object { - "name": "get", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 10, - 17, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 4, - 18, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "get", - "range": Array [ - 10, - 13, - ], - "type": "Identifier", - }, - ], - "name": "get", - "references": Array [ - Object { - "$ref": 12, - }, - ], - "scope": Object { - "$ref": 18, + "$id": 75, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "keyof", + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 44, + }, + "writeExpr": Object { + "range": Array [ + 251, + 252, + ], + "type": "Literal", }, }, Object { - "$id": 7, - "defs": Array [ - Object { - "name": Object { - "name": "set", + "$id": 76, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "module", + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 45, + }, + "writeExpr": Object { + "range": Array [ + 271, + 272, + ], + "type": "Literal", + }, + }, + Object { + "$id": 77, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "namespace", + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 46, + }, + "writeExpr": Object { + "range": Array [ + 294, + 295, + ], + "type": "Literal", + }, + }, + Object { + "$id": 78, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "never", + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 47, + }, + "writeExpr": Object { + "range": Array [ + 313, + 314, + ], + "type": "Literal", + }, + }, + Object { + "$id": 79, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "readonly", + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 48, + }, + "writeExpr": Object { + "range": Array [ + 335, + 336, + ], + "type": "Literal", + }, + }, + Object { + "$id": 80, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "require", + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 49, + }, + "writeExpr": Object { + "range": Array [ + 356, + 357, + ], + "type": "Literal", + }, + }, + Object { + "$id": 81, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "number", + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 50, + }, + "writeExpr": Object { + "range": Array [ + 376, + 377, + ], + "type": "Literal", + }, + }, + Object { + "$id": 82, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "object", + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 51, + }, + "writeExpr": Object { + "range": Array [ + 396, + 397, + ], + "type": "Literal", + }, + }, + Object { + "$id": 83, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "set", + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 52, + }, + "writeExpr": Object { + "range": Array [ + 413, + 414, + ], + "type": "Literal", + }, + }, + Object { + "$id": 84, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "string", + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 53, + }, + "writeExpr": Object { + "range": Array [ + 433, + 434, + ], + "type": "Literal", + }, + }, + Object { + "$id": 85, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "symbol", + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 54, + }, + "writeExpr": Object { + "range": Array [ + 453, + 454, + ], + "type": "Literal", + }, + }, + Object { + "$id": 86, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "type", + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 55, + }, + "writeExpr": Object { + "range": Array [ + 471, + 472, + ], + "type": "Literal", + }, + }, + Object { + "$id": 87, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "undefined", + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 56, + }, + "writeExpr": Object { + "range": Array [ + 494, + 495, + ], + "type": "Literal", + }, + }, + Object { + "$id": 88, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "unique", + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 57, + }, + "writeExpr": Object { + "range": Array [ + 514, + 515, + ], + "type": "Literal", + }, + }, + Object { + "$id": 89, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "unknown", + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 58, + }, + "writeExpr": Object { + "range": Array [ + 535, + 536, + ], + "type": "Literal", + }, + }, + Object { + "$id": 90, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "from", + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 59, + }, + "writeExpr": Object { + "range": Array [ + 553, + 554, + ], + "type": "Literal", + }, + }, + Object { + "$id": 91, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "global", + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 60, + }, + "writeExpr": Object { + "range": Array [ + 573, + 574, + ], + "type": "Literal", + }, + }, + Object { + "$id": 92, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "bigint", + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 61, + }, + "writeExpr": Object { + "range": Array [ + 593, + 594, + ], + "type": "Literal", + }, + }, + Object { + "$id": 93, + "from": Object { + "$ref": 94, + }, + "identifier": Object { + "name": "of", + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 62, + }, + "writeExpr": Object { + "range": Array [ + 609, + 610, + ], + "type": "Literal", + }, + }, + ], + "throughReferences": Array [], + "type": "block", + "upperScope": Object { + "$ref": 107, + }, + "variableMap": Object { + "abstract": Object { + "$ref": 32, + }, + "any": Object { + "$ref": 35, + }, + "as": Object { + "$ref": 33, + }, + "asserts": Object { + "$ref": 34, + }, + "async": Object { + "$ref": 36, + }, + "await": Object { + "$ref": 37, + }, + "bigint": Object { + "$ref": 61, + }, + "boolean": Object { + "$ref": 38, + }, + "constructor": Object { + "$ref": 39, + }, + "declare": Object { + "$ref": 40, + }, + "from": Object { + "$ref": 59, + }, + "get": Object { + "$ref": 41, + }, + "global": Object { + "$ref": 60, + }, + "infer": Object { + "$ref": 42, + }, + "is": Object { + "$ref": 43, + }, + "keyof": Object { + "$ref": 44, + }, + "module": Object { + "$ref": 45, + }, + "namespace": Object { + "$ref": 46, + }, + "never": Object { + "$ref": 47, + }, + "number": Object { + "$ref": 50, + }, + "object": Object { + "$ref": 51, + }, + "of": Object { + "$ref": 62, + }, + "readonly": Object { + "$ref": 48, + }, + "require": Object { + "$ref": 49, + }, + "set": Object { + "$ref": 52, + }, + "string": Object { + "$ref": 53, + }, + "symbol": Object { + "$ref": 54, + }, + "type": Object { + "$ref": 55, + }, + "undefined": Object { + "$ref": 56, + }, + "unique": Object { + "$ref": 57, + }, + "unknown": Object { + "$ref": 58, + }, + }, + "variableScope": Object { + "$ref": 107, + }, + "variables": Array [ + Object { + "$id": 32, + "defs": Array [ + Object { + "name": Object { + "name": "abstract", + "range": Array [ + 10, + 18, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 10, + 22, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 4, + 23, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "abstract", + "range": Array [ + 10, + 18, + ], + "type": "Identifier", + }, + ], + "name": "abstract", + "references": Array [ + Object { + "$ref": 63, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 33, + "defs": Array [ + Object { + "name": Object { + "name": "as", + "range": Array [ + 32, + 34, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 32, + 38, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 26, + 39, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "as", + "range": Array [ + 32, + 34, + ], + "type": "Identifier", + }, + ], + "name": "as", + "references": Array [ + Object { + "$ref": 64, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 34, + "defs": Array [ + Object { + "name": Object { + "name": "asserts", + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 48, + 59, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 42, + 60, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "asserts", + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + }, + ], + "name": "asserts", + "references": Array [ + Object { + "$ref": 65, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 35, + "defs": Array [ + Object { + "name": Object { + "name": "any", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 69, + 76, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 63, + 77, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "any", + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + }, + ], + "name": "any", + "references": Array [ + Object { + "$ref": 66, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 36, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 86, + 95, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 80, + 96, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [ + Object { + "$ref": 67, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 37, + "defs": Array [ + Object { + "name": Object { + "name": "await", + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 105, + 114, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 99, + 115, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "await", + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + }, + ], + "name": "await", + "references": Array [ + Object { + "$ref": 68, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 38, + "defs": Array [ + Object { + "name": Object { + "name": "boolean", + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 124, + 135, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 118, + 136, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "boolean", + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + }, + ], + "name": "boolean", + "references": Array [ + Object { + "$ref": 69, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 39, + "defs": Array [ + Object { + "name": Object { + "name": "constructor", + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 145, + 160, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 139, + 161, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "constructor", + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + }, + ], + "name": "constructor", + "references": Array [ + Object { + "$ref": 70, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 40, + "defs": Array [ + Object { + "name": Object { + "name": "declare", + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 170, + 181, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 164, + 182, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "declare", + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + }, + ], + "name": "declare", + "references": Array [ + Object { + "$ref": 71, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 41, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 191, + 198, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 185, + 199, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [ + Object { + "$ref": 72, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 42, + "defs": Array [ + Object { + "name": Object { + "name": "infer", + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 208, + 217, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 202, + 218, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "infer", + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + }, + ], + "name": "infer", + "references": Array [ + Object { + "$ref": 73, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 43, + "defs": Array [ + Object { + "name": Object { + "name": "is", + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 227, + 233, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 221, + 234, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "is", + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + }, + ], + "name": "is", + "references": Array [ + Object { + "$ref": 74, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 44, + "defs": Array [ + Object { + "name": Object { + "name": "keyof", + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 243, + 252, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 237, + 253, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "keyof", + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + }, + ], + "name": "keyof", + "references": Array [ + Object { + "$ref": 75, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 45, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 262, + 272, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 256, + 273, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [ + Object { + "$ref": 76, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 46, + "defs": Array [ + Object { + "name": Object { + "name": "namespace", + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 282, + 295, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 276, + 296, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "namespace", + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + }, + ], + "name": "namespace", + "references": Array [ + Object { + "$ref": 77, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 47, + "defs": Array [ + Object { + "name": Object { + "name": "never", + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 305, + 314, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 299, + 315, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "never", + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + }, + ], + "name": "never", + "references": Array [ + Object { + "$ref": 78, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 48, + "defs": Array [ + Object { + "name": Object { + "name": "readonly", + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 324, + 336, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 318, + 337, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "readonly", + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + }, + ], + "name": "readonly", + "references": Array [ + Object { + "$ref": 79, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 49, + "defs": Array [ + Object { + "name": Object { + "name": "require", + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 346, + 357, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 340, + 358, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "require", + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + }, + ], + "name": "require", + "references": Array [ + Object { + "$ref": 80, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 50, + "defs": Array [ + Object { + "name": Object { + "name": "number", + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 367, + 377, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 361, + 378, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "number", + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + }, + ], + "name": "number", + "references": Array [ + Object { + "$ref": 81, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 51, + "defs": Array [ + Object { + "name": Object { + "name": "object", + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 387, + 397, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 381, + 398, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "object", + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + }, + ], + "name": "object", + "references": Array [ + Object { + "$ref": 82, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 52, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 407, + 414, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 401, + 415, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "set", + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [ + Object { + "$ref": 83, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 53, + "defs": Array [ + Object { + "name": Object { + "name": "string", + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 424, + 434, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 418, + 435, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "string", + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + }, + ], + "name": "string", + "references": Array [ + Object { + "$ref": 84, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 54, + "defs": Array [ + Object { + "name": Object { + "name": "symbol", + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 444, + 454, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 438, + 455, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "symbol", + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + }, + ], + "name": "symbol", + "references": Array [ + Object { + "$ref": 85, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 55, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 464, + 472, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 458, + 473, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "type", + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [ + Object { + "$ref": 86, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 56, + "defs": Array [ + Object { + "name": Object { + "name": "undefined", + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 482, + 495, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 476, + 496, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "undefined", + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + }, + ], + "name": "undefined", + "references": Array [ + Object { + "$ref": 87, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 57, + "defs": Array [ + Object { + "name": Object { + "name": "unique", + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 505, + 515, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 499, + 516, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "unique", + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + }, + ], + "name": "unique", + "references": Array [ + Object { + "$ref": 88, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 58, + "defs": Array [ + Object { + "name": Object { + "name": "unknown", + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 525, + 536, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 519, + 537, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "unknown", + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + }, + ], + "name": "unknown", + "references": Array [ + Object { + "$ref": 89, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 59, + "defs": Array [ + Object { + "name": Object { + "name": "from", + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 546, + 554, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 540, + 555, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "from", + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + }, + ], + "name": "from", + "references": Array [ + Object { + "$ref": 90, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 60, + "defs": Array [ + Object { + "name": Object { + "name": "global", + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 564, + 574, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 558, + 575, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "global", + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + }, + ], + "name": "global", + "references": Array [ + Object { + "$ref": 91, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 61, + "defs": Array [ + Object { + "name": Object { + "name": "bigint", + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 584, + 594, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 578, + 595, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "bigint", + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + }, + ], + "name": "bigint", + "references": Array [ + Object { + "$ref": 92, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + Object { + "$id": 62, + "defs": Array [ + Object { + "name": Object { + "name": "of", + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 604, + 610, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 598, + 611, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "of", + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + }, + ], + "name": "of", + "references": Array [ + Object { + "$ref": 93, + }, + ], + "scope": Object { + "$ref": 94, + }, + }, + ], + }, + Object { + "$id": 106, + "block": Object { + "range": Array [ + 962, + 1077, + ], + "type": "ClassDeclaration", + }, + "childScopes": Array [ + Object { + "$id": 97, + "block": Object { + "range": Array [ + 995, + 1000, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 106, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 96, + }, + }, + "variableScope": Object { + "$ref": 97, + }, + "variables": Array [ + Object { + "$id": 96, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 97, + }, + }, + ], + }, + Object { + "$id": 99, + "block": Object { + "range": Array [ + 1012, + 1017, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 106, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 98, + }, + }, + "variableScope": Object { + "$ref": 99, + }, + "variables": Array [ + Object { + "$id": 98, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 99, + }, + }, + ], + }, + Object { + "$id": 101, + "block": Object { + "range": Array [ + 1028, + 1033, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 106, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 100, + }, + }, + "variableScope": Object { + "$ref": 101, + }, + "variables": Array [ + Object { + "$id": 100, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 101, + }, + }, + ], + }, + Object { + "$id": 105, + "block": Object { + "range": Array [ + 1048, + 1075, + ], + "type": "FunctionExpression", + }, + "childScopes": Array [], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [ + Object { + "$id": 104, + "from": Object { + "$ref": 105, + }, + "identifier": Object { + "name": "x", + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + }, + "kind": "w", + "resolved": Object { + "$ref": 103, + }, + "writeExpr": Object { + "range": Array [ + 1065, + 1070, + ], + "type": "YieldExpression", + }, + }, + ], + "throughReferences": Array [], + "type": "function", + "upperScope": Object { + "$ref": 106, + }, + "variableMap": Object { + "arguments": Object { + "$ref": 102, + }, + "x": Object { + "$ref": 103, + }, + }, + "variableScope": Object { + "$ref": 105, + }, + "variables": Array [ + Object { + "$id": 102, + "defs": Array [], + "eslintUsed": undefined, + "identifiers": Array [], + "name": "arguments", + "references": Array [], + "scope": Object { + "$ref": 105, + }, + }, + Object { + "$id": 103, + "defs": Array [ + Object { + "name": Object { + "name": "x", + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 1061, + 1070, + ], + "type": "VariableDeclarator", + }, + "parent": Object { + "range": Array [ + 1057, + 1071, + ], + "type": "VariableDeclaration", + }, + "type": "Variable", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "x", + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + }, + ], + "name": "x", + "references": Array [ + Object { + "$ref": 104, + }, + ], + "scope": Object { + "$ref": 105, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "class", + "upperScope": Object { + "$ref": 107, + }, + "variableMap": Object { + "C": Object { + "$ref": 95, + }, + }, + "variableScope": Object { + "$ref": 107, + }, + "variables": Array [ + Object { + "$id": 95, + "defs": Array [ + Object { + "name": Object { + "name": "C", "range": Array [ - 27, - 30, + 968, + 969, ], "type": "Identifier", }, "node": Object { "range": Array [ - 27, - 34, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 21, - 35, + 962, + 1077, ], - "type": "VariableDeclaration", + "type": "ClassDeclaration", }, - "type": "Variable", + "parent": undefined, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 968, + 969, + ], + "type": "Identifier", }, ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "set", - "range": Array [ - 27, - 30, - ], - "type": "Identifier", - }, + "name": "C", + "references": Array [], + "scope": Object { + "$ref": 106, + }, + }, + ], + }, + ], + "functionExpressionScope": false, + "isStrict": true, + "references": Array [], + "throughReferences": Array [], + "type": "module", + "upperScope": Object { + "$ref": 108, + }, + "variableMap": Object { + "C": Object { + "$ref": 31, + }, + "abstract": Object { + "$ref": 0, + }, + "any": Object { + "$ref": 3, + }, + "as": Object { + "$ref": 1, + }, + "asserts": Object { + "$ref": 2, + }, + "async": Object { + "$ref": 4, + }, + "await": Object { + "$ref": 5, + }, + "bigint": Object { + "$ref": 29, + }, + "boolean": Object { + "$ref": 6, + }, + "constructor": Object { + "$ref": 7, + }, + "declare": Object { + "$ref": 8, + }, + "from": Object { + "$ref": 27, + }, + "get": Object { + "$ref": 9, + }, + "global": Object { + "$ref": 28, + }, + "infer": Object { + "$ref": 10, + }, + "is": Object { + "$ref": 11, + }, + "keyof": Object { + "$ref": 12, + }, + "module": Object { + "$ref": 13, + }, + "namespace": Object { + "$ref": 14, + }, + "never": Object { + "$ref": 15, + }, + "number": Object { + "$ref": 18, + }, + "object": Object { + "$ref": 19, + }, + "of": Object { + "$ref": 30, + }, + "readonly": Object { + "$ref": 16, + }, + "require": Object { + "$ref": 17, + }, + "set": Object { + "$ref": 20, + }, + "string": Object { + "$ref": 21, + }, + "symbol": Object { + "$ref": 22, + }, + "type": Object { + "$ref": 23, + }, + "undefined": Object { + "$ref": 24, + }, + "unique": Object { + "$ref": 25, + }, + "unknown": Object { + "$ref": 26, + }, + }, + "variableScope": Object { + "$ref": 107, + }, + "variables": Array [ + Object { + "$id": 0, + "defs": Array [ + Object { + "name": Object { + "name": "abstract", + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 626, + 634, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "abstract", + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + }, + ], + "name": "abstract", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 1, + "defs": Array [ + Object { + "name": Object { + "name": "as", + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 638, + 640, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "as", + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + }, + ], + "name": "as", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 2, + "defs": Array [ + Object { + "name": Object { + "name": "asserts", + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 644, + 651, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "asserts", + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + }, + ], + "name": "asserts", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 3, + "defs": Array [ + Object { + "name": Object { + "name": "any", + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 655, + 658, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "any", + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + }, + ], + "name": "any", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 4, + "defs": Array [ + Object { + "name": Object { + "name": "async", + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 662, + 667, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "async", + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + }, + ], + "name": "async", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 5, + "defs": Array [ + Object { + "name": Object { + "name": "await", + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 671, + 676, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "await", + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + }, + ], + "name": "await", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 6, + "defs": Array [ + Object { + "name": Object { + "name": "boolean", + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 680, + 687, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "boolean", + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + }, + ], + "name": "boolean", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 7, + "defs": Array [ + Object { + "name": Object { + "name": "constructor", + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 691, + 702, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "constructor", + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + }, + ], + "name": "constructor", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 8, + "defs": Array [ + Object { + "name": Object { + "name": "declare", + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 706, + 713, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "declare", + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + }, + ], + "name": "declare", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 9, + "defs": Array [ + Object { + "name": Object { + "name": "get", + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 717, + 720, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "get", + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + }, + ], + "name": "get", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 10, + "defs": Array [ + Object { + "name": Object { + "name": "infer", + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 724, + 729, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "infer", + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + }, + ], + "name": "infer", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 11, + "defs": Array [ + Object { + "name": Object { + "name": "is", + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 733, + 735, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "is", + "range": Array [ + 733, + 735, ], - "name": "set", - "references": Array [ - Object { - "$ref": 13, - }, + "type": "Identifier", + }, + ], + "name": "is", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 12, + "defs": Array [ + Object { + "name": Object { + "name": "keyof", + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 739, + 744, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "keyof", + "range": Array [ + 739, + 744, ], - "scope": Object { - "$ref": 18, + "type": "Identifier", + }, + ], + "name": "keyof", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 13, + "defs": Array [ + Object { + "name": Object { + "name": "module", + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 748, + 754, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "module", + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + }, + ], + "name": "module", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 14, + "defs": Array [ + Object { + "name": Object { + "name": "namespace", + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 758, + 767, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "namespace", + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + }, + ], + "name": "namespace", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 15, + "defs": Array [ + Object { + "name": Object { + "name": "never", + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 771, + 776, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "never", + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + }, + ], + "name": "never", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 16, + "defs": Array [ + Object { + "name": Object { + "name": "readonly", + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 780, + 788, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "readonly", + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + }, + ], + "name": "readonly", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 17, + "defs": Array [ + Object { + "name": Object { + "name": "require", + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 792, + 799, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", }, + "type": "ImportBinding", }, + ], + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 8, - "defs": Array [ - Object { - "name": Object { - "name": "module", - "range": Array [ - 44, - 50, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 44, - 54, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 38, - 55, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, + "name": "require", + "range": Array [ + 792, + 799, ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "module", - "range": Array [ - 44, - 50, - ], - "type": "Identifier", - }, + "type": "Identifier", + }, + ], + "name": "require", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 18, + "defs": Array [ + Object { + "name": Object { + "name": "number", + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 803, + 809, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "number", + "range": Array [ + 803, + 809, ], - "name": "module", - "references": Array [ - Object { - "$ref": 14, - }, + "type": "Identifier", + }, + ], + "name": "number", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 19, + "defs": Array [ + Object { + "name": Object { + "name": "object", + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 813, + 819, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "object", + "range": Array [ + 813, + 819, ], - "scope": Object { - "$ref": 18, + "type": "Identifier", + }, + ], + "name": "object", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 20, + "defs": Array [ + Object { + "name": Object { + "name": "set", + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 823, + 826, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", }, + "type": "ImportBinding", }, + ], + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 9, - "defs": Array [ - Object { - "name": Object { - "name": "type", - "range": Array [ - 64, - 68, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 64, - 72, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 58, - 73, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, + "name": "set", + "range": Array [ + 823, + 826, ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "type", - "range": Array [ - 64, - 68, - ], - "type": "Identifier", - }, + "type": "Identifier", + }, + ], + "name": "set", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 21, + "defs": Array [ + Object { + "name": Object { + "name": "string", + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 830, + 836, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "string", + "range": Array [ + 830, + 836, ], - "name": "type", - "references": Array [ - Object { - "$ref": 15, - }, + "type": "Identifier", + }, + ], + "name": "string", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 22, + "defs": Array [ + Object { + "name": Object { + "name": "symbol", + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 840, + 846, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", + }, + "type": "ImportBinding", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "symbol", + "range": Array [ + 840, + 846, ], - "scope": Object { - "$ref": 18, + "type": "Identifier", + }, + ], + "name": "symbol", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 23, + "defs": Array [ + Object { + "name": Object { + "name": "type", + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 850, + 854, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", }, + "type": "ImportBinding", }, + ], + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 10, - "defs": Array [ - Object { - "name": Object { - "name": "async", - "range": Array [ - 82, - 87, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 82, - 91, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 76, - 92, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "async", - "range": Array [ - 82, - 87, - ], - "type": "Identifier", - }, - ], - "name": "async", - "references": Array [ - Object { - "$ref": 16, - }, + "name": "type", + "range": Array [ + 850, + 854, ], - "scope": Object { - "$ref": 18, + "type": "Identifier", + }, + ], + "name": "type", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 24, + "defs": Array [ + Object { + "name": Object { + "name": "undefined", + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 858, + 867, + ], + "type": "ImportSpecifier", + }, + "parent": Object { + "range": Array [ + 615, + 945, + ], + "type": "ImportDeclaration", }, + "type": "ImportBinding", }, + ], + "eslintUsed": undefined, + "identifiers": Array [ Object { - "$id": 11, - "defs": Array [ - Object { - "name": Object { - "name": "is", - "range": Array [ - 101, - 103, - ], - "type": "Identifier", - }, - "node": Object { - "range": Array [ - 101, - 107, - ], - "type": "VariableDeclarator", - }, - "parent": Object { - "range": Array [ - 95, - 108, - ], - "type": "VariableDeclaration", - }, - "type": "Variable", - }, - ], - "eslintUsed": undefined, - "identifiers": Array [ - Object { - "name": "is", - "range": Array [ - 101, - 103, - ], - "type": "Identifier", - }, - ], - "name": "is", - "references": Array [ - Object { - "$ref": 17, - }, + "name": "undefined", + "range": Array [ + 858, + 867, ], - "scope": Object { - "$ref": 18, - }, + "type": "Identifier", }, ], + "name": "undefined", + "references": Array [], + "scope": Object { + "$ref": 107, + }, }, - ], - "functionExpressionScope": false, - "isStrict": true, - "references": Array [], - "throughReferences": Array [], - "type": "module", - "upperScope": Object { - "$ref": 20, - }, - "variableMap": Object { - "async": Object { - "$ref": 4, - }, - "get": Object { - "$ref": 0, - }, - "is": Object { - "$ref": 5, - }, - "module": Object { - "$ref": 2, - }, - "set": Object { - "$ref": 1, - }, - "type": Object { - "$ref": 3, - }, - }, - "variableScope": Object { - "$ref": 19, - }, - "variables": Array [ Object { - "$id": 0, + "$id": 25, "defs": Array [ Object { "name": Object { - "name": "get", + "name": "unique", "range": Array [ - 123, - 126, + 871, + 877, ], "type": "Identifier", }, "node": Object { "range": Array [ - 123, - 126, + 871, + 877, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -20846,43 +24333,43 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "get", + "name": "unique", "range": Array [ - 123, - 126, + 871, + 877, ], "type": "Identifier", }, ], - "name": "get", + "name": "unique", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, Object { - "$id": 1, + "$id": 26, "defs": Array [ Object { "name": Object { - "name": "set", + "name": "unknown", "range": Array [ - 130, - 133, + 881, + 888, ], "type": "Identifier", }, "node": Object { "range": Array [ - 130, - 133, + 881, + 888, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -20892,43 +24379,43 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "set", + "name": "unknown", "range": Array [ - 130, - 133, + 881, + 888, ], "type": "Identifier", }, ], - "name": "set", + "name": "unknown", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, Object { - "$id": 2, + "$id": 27, "defs": Array [ Object { "name": Object { - "name": "module", + "name": "from", "range": Array [ - 137, - 143, + 892, + 896, ], "type": "Identifier", }, "node": Object { "range": Array [ - 137, - 143, + 892, + 896, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -20938,43 +24425,43 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "module", + "name": "from", "range": Array [ - 137, - 143, + 892, + 896, ], "type": "Identifier", }, ], - "name": "module", + "name": "from", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, Object { - "$id": 3, + "$id": 28, "defs": Array [ Object { "name": Object { - "name": "type", + "name": "global", "range": Array [ - 147, - 151, + 900, + 906, ], "type": "Identifier", }, "node": Object { "range": Array [ - 147, - 151, + 900, + 906, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -20984,43 +24471,43 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "type", + "name": "global", "range": Array [ - 147, - 151, + 900, + 906, ], "type": "Identifier", }, ], - "name": "type", + "name": "global", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, Object { - "$id": 4, + "$id": 29, "defs": Array [ Object { "name": Object { - "name": "async", + "name": "bigint", "range": Array [ - 155, - 160, + 910, + 916, ], "type": "Identifier", }, "node": Object { "range": Array [ - 155, - 160, + 910, + 916, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -21030,43 +24517,43 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "async", + "name": "bigint", "range": Array [ - 155, - 160, + 910, + 916, ], "type": "Identifier", }, ], - "name": "async", + "name": "bigint", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, Object { - "$id": 5, + "$id": 30, "defs": Array [ Object { "name": Object { - "name": "is", + "name": "of", "range": Array [ - 164, - 166, + 920, + 922, ], "type": "Identifier", }, "node": Object { "range": Array [ - 164, - 166, + 920, + 922, ], "type": "ImportSpecifier", }, "parent": Object { "range": Array [ - 112, - 189, + 615, + 945, ], "type": "ImportDeclaration", }, @@ -21076,18 +24563,58 @@ Object { "eslintUsed": undefined, "identifiers": Array [ Object { - "name": "is", + "name": "of", "range": Array [ - 164, - 166, + 920, + 922, ], "type": "Identifier", }, ], - "name": "is", + "name": "of", + "references": Array [], + "scope": Object { + "$ref": 107, + }, + }, + Object { + "$id": 31, + "defs": Array [ + Object { + "name": Object { + "name": "C", + "range": Array [ + 968, + 969, + ], + "type": "Identifier", + }, + "node": Object { + "range": Array [ + 962, + 1077, + ], + "type": "ClassDeclaration", + }, + "parent": null, + "type": "ClassName", + }, + ], + "eslintUsed": undefined, + "identifiers": Array [ + Object { + "name": "C", + "range": Array [ + 968, + 969, + ], + "type": "Identifier", + }, + ], + "name": "C", "references": Array [], "scope": Object { - "$ref": 19, + "$ref": 107, }, }, ], @@ -21101,7 +24628,7 @@ Object { "upperScope": null, "variableMap": Object {}, "variableScope": Object { - "$ref": 20, + "$ref": 108, }, "variables": Array [], } diff --git a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts index a6b69461af8f..ed934d7df080 100644 --- a/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts +++ b/packages/shared-fixtures/fixtures/typescript/basics/keyword-variables.src.ts @@ -1,17 +1,77 @@ { + const abstract = 1; + const as = 1; + const asserts = 1; + const any = 1; + const async = 1; + const await = 1; + const boolean = 1; + const constructor = 1; + const declare = 1; const get = 1; - const set = 1; + const infer = 1; + const is = 1; + const keyof = 1; const module = 1; + const namespace = 1; + const never = 1; + const readonly = 1; + const require = 1; + const number = 1; + const object = 1; + const set = 1; + const string = 1; + const symbol = 1; const type = 1; - const async = 1; - const is = 1; + const undefined = 1; + const unique = 1; + const unknown = 1; + const from = 1; + const global = 1; + const bigint = 1; + const of = 1; } import { + abstract, + as, + asserts, + any, + async, + await, + boolean, + constructor, + declare, get, - set, + infer, + is, + keyof, module, + namespace, + never, + readonly, + require, + number, + object, + set, + string, + symbol, type, - async, - is, + undefined, + unique, + unknown, + from, + global, + bigint, + of, } from 'fake-module'; + +interface X {} +class C implements X { + static a() {} + private b() {} + public c() {} + protected *d() { + let x = yield; + } +} diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index ffcd0af0b579..3f9e4549bc5d 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -456,23 +456,16 @@ export function isOptional(node: { export function getTokenType( token: ts.Identifier | ts.Token, ): AST_TOKEN_TYPES { - // Need two checks for keywords since some are also identifiers if ('originalKeywordKind' in token && token.originalKeywordKind) { - switch (token.originalKeywordKind) { - case SyntaxKind.NullKeyword: - return AST_TOKEN_TYPES.Null; - - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - case SyntaxKind.TypeKeyword: - case SyntaxKind.ModuleKeyword: - case SyntaxKind.AsyncKeyword: - case SyntaxKind.IsKeyword: - return AST_TOKEN_TYPES.Identifier; - - default: - return AST_TOKEN_TYPES.Keyword; + if (token.originalKeywordKind === SyntaxKind.NullKeyword) { + return AST_TOKEN_TYPES.Null; + } else if ( + token.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && + token.originalKeywordKind <= SyntaxKind.LastKeyword + ) { + return AST_TOKEN_TYPES.Identifier; } + return AST_TOKEN_TYPES.Keyword; } if ( diff --git a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap index 84f3780a21c2..0f9639a3bcb5 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap @@ -21870,7 +21870,7 @@ Object { 9, 15, ], - "type": "Keyword", + "type": "Identifier", "value": "static", }, Object { @@ -24218,7 +24218,7 @@ Object { 16, 22, ], - "type": "Keyword", + "type": "Identifier", "value": "static", }, Object { @@ -120511,7 +120511,7 @@ Object { 11, 16, ], - "type": "Keyword", + "type": "Identifier", "value": "await", }, Object { @@ -138207,7 +138207,7 @@ Object { 10, 19, ], - "type": "Keyword", + "type": "Identifier", "value": "undefined", }, Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap index d0d092c78411..037f88206448 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap @@ -1158,7 +1158,7 @@ Object { 11, 17, ], - "type": "Keyword", + "type": "Identifier", "value": "object", }, Object { @@ -1249,7 +1249,7 @@ Object { 26, 34, ], - "type": "Keyword", + "type": "Identifier", "value": "abstract", }, Object { @@ -10601,7 +10601,7 @@ Object { 28, 35, ], - "type": "Keyword", + "type": "Identifier", "value": "declare", }, Object { @@ -10637,7 +10637,7 @@ Object { 36, 42, ], - "type": "Keyword", + "type": "Identifier", "value": "static", }, Object { @@ -10781,7 +10781,7 @@ Object { 56, 63, ], - "type": "Keyword", + "type": "Identifier", "value": "declare", }, Object { @@ -10817,7 +10817,7 @@ Object { 64, 70, ], - "type": "Keyword", + "type": "Identifier", "value": "static", }, Object { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap index a439478f2a98..cbd1e12b3783 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap @@ -11018,7 +11018,7 @@ Object { 0, 8, ], - "type": "Keyword", + "type": "Identifier", "value": "abstract", }, Object { @@ -11222,7 +11222,7 @@ Object { 0, 7, ], - "type": "Keyword", + "type": "Identifier", "value": "declare", }, Object { @@ -24094,7 +24094,7 @@ Object { 33, 42, ], - "type": "Keyword", + "type": "Identifier", "value": "undefined", }, Object { @@ -27094,7 +27094,7 @@ Object { 27, 36, ], - "type": "Keyword", + "type": "Identifier", "value": "undefined", }, Object { @@ -64946,7 +64946,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 16, "line": 2, }, "start": Object { @@ -64954,27 +64954,27 @@ Object { "line": 2, }, }, - "name": "get", + "name": "abstract", "range": Array [ 10, - 13, + 18, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 2, }, "start": Object { - "column": 14, + "column": 19, "line": 2, }, }, "range": Array [ - 16, - 17, + 21, + 22, ], "raw": "1", "type": "Literal", @@ -64982,7 +64982,7 @@ Object { }, "loc": Object { "end": Object { - "column": 15, + "column": 20, "line": 2, }, "start": Object { @@ -64992,7 +64992,7 @@ Object { }, "range": Array [ 10, - 17, + 22, ], "type": "VariableDeclarator", }, @@ -65000,7 +65000,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 16, + "column": 21, "line": 2, }, "start": Object { @@ -65010,7 +65010,7 @@ Object { }, "range": Array [ 4, - 18, + 23, ], "type": "VariableDeclaration", }, @@ -65020,7 +65020,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 11, + "column": 10, "line": 3, }, "start": Object { @@ -65028,27 +65028,27 @@ Object { "line": 3, }, }, - "name": "set", + "name": "as", "range": Array [ - 27, - 30, + 32, + 34, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 3, }, "start": Object { - "column": 14, + "column": 13, "line": 3, }, }, "range": Array [ - 33, - 34, + 37, + 38, ], "raw": "1", "type": "Literal", @@ -65056,7 +65056,7 @@ Object { }, "loc": Object { "end": Object { - "column": 15, + "column": 14, "line": 3, }, "start": Object { @@ -65065,8 +65065,8 @@ Object { }, }, "range": Array [ - 27, - 34, + 32, + 38, ], "type": "VariableDeclarator", }, @@ -65074,7 +65074,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 3, }, "start": Object { @@ -65083,8 +65083,8 @@ Object { }, }, "range": Array [ - 21, - 35, + 26, + 39, ], "type": "VariableDeclaration", }, @@ -65094,7 +65094,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 14, + "column": 15, "line": 4, }, "start": Object { @@ -65102,27 +65102,27 @@ Object { "line": 4, }, }, - "name": "module", + "name": "asserts", "range": Array [ - 44, - 50, + 48, + 55, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 18, + "column": 19, "line": 4, }, "start": Object { - "column": 17, + "column": 18, "line": 4, }, }, "range": Array [ - 53, - 54, + 58, + 59, ], "raw": "1", "type": "Literal", @@ -65130,7 +65130,7 @@ Object { }, "loc": Object { "end": Object { - "column": 18, + "column": 19, "line": 4, }, "start": Object { @@ -65139,8 +65139,8 @@ Object { }, }, "range": Array [ - 44, - 54, + 48, + 59, ], "type": "VariableDeclarator", }, @@ -65148,7 +65148,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 19, + "column": 20, "line": 4, }, "start": Object { @@ -65157,8 +65157,8 @@ Object { }, }, "range": Array [ - 38, - 55, + 42, + 60, ], "type": "VariableDeclaration", }, @@ -65168,7 +65168,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 12, + "column": 11, "line": 5, }, "start": Object { @@ -65176,27 +65176,27 @@ Object { "line": 5, }, }, - "name": "type", + "name": "any", "range": Array [ - 64, - 68, + 69, + 72, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 5, }, "start": Object { - "column": 15, + "column": 14, "line": 5, }, }, "range": Array [ - 71, - 72, + 75, + 76, ], "raw": "1", "type": "Literal", @@ -65204,7 +65204,7 @@ Object { }, "loc": Object { "end": Object { - "column": 16, + "column": 15, "line": 5, }, "start": Object { @@ -65213,8 +65213,8 @@ Object { }, }, "range": Array [ - 64, - 72, + 69, + 76, ], "type": "VariableDeclarator", }, @@ -65222,7 +65222,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 17, + "column": 16, "line": 5, }, "start": Object { @@ -65231,8 +65231,8 @@ Object { }, }, "range": Array [ - 58, - 73, + 63, + 77, ], "type": "VariableDeclaration", }, @@ -65252,8 +65252,8 @@ Object { }, "name": "async", "range": Array [ - 82, - 87, + 86, + 91, ], "type": "Identifier", }, @@ -65269,8 +65269,8 @@ Object { }, }, "range": Array [ - 90, - 91, + 94, + 95, ], "raw": "1", "type": "Literal", @@ -65287,8 +65287,8 @@ Object { }, }, "range": Array [ - 82, - 91, + 86, + 95, ], "type": "VariableDeclarator", }, @@ -65305,8 +65305,8 @@ Object { }, }, "range": Array [ - 76, - 92, + 80, + 96, ], "type": "VariableDeclaration", }, @@ -65316,7 +65316,7 @@ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, + "column": 13, "line": 7, }, "start": Object { @@ -65324,27 +65324,27 @@ Object { "line": 7, }, }, - "name": "is", + "name": "await", "range": Array [ - 101, - 103, + 105, + 110, ], "type": "Identifier", }, "init": Object { "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 7, }, "start": Object { - "column": 13, + "column": 16, "line": 7, }, }, "range": Array [ - 106, - 107, + 113, + 114, ], "raw": "1", "type": "Literal", @@ -65352,7 +65352,7 @@ Object { }, "loc": Object { "end": Object { - "column": 14, + "column": 17, "line": 7, }, "start": Object { @@ -65361,8 +65361,8 @@ Object { }, }, "range": Array [ - 101, - 107, + 105, + 114, ], "type": "VariableDeclarator", }, @@ -65370,7 +65370,7 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 15, + "column": 18, "line": 7, }, "start": Object { @@ -65379,685 +65379,8157 @@ Object { }, }, "range": Array [ - 95, - 108, + 99, + 115, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "name": "boolean", + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 124, + 135, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 118, + 136, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "name": "constructor", + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 145, + 160, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 139, + 161, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "name": "declare", + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 180, + 181, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 170, + 181, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 164, + 182, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "get", + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 197, + 198, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 191, + 198, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 185, + 199, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "name": "infer", + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 216, + 217, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 208, + 217, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 202, + 218, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "name": "is", + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 232, + 233, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 227, + 233, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 221, + 234, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "name": "keyof", + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 251, + 252, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 243, + 252, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "range": Array [ + 237, + 253, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "name": "module", + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 271, + 272, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "range": Array [ + 262, + 272, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 256, + 273, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "name": "namespace", + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 20, + "line": 16, + }, + }, + "range": Array [ + 294, + 295, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "range": Array [ + 282, + 295, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 22, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 276, + 296, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "name": "never", + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 313, + 314, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 305, + 314, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 299, + 315, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "name": "readonly", + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 335, + 336, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 324, + 336, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 18, + }, + "start": Object { + "column": 2, + "line": 18, + }, + }, + "range": Array [ + 318, + 337, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "name": "require", + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 18, + "line": 19, + }, + }, + "range": Array [ + 356, + 357, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "range": Array [ + 346, + 357, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 19, + }, + "start": Object { + "column": 2, + "line": 19, + }, + }, + "range": Array [ + 340, + 358, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "name": "number", + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 17, + "line": 20, + }, + }, + "range": Array [ + 376, + 377, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "range": Array [ + 367, + 377, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 20, + }, + }, + "range": Array [ + 361, + 378, ], "type": "VariableDeclaration", }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "name": "object", + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 17, + "line": 21, + }, + }, + "range": Array [ + 396, + 397, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "range": Array [ + 387, + 397, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 21, + }, + "start": Object { + "column": 2, + "line": 21, + }, + }, + "range": Array [ + 381, + 398, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "name": "set", + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 14, + "line": 22, + }, + }, + "range": Array [ + 413, + 414, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "range": Array [ + 407, + 414, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 22, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "range": Array [ + 401, + 415, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "name": "string", + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 433, + 434, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "range": Array [ + 424, + 434, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 23, + }, + "start": Object { + "column": 2, + "line": 23, + }, + }, + "range": Array [ + 418, + 435, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "name": "symbol", + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 24, + }, + }, + "range": Array [ + 453, + 454, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "range": Array [ + 444, + 454, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 438, + 455, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "name": "type", + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 15, + "line": 25, + }, + }, + "range": Array [ + 471, + 472, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "range": Array [ + 464, + 472, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 25, + }, + "start": Object { + "column": 2, + "line": 25, + }, + }, + "range": Array [ + 458, + 473, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "name": "undefined", + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 494, + 495, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "range": Array [ + 482, + 495, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 22, + "line": 26, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "range": Array [ + 476, + 496, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "name": "unique", + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 17, + "line": 27, + }, + }, + "range": Array [ + 514, + 515, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "range": Array [ + 505, + 515, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 27, + }, + "start": Object { + "column": 2, + "line": 27, + }, + }, + "range": Array [ + 499, + 516, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "name": "unknown", + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 18, + "line": 28, + }, + }, + "range": Array [ + 535, + 536, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "range": Array [ + 525, + 536, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 28, + }, + }, + "range": Array [ + 519, + 537, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "name": "from", + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 15, + "line": 29, + }, + }, + "range": Array [ + 553, + 554, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "range": Array [ + 546, + 554, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 29, + }, + "start": Object { + "column": 2, + "line": 29, + }, + }, + "range": Array [ + 540, + 555, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "name": "global", + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 17, + "line": 30, + }, + }, + "range": Array [ + 573, + 574, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "range": Array [ + 564, + 574, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 30, + }, + "start": Object { + "column": 2, + "line": 30, + }, + }, + "range": Array [ + 558, + 575, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "name": "bigint", + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 17, + "line": 31, + }, + }, + "range": Array [ + 593, + 594, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "range": Array [ + 584, + 594, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 31, + }, + "start": Object { + "column": 2, + "line": 31, + }, + }, + "range": Array [ + 578, + 595, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "name": "of", + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 13, + "line": 32, + }, + }, + "range": Array [ + 609, + 610, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "range": Array [ + 604, + 610, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 32, + }, + "start": Object { + "column": 2, + "line": 32, + }, + }, + "range": Array [ + 598, + 611, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 613, + ], + "type": "BlockStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 67, + }, + "start": Object { + "column": 0, + "line": 35, + }, + }, + "range": Array [ + 615, + 945, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 67, + }, + "start": Object { + "column": 7, + "line": 67, + }, + }, + "range": Array [ + 931, + 944, + ], + "raw": "'fake-module'", + "type": "Literal", + "value": "fake-module", + }, + "specifiers": Array [ + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "name": "abstract", + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "name": "abstract", + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + }, + "range": Array [ + 626, + 634, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "name": "as", + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "name": "as", + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + }, + "range": Array [ + 638, + 640, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "name": "asserts", + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "name": "asserts", + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + }, + "range": Array [ + 644, + 651, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "name": "any", + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "name": "any", + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + }, + "range": Array [ + 655, + 658, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "name": "async", + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "name": "async", + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + }, + "range": Array [ + 662, + 667, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "name": "await", + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "name": "await", + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + }, + "range": Array [ + 671, + 676, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "name": "boolean", + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "name": "boolean", + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + }, + "range": Array [ + 680, + 687, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "name": "constructor", + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "name": "constructor", + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + }, + "range": Array [ + 691, + 702, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "name": "declare", + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "name": "declare", + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + }, + "range": Array [ + 706, + 713, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "name": "get", + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "name": "get", + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + }, + "range": Array [ + 717, + 720, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "name": "infer", + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "name": "infer", + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + }, + "range": Array [ + 724, + 729, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "name": "is", + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "name": "is", + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + }, + "range": Array [ + 733, + 735, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "name": "keyof", + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "name": "keyof", + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + }, + "range": Array [ + 739, + 744, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "name": "module", + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "name": "module", + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + }, + "range": Array [ + 748, + 754, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "name": "namespace", + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "name": "namespace", + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + }, + "range": Array [ + 758, + 767, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "name": "never", + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "name": "never", + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + }, + "range": Array [ + 771, + 776, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "name": "readonly", + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "name": "readonly", + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + }, + "range": Array [ + 780, + 788, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "name": "require", + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "name": "require", + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + }, + "range": Array [ + 792, + 799, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "name": "number", + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "name": "number", + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + }, + "range": Array [ + 803, + 809, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "name": "object", + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "name": "object", + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + }, + "range": Array [ + 813, + 819, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "name": "set", + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "name": "set", + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + }, + "range": Array [ + 823, + 826, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "name": "string", + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "name": "string", + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + }, + "range": Array [ + 830, + 836, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "name": "symbol", + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "name": "symbol", + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + }, + "range": Array [ + 840, + 846, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "name": "type", + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "name": "type", + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + }, + "range": Array [ + 850, + 854, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "name": "undefined", + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "name": "undefined", + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + }, + "range": Array [ + 858, + 867, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "name": "unique", + "range": Array [ + 871, + 877, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "name": "unique", + "range": Array [ + 871, + 877, + ], + "type": "Identifier", + }, + "range": Array [ + 871, + 877, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "name": "unknown", + "range": Array [ + 881, + 888, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "name": "unknown", + "range": Array [ + 881, + 888, + ], + "type": "Identifier", + }, + "range": Array [ + 881, + 888, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "name": "from", + "range": Array [ + 892, + 896, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "name": "from", + "range": Array [ + 892, + 896, + ], + "type": "Identifier", + }, + "range": Array [ + 892, + 896, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "name": "global", + "range": Array [ + 900, + 906, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "name": "global", + "range": Array [ + 900, + 906, + ], + "type": "Identifier", + }, + "range": Array [ + 900, + 906, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "name": "bigint", + "range": Array [ + 910, + 916, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "name": "bigint", + "range": Array [ + 910, + 916, + ], + "type": "Identifier", + }, + "range": Array [ + 910, + 916, + ], + "type": "ImportSpecifier", + }, + Object { + "imported": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "name": "of", + "range": Array [ + 920, + 922, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "local": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "name": "of", + "range": Array [ + 920, + 922, + ], + "type": "Identifier", + }, + "range": Array [ + 920, + 922, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 69, + }, + "start": Object { + "column": 12, + "line": 69, + }, + }, + "range": Array [ + 959, + 961, + ], + "type": "TSInterfaceBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 69, + }, + "start": Object { + "column": 10, + "line": 69, + }, + }, + "name": "X", + "range": Array [ + 957, + 958, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 69, + }, + "start": Object { + "column": 0, + "line": 69, + }, + }, + "range": Array [ + 947, + 961, + ], + "type": "TSInterfaceDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 71, + }, + "start": Object { + "column": 9, + "line": 71, + }, + }, + "name": "a", + "range": Array [ + 994, + 995, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 2, + "line": 71, + }, + }, + "range": Array [ + 987, + 1000, + ], + "static": true, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 13, + "line": 71, + }, + }, + "range": Array [ + 998, + 1000, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 10, + "line": 71, + }, + }, + "params": Array [], + "range": Array [ + 995, + 1000, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "private", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 72, + }, + "start": Object { + "column": 10, + "line": 72, + }, + }, + "name": "b", + "range": Array [ + 1011, + 1012, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 2, + "line": 72, + }, + }, + "range": Array [ + 1003, + 1017, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 14, + "line": 72, + }, + }, + "range": Array [ + 1015, + 1017, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 11, + "line": 72, + }, + }, + "params": Array [], + "range": Array [ + 1012, + 1017, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "public", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 73, + }, + "start": Object { + "column": 9, + "line": 73, + }, + }, + "name": "c", + "range": Array [ + 1027, + 1028, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 2, + "line": 73, + }, + }, + "range": Array [ + 1020, + 1033, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 13, + "line": 73, + }, + }, + "range": Array [ + 1031, + 1033, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 10, + "line": 73, + }, + }, + "params": Array [], + "range": Array [ + 1028, + 1033, + ], + "type": "FunctionExpression", + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 74, + }, + "start": Object { + "column": 13, + "line": 74, + }, + }, + "name": "d", + "range": Array [ + 1047, + 1048, + ], + "type": "Identifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 2, + "line": 74, + }, + }, + "range": Array [ + 1036, + 1075, + ], + "static": false, + "type": "MethodDefinition", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 75, + }, + "start": Object { + "column": 8, + "line": 75, + }, + }, + "name": "x", + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + }, + "init": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 75, + }, + "start": Object { + "column": 12, + "line": 75, + }, + }, + "range": Array [ + 1065, + 1070, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 75, + }, + "start": Object { + "column": 8, + "line": 75, + }, + }, + "range": Array [ + 1061, + 1070, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "let", + "loc": Object { + "end": Object { + "column": 18, + "line": 75, + }, + "start": Object { + "column": 4, + "line": 75, + }, + }, + "range": Array [ + 1057, + 1071, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 17, + "line": 74, + }, + }, + "range": Array [ + 1051, + 1075, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 14, + "line": 74, + }, + }, + "params": Array [], + "range": Array [ + 1048, + 1075, + ], + "type": "FunctionExpression", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 77, + }, + "start": Object { + "column": 21, + "line": 70, + }, + }, + "range": Array [ + 983, + 1077, + ], + "type": "ClassBody", + }, + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 70, + }, + "start": Object { + "column": 6, + "line": 70, + }, + }, + "name": "C", + "range": Array [ + 968, + 969, + ], + "type": "Identifier", + }, + "implements": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "name": "X", + "range": Array [ + 981, + 982, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "range": Array [ + 981, + 982, + ], + "type": "TSClassImplements", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 77, + }, + "start": Object { + "column": 0, + "line": 70, + }, + }, + "range": Array [ + 962, + 1077, + ], + "superClass": null, + "type": "ClassDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 78, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1078, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 47, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 80, + 85, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 99, + 104, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 118, + 123, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 139, + 144, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 23, + "line": 9, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 164, + 169, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 185, + 190, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 202, + 207, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 221, + 226, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "start": Object { + "column": 11, + "line": 13, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 233, + 234, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "range": Array [ + 237, + 242, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 251, + 252, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 252, + 253, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 256, + 261, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 15, + "line": 15, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 18, + "line": 15, + }, + }, + "range": Array [ + 272, + 273, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 276, + 281, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 16, + }, + "start": Object { + "column": 18, + "line": 16, + }, + }, + "range": Array [ + 292, + 293, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 20, + "line": 16, + }, + }, + "range": Array [ + 294, + 295, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 16, + }, + "start": Object { + "column": 21, + "line": 16, + }, + }, + "range": Array [ + 295, + 296, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 299, + 304, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 17, + }, + "start": Object { + "column": 14, + "line": 17, + }, + }, + "range": Array [ + 311, + 312, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 313, + 314, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "range": Array [ + 314, + 315, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 18, + }, + "start": Object { + "column": 2, + "line": 18, + }, + }, + "range": Array [ + 318, + 323, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 18, + }, + "start": Object { + "column": 17, + "line": 18, + }, + }, + "range": Array [ + 333, + 334, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 335, + 336, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 18, + }, + "start": Object { + "column": 20, + "line": 18, + }, + }, + "range": Array [ + 336, + 337, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 19, + }, + "start": Object { + "column": 2, + "line": 19, + }, + }, + "range": Array [ + 340, + 345, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 19, + }, + "start": Object { + "column": 16, + "line": 19, + }, + }, + "range": Array [ + 354, + 355, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 18, + "line": 19, + }, + }, + "range": Array [ + 356, + 357, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 19, + }, + "start": Object { + "column": 19, + "line": 19, + }, + }, + "range": Array [ + 357, + 358, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 20, + }, + }, + "range": Array [ + 361, + 366, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "start": Object { + "column": 15, + "line": 20, + }, + }, + "range": Array [ + 374, + 375, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 17, + "line": 20, + }, + }, + "range": Array [ + 376, + 377, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 377, + 378, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 21, + }, + "start": Object { + "column": 2, + "line": 21, + }, + }, + "range": Array [ + 381, + 386, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 21, + }, + "start": Object { + "column": 15, + "line": 21, + }, + }, + "range": Array [ + 394, + 395, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 17, + "line": 21, + }, + }, + "range": Array [ + 396, + 397, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 397, + 398, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 22, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "range": Array [ + 401, + 406, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 22, + }, + "start": Object { + "column": 12, + "line": 22, + }, + }, + "range": Array [ + 411, + 412, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 14, + "line": 22, + }, + }, + "range": Array [ + 413, + 414, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 22, + }, + "start": Object { + "column": 15, + "line": 22, + }, + }, + "range": Array [ + 414, + 415, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 23, + }, + "start": Object { + "column": 2, + "line": 23, + }, + }, + "range": Array [ + 418, + 423, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 23, + }, + "start": Object { + "column": 15, + "line": 23, + }, + }, + "range": Array [ + 431, + 432, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 433, + 434, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 23, + }, + "start": Object { + "column": 18, + "line": 23, + }, + }, + "range": Array [ + 434, + 435, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 438, + 443, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 24, + }, + "start": Object { + "column": 15, + "line": 24, + }, + }, + "range": Array [ + 451, + 452, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 24, + }, + }, + "range": Array [ + 453, + 454, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 24, + }, + "start": Object { + "column": 18, + "line": 24, + }, + }, + "range": Array [ + 454, + 455, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 25, + }, + "start": Object { + "column": 2, + "line": 25, + }, + }, + "range": Array [ + 458, + 463, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 25, + }, + "start": Object { + "column": 13, + "line": 25, + }, + }, + "range": Array [ + 469, + 470, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 15, + "line": 25, + }, + }, + "range": Array [ + 471, + 472, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 25, + }, + "start": Object { + "column": 16, + "line": 25, + }, + }, + "range": Array [ + 472, + 473, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 26, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "range": Array [ + 476, + 481, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 26, + }, + "start": Object { + "column": 18, + "line": 26, + }, + }, + "range": Array [ + 492, + 493, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 494, + 495, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 26, + }, + "start": Object { + "column": 21, + "line": 26, + }, + }, + "range": Array [ + 495, + 496, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 27, + }, + "start": Object { + "column": 2, + "line": 27, + }, + }, + "range": Array [ + 499, + 504, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 27, + }, + "start": Object { + "column": 15, + "line": 27, + }, + }, + "range": Array [ + 512, + 513, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 17, + "line": 27, + }, + }, + "range": Array [ + 514, + 515, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 27, + }, + "start": Object { + "column": 18, + "line": 27, + }, + }, + "range": Array [ + 515, + 516, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 28, + }, + }, + "range": Array [ + 519, + 524, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + "value": "unknown", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 28, + }, + "start": Object { + "column": 16, + "line": 28, + }, + }, + "range": Array [ + 533, + 534, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 18, + "line": 28, + }, + }, + "range": Array [ + 535, + 536, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 28, + }, + "start": Object { + "column": 19, + "line": 28, + }, + }, + "range": Array [ + 536, + 537, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 29, + }, + "start": Object { + "column": 2, + "line": 29, + }, + }, + "range": Array [ + 540, + 545, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 29, + }, + "start": Object { + "column": 13, + "line": 29, + }, + }, + "range": Array [ + 551, + 552, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 15, + "line": 29, + }, + }, + "range": Array [ + 553, + 554, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 29, + }, + "start": Object { + "column": 16, + "line": 29, + }, + }, + "range": Array [ + 554, + 555, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 30, + }, + "start": Object { + "column": 2, + "line": 30, + }, + }, + "range": Array [ + 558, + 563, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 30, + }, + "start": Object { + "column": 15, + "line": 30, + }, + }, + "range": Array [ + 571, + 572, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 17, + "line": 30, + }, + }, + "range": Array [ + 573, + 574, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 30, + }, + "start": Object { + "column": 18, + "line": 30, + }, + }, + "range": Array [ + 574, + 575, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 31, + }, + "start": Object { + "column": 2, + "line": 31, + }, + }, + "range": Array [ + 578, + 583, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + "value": "bigint", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 31, + }, + "start": Object { + "column": 15, + "line": 31, + }, + }, + "range": Array [ + 591, + 592, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 17, + "line": 31, + }, + }, + "range": Array [ + 593, + 594, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 31, + }, + "start": Object { + "column": 18, + "line": 31, + }, + }, + "range": Array [ + 594, + 595, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 32, + }, + "start": Object { + "column": 2, + "line": 32, + }, + }, + "range": Array [ + 598, + 603, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 32, + }, + "start": Object { + "column": 11, + "line": 32, + }, + }, + "range": Array [ + 607, + 608, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 13, + "line": 32, + }, + }, + "range": Array [ + 609, + 610, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 32, + }, + "start": Object { + "column": 14, + "line": 32, + }, + }, + "range": Array [ + 610, + 611, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "start": Object { + "column": 0, + "line": 33, + }, + }, + "range": Array [ + 612, + 613, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 35, + }, + "start": Object { + "column": 0, + "line": 35, + }, + }, + "range": Array [ + 615, + 621, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 35, + }, + "start": Object { + "column": 7, + "line": 35, + }, + }, + "range": Array [ + 622, + 623, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 36, + }, + "start": Object { + "column": 10, + "line": 36, + }, + }, + "range": Array [ + 634, + 635, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 37, + }, + "start": Object { + "column": 4, + "line": 37, + }, + }, + "range": Array [ + 640, + 641, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 38, + }, + "start": Object { + "column": 9, + "line": 38, + }, + }, + "range": Array [ + 651, + 652, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 39, + }, + "start": Object { + "column": 5, + "line": 39, + }, + }, + "range": Array [ + 658, + 659, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 40, + }, + "start": Object { + "column": 7, + "line": 40, + }, + }, + "range": Array [ + 667, + 668, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 41, + }, + "start": Object { + "column": 7, + "line": 41, + }, + }, + "range": Array [ + 676, + 677, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 42, + }, + "start": Object { + "column": 9, + "line": 42, + }, + }, + "range": Array [ + 687, + 688, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 43, + }, + "start": Object { + "column": 13, + "line": 43, + }, + }, + "range": Array [ + 702, + 703, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 44, + }, + "start": Object { + "column": 9, + "line": 44, + }, + }, + "range": Array [ + 713, + 714, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 45, + }, + "start": Object { + "column": 5, + "line": 45, + }, + }, + "range": Array [ + 720, + 721, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 46, + }, + "start": Object { + "column": 7, + "line": 46, + }, + }, + "range": Array [ + 729, + 730, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 47, + }, + "start": Object { + "column": 4, + "line": 47, + }, + }, + "range": Array [ + 735, + 736, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 48, + }, + "start": Object { + "column": 7, + "line": 48, + }, + }, + "range": Array [ + 744, + 745, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 49, + }, + "start": Object { + "column": 8, + "line": 49, + }, + }, + "range": Array [ + 754, + 755, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 50, + }, + "start": Object { + "column": 11, + "line": 50, + }, + }, + "range": Array [ + 767, + 768, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 51, + }, + "start": Object { + "column": 7, + "line": 51, + }, + }, + "range": Array [ + 776, + 777, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 52, + }, + "start": Object { + "column": 10, + "line": 52, + }, + }, + "range": Array [ + 788, + 789, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 53, + }, + "start": Object { + "column": 9, + "line": 53, + }, + }, + "range": Array [ + 799, + 800, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 54, + }, + "start": Object { + "column": 8, + "line": 54, + }, + }, + "range": Array [ + 809, + 810, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 55, + }, + "start": Object { + "column": 8, + "line": 55, + }, + }, + "range": Array [ + 819, + 820, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 56, + }, + "start": Object { + "column": 5, + "line": 56, + }, + }, + "range": Array [ + 826, + 827, ], + "type": "Punctuator", + "value": ",", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 8, + "line": 57, }, "start": Object { - "column": 0, - "line": 1, + "column": 2, + "line": 57, }, }, "range": Array [ - 0, - 110, + 830, + 836, ], - "type": "BlockStatement", + "type": "Identifier", + "value": "string", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 17, + "column": 9, + "line": 57, }, "start": Object { - "column": 0, - "line": 10, + "column": 8, + "line": 57, }, }, "range": Array [ - 112, - 189, + 836, + 837, ], - "source": Object { - "loc": Object { - "end": Object { - "column": 20, - "line": 17, - }, - "start": Object { - "column": 7, - "line": 17, - }, - }, - "range": Array [ - 175, - 188, - ], - "raw": "'fake-module'", - "type": "Literal", - "value": "fake-module", - }, - "specifiers": Array [ - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "name": "get", - "range": Array [ - 123, - 126, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 11, - }, - "start": Object { - "column": 2, - "line": 11, - }, - }, - "name": "get", - "range": Array [ - 123, - 126, - ], - "type": "Identifier", - }, - "range": Array [ - 123, - 126, - ], - "type": "ImportSpecifier", + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 58, }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "name": "set", - "range": Array [ - 130, - 133, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 5, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 12, - }, - "start": Object { - "column": 2, - "line": 12, - }, - }, - "name": "set", - "range": Array [ - 130, - 133, - ], - "type": "Identifier", - }, - "range": Array [ - 130, - 133, - ], - "type": "ImportSpecifier", + "start": Object { + "column": 2, + "line": 58, }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 13, - }, - "start": Object { - "column": 2, - "line": 13, - }, - }, - "name": "module", - "range": Array [ - 137, - 143, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 8, - "line": 13, - }, - "start": Object { - "column": 2, - "line": 13, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 13, - }, - "start": Object { - "column": 2, - "line": 13, - }, - }, - "name": "module", - "range": Array [ - 137, - 143, - ], - "type": "Identifier", - }, - "range": Array [ - 137, - 143, - ], - "type": "ImportSpecifier", + }, + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 58, }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 14, - }, - "start": Object { - "column": 2, - "line": 14, - }, - }, - "name": "type", - "range": Array [ - 147, - 151, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 6, - "line": 14, - }, - "start": Object { - "column": 2, - "line": 14, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 6, - "line": 14, - }, - "start": Object { - "column": 2, - "line": 14, - }, - }, - "name": "type", - "range": Array [ - 147, - 151, - ], - "type": "Identifier", - }, - "range": Array [ - 147, - 151, - ], - "type": "ImportSpecifier", + "start": Object { + "column": 8, + "line": 58, }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 15, - }, - "start": Object { - "column": 2, - "line": 15, - }, - }, - "name": "async", - "range": Array [ - 155, - 160, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 7, - "line": 15, - }, - "start": Object { - "column": 2, - "line": 15, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 7, - "line": 15, - }, - "start": Object { - "column": 2, - "line": 15, - }, - }, - "name": "async", - "range": Array [ - 155, - 160, - ], - "type": "Identifier", - }, - "range": Array [ - 155, - 160, - ], - "type": "ImportSpecifier", + }, + "range": Array [ + 846, + 847, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 59, }, - Object { - "imported": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 16, - }, - "start": Object { - "column": 2, - "line": 16, - }, - }, - "name": "is", - "range": Array [ - 164, - 166, - ], - "type": "Identifier", - }, - "loc": Object { - "end": Object { - "column": 4, - "line": 16, - }, - "start": Object { - "column": 2, - "line": 16, - }, - }, - "local": Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 16, - }, - "start": Object { - "column": 2, - "line": 16, - }, - }, - "name": "is", - "range": Array [ - 164, - 166, - ], - "type": "Identifier", - }, - "range": Array [ - 164, - 166, - ], - "type": "ImportSpecifier", + "start": Object { + "column": 2, + "line": 59, }, + }, + "range": Array [ + 850, + 854, ], - "type": "ImportDeclaration", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 18, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Identifier", + "value": "type", }, - }, - "range": Array [ - 0, - 190, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 1, - "line": 1, + "column": 7, + "line": 59, }, "start": Object { - "column": 0, - "line": 1, + "column": 6, + "line": 59, }, }, "range": Array [ - 0, - 1, + 854, + 855, ], "type": "Punctuator", - "value": "{", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 2, + "column": 11, + "line": 60, }, "start": Object { "column": 2, - "line": 2, + "line": 60, }, }, "range": Array [ - 4, - 9, + 858, + 867, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "undefined", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 2, + "column": 12, + "line": 60, }, "start": Object { + "column": 11, + "line": 60, + }, + }, + "range": Array [ + 867, + 868, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { "column": 8, - "line": 2, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, }, }, "range": Array [ - 10, - 13, + 871, + 877, ], "type": "Identifier", - "value": "get", + "value": "unique", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 2, + "column": 9, + "line": 61, }, "start": Object { - "column": 12, - "line": 2, + "column": 8, + "line": 61, }, }, "range": Array [ - 14, - 15, + 877, + 878, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 2, + "column": 9, + "line": 62, }, "start": Object { - "column": 14, - "line": 2, + "column": 2, + "line": 62, }, }, "range": Array [ - 16, - 17, + 881, + 888, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "unknown", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 2, + "column": 10, + "line": 62, }, "start": Object { - "column": 15, - "line": 2, + "column": 9, + "line": 62, }, }, "range": Array [ - 17, - 18, + 888, + 889, ], "type": "Punctuator", - "value": ";", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 3, + "column": 6, + "line": 63, }, "start": Object { "column": 2, - "line": 3, + "line": 63, }, }, "range": Array [ - 21, - 26, + 892, + 896, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 11, - "line": 3, + "column": 7, + "line": 63, }, "start": Object { + "column": 6, + "line": 63, + }, + }, + "range": Array [ + 896, + 897, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { "column": 8, - "line": 3, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, }, }, "range": Array [ - 27, - 30, + 900, + 906, ], "type": "Identifier", - "value": "set", + "value": "global", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 9, + "line": 64, }, "start": Object { - "column": 12, - "line": 3, + "column": 8, + "line": 64, }, }, "range": Array [ - 31, - 32, + 906, + 907, ], "type": "Punctuator", - "value": "=", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 8, + "line": 65, }, "start": Object { - "column": 14, - "line": 3, + "column": 2, + "line": 65, }, }, "range": Array [ - 33, - 34, + 910, + 916, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "bigint", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 3, + "column": 9, + "line": 65, }, "start": Object { - "column": 15, - "line": 3, + "column": 8, + "line": 65, }, }, "range": Array [ - 34, - 35, + 916, + 917, ], "type": "Punctuator", - "value": ";", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 4, + "column": 4, + "line": 66, }, "start": Object { "column": 2, - "line": 4, + "line": 66, }, }, "range": Array [ - 38, - 43, + 920, + 922, ], - "type": "Keyword", - "value": "const", + "type": "Identifier", + "value": "of", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 4, + "column": 5, + "line": 66, }, "start": Object { - "column": 8, - "line": 4, + "column": 4, + "line": 66, }, }, "range": Array [ - 44, - 50, + 922, + 923, ], - "type": "Identifier", - "value": "module", + "type": "Punctuator", + "value": ",", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 4, + "column": 1, + "line": 67, }, "start": Object { - "column": 15, - "line": 4, + "column": 0, + "line": 67, }, }, "range": Array [ - 51, - 52, + 924, + 925, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 4, + "column": 6, + "line": 67, }, "start": Object { - "column": 17, - "line": 4, + "column": 2, + "line": 67, }, }, "range": Array [ - 53, - 54, + 926, + 930, ], - "type": "Numeric", - "value": "1", + "type": "Identifier", + "value": "from", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 4, + "column": 20, + "line": 67, }, "start": Object { - "column": 18, - "line": 4, + "column": 7, + "line": 67, }, }, "range": Array [ - 54, - 55, + 931, + 944, + ], + "type": "String", + "value": "'fake-module'", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 67, + }, + "start": Object { + "column": 20, + "line": 67, + }, + }, + "range": Array [ + 944, + 945, ], "type": "Punctuator", "value": ";", @@ -66065,287 +73537,377 @@ Object { Object { "loc": Object { "end": Object { - "column": 7, - "line": 5, + "column": 9, + "line": 69, }, "start": Object { - "column": 2, - "line": 5, + "column": 0, + "line": 69, }, }, "range": Array [ - 58, - 63, + 947, + 956, ], "type": "Keyword", - "value": "const", + "value": "interface", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 5, + "column": 11, + "line": 69, }, "start": Object { - "column": 8, - "line": 5, + "column": 10, + "line": 69, }, }, "range": Array [ - 64, - 68, + 957, + 958, ], "type": "Identifier", - "value": "type", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 69, + }, + "start": Object { + "column": 12, + "line": 69, + }, + }, + "range": Array [ + 959, + 960, + ], + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 5, + "line": 69, }, "start": Object { "column": 13, - "line": 5, + "line": 69, }, }, "range": Array [ - 69, - 70, + 960, + 961, ], "type": "Punctuator", - "value": "=", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 5, + "column": 5, + "line": 70, }, "start": Object { - "column": 15, - "line": 5, + "column": 0, + "line": 70, }, }, "range": Array [ - 71, - 72, + 962, + 967, ], - "type": "Numeric", - "value": "1", + "type": "Keyword", + "value": "class", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 5, + "column": 7, + "line": 70, }, "start": Object { - "column": 16, - "line": 5, + "column": 6, + "line": 70, }, }, "range": Array [ - 72, - 73, + 968, + 969, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 70, + }, + "start": Object { + "column": 8, + "line": 70, + }, + }, + "range": Array [ + 970, + 980, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "range": Array [ + 981, + 982, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 70, + }, + "start": Object { + "column": 21, + "line": 70, + }, + }, + "range": Array [ + 983, + 984, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 6, + "column": 8, + "line": 71, }, "start": Object { "column": 2, - "line": 6, + "line": 71, }, }, "range": Array [ - 76, - 81, + 987, + 993, ], "type": "Keyword", - "value": "const", + "value": "static", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 6, + "column": 10, + "line": 71, }, "start": Object { - "column": 8, - "line": 6, + "column": 9, + "line": 71, }, }, "range": Array [ - 82, - 87, + 994, + 995, ], "type": "Identifier", - "value": "async", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 11, + "line": 71, }, "start": Object { - "column": 14, - "line": 6, + "column": 10, + "line": 71, }, }, "range": Array [ - 88, - 89, + 995, + 996, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 6, + "column": 12, + "line": 71, }, "start": Object { - "column": 16, - "line": 6, + "column": 11, + "line": 71, }, }, "range": Array [ - 90, - 91, + 996, + 997, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 6, + "column": 14, + "line": 71, }, "start": Object { - "column": 17, - "line": 6, + "column": 13, + "line": 71, }, }, "range": Array [ - 91, - 92, + 998, + 999, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 7, + "column": 15, + "line": 71, + }, + "start": Object { + "column": 14, + "line": 71, + }, + }, + "range": Array [ + 999, + 1000, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 72, }, "start": Object { "column": 2, - "line": 7, + "line": 72, }, }, "range": Array [ - 95, - 100, + 1003, + 1010, ], "type": "Keyword", - "value": "const", + "value": "private", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 11, + "line": 72, }, "start": Object { - "column": 8, - "line": 7, + "column": 10, + "line": 72, }, }, "range": Array [ - 101, - 103, + 1011, + 1012, ], "type": "Identifier", - "value": "is", + "value": "b", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 7, + "line": 72, }, "start": Object { "column": 11, - "line": 7, + "line": 72, }, }, "range": Array [ - 104, - 105, + 1012, + 1013, ], "type": "Punctuator", - "value": "=", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 13, + "line": 72, }, "start": Object { - "column": 13, - "line": 7, + "column": 12, + "line": 72, }, }, "range": Array [ - 106, - 107, + 1013, + 1014, ], - "type": "Numeric", - "value": "1", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { "column": 15, - "line": 7, + "line": 72, }, "start": Object { "column": 14, - "line": 7, + "line": 72, }, }, "range": Array [ - 107, - 108, + 1015, + 1016, ], "type": "Punctuator", - "value": ";", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 8, + "column": 16, + "line": 72, }, "start": Object { - "column": 0, - "line": 8, + "column": 15, + "line": 72, }, }, "range": Array [ - 109, - 110, + 1016, + 1017, ], "type": "Punctuator", "value": "}", @@ -66353,326 +73915,344 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 10, + "column": 8, + "line": 73, }, "start": Object { - "column": 0, - "line": 10, + "column": 2, + "line": 73, }, }, "range": Array [ - 112, - 118, + 1020, + 1026, ], "type": "Keyword", - "value": "import", + "value": "public", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 10, + "column": 10, + "line": 73, }, "start": Object { - "column": 7, - "line": 10, + "column": 9, + "line": 73, }, }, "range": Array [ - 119, - 120, + 1027, + 1028, ], - "type": "Punctuator", - "value": "{", + "type": "Identifier", + "value": "c", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 11, + "line": 73, }, "start": Object { - "column": 2, - "line": 11, + "column": 10, + "line": 73, }, }, "range": Array [ - 123, - 126, + 1028, + 1029, ], - "type": "Identifier", - "value": "get", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 11, + "column": 12, + "line": 73, }, "start": Object { - "column": 5, - "line": 11, + "column": 11, + "line": 73, }, }, "range": Array [ - 126, - 127, + 1029, + 1030, ], "type": "Punctuator", - "value": ",", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 12, + "column": 14, + "line": 73, }, "start": Object { - "column": 2, - "line": 12, + "column": 13, + "line": 73, }, }, "range": Array [ - 130, - 133, + 1031, + 1032, ], - "type": "Identifier", - "value": "set", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 12, + "column": 15, + "line": 73, }, "start": Object { - "column": 5, - "line": 12, + "column": 14, + "line": 73, }, }, "range": Array [ - 133, - 134, + 1032, + 1033, ], "type": "Punctuator", - "value": ",", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 13, + "column": 11, + "line": 74, }, "start": Object { "column": 2, - "line": 13, + "line": 74, }, }, "range": Array [ - 137, - 143, + 1036, + 1045, ], - "type": "Identifier", - "value": "module", + "type": "Keyword", + "value": "protected", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 13, + "column": 13, + "line": 74, }, "start": Object { - "column": 8, - "line": 13, + "column": 12, + "line": 74, }, }, "range": Array [ - 143, - 144, + 1046, + 1047, ], "type": "Punctuator", - "value": ",", + "value": "*", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 14, + "column": 14, + "line": 74, }, "start": Object { - "column": 2, - "line": 14, + "column": 13, + "line": 74, }, }, "range": Array [ - 147, - 151, + 1047, + 1048, ], "type": "Identifier", - "value": "type", + "value": "d", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 14, + "column": 15, + "line": 74, }, "start": Object { - "column": 6, - "line": 14, + "column": 14, + "line": 74, }, }, "range": Array [ - 151, - 152, + 1048, + 1049, ], "type": "Punctuator", - "value": ",", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 15, + "column": 16, + "line": 74, }, "start": Object { - "column": 2, - "line": 15, + "column": 15, + "line": 74, }, }, "range": Array [ - 155, - 160, + 1049, + 1050, ], - "type": "Identifier", - "value": "async", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 15, + "column": 18, + "line": 74, }, "start": Object { - "column": 7, - "line": 15, + "column": 17, + "line": 74, }, }, "range": Array [ - 160, - 161, + 1051, + 1052, ], "type": "Punctuator", - "value": ",", + "value": "{", }, Object { "loc": Object { "end": Object { + "column": 7, + "line": 75, + }, + "start": Object { "column": 4, - "line": 16, + "line": 75, + }, + }, + "range": Array [ + 1057, + 1060, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 75, }, "start": Object { - "column": 2, - "line": 16, + "column": 8, + "line": 75, }, }, "range": Array [ - 164, - 166, + 1061, + 1062, ], "type": "Identifier", - "value": "is", + "value": "x", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 16, + "column": 11, + "line": 75, }, "start": Object { - "column": 4, - "line": 16, + "column": 10, + "line": 75, }, }, "range": Array [ - 166, - 167, + 1063, + 1064, ], "type": "Punctuator", - "value": ",", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 17, + "column": 17, + "line": 75, }, "start": Object { - "column": 0, - "line": 17, + "column": 12, + "line": 75, }, }, "range": Array [ - 168, - 169, + 1065, + 1070, ], - "type": "Punctuator", - "value": "}", + "type": "Keyword", + "value": "yield", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 17, + "column": 18, + "line": 75, }, "start": Object { - "column": 2, - "line": 17, + "column": 17, + "line": 75, }, }, "range": Array [ - 170, - 174, + 1070, + 1071, ], - "type": "Identifier", - "value": "from", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 17, + "column": 3, + "line": 76, }, "start": Object { - "column": 7, - "line": 17, + "column": 2, + "line": 76, }, }, "range": Array [ - 175, - 188, + 1074, + 1075, ], - "type": "String", - "value": "'fake-module'", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 17, + "column": 1, + "line": 77, }, "start": Object { - "column": 20, - "line": 17, + "column": 0, + "line": 77, }, }, "range": Array [ - 188, - 189, + 1076, + 1077, ], "type": "Punctuator", - "value": ";", + "value": "}", }, ], "type": "Program", @@ -139361,7 +146941,7 @@ Object { 8, 14, ], - "type": "Keyword", + "type": "Identifier", "value": "global", }, Object { @@ -139433,7 +147013,7 @@ Object { 36, 42, ], - "type": "Keyword", + "type": "Identifier", "value": "global", }, Object { @@ -139523,7 +147103,7 @@ Object { 74, 80, ], - "type": "Keyword", + "type": "Identifier", "value": "global", }, Object { From 5562ad5ed902102d7c09a7fd47ca4ea7e50d6654 Mon Sep 17 00:00:00 2001 From: Mitya Kononchuk Date: Wed, 22 Jan 2020 02:42:22 +0100 Subject: [PATCH 10/30] fix(eslint-plugin): [explicit-module-boundary-types] false positive for returned fns (#1490) --- .../rules/explicit-module-boundary-types.ts | 17 ++++++ .../explicit-module-boundary-types.test.ts | 53 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts index eeb9d6e39ae8..7871035672f9 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -211,6 +211,7 @@ export default util.createRule({ } function isUnexported(node: TSESTree.Node | undefined): boolean { + let isReturnedValue = false; while (node) { if ( node.type === AST_NODE_TYPES.ExportDefaultDeclaration || @@ -220,6 +221,22 @@ export default util.createRule({ return false; } + if (node.type === AST_NODE_TYPES.ReturnStatement) { + isReturnedValue = true; + } + + if ( + node.type === AST_NODE_TYPES.ArrowFunctionExpression || + node.type === AST_NODE_TYPES.FunctionDeclaration || + node.type === AST_NODE_TYPES.FunctionExpression + ) { + isReturnedValue = false; + } + + if (node.type === AST_NODE_TYPES.BlockStatement && !isReturnedValue) { + return true; + } + node = node.parent; } diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index f67218588d76..c257d60f715d 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -72,6 +72,39 @@ export class Test { { filename: 'test.ts', code: ` +export function test(): void { + nested(); + return; + + function nested() {} +} + `, + }, + { + filename: 'test.ts', + code: ` +export function test(): string { + const nested = () => 'value'; + return nested(); +} + `, + }, + { + filename: 'test.ts', + code: ` +export function test(): string { + class Nested { + public method() { + return 'value'; + } + } + return new Nested().method(); +} + `, + }, + { + filename: 'test.ts', + code: ` export var arrowFn: Foo = () => 'test'; `, options: [ @@ -452,6 +485,26 @@ export class Foo { }, ], }, + { + filename: 'test.ts', + code: 'export default () => true ? (() => {}) : ((): void => {});', + errors: [ + { + messageId: 'missingReturnType', + line: 1, + endLine: 1, + column: 16, + endColumn: 21, + }, + { + messageId: 'missingReturnType', + line: 1, + endLine: 1, + column: 30, + endColumn: 35, + }, + ], + }, { filename: 'test.ts', code: "export var arrowFn = () => 'test';", From b5730e02feaec3b66b6e6289ad09d4deadb45592 Mon Sep 17 00:00:00 2001 From: vages Date: Wed, 22 Jan 2020 17:08:47 +0000 Subject: [PATCH 11/30] docs: fix outdated statement in readme (#1494) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e9908954227..c71797e98bab 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ TSLint is a fantastic tool. It is a linter that was written specifically to work One advantage is there is no tooling required to reconcile differences between AST formats, but the major disadvantage is that the tool is therefore unable to reuse any of the previous work which has been done in the JavaScript ecosystem around linting, and it has to reimplement everything from scratch. Everything from rules to auto-fixing capabilities and more. -Palantir, the backers behind TSLint announced earlier this year that **they would be deprecating TSLint in favor of supporting `typescript-eslint`** in order to benefit the community. You can read more about that here: https://medium.com/palantir/tslint-in-2019-1a144c2317a9 +Palantir, the backers behind TSLint announced in 2019 that **they would be deprecating TSLint in favor of supporting `typescript-eslint`** in order to benefit the community. You can read more about that here: https://medium.com/palantir/tslint-in-2019-1a144c2317a9 The TypeScript Team themselves also announced their plans to move the TypeScript codebase from TSLint to `typescript-eslint`, and they have been big supporters of this project. More details at https://github.com/microsoft/TypeScript/issues/30553 From 1fd86befa6a940a0354c619dd2da08a5c5d69fb4 Mon Sep 17 00:00:00 2001 From: Alexander T Date: Thu, 23 Jan 2020 18:32:41 +0200 Subject: [PATCH 12/30] feat(eslint-plugin): add comma-spacing (#1495) --- packages/eslint-plugin/README.md | 1 + .../eslint-plugin/docs/rules/comma-spacing.md | 22 + packages/eslint-plugin/src/configs/all.json | 2 + .../eslint-plugin/src/rules/comma-spacing.ts | 190 +++++ packages/eslint-plugin/src/rules/index.ts | 2 + packages/eslint-plugin/src/util/astUtils.ts | 4 +- .../tests/rules/comma-spacing.test.ts | 785 ++++++++++++++++++ 7 files changed, 1004 insertions(+), 2 deletions(-) create mode 100644 packages/eslint-plugin/docs/rules/comma-spacing.md create mode 100644 packages/eslint-plugin/src/rules/comma-spacing.ts create mode 100644 packages/eslint-plugin/tests/rules/comma-spacing.test.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index fa34718fc4c7..91eaf17711e4 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -169,6 +169,7 @@ In these cases, we create what we call an extension rule; a rule within our plug | Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | | [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | +| [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | | [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | | [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | | [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | diff --git a/packages/eslint-plugin/docs/rules/comma-spacing.md b/packages/eslint-plugin/docs/rules/comma-spacing.md new file mode 100644 index 000000000000..145e3607726c --- /dev/null +++ b/packages/eslint-plugin/docs/rules/comma-spacing.md @@ -0,0 +1,22 @@ +# Enforces consistent spacing before and after commas (`comma-spacing`) + +## Rule Details + +This rule extends the base [`eslint/comma-spacing`](https://eslint.org/docs/rules/comma-spacing) rule. +It adds support for trailing comma in a types parameters list. + +## How to use + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "comma-spacing": "off", + "@typescript-eslint/comma-spacing": ["error"] +} +``` + +## Options + +See [`eslint/comma-spacing` options](https://eslint.org/docs/rules/comma-spacing#options). + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/comma-spacing.md) diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 916d9a0238f4..e4b69b7764cd 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -8,6 +8,8 @@ "@typescript-eslint/ban-types": "error", "brace-style": "off", "@typescript-eslint/brace-style": "error", + "comma-spacing": "off", + "@typescript-eslint/comma-spacing": "error", "@typescript-eslint/consistent-type-assertions": "error", "@typescript-eslint/consistent-type-definitions": "error", "default-param-last": "off", diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts new file mode 100644 index 000000000000..0651142efcbe --- /dev/null +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -0,0 +1,190 @@ +import { + TSESTree, + AST_TOKEN_TYPES, +} from '@typescript-eslint/experimental-utils'; +import { isClosingParenToken, isCommaToken } from 'eslint-utils'; +import { isTokenOnSameLine, createRule } from '../util'; + +type Options = [ + { + before: boolean; + after: boolean; + }, +]; +type MessageIds = 'unexpected' | 'missing'; + +export default createRule({ + name: 'comma-spacing', + meta: { + type: 'suggestion', + docs: { + description: 'Enforces consistent spacing before and after commas', + category: 'Stylistic Issues', + recommended: false, + extendsBaseRule: true, + }, + fixable: 'whitespace', + schema: [ + { + type: 'object', + properties: { + before: { + type: 'boolean', + default: false, + }, + after: { + type: 'boolean', + default: true, + }, + }, + additionalProperties: false, + }, + ], + messages: { + unexpected: `There should be no space {{loc}} ','.`, + missing: `A space is required {{loc}} ','.`, + }, + }, + defaultOptions: [ + { + before: false, + after: true, + }, + ], + create(context, [{ before: spaceBefore, after: spaceAfter }]) { + const sourceCode = context.getSourceCode(); + const tokensAndComments = sourceCode.tokensAndComments; + const ignoredTokens = new Set(); + + /** + * Adds null elements of the ArrayExpression or ArrayPattern node to the ignore list + * @param node node to evaluate + */ + function addNullElementsToIgnoreList( + node: TSESTree.ArrayExpression | TSESTree.ArrayPattern, + ): void { + let previousToken = sourceCode.getFirstToken(node); + for (const element of node.elements) { + let token: TSESTree.Token | null; + if (element === null) { + token = sourceCode.getTokenAfter(previousToken as TSESTree.Token); + if (token && isCommaToken(token)) { + ignoredTokens.add(token); + } + } else { + token = sourceCode.getTokenAfter(element); + } + + previousToken = token; + } + } + + /** + * Adds type parameters trailing comma token to the ignore list + * @param node node to evaluate + */ + function addTypeParametersTrailingCommaToIgnoreList( + node: TSESTree.TSTypeParameterDeclaration, + ): void { + const param = node.params[node.params.length - 1]; + const afterToken = sourceCode.getTokenAfter(param); + if (afterToken && isCommaToken(afterToken)) { + ignoredTokens.add(afterToken); + } + } + + /** + * Validates the spacing around a comma token. + * @param commaToken The token representing the comma + * @param prevToken The last token before the comma + * @param nextToken The first token after the comma + */ + function validateCommaSpacing( + commaToken: TSESTree.Token, + prevToken: TSESTree.Token | null, + nextToken: TSESTree.Token | null, + ): void { + if ( + prevToken && + isTokenOnSameLine(prevToken, commaToken) && + spaceBefore !== sourceCode.isSpaceBetween(prevToken, commaToken) + ) { + context.report({ + node: commaToken, + data: { + loc: 'before', + }, + messageId: spaceBefore ? 'missing' : 'unexpected', + fix: fixer => + spaceBefore + ? fixer.insertTextBefore(commaToken, ' ') + : fixer.replaceTextRange( + [prevToken.range[1], commaToken.range[0]], + '', + ), + }); + } + + if (nextToken && isClosingParenToken(nextToken)) { + return; + } + + if (!spaceAfter && nextToken && nextToken.type === AST_TOKEN_TYPES.Line) { + return; + } + + if ( + nextToken && + isTokenOnSameLine(commaToken, nextToken) && + spaceAfter !== sourceCode.isSpaceBetween(commaToken, nextToken) + ) { + context.report({ + node: commaToken, + data: { + loc: 'after', + }, + messageId: spaceAfter ? 'missing' : 'unexpected', + fix: fixer => + spaceAfter + ? fixer.insertTextAfter(commaToken, ' ') + : fixer.replaceTextRange( + [commaToken.range[1], nextToken.range[0]], + '', + ), + }); + } + } + + return { + TSTypeParameterDeclaration: addTypeParametersTrailingCommaToIgnoreList, + ArrayExpression: addNullElementsToIgnoreList, + ArrayPattern: addNullElementsToIgnoreList, + + 'Program:exit'(): void { + tokensAndComments.forEach((token, i) => { + if (!isCommaToken(token)) { + return; + } + + if (token.type === AST_TOKEN_TYPES.JSXText) { + return; + } + + const commaToken = token as TSESTree.Token; + const prevToken = tokensAndComments[i - 1] as TSESTree.Token; + const nextToken = tokensAndComments[i + 1] as TSESTree.Token; + + validateCommaSpacing( + commaToken, + isCommaToken(prevToken) || ignoredTokens.has(commaToken) + ? null + : prevToken, + isCommaToken(nextToken) || ignoredTokens.has(commaToken) + ? null + : nextToken, + ); + }); + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index 2079ccc4e401..abaa31db3b37 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -7,6 +7,7 @@ import banTypes from './ban-types'; import braceStyle from './brace-style'; import camelcase from './camelcase'; import classNameCasing from './class-name-casing'; +import commaSpacing from './comma-spacing'; import consistentTypeAssertions from './consistent-type-assertions'; import consistentTypeDefinitions from './consistent-type-definitions'; import defaultParamLast from './default-param-last'; @@ -92,6 +93,7 @@ export default { 'brace-style': braceStyle, camelcase: camelcase, 'class-name-casing': classNameCasing, + 'comma-spacing': commaSpacing, 'consistent-type-assertions': consistentTypeAssertions, 'consistent-type-definitions': consistentTypeDefinitions, 'default-param-last': defaultParamLast, diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 3b54d5a61ca0..060165a28edc 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -55,8 +55,8 @@ function isLogicalOrOperator(node: TSESTree.Node): boolean { * Determines whether two adjacent tokens are on the same line */ function isTokenOnSameLine( - left: TSESTree.Token, - right: TSESTree.Token, + left: TSESTree.Token | TSESTree.Comment, + right: TSESTree.Token | TSESTree.Comment, ): boolean { return left.loc.end.line === right.loc.start.line; } diff --git a/packages/eslint-plugin/tests/rules/comma-spacing.test.ts b/packages/eslint-plugin/tests/rules/comma-spacing.test.ts new file mode 100644 index 000000000000..12a6e0219f8c --- /dev/null +++ b/packages/eslint-plugin/tests/rules/comma-spacing.test.ts @@ -0,0 +1,785 @@ +import rule from '../../src/rules/comma-spacing'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('comma-spacing', rule, { + valid: [ + `foo(1, true/* comment */, 'text');`, + `foo(1, true /* comment */, 'text');`, + `foo(1, true/* comment *//* comment */, 'text');`, + `foo(1, true/* comment */ /* comment */, 'text');`, + `foo(1, true, /* comment */ 'text');`, + `foo(1, // comment\n true, /* comment */ 'text');`, + { + code: `foo(1, // comment\n true,/* comment */ 'text');`, + options: [{ before: false, after: false }], + }, + `const a = 1, b = 2;`, + `const foo = [, ];`, + `const foo = [1, ];`, + `const foo = [, 2];`, + `const foo = [1, 2];`, + `const foo = [, , ];`, + `const foo = [1, , ];`, + `const foo = [, 2, ];`, + `const foo = [, , 3];`, + `const foo = [1, 2, ];`, + `const foo = [, 2, 3];`, + `const foo = [1, , 3];`, + `const foo = [1, 2, 3];`, + `const foo = {'foo':'foo', 'baz':'baz'};`, + `const foo = {'foo':'foo', 'baz':\n'baz'};`, + `const foo = {'foo':\n'foo', 'baz':\n'baz'};`, + `function foo(a, b){}`, + `function foo(a, b = 1){}`, + `function foo(a = 1, b, c){}`, + `const foo = (a, b) => {}`, + `const foo = (a=1, b) => {}`, + `const foo = a => a + 2`, + `a, b`, + `const a = (1 + 2, 2)`, + `a(b, c)`, + `new A(b, c)`, + `foo((a), b)`, + `const b = ((1 + 2), 2)`, + `parseInt((a + b), 10)`, + `go.boom((a + b), 10)`, + `go.boom((a + b), 10, (4))`, + `const x = [ (a + c), (b + b) ]`, + `[' , ']`, + '[` , `]', + '`${[1, 2]}`', + `fn(a, b,)`, + `const fn = (a, b,) => {}`, + `const fn = function (a, b,) {}`, + `foo(/,/, 'a')`, + `const x = ',,,,,';`, + `const code = 'var foo = 1, bar = 3;'`, + `['apples', \n 'oranges'];`, + `{x: 'var x,y,z'}`, + { + code: `const foo = {'foo':\n'bar' ,'baz':\n'qur'};`, + options: [{ before: true, after: false }], + }, + { + code: `const a = 1 ,b = 2;`, + options: [{ before: true, after: false }], + }, + { + code: `function foo(a ,b){}`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 ,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [ ,2];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 ,2];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [,,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 , ,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [ ,2 ,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [ , ,3];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 ,2 ,];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [ ,2 ,3];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 , ,3];`, + options: [{ before: true, after: false }], + }, + { + code: `const arr = [1 ,2 ,3];`, + options: [{ before: true, after: false }], + }, + { + code: `const obj = {'foo':'bar' , 'baz':'qur'};`, + options: [{ before: true, after: true }], + }, + { + code: `const a = 1 , b = 2;`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [, ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [ , 2];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , 2];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [, , ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , , ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [ , 2 , ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [ , , 3];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , 2 , ];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [, 2 , 3];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , , 3];`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [1 , 2 , 3];`, + options: [{ before: true, after: true }], + }, + { + code: `a , b`, + options: [{ before: true, after: true }], + }, + { + code: `const arr = [,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [ ,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [,2];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [ ,2];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,2];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [,,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [ ,,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [,2,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [ ,2,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [,,3];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,2,];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [,2,3];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,,3];`, + options: [{ before: false, after: false }], + }, + { + code: `const arr = [1,2,3];`, + options: [{ before: false, after: false }], + }, + { + code: `const a = (1 + 2,2)`, + options: [{ before: false, after: false }], + }, + 'const a; console.log(`${a}`, "a");', + `const [a, b] = [1, 2];`, + `const [a, b, ] = [1, 2];`, + `const [a, , b] = [1, 2, 3];`, + `const [ , b] = a;`, + `const [, b] = a;`, + { + code: `,`, + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + }, + { + code: ` , `, + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + }, + { + code: `Hello, world`, + options: [{ before: true, after: false }], + parserOptions: { ecmaFeatures: { jsx: true } }, + }, + `const Foo = (foo: T) => {}`, + `function foo() {}`, + `class Foo {}`, + `interface Foo{}`, + ], + + invalid: [ + { + code: `a(b,c)`, + output: `a(b , c)`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 4, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 4, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `new A(b,c)`, + output: `new A(b , c)`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 8, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 8, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const a = 1 ,b = 2;`, + output: `const a = 1, b = 2;`, + errors: [ + { + messageId: 'unexpected', + column: 13, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 13, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1 , 2];`, + output: `const arr = [1, 2];`, + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: 'const arr = [1 , ];', + output: 'const arr = [1, ];', + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `const arr = [1 , ];`, + output: `const arr = [1 ,];`, + options: [{ before: true, after: false }], + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1 ,2];`, + output: `const arr = [1, 2];`, + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: `missing`, + column: 16, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [(1) , 2];`, + output: `const arr = [(1), 2];`, + errors: [ + { + messageId: 'unexpected', + column: 18, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `const arr = [1, 2];`, + output: `const arr = [1 ,2];`, + options: [{ before: true, after: false }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'unexpected', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1\n , 2];`, + output: `const arr = [1\n ,2];`, + options: [{ before: false, after: false }], + errors: [ + { + messageId: 'unexpected', + column: 3, + line: 2, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1,\n 2];`, + output: `const arr = [1 ,\n 2];`, + options: [{ before: true, after: false }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `const obj = {'foo':\n'bar', 'baz':\n'qur'};`, + output: `const obj = {'foo':\n'bar' ,'baz':\n'qur'};`, + options: [{ before: true, after: false }], + errors: [ + { + messageId: 'missing', + column: 6, + line: 2, + data: { loc: 'before' }, + }, + { + messageId: 'unexpected', + column: 6, + line: 2, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const obj = {a: 1\n ,b: 2};`, + output: `const obj = {a: 1\n , b: 2};`, + options: [{ before: false, after: true }], + errors: [ + { + messageId: 'missing', + column: 3, + line: 2, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const obj = {a: 1 ,\n b: 2};`, + output: `const obj = {a: 1,\n b: 2};`, + options: [{ before: false, after: false }], + errors: [ + { + messageId: 'unexpected', + column: 19, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `const arr = [1 ,2];`, + output: `const arr = [1 , 2];`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 16, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1,2];`, + output: `const arr = [1 , 2];`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const obj = {'foo':\n'bar','baz':\n'qur'};`, + output: `const obj = {'foo':\n'bar' , 'baz':\n'qur'};`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 6, + line: 2, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 6, + line: 2, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const arr = [1 , 2];`, + output: `const arr = [1,2];`, + options: [{ before: false, after: false }], + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `a ,b`, + output: `a, b`, + options: [{ before: false, after: true }], + errors: [ + { + messageId: 'unexpected', + column: 3, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 3, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function foo(a,b){}`, + output: `function foo(a , b){}`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const foo = (a,b) => {}`, + output: `const foo = (a , b) => {}`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `const foo = (a = 1,b) => {}`, + output: `const foo = (a = 1 , b) => {}`, + options: [{ before: true, after: true }], + errors: [ + { + messageId: 'missing', + column: 19, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 19, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function foo(a = 1 ,b = 2) {}`, + output: `function foo(a = 1, b = 2) {}`, + options: [{ before: false, after: true }], + errors: [ + { + messageId: 'unexpected', + column: 20, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 20, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `{foo(1 ,2)}`, + output: `{foo(1, 2)}`, + parserOptions: { + ecmaFeatures: { jsx: true }, + }, + errors: [ + { + messageId: 'unexpected', + column: 11, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 11, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `foo(1, true/* comment */ , 'foo');`, + output: `foo(1, true/* comment */, 'foo');`, + errors: [ + { + messageId: 'unexpected', + column: 26, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `foo(1, true,/* comment */ 'foo');`, + output: `foo(1, true, /* comment */ 'foo');`, + errors: [ + { + messageId: 'missing', + column: 12, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `foo(404,// comment\n true, 'hello');`, + output: `foo(404, // comment\n true, 'hello');`, + errors: [ + { + messageId: 'missing', + column: 8, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function Foo() {}`, + output: `function Foo() {}`, + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function Foo() {}`, + output: `function Foo() {}`, + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + { + code: `function Foo() {}`, + output: `function Foo() {}`, + errors: [ + { + messageId: 'unexpected', + column: 16, + line: 1, + data: { loc: 'before' }, + }, + { + messageId: 'missing', + column: 16, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function Foo() {}`, + output: `function Foo() {}`, + options: [{ before: false, after: false }], + errors: [ + { + messageId: 'unexpected', + column: 15, + line: 1, + data: { loc: 'after' }, + }, + ], + }, + { + code: `function Foo() {}`, + output: `function Foo() {}`, + options: [{ before: true, after: false }], + errors: [ + { + messageId: 'missing', + column: 15, + line: 1, + data: { loc: 'before' }, + }, + ], + }, + ], +}); From 101b34af93f09f8f33856448b2927b0ade2f0f47 Mon Sep 17 00:00:00 2001 From: Armano Date: Thu, 23 Jan 2020 18:01:52 +0100 Subject: [PATCH 13/30] chore: upgrade lerna to 3.20 (#1498) --- package.json | 2 +- yarn.lock | 699 +++++++++++++++++++++++++++------------------------ 2 files changed, 370 insertions(+), 331 deletions(-) diff --git a/package.json b/package.json index 6ae87643628a..d4b7c07ac538 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "husky": "^3.0.9", "isomorphic-fetch": "^2.2.1", "jest": "^24.9.0", - "lerna": "^3.18.4", + "lerna": "^3.20.2", "lint-staged": "^9.4.3", "opencollective-postinstall": "^2.0.2", "prettier": "^1.19.1", diff --git a/yarn.lock b/yarn.lock index 40840f1150f3..e4ad700bcc8f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -506,15 +506,15 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" -"@lerna/add@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.18.4.tgz#0d97c75b64febc10a9a38546a3019f0f2c24b0e6" - integrity sha512-R+9RmYrSbcmnmaFL2aB0HJtTq95ePEa0FMS4r4NnA7Xw07l5buVBPOfxv6P8kFrVvIcNpaa7S0Eo/KkbycMhKA== +"@lerna/add@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.20.0.tgz#bea7edf36fc93fb72ec34cb9ba854c48d4abf309" + integrity sha512-AnH1oRIEEg/VDa3SjYq4x1/UglEAvrZuV0WssHUMN81RTZgQk3we+Mv3qZNddrZ/fBcZu2IAdN/EQ3+ie2JxKQ== dependencies: "@evocateur/pacote" "^9.6.3" - "@lerna/bootstrap" "3.18.4" - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" + "@lerna/bootstrap" "3.20.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" @@ -522,20 +522,20 @@ p-map "^2.1.0" semver "^6.2.0" -"@lerna/bootstrap@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.18.4.tgz#b5340800358e4916e9d2ba728d266a23fdd7665c" - integrity sha512-mvqMyionPSqhbeGhoUQYEBTgbJ47LkONHfQ1AKBET0fJOjIZf6x0pWC17KvfCjsiE017325ySLKDH23z1Kb9ww== +"@lerna/bootstrap@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.20.0.tgz#635d71046830f208e851ab429a63da1747589e37" + integrity sha512-Wylullx3uthKE7r4izo09qeRGL20Y5yONlQEjPCfnbxCC2Elu+QcPu4RC6kqKQ7b+g7pdC3OOgcHZjngrwr5XQ== dependencies: - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" "@lerna/has-npm-version" "3.16.5" "@lerna/npm-install" "3.16.5" - "@lerna/package-graph" "3.18.0" + "@lerna/package-graph" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.16.5" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-topologically" "3.18.0" + "@lerna/run-topologically" "3.18.5" "@lerna/symlink-binary" "3.17.0" "@lerna/symlink-dependencies" "3.17.0" "@lerna/validation-error" "3.13.0" @@ -551,14 +551,14 @@ read-package-tree "^5.1.6" semver "^6.2.0" -"@lerna/changed@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.18.4.tgz#2453ad7b3545554eaa365347a229042918b6decc" - integrity sha512-Ui4UsneDk9gCuJRfTpR5js+Ctt9Je+j+3Q4z7H7HhBn6WeWDTp6FBGJZ7SfrBCdQ47EKK27Mr95LbJ4I77xFfQ== +"@lerna/changed@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.20.0.tgz#66b97ebd6c8f8d207152ee524a0791846a9097ae" + integrity sha512-+hzMFSldbRPulZ0vbKk6RD9f36gaH3Osjx34wrrZ62VB4pKmjyuS/rxVYkCA3viPLHoiIw2F8zHM5BdYoDSbjw== dependencies: - "@lerna/collect-updates" "3.18.0" - "@lerna/command" "3.18.0" - "@lerna/listable" "3.18.4" + "@lerna/collect-updates" "3.20.0" + "@lerna/command" "3.18.5" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" "@lerna/check-working-tree@3.16.5": @@ -579,29 +579,29 @@ execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.18.4.tgz#704b345dfec4610823d6670e37f9984196d58874" - integrity sha512-puuL0sBHIv3Tvq8cdu3kCGfRpdsXuaDGIRha33GVmRPfMBi2GN8nPPysVyWmP99PfgfafO6eT5R3jqXjvASAZA== +"@lerna/clean@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.20.0.tgz#ba777e373ddeae63e57860df75d47a9e5264c5b2" + integrity sha512-9ZdYrrjQvR5wNXmHfDsfjWjp0foOkCwKe3hrckTzkAeQA1ibyz5llGwz5e1AeFrV12e2/OLajVqYfe+qdkZUgg== dependencies: - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" - "@lerna/prompt" "3.13.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/rimraf-dir" "3.16.5" p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" -"@lerna/cli@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.18.0.tgz#2b6f8605bee299c6ada65bc2e4b3ed7bf715af3a" - integrity sha512-AwDyfGx7fxJgeaZllEuyJ9LZ6Tdv9yqRD9RX762yCJu+PCAFvB9bp6OYuRSGli7QQgM0CuOYnSg4xVNOmuGKDA== +"@lerna/cli@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/cli/-/cli-3.18.5.tgz#c90c461542fcd35b6d5b015a290fb0dbfb41d242" + integrity sha512-erkbxkj9jfc89vVs/jBLY/fM0I80oLmJkFUV3Q3wk9J3miYhP14zgVEBsPZY68IZlEjT6T3Xlq2xO1AVaatHsA== dependencies: "@lerna/global-options" "3.13.0" dedent "^0.7.0" npmlog "^4.1.2" - yargs "^14.2.0" + yargs "^14.2.2" "@lerna/collect-uncommitted@3.16.5": version "3.16.5" @@ -613,10 +613,10 @@ figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.18.0.tgz#6086c64df3244993cc0a7f8fc0ddd6a0103008a6" - integrity sha512-LJMKgWsE/var1RSvpKDIxS8eJ7POADEc0HM3FQiTpEczhP6aZfv9x3wlDjaHpZm9MxJyQilqxZcasRANmRcNgw== +"@lerna/collect-updates@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.20.0.tgz#62f9d76ba21a25b7d9fbf31c02de88744a564bd1" + integrity sha512-qBTVT5g4fupVhBFuY4nI/3FSJtQVcDh7/gEPOpRxoXB/yCSnT38MFHXWl+y4einLciCjt/+0x6/4AG80fjay2Q== dependencies: "@lerna/child-process" "3.16.5" "@lerna/describe-ref" "3.16.5" @@ -624,26 +624,26 @@ npmlog "^4.1.2" slash "^2.0.0" -"@lerna/command@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.18.0.tgz#1e40399324a69d26a78969d59cf60e19b2f13fc3" - integrity sha512-JQ0TGzuZc9Ky8xtwtSLywuvmkU8X62NTUT3rMNrUykIkOxBaO+tE0O98u2yo/9BYOeTRji9IsjKZEl5i9Qt0xQ== +"@lerna/command@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.18.5.tgz#14c6d2454adbfd365f8027201523e6c289cd3cd9" + integrity sha512-36EnqR59yaTU4HrR1C9XDFti2jRx0BgpIUBeWn129LZZB8kAB3ov1/dJNa1KcNRKp91DncoKHLY99FZ6zTNpMQ== dependencies: "@lerna/child-process" "3.16.5" - "@lerna/package-graph" "3.18.0" + "@lerna/package-graph" "3.18.5" "@lerna/project" "3.18.0" "@lerna/validation-error" "3.13.0" "@lerna/write-log-file" "3.13.0" + clone-deep "^4.0.1" dedent "^0.7.0" execa "^1.0.0" is-ci "^2.0.0" - lodash "^4.17.14" npmlog "^4.1.2" -"@lerna/conventional-commits@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.16.4.tgz#bf464f11b2f6534dad204db00430e1651b346a04" - integrity sha512-QSZJ0bC9n6FVaf+7KDIq5zMv8WnHXnwhyL5jG1Nyh3SgOg9q2uflqh7YsYB+G6FwaRfnPaKosh6obijpYg0llA== +"@lerna/conventional-commits@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/conventional-commits/-/conventional-commits-3.18.5.tgz#08efd2e5b45acfaf3f151a53a3ec7ecade58a7bc" + integrity sha512-qcvXIEJ3qSgalxXnQ7Yxp5H9Ta5TVyai6vEor6AAEHc20WiO7UIdbLDCxBtiiHMdGdpH85dTYlsoYUwsCJu3HQ== dependencies: "@lerna/validation-error" "3.13.0" conventional-changelog-angular "^5.0.3" @@ -666,14 +666,14 @@ fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.18.0.tgz#78ba4af5eced661944a12b9d7da8553c096c390d" - integrity sha512-y9oS7ND5T13c+cCTJHa2Y9in02ppzyjsNynVWFuS40eIzZ3z058d9+3qSBt1nkbbQlVyfLoP6+bZPsjyzap5ig== +"@lerna/create@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.18.5.tgz#11ac539f069248eaf7bc4c42e237784330f4fc47" + integrity sha512-cHpjocbpKmLopCuZFI7cKEM3E/QY8y+yC7VtZ4FQRSaLU8D8i2xXtXmYaP1GOlVNavji0iwoXjuNpnRMInIr2g== dependencies: "@evocateur/pacote" "^9.6.3" "@lerna/child-process" "3.16.5" - "@lerna/command" "3.18.0" + "@lerna/command" "3.18.5" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" @@ -698,34 +698,35 @@ "@lerna/child-process" "3.16.5" npmlog "^4.1.2" -"@lerna/diff@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.18.0.tgz#9638ff4b46e2a8b0d4ebf54cf2f267ac2f8fdb29" - integrity sha512-3iLNlpurc2nV9k22w8ini2Zjm2UPo3xtQgWyqdA6eJjvge0+5AlNAWfPoV6cV+Hc1xDbJD2YDSFpZPJ1ZGilRw== +"@lerna/diff@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.18.5.tgz#e9e2cb882f84d5b84f0487c612137305f07accbc" + integrity sha512-u90lGs+B8DRA9Z/2xX4YaS3h9X6GbypmGV6ITzx9+1Ga12UWGTVlKaCXBgONMBjzJDzAQOK8qPTwLA57SeBLgA== dependencies: "@lerna/child-process" "3.16.5" - "@lerna/command" "3.18.0" + "@lerna/command" "3.18.5" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.18.4.tgz#7f722abc3c7074dffe6aa48bca71171e0635f84a" - integrity sha512-BpBFxyCQXcfess9Nmj/OwQ9e1IhzPzNxqF5JK7dPIjko5oBn5Hm2EWVAcgUGSHKPZGLiOWPu3Wx/C92NtDBS1w== +"@lerna/exec@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.20.0.tgz#29f0c01aee2340eb46f90706731fef2062a49639" + integrity sha512-pS1mmC7kzV668rHLWuv31ClngqeXjeHC8kJuM+W2D6IpUVMGQHLcCTYLudFgQsuKGVpl0DGNYG+sjLhAPiiu6A== dependencies: "@lerna/child-process" "3.16.5" - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" - "@lerna/run-topologically" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" + "@lerna/profiler" "3.20.0" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" p-map "^2.1.0" -"@lerna/filter-options@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.18.4.tgz#f5476a7ee2169abed27ad433222e92103f56f9f1" - integrity sha512-4giVQD6tauRwweO/322LP2gfVDOVrt/xN4khkXyfkJDfcsZziFXq+668otD9KSLL8Ps+To4Fah3XbK0MoNuEvA== +"@lerna/filter-options@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.20.0.tgz#0f0f5d5a4783856eece4204708cc902cbc8af59b" + integrity sha512-bmcHtvxn7SIl/R9gpiNMVG7yjx7WyT0HSGw34YVZ9B+3xF/83N3r5Rgtjh4hheLZ+Q91Or0Jyu5O3Nr+AwZe2g== dependencies: - "@lerna/collect-updates" "3.18.0" + "@lerna/collect-updates" "3.20.0" "@lerna/filter-packages" "3.18.0" dedent "^0.7.0" figgy-pudding "^3.5.1" @@ -789,58 +790,67 @@ "@lerna/child-process" "3.16.5" semver "^6.2.0" -"@lerna/import@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.18.0.tgz#c6b124b346a097e6c0f3f1ed4921a278d18bc80b" - integrity sha512-2pYIkkBTZsEdccfc+dPsKZeSw3tBzKSyl0b2lGrfmNX2Y41qqOzsJCyI1WO1uvEIP8aOaLy4hPpqRIBe4ee7hw== +"@lerna/import@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.18.5.tgz#a9c7d8601870729851293c10abd18b3707f7ba5e" + integrity sha512-PH0WVLEgp+ORyNKbGGwUcrueW89K3Iuk/DDCz8mFyG2IG09l/jOF0vzckEyGyz6PO5CMcz4TI1al/qnp3FrahQ== dependencies: "@lerna/child-process" "3.16.5" - "@lerna/command" "3.18.0" - "@lerna/prompt" "3.13.0" + "@lerna/command" "3.18.5" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.18.0.tgz#b23b9170cce1f4630170dd744e8ee75785ea898d" - integrity sha512-/vHpmXkMlSaJaq25v5K13mcs/2L7E32O6dSsEkHaZCDRiV2BOqsZng9jjbE/4ynfsWfLLlU9ZcydwG72C3I+mQ== +"@lerna/info@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/info/-/info-3.20.0.tgz#3a5212f3029f2bc6255f9533bdf4bcb120ef329a" + integrity sha512-Rsz+KQF9mczbGUbPTrtOed1N0C+cA08Qz0eX/oI+NNjvsryZIju/o7uedG4I3P55MBiAioNrJI88fHH3eTgYug== + dependencies: + "@lerna/command" "3.18.5" + "@lerna/output" "3.13.0" + envinfo "^7.3.1" + +"@lerna/init@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.18.5.tgz#86dd0b2b3290755a96975069b5cb007f775df9f5" + integrity sha512-oCwipWrha98EcJAHm8AGd2YFFLNI7AW9AWi0/LbClj1+XY9ah+uifXIgYGfTk63LbgophDd8936ZEpHMxBsbAg== dependencies: "@lerna/child-process" "3.16.5" - "@lerna/command" "3.18.0" + "@lerna/command" "3.18.5" fs-extra "^8.1.0" p-map "^2.1.0" write-json-file "^3.2.0" -"@lerna/link@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.18.0.tgz#bc72dc62ef4d8fb842b3286887980f98b764781d" - integrity sha512-FbbIpH0EpsC+dpAbvxCoF3cn7F1MAyJjEa5Lh3XkDGATOlinMFuKCbmX0NLpOPQZ5zghvrui97cx+jz5F2IlHw== +"@lerna/link@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.18.5.tgz#f24347e4f0b71d54575bd37cfa1794bc8ee91b18" + integrity sha512-xTN3vktJpkT7Nqc3QkZRtHO4bT5NvuLMtKNIBDkks0HpGxC9PRyyqwOoCoh1yOGbrWIuDezhfMg3Qow+6I69IQ== dependencies: - "@lerna/command" "3.18.0" - "@lerna/package-graph" "3.18.0" + "@lerna/command" "3.18.5" + "@lerna/package-graph" "3.18.5" "@lerna/symlink-dependencies" "3.17.0" p-map "^2.1.0" slash "^2.0.0" -"@lerna/list@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.18.4.tgz#4320f262cdb2df54b57b3ef0da935c568e30f1e9" - integrity sha512-bgtlhAwhjHOTLq0iIuPs30abeuLbwZvVB60Ym8kPp+chh939obKU3vy2KMyX+Gpxf8pzuQG+k986YXcUBvXVsw== +"@lerna/list@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.20.0.tgz#7e67cc29c5cf661cfd097e8a7c2d3dcce7a81029" + integrity sha512-fXTicPrfioVnRzknyPawmYIVkzDRBaQqk9spejS1S3O1DOidkihK0xxNkr8HCVC0L22w6f92g83qWDp2BYRUbg== dependencies: - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" - "@lerna/listable" "3.18.4" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" + "@lerna/listable" "3.18.5" "@lerna/output" "3.13.0" -"@lerna/listable@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.18.4.tgz#45d14ad4eba00d7da71deba839312bed78e02680" - integrity sha512-EKSsnST5k3dZfw+UTwBH1/sHQ1YfgjYjGxXCabyn55mMgc2GjoDekODMYzZ1TNF2NNy6RgIZ24X2JI8G22nZUw== +"@lerna/listable@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/listable/-/listable-3.18.5.tgz#e82798405b5ed8fc51843c8ef1e7a0e497388a1a" + integrity sha512-Sdr3pVyaEv5A7ZkGGYR7zN+tTl2iDcinryBPvtuv20VJrXBE8wYcOks1edBTcOWsPjCE/rMP4bo1pseyk3UTsg== dependencies: - "@lerna/query-graph" "3.18.0" + "@lerna/query-graph" "3.18.5" chalk "^2.3.1" columnify "^1.5.4" @@ -862,13 +872,13 @@ config-chain "^1.1.11" pify "^4.0.1" -"@lerna/npm-dist-tag@3.18.1": - version "3.18.1" - resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.1.tgz#d4dd82ea92e41e960b7117f83102ebcd7a23e511" - integrity sha512-vWkZh2T/O9OjPLDrba0BTWO7ug/C3sCwjw7Qyk1aEbxMBXB/eEJPqirwJTWT+EtRJQYB01ky3K8ZFOhElVyjLw== +"@lerna/npm-dist-tag@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-dist-tag/-/npm-dist-tag-3.18.5.tgz#9ef9abb7c104077b31f6fab22cc73b314d54ac55" + integrity sha512-xw0HDoIG6HreVsJND9/dGls1c+lf6vhu7yJoo56Sz5bvncTloYGLUppIfDHQr4ZvmPCK8rsh0euCVh2giPxzKQ== dependencies: "@evocateur/npm-registry-fetch" "^4.0.0" - "@lerna/otplease" "3.16.0" + "@lerna/otplease" "3.18.5" figgy-pudding "^3.5.1" npm-package-arg "^6.1.0" npmlog "^4.1.2" @@ -886,13 +896,13 @@ signal-exit "^3.0.2" write-pkg "^3.1.0" -"@lerna/npm-publish@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.16.2.tgz#a850b54739446c4aa766a0ceabfa9283bb0be676" - integrity sha512-tGMb9vfTxP57vUV5svkBQxd5Tzc+imZbu9ZYf8Mtwe0+HYfDjNiiHLIQw7G95w4YRdc5KsCE8sQ0uSj+f2soIg== +"@lerna/npm-publish@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-publish/-/npm-publish-3.18.5.tgz#240e4039959fd9816b49c5b07421e11b5cb000af" + integrity sha512-3etLT9+2L8JAx5F8uf7qp6iAtOLSMj+ZYWY6oUgozPi/uLqU0/gsMsEXh3F0+YVW33q0M61RpduBoAlOOZnaTg== dependencies: "@evocateur/libnpmpublish" "^1.2.2" - "@lerna/otplease" "3.16.0" + "@lerna/otplease" "3.18.5" "@lerna/run-lifecycle" "3.16.2" figgy-pudding "^3.5.1" fs-extra "^8.1.0" @@ -910,12 +920,12 @@ "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" -"@lerna/otplease@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.16.0.tgz#de66aec4f3e835a465d7bea84b58a4ab6590a0fa" - integrity sha512-uqZ15wYOHC+/V0WnD2iTLXARjvx3vNrpiIeyIvVlDB7rWse9mL4egex/QSgZ+lDx1OID7l2kgvcUD9cFpbqB7Q== +"@lerna/otplease@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/otplease/-/otplease-3.18.5.tgz#b77b8e760b40abad9f7658d988f3ea77d4fd0231" + integrity sha512-S+SldXAbcXTEDhzdxYLU0ZBKuYyURP/ND2/dK6IpKgLxQYh/z4ScljPDMyKymmEvgiEJmBsPZAAPfmNPEzxjog== dependencies: - "@lerna/prompt" "3.13.0" + "@lerna/prompt" "3.18.5" figgy-pudding "^3.5.1" "@lerna/output@3.13.0": @@ -939,10 +949,10 @@ tar "^4.4.10" temp-write "^3.4.0" -"@lerna/package-graph@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.18.0.tgz#eb42d14404a55b26b2472081615e26b0817cd91a" - integrity sha512-BLYDHO5ihPh20i3zoXfLZ5ZWDCrPuGANgVhl7k5pCmRj90LCvT+C7V3zrw70fErGAfvkcYepMqxD+oBrAYwquQ== +"@lerna/package-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/package-graph/-/package-graph-3.18.5.tgz#c740e2ea3578d059e551633e950690831b941f6b" + integrity sha512-8QDrR9T+dBegjeLr+n9WZTVxUYUhIUjUgZ0gvNxUBN8S1WB9r6H5Yk56/MVaB64tA3oGAN9IIxX6w0WvTfFudA== dependencies: "@lerna/prerelease-id-from-version" "3.16.0" "@lerna/validation-error" "3.13.0" @@ -966,6 +976,16 @@ dependencies: semver "^6.2.0" +"@lerna/profiler@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/profiler/-/profiler-3.20.0.tgz#0f6dc236f4ea8f9ea5f358c6703305a4f32ad051" + integrity sha512-bh8hKxAlm6yu8WEOvbLENm42i2v9SsR4WbrCWSbsmOElx3foRnMlYk7NkGECa+U5c3K4C6GeBbwgqs54PP7Ljg== + dependencies: + figgy-pudding "^3.5.1" + fs-extra "^8.1.0" + npmlog "^4.1.2" + upath "^1.2.0" + "@lerna/project@3.18.0": version "3.18.0" resolved "https://registry.yarnpkg.com/@lerna/project/-/project-3.18.0.tgz#56feee01daeb42c03cbdf0ed8a2a10cbce32f670" @@ -984,41 +1004,41 @@ resolve-from "^4.0.0" write-json-file "^3.2.0" -"@lerna/prompt@3.13.0": - version "3.13.0" - resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.13.0.tgz#53571462bb3f5399cc1ca6d335a411fe093426a5" - integrity sha512-P+lWSFokdyvYpkwC3it9cE0IF2U5yy2mOUbGvvE4iDb9K7TyXGE+7lwtx2thtPvBAfIb7O13POMkv7df03HJeA== +"@lerna/prompt@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/prompt/-/prompt-3.18.5.tgz#628cd545f225887d060491ab95df899cfc5218a1" + integrity sha512-rkKj4nm1twSbBEb69+Em/2jAERK8htUuV8/xSjN0NPC+6UjzAwY52/x9n5cfmpa9lyKf/uItp7chCI7eDmNTKQ== dependencies: inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.18.4.tgz#2f3de9d00ae63ec89b5411199e8bac96445b9f17" - integrity sha512-Q+MqM5DUZvk+uT6hdEyO3khXET6LwED0YEuCu8fRwtHad03HkZ9i8PtTY5h8Sn6D6RCyCOlHTuf8O0KKAUy3ow== +"@lerna/publish@3.20.2": + version "3.20.2" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.20.2.tgz#a45d29813099b3249657ea913d0dc3f8ebc5cc2e" + integrity sha512-N7Y6PdhJ+tYQPdI1tZum8W25cDlTp4D6brvRacKZusweWexxaopbV8RprBaKexkEX/KIbncuADq7qjDBdQHzaA== dependencies: "@evocateur/libnpmaccess" "^3.1.2" "@evocateur/npm-registry-fetch" "^4.0.0" "@evocateur/pacote" "^9.6.3" "@lerna/check-working-tree" "3.16.5" "@lerna/child-process" "3.16.5" - "@lerna/collect-updates" "3.18.0" - "@lerna/command" "3.18.0" + "@lerna/collect-updates" "3.20.0" + "@lerna/command" "3.18.5" "@lerna/describe-ref" "3.16.5" "@lerna/log-packed" "3.16.0" "@lerna/npm-conf" "3.16.0" - "@lerna/npm-dist-tag" "3.18.1" - "@lerna/npm-publish" "3.16.2" - "@lerna/otplease" "3.16.0" + "@lerna/npm-dist-tag" "3.18.5" + "@lerna/npm-publish" "3.18.5" + "@lerna/otplease" "3.18.5" "@lerna/output" "3.13.0" "@lerna/pack-directory" "3.16.4" "@lerna/prerelease-id-from-version" "3.16.0" - "@lerna/prompt" "3.13.0" + "@lerna/prompt" "3.18.5" "@lerna/pulse-till-done" "3.13.0" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-topologically" "3.18.0" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.18.4" + "@lerna/version" "3.20.2" figgy-pudding "^3.5.1" fs-extra "^8.1.0" npm-package-arg "^6.1.0" @@ -1035,12 +1055,12 @@ dependencies: npmlog "^4.1.2" -"@lerna/query-graph@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.18.0.tgz#43801a2f1b80a0ea0bfd9d42d470605326a3035d" - integrity sha512-fgUhLx6V0jDuKZaKj562jkuuhrfVcjl5sscdfttJ8dXNVADfDz76nzzwLY0ZU7/0m69jDedohn5Fx5p7hDEVEg== +"@lerna/query-graph@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/query-graph/-/query-graph-3.18.5.tgz#df4830bb5155273003bf35e8dda1c32d0927bd86" + integrity sha512-50Lf4uuMpMWvJ306be3oQDHrWV42nai9gbIVByPBYJuVW8dT8O8pA3EzitNYBUdLL9/qEVbrR0ry1HD7EXwtRA== dependencies: - "@lerna/package-graph" "3.18.0" + "@lerna/package-graph" "3.18.5" figgy-pudding "^3.5.1" "@lerna/resolve-symlink@3.16.0": @@ -1072,25 +1092,26 @@ npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-topologically@3.18.0": - version "3.18.0" - resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.18.0.tgz#9508604553cfbeba106cd84b711fade17947f94a" - integrity sha512-lrfEewwuUMC3ioxf9Z9NdHUakN6ihekcPfdYbzR2slmdbjYKmIA5srkWdrK8NwOpQCAuekpOovH2s8X3FGEopg== +"@lerna/run-topologically@3.18.5": + version "3.18.5" + resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.18.5.tgz#3cd639da20e967d7672cb88db0f756b92f2fdfc3" + integrity sha512-6N1I+6wf4hLOnPW+XDZqwufyIQ6gqoPfHZFkfWlvTQ+Ue7CuF8qIVQ1Eddw5HKQMkxqN10thKOFfq/9NQZ4NUg== dependencies: - "@lerna/query-graph" "3.18.0" + "@lerna/query-graph" "3.18.5" figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.18.4.tgz#c3ab3bffe4f098761c210a3215582f3b5b0d7227" - integrity sha512-u2ZNO2fVk5kVEpbpn4DLJZZxZ08LFnIFuaXJMAhxvOgvm12ZF2rabA9kZc3NXp5+DedG5nHHgyoyLVVbStKzBA== +"@lerna/run@3.20.0": + version "3.20.0" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.20.0.tgz#a479f7c42bdf9ebabb3a1e5a2bdebb7a8d201151" + integrity sha512-9U3AqeaCeB7KsGS9oyKNp62s9vYoULg/B4cqXTKZkc+OKL6QOEjYHYVSBcMK9lUXrMjCjDIuDSX3PnTCPxQ2Dw== dependencies: - "@lerna/command" "3.18.0" - "@lerna/filter-options" "3.18.4" + "@lerna/command" "3.18.5" + "@lerna/filter-options" "3.20.0" "@lerna/npm-run-script" "3.16.5" "@lerna/output" "3.13.0" - "@lerna/run-topologically" "3.18.0" + "@lerna/profiler" "3.20.0" + "@lerna/run-topologically" "3.18.5" "@lerna/timer" "3.13.0" "@lerna/validation-error" "3.13.0" p-map "^2.1.0" @@ -1130,23 +1151,23 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.18.4": - version "3.18.4" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.18.4.tgz#48261a8a69d1b15ab40a7cc6400381c4e480ec6b" - integrity sha512-+gR9H89qSP8iqzNi4tRVQUbWlFMOlhbY6+5TXkP72Ibb/z87O+C46DBqizSMVaPQYdSYjS1c9Xfa1oOhEWxGaw== +"@lerna/version@3.20.2": + version "3.20.2" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.20.2.tgz#3709141c0f537741d9bc10cb24f56897bcb30428" + integrity sha512-ckBJMaBWc+xJen0cMyCE7W67QXLLrc0ELvigPIn8p609qkfNM0L0CF803MKxjVOldJAjw84b8ucNWZLvJagP/Q== dependencies: "@lerna/check-working-tree" "3.16.5" "@lerna/child-process" "3.16.5" - "@lerna/collect-updates" "3.18.0" - "@lerna/command" "3.18.0" - "@lerna/conventional-commits" "3.16.4" + "@lerna/collect-updates" "3.20.0" + "@lerna/command" "3.18.5" + "@lerna/conventional-commits" "3.18.5" "@lerna/github-client" "3.16.5" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" "@lerna/prerelease-id-from-version" "3.16.0" - "@lerna/prompt" "3.13.0" + "@lerna/prompt" "3.18.5" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-topologically" "3.18.0" + "@lerna/run-topologically" "3.18.5" "@lerna/validation-error" "3.13.0" chalk "^2.3.1" dedent "^0.7.0" @@ -1213,11 +1234,19 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@octokit/endpoint@^5.1.0": - version "5.3.6" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.3.6.tgz#58a67b75b853127568e0db533cdd10f3bdca2e23" - integrity sha512-XuerByak8H+jW9J/rVMEdBXfI4UTsDWUwAKgIP/uhQjXIUVdPRwt2Zg+SmbWQ+WY7pRkw/hFVES8C4G/Kle7oA== +"@octokit/auth-token@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.0.tgz#b64178975218b99e4dfe948253f0673cbbb59d9f" + integrity sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg== + dependencies: + "@octokit/types" "^2.0.0" + +"@octokit/endpoint@^5.5.0": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.5.1.tgz#2eea81e110ca754ff2de11c79154ccab4ae16b3f" + integrity sha512-nBFhRUb5YzVTCX/iAK1MgQ4uWo89Gu0TH00qQHoYRCsE12dWcG1OiLd7v2EIo2+tpUKPMOQ62QFy9hy9Vg2ULg== dependencies: + "@octokit/types" "^2.0.0" is-plain-object "^3.0.0" universal-user-agent "^4.0.0" @@ -1227,20 +1256,22 @@ integrity sha512-3wF5eueS5OHQYuAEudkpN+xVeUsg8vYEMMenEzLphUZ7PRZ8OJtDcsreL3ad9zxXmBbaFWzLmFcdob5CLyZftA== "@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": - version "1.0.4" - resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.0.4.tgz#15e1dc22123ba4a9a4391914d80ec1e5303a23be" - integrity sha512-L4JaJDXn8SGT+5G0uX79rZLv0MNJmfGa4vb4vy1NnpjSnWDLJRy6m90udGwvMmavwsStgbv2QNkPzzTCMmL+ig== + version "1.2.0" + resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.2.0.tgz#a64d2a9d7a13555570cd79722de4a4d76371baaa" + integrity sha512-DNBhROBYjjV/I9n7A8kVkmQNkqFAMem90dSxqvPq57e2hBr7mNTX98y3R2zDpqMQHVRpBDjsvsfIGgBzy+4PAg== dependencies: + "@octokit/types" "^2.0.0" deprecation "^2.0.0" once "^1.4.0" -"@octokit/request@^5.0.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.1.0.tgz#5609dcc7b5323e529f29d535214383d9eaf0c05c" - integrity sha512-I15T9PwjFs4tbWyhtFU2Kq7WDPidYMvRB7spmxoQRZfxSmiqullG+Nz+KbSmpkfnlvHwTr1e31R5WReFRKMXjg== +"@octokit/request@^5.2.0": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.3.1.tgz#3a1ace45e6f88b1be4749c5da963b3a3b4a2f120" + integrity sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg== dependencies: - "@octokit/endpoint" "^5.1.0" + "@octokit/endpoint" "^5.5.0" "@octokit/request-error" "^1.0.1" + "@octokit/types" "^2.0.0" deprecation "^2.0.0" is-plain-object "^3.0.0" node-fetch "^2.3.0" @@ -1248,11 +1279,12 @@ universal-user-agent "^4.0.0" "@octokit/rest@^16.28.4": - version "16.30.2" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.30.2.tgz#da379a6f4f7e7e152733d38a9cba21da5c76ef7c" - integrity sha512-6YN4N/uWjjBUx4TNfWAxkrzCy1i7M4agdHs2g/sOTdSY/Va3T1v/f/ME5EnNfd64AMpBWee6rcLHQe5fki89lg== + version "16.38.1" + resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.38.1.tgz#be24e0faa7d0bdb9459fbc089ec866ed11774b72" + integrity sha512-zyNFx+/Bd1EXt7LQjfrc6H4wryBQ/oDuZeZhGMBSFr1eMPFDmpEweFQR3R25zjKwBQpDY7L5GQO6A3XSaOfV1w== dependencies: - "@octokit/request" "^5.0.0" + "@octokit/auth-token" "^2.4.0" + "@octokit/request" "^5.2.0" "@octokit/request-error" "^1.0.2" atob-lite "^2.0.0" before-after-hook "^2.0.0" @@ -1265,6 +1297,13 @@ once "^1.4.0" universal-user-agent "^4.0.0" +"@octokit/types@^2.0.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.1.1.tgz#77e80d1b663c5f1f829e5377b728fa3c4fe5a97d" + integrity sha512-89LOYH+d/vsbDX785NOfLxTW88GjNd0lWRz1DVPVsZgg9Yett5O+3MOvwo7iHgvUwbFz0mf/yPIjBkUbs4kxoQ== + dependencies: + "@types/node" ">= 8" + "@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" @@ -1391,7 +1430,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^12.12.7": +"@types/node@*", "@types/node@^12.12.7", "@types/node@>= 8": version "12.12.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== @@ -1873,9 +1912,9 @@ bindings@^1.5.0: file-uri-to-path "1.0.0" bluebird@^3.5.1, bluebird@^3.5.3, bluebird@^3.5.5: - version "3.7.0" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.0.tgz#56a6a886e03f6ae577cffedeb524f8f2450293cf" - integrity sha512-aBQ1FxIa7kSWCcmKHlcHFlT2jt6J/l4FzC7KcPELkOJOsPOb/bccdhmIrKDfXhwFrmc7vDoDrrepFvGqjyXGJg== + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== brace-expansion@^1.1.7: version "1.1.11" @@ -2172,6 +2211,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +clone-deep@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -2349,9 +2397,9 @@ conventional-changelog-angular@^1.3.3: q "^1.5.1" conventional-changelog-angular@^5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.3.tgz#299fdd43df5a1f095283ac16aeedfb0a682ecab0" - integrity sha512-YD1xzH7r9yXQte/HF9JBuEDfvjxxwDGGwZU1+ndanbY0oFgA+Po1T9JDSpPLdP0pZT6MhCAsdvFKC4TJ4MTJTA== + version "5.0.6" + resolved "https://registry.yarnpkg.com/conventional-changelog-angular/-/conventional-changelog-angular-5.0.6.tgz#269540c624553aded809c29a3508fdc2b544c059" + integrity sha512-QDEmLa+7qdhVIv8sFZfVxU1VSyVvnXPsxq8Vam49mKUcO1Z8VTLEJk9uI21uiJUsnmm0I4Hrsdc9TgkOQo9WSA== dependencies: compare-func "^1.3.1" q "^1.5.1" @@ -2385,22 +2433,22 @@ conventional-changelog-core@^3.1.6: through2 "^3.0.0" conventional-changelog-preset-loader@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.2.0.tgz#571e2b3d7b53d65587bea9eedf6e37faa5db4fcc" - integrity sha512-zXB+5vF7D5Y3Cb/rJfSyCCvFphCVmF8mFqOdncX3BmjZwAtGAPfYrBcT225udilCKvBbHgyzgxqz2GWDB5xShQ== + version "2.3.0" + resolved "https://registry.yarnpkg.com/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-2.3.0.tgz#580fa8ab02cef22c24294d25e52d7ccd247a9a6a" + integrity sha512-/rHb32J2EJnEXeK4NpDgMaAVTFZS3o1ExmjKMtYVgIC4MQn0vkNSbYpdGRotkfGGRWiqk3Ri3FBkiZGbAfIfOQ== conventional-changelog-writer@^4.0.6: - version "4.0.7" - resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.7.tgz#e4b7d9cbea902394ad671f67108a71fa90c7095f" - integrity sha512-p/wzs9eYaxhFbrmX/mCJNwJuvvHR+j4Fd0SQa2xyAhYed6KBiZ780LvoqUUvsayP4R1DtC27czalGUhKV2oabw== + version "4.0.11" + resolved "https://registry.yarnpkg.com/conventional-changelog-writer/-/conventional-changelog-writer-4.0.11.tgz#9f56d2122d20c96eb48baae0bf1deffaed1edba4" + integrity sha512-g81GQOR392I+57Cw3IyP1f+f42ME6aEkbR+L7v1FBBWolB0xkjKTeCWVguzRrp6UiT1O6gBpJbEy2eq7AnV1rw== dependencies: compare-func "^1.3.1" conventional-commits-filter "^2.0.2" dateformat "^3.0.0" - handlebars "^4.1.2" + handlebars "^4.4.0" json-stringify-safe "^5.0.1" - lodash "^4.2.1" - meow "^4.0.0" + lodash "^4.17.15" + meow "^5.0.0" semver "^6.0.0" split "^1.0.0" through2 "^3.0.0" @@ -2418,7 +2466,7 @@ conventional-commits-filter@^2.0.2: lodash.ismatch "^4.4.0" modify-values "^1.0.0" -conventional-commits-parser@^3.0.0: +conventional-commits-parser@^3.0.0, conventional-commits-parser@^3.0.3: version "3.0.8" resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.8.tgz#23310a9bda6c93c874224375e72b09fb275fe710" integrity sha512-YcBSGkZbYp7d+Cr3NWUeXbPDFUN6g3SaSIzOybi8bjHL5IJ5225OSCxJJ4LgziyEJ7AaJtE9L2/EU6H7Nt/DDQ== @@ -2431,19 +2479,6 @@ conventional-commits-parser@^3.0.0: through2 "^3.0.0" trim-off-newlines "^1.0.0" -conventional-commits-parser@^3.0.3: - version "3.0.5" - resolved "https://registry.yarnpkg.com/conventional-commits-parser/-/conventional-commits-parser-3.0.5.tgz#df471d6cb3f6fecfd1356ac72e0b577dbdae0a9c" - integrity sha512-qVz9+5JwdJzsbt7JbJ6P7NOXBGt8CyLFJYSjKAuPSgO+5UGfcsbk9EMR+lI8Unlvx6qwIc2YDJlrGIfay2ehNA== - dependencies: - JSONStream "^1.0.4" - is-text-path "^2.0.0" - lodash "^4.2.1" - meow "^4.0.0" - split2 "^2.0.0" - through2 "^3.0.0" - trim-off-newlines "^1.0.0" - conventional-recommended-bump@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/conventional-recommended-bump/-/conventional-recommended-bump-5.0.1.tgz#5af63903947b6e089e77767601cb592cabb106ba" @@ -3131,10 +3166,15 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0: dependencies: once "^1.4.0" -env-paths@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-1.0.0.tgz#4168133b42bb05c38a35b1ae4397c8298ab369e0" - integrity sha1-QWgTO0K7BcOKNbGuQ5fIKYqzaeA= +env-paths@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.0.tgz#cdca557dc009152917d6166e2febe1f039685e43" + integrity sha512-6u0VYSCo/OW6IoD5WCLLy9JUGARbamfSavcNXry/eu8aHVFei6CD3Sw+VGX5alea1i9pgPHW0mbu6Xj0uBh7gA== + +envinfo@^7.3.1: + version "7.5.0" + resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.5.0.tgz#91410bb6db262fb4f1409bd506e9ff57e91023f4" + integrity sha512-jDgnJaF/Btomk+m3PZDTTCb5XIIIX3zYItnCRfF73zVgvinLoRomuhi75Y4su0PtQxWz4v66XnLLckyvyJTOIQ== err-code@^1.0.0: version "1.1.2" @@ -3927,7 +3967,7 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= -glob@*, glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: +glob@*, glob@^7.0.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6: version "7.1.6" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== @@ -4028,10 +4068,10 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -handlebars@^4.1.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.4.2.tgz#8810a9821a9d6d52cb2f57d326d6ce7c3dfe741d" - integrity sha512-cIv17+GhL8pHHnRJzGu2wwcthL5sb8uDKBHvZ2Dtu5s1YNt0ljbzKbamnc+gr69y7bzwQiBdr5+hOpRd5pnOdg== +handlebars@^4.1.2, handlebars@^4.4.0: + version "4.7.2" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.2.tgz#01127b3840156a0927058779482031afe0e730d7" + integrity sha512-4PwqDL2laXtTWZghzzCtunQUTLbo31pcCJrd/B/9JP8XbhVzpS5ZXuKqlOzsd1rtcaLo4KqAn8nl8mkknS4MHw== dependencies: neo-async "^2.6.0" optimist "^0.6.1" @@ -4158,10 +4198,10 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-proxy-agent@^2.2.1: - version "2.2.2" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.2.tgz#271ea8e90f836ac9f119daccd39c19ff7dfb0793" - integrity sha512-c8Ndjc9Bkpfx/vCJueCPy0jlP4ccCCSNDp8xwCZzPjKJUm+B+u9WX2x98Qx4n1PiMNTWo3D7KK5ifNV/yJyRzg== +https-proxy-agent@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.4.tgz#4ee7a737abd92678a293d9b34a1af4d0d08c787b" + integrity sha512-OmvfoQ53WLjtA9HeYP9RNrWMJzzAz1JGaSFr1nijg0PVR1JaD/xbJq1mdEIIlxGpXp9eSe/O2LgU9DJmTPd0Eg== dependencies: agent-base "^4.3.0" debug "^3.1.0" @@ -4203,9 +4243,9 @@ iferr@^0.1.5: integrity sha1-xg7taebY/bazEEofy8ocGS3FtQE= ignore-walk@^3.0.1: - version "3.0.2" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.2.tgz#99d83a246c196ea5c93ef9315ad7b0819c35069b" - integrity sha512-EXyErtpHbn75ZTsOADsfx6J/FPo6/5cjev46PXrcTpd8z3BoRkXgYu9/JVqrI7tusjmwCZutGeRJeU0Wo1e4Cw== + version "3.0.3" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.3.tgz#017e2447184bfeade7c238e4aefdd1e8f95b1e37" + integrity sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw== dependencies: minimatch "^3.0.4" @@ -4378,7 +4418,7 @@ invariant@^2.2.4: dependencies: loose-envify "^1.0.0" -ip@^1.1.5: +ip@1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= @@ -4627,13 +4667,6 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" -is-text-path@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-text-path/-/is-text-path-2.0.0.tgz#b2484e2b720a633feb2e85b67dc193ff72c75636" - integrity sha512-+oDTluR6WEjdXEJMnC2z6A4FRwFoYuvShVVEGsS7ewc0UTi2QtAKMDJuL4BDEVt+5T7MjFo12RP8ghOM75oKJw== - dependencies: - text-extensions "^2.0.0" - is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" @@ -5257,26 +5290,27 @@ left-pad@^1.3.0: resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== -lerna@^3.18.4: - version "3.18.4" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.18.4.tgz#132858cabb8fc8393341ddddbbbd85dd0ca82a79" - integrity sha512-DiU53cvMxaU07Bj2HwBwUQ2O3c/ORNq/QwKj1vGJH4vSkZSTUxPryp2baSNlt8PmnLNXOVpw0vOTRkEF+6n/cA== - dependencies: - "@lerna/add" "3.18.4" - "@lerna/bootstrap" "3.18.4" - "@lerna/changed" "3.18.4" - "@lerna/clean" "3.18.4" - "@lerna/cli" "3.18.0" - "@lerna/create" "3.18.0" - "@lerna/diff" "3.18.0" - "@lerna/exec" "3.18.4" - "@lerna/import" "3.18.0" - "@lerna/init" "3.18.0" - "@lerna/link" "3.18.0" - "@lerna/list" "3.18.4" - "@lerna/publish" "3.18.4" - "@lerna/run" "3.18.4" - "@lerna/version" "3.18.4" +lerna@^3.20.2: + version "3.20.2" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.20.2.tgz#abf84e73055fe84ee21b46e64baf37b496c24864" + integrity sha512-bjdL7hPLpU3Y8CBnw/1ys3ynQMUjiK6l9iDWnEGwFtDy48Xh5JboR9ZJwmKGCz9A/sarVVIGwf1tlRNKUG9etA== + dependencies: + "@lerna/add" "3.20.0" + "@lerna/bootstrap" "3.20.0" + "@lerna/changed" "3.20.0" + "@lerna/clean" "3.20.0" + "@lerna/cli" "3.18.5" + "@lerna/create" "3.18.5" + "@lerna/diff" "3.18.5" + "@lerna/exec" "3.20.0" + "@lerna/import" "3.18.5" + "@lerna/info" "3.20.0" + "@lerna/init" "3.18.5" + "@lerna/link" "3.18.5" + "@lerna/list" "3.20.0" + "@lerna/publish" "3.20.2" + "@lerna/run" "3.20.0" + "@lerna/version" "3.20.2" import-local "^2.0.0" npmlog "^4.1.2" @@ -5575,15 +5609,15 @@ make-error@1.x, make-error@^1.1.1: integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== make-fetch-happen@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.0.tgz#a8e3fe41d3415dd656fe7b8e8172e1fb4458b38d" - integrity sha512-nFr/vpL1Jc60etMVKeaLOqfGjMMb3tAHFVJWxHOFCFS04Zmd7kGlMxo0l1tzfhoQje0/UPnd0X8OeGUiXXnfPA== + version "5.0.2" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-5.0.2.tgz#aa8387104f2687edca01c8687ee45013d02d19bd" + integrity sha512-07JHC0r1ykIoruKO8ifMXu+xEU8qOXDFETylktdug6vJDACnP+HKevOu3PXyNPzFyTSlz8vrBYlBO1JZRe8Cag== dependencies: agentkeepalive "^3.4.1" cacache "^12.0.0" http-cache-semantics "^3.8.1" http-proxy-agent "^2.1.0" - https-proxy-agent "^2.2.1" + https-proxy-agent "^2.2.3" lru-cache "^5.1.1" mississippi "^3.0.0" node-fetch-npm "^2.0.2" @@ -5934,21 +5968,21 @@ node-fetch@^2.3.0, node-fetch@^2.5.0: integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== node-gyp@^5.0.2: - version "5.0.5" - resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.5.tgz#f6cf1da246eb8c42b097d7cd4d6c3ce23a4163af" - integrity sha512-WABl9s4/mqQdZneZHVWVG4TVr6QQJZUC6PAx47ITSk9lreZ1n+7Z9mMAIbA3vnO4J9W20P7LhCxtzfWsAD/KDw== + version "5.0.7" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-5.0.7.tgz#dd4225e735e840cf2870e4037c2ed9c28a31719e" + integrity sha512-K8aByl8OJD51V0VbUURTKsmdswkQQusIvlvmTyhHlIT1hBvaSxzdxpSle857XuXa7uc02UEZx9OR5aDxSWS5Qw== dependencies: - env-paths "^1.0.0" - glob "^7.0.3" - graceful-fs "^4.1.2" - mkdirp "^0.5.0" - nopt "2 || 3" - npmlog "0 || 1 || 2 || 3 || 4" - request "^2.87.0" - rimraf "2" - semver "~5.3.0" + env-paths "^2.2.0" + glob "^7.1.4" + graceful-fs "^4.2.2" + mkdirp "^0.5.1" + nopt "^4.0.1" + npmlog "^4.1.2" + request "^2.88.0" + rimraf "^2.6.3" + semver "^5.7.1" tar "^4.4.12" - which "1" + which "^1.3.1" node-int64@^0.4.0: version "0.4.0" @@ -5971,12 +6005,13 @@ node-notifier@^5.4.2: shellwords "^0.1.1" which "^1.3.0" -"nopt@2 || 3": - version "3.0.6" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9" - integrity sha1-xkZdvwirzU2zWTF/eaxopkayj/k= +nopt@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" + integrity sha1-0NRoWv1UFRk8jHUFYC0NF81kR00= dependencies: abbrev "1" + osenv "^0.1.4" normalize-package-data@^2.0.0, normalize-package-data@^2.3.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.3.5, normalize-package-data@^2.4.0, normalize-package-data@^2.5.0: version "2.5.0" @@ -6006,9 +6041,11 @@ normalize-url@^3.3.0: integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== npm-bundled@^1.0.1: - version "1.0.6" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.6.tgz#e7ba9aadcef962bb61248f91721cd932b3fe6bdd" - integrity sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g== + version "1.1.1" + resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.1.1.tgz#1edd570865a94cdb1bc8220775e29466c9fb234b" + integrity sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA== + dependencies: + npm-normalize-package-bin "^1.0.1" npm-lifecycle@^3.1.2: version "3.1.4" @@ -6024,6 +6061,11 @@ npm-lifecycle@^3.1.2: umask "^1.1.0" which "^1.3.1" +npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" + integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== + "npm-package-arg@^4.0.0 || ^5.0.0 || ^6.0.0", npm-package-arg@^6.0.0, npm-package-arg@^6.1.0: version "6.1.1" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-6.1.1.tgz#02168cb0a49a2b75bf988a28698de7b529df5cb7" @@ -6035,9 +6077,9 @@ npm-lifecycle@^3.1.2: validate-npm-package-name "^3.0.0" npm-packlist@^1.4.4: - version "1.4.4" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.4.tgz#866224233850ac534b63d1a6e76050092b5d2f44" - integrity sha512-zTLo8UcVYtDU3gdeaFu2Xu0n0EvelfHDGuqtNIn5RO7yQj4H1TqNdBc/yZjxnWA0PVB8D3Woyp0i5B43JwQ6Vw== + version "1.4.7" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.4.7.tgz#9e954365a06b80b18111ea900945af4f88ed4848" + integrity sha512-vAj7dIkp5NhieaGZxBJB8fF4R0078rqsmhJcAfXZ6O7JJhjhPK96n5Ry1oZcfLXgfun0GWTZPOxaEyqv8GBykQ== dependencies: ignore-walk "^3.0.1" npm-bundled "^1.0.1" @@ -6065,7 +6107,7 @@ npm-run-path@^3.0.0: dependencies: path-key "^3.0.0" -"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.1.2: +npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== @@ -6215,7 +6257,7 @@ os-tmpdir@^1.0.0, os-tmpdir@~1.0.2: resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" integrity sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ= -osenv@^0.1.5: +osenv@^0.1.4, osenv@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/osenv/-/osenv-0.1.5.tgz#85cdfafaeb28e8677f416e287592b5f3f49ea410" integrity sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g== @@ -6705,21 +6747,21 @@ react-is@^16.8.4: integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== read-cmd-shim@^1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.4.tgz#b4a53d43376211b45243f0072b6e603a8e37640d" - integrity sha512-Pqpl3qJ/QdOIjRYA0q5DND/gLvGOfpIz/fYVDGYpOXfW/lFrIttmLsBnd6IkyK10+JHU9zhsaudfvrQTBB9YFQ== + version "1.0.5" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-1.0.5.tgz#87e43eba50098ba5a32d0ceb583ab8e43b961c16" + integrity sha512-v5yCqQ/7okKoZZkBQUAfTsQ3sVJtXdNfbPnI5cceppoxEVLYA3k+VtV2omkeo8MS94JCy4fSiUwlRBAwCVRPUA== dependencies: graceful-fs "^4.1.2" "read-package-json@1 || 2", read-package-json@^2.0.0, read-package-json@^2.0.13: - version "2.1.0" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.0.tgz#e3d42e6c35ea5ae820d9a03ab0c7291217fc51d5" - integrity sha512-KLhu8M1ZZNkMcrq1+0UJbR8Dii8KZUqB0Sha4mOx/bknfKI/fyrQVrG/YIt2UOtG667sD8+ee4EXMM91W9dC+A== + version "2.1.1" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-2.1.1.tgz#16aa66c59e7d4dad6288f179dd9295fd59bb98f1" + integrity sha512-dAiqGtVc/q5doFz6096CcnXhpYk0ZN8dEKVkGLU0CsASt8SrgF6SF7OTKAYubfvFhWaqofl+Y8HK19GR8jwW+A== dependencies: glob "^7.1.1" json-parse-better-errors "^1.0.1" normalize-package-data "^2.0.0" - slash "^1.0.0" + npm-normalize-package-bin "^1.0.0" optionalDependencies: graceful-fs "^4.1.2" @@ -6941,7 +6983,7 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.72.0, request@^2.87.0: +request@^2.72.0, request@^2.87.0, request@^2.88.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -7074,13 +7116,6 @@ right-pad@^1.0.1: resolved "https://registry.yarnpkg.com/right-pad/-/right-pad-1.0.1.tgz#8ca08c2cbb5b55e74dafa96bf7fd1a27d568c8d0" integrity sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA= -rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - rimraf@2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" @@ -7088,6 +7123,13 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" +rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.2, rimraf@^2.6.3: + version "2.7.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== + dependencies: + glob "^7.1.3" + rimraf@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.0.tgz#614176d4b3010b75e5c390eb0ee96f6dc0cebb9b" @@ -7178,7 +7220,7 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -7188,11 +7230,6 @@ semver@6.3.0, semver@^6.0.0, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== -semver@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" - integrity sha1-myzl094C0XxgEq0yaqa00M9U+U8= - set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -7208,6 +7245,13 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -7244,11 +7288,6 @@ sisteransi@^1.0.3: resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.4.tgz#386713f1ef688c7c0304dc4c0632898941cad2e3" integrity sha512-/ekMoM4NJ59ivGSfKapeG+FWtrmWvA1p6FBZwXrqojw90vJu8lBmrTxCMuBCydKtkaUe2zt4PlxeTKpjwMbyig== -slash@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" - integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= - slash@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" @@ -7278,10 +7317,10 @@ slide@^1.1.6: resolved "https://registry.yarnpkg.com/slide/-/slide-1.1.6.tgz#56eb027d65b4d2dce6cb2e2d32c4d4afc9e1d707" integrity sha1-VusCfWW00tzmyy4tMsTUr8nh1wc= -smart-buffer@4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.0.2.tgz#5207858c3815cc69110703c6b94e46c15634395d" - integrity sha512-JDhEpTKzXusOqXZ0BUIdH+CjFdO/CR3tLlf5CN34IypI+xMmXW1uB16OOY8z3cICbJlDAVJzNbwBhNO0wt9OAw== +smart-buffer@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/smart-buffer/-/smart-buffer-4.1.0.tgz#91605c25d91652f4661ea69ccf45f1b331ca21ba" + integrity sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw== snapdragon-node@^2.0.1: version "2.1.1" @@ -7322,12 +7361,12 @@ socks-proxy-agent@^4.0.0: socks "~2.3.2" socks@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.2.tgz#ade388e9e6d87fdb11649c15746c578922a5883e" - integrity sha512-pCpjxQgOByDHLlNqlnh/mNSAxIUkyBBuwwhTcV+enZGbDaClPvHdvm6uvOwZfFJkam7cGhBNbb4JxiP8UZkRvQ== + version "2.3.3" + resolved "https://registry.yarnpkg.com/socks/-/socks-2.3.3.tgz#01129f0a5d534d2b897712ed8aceab7ee65d78e3" + integrity sha512-o5t52PCNtVdiOvzMry7wU4aOqYWL0PeCXRWBEiJow4/i/wr+wpsJQ9awEu1EonLIqsfGd5qSgDdxEOvCdmBEpA== dependencies: - ip "^1.1.5" - smart-buffer "4.0.2" + ip "1.1.5" + smart-buffer "^4.1.0" sort-keys@^2.0.0: version "2.0.0" @@ -7471,9 +7510,9 @@ stream-each@^1.1.0: stream-shift "^1.0.0" stream-shift@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952" - integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI= + version "1.0.1" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== string-argv@^0.3.0: version "0.3.1" @@ -7734,11 +7773,6 @@ text-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== -text-extensions@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-2.0.0.tgz#43eabd1b495482fae4a2bf65e5f56c29f69220f6" - integrity sha512-F91ZqLgvi1E0PdvmxMgp+gcf6q8fMH7mhdwWfzXnl1k+GbpQDmi8l7DzLC5JTASKbwpY3TfxajAUzAXcv2NmsQ== - text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" @@ -8067,6 +8101,11 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" +upath@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/upath/-/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894" + integrity sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg== + uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" @@ -8105,9 +8144,9 @@ util.promisify@^1.0.0: object.getownpropertydescriptors "^2.0.3" uuid@^3.0.1, uuid@^3.3.2: - version "3.3.3" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.3.3.tgz#4568f0216e78760ee1dbf3a4d2cf53e224112866" - integrity sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ== + version "3.4.0" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" + integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== v8-compile-cache@^2.0.3: version "2.1.0" @@ -8209,7 +8248,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -8400,10 +8439,10 @@ yargs@^13.3.0: y18n "^4.0.0" yargs-parser "^13.1.1" -yargs@^14.0.0, yargs@^14.2.0: - version "14.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.0.tgz#f116a9242c4ed8668790b40759b4906c276e76c3" - integrity sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg== +yargs@^14.0.0, yargs@^14.2.2: + version "14.2.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-14.2.2.tgz#2769564379009ff8597cdd38fba09da9b493c4b5" + integrity sha512-/4ld+4VV5RnrynMhPZJ/ZpOCGSCeghMykZ3BhdFBDa9Wy/RH6uEGNWDJog+aUlq+9OM1CFTgtYRW5Is1Po9NOA== dependencies: cliui "^5.0.0" decamelize "^1.2.0" From 56acddd41515ef1600c51dcb1c87632ed4b43b8c Mon Sep 17 00:00:00 2001 From: Armano Date: Thu, 23 Jan 2020 21:41:16 +0100 Subject: [PATCH 14/30] chore: add funding field to package.json (#1499) --- azure-pipelines.yml | 3 +++ package.json | 7 +------ packages/eslint-plugin/package.json | 4 ++++ packages/experimental-utils/package.json | 4 ++++ packages/parser/package.json | 4 ++++ packages/typescript-estree/package.json | 4 ++++ 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b80f0eea4b51..4f941eba01df 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,7 @@ jobs: # This also runs a build as part of the postinstall # bootstrap yarn --ignore-engines --frozen-lockfile + yarn check-clean-workspace-after-install - script: | # Note that this command *also* typechecks tests/tools, @@ -68,6 +69,7 @@ jobs: # This also runs a build as part of the postinstall # bootstrap yarn --ignore-engines --frozen-lockfile + yarn check-clean-workspace-after-install - script: | yarn test @@ -91,6 +93,7 @@ jobs: # This also runs a build as part of the postinstall # bootstrap yarn --ignore-engines --frozen-lockfile + yarn check-clean-workspace-after-install - script: | npm config set //registry.npmjs.org/:_authToken=$(NPM_TOKEN) diff --git a/package.json b/package.json index d4b7c07ac538..5a0df3fd6a21 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "lint-fix": "eslint . --ext .js,.ts --fix", "pre-commit": "yarn lint-staged", "pre-push": "yarn format-check", - "postinstall": "lerna bootstrap && yarn build && lerna link && npm run check-clean-workspace-after-install && opencollective-postinstall", + "postinstall": "lerna bootstrap && yarn build && lerna link", "check-clean-workspace-after-install": "git diff --quiet --exit-code", "test": "lerna run test --concurrency 1", "typecheck": "lerna run typecheck" @@ -70,17 +70,12 @@ "jest": "^24.9.0", "lerna": "^3.20.2", "lint-staged": "^9.4.3", - "opencollective-postinstall": "^2.0.2", "prettier": "^1.19.1", "ts-jest": "^24.0.0", "ts-node": "^8.5.0", "tslint": "^5.20.1", "typescript": ">=3.2.1 <3.8.0" }, - "collective": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, "resolutions": { "typescript": "^3.7.2" } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 1465b812eac0..dc526268271f 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -63,5 +63,9 @@ "typescript": { "optional": true } + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 7513607b1114..36ce440a646c 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -45,5 +45,9 @@ }, "devDependencies": { "typescript": "*" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/parser/package.json b/packages/parser/package.json index 32dbb0f156cc..161f5fa58efb 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -56,5 +56,9 @@ "typescript": { "optional": true } + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 6068d86569a9..dc2a1ff1b329 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -66,5 +66,9 @@ "typescript": { "optional": true } + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } } From ce41d7de33bcb7ccf96c03ac1438304c5a49ff54 Mon Sep 17 00:00:00 2001 From: Armano Date: Fri, 24 Jan 2020 01:57:16 +0100 Subject: [PATCH 15/30] fix: improve token types and add missing type guards (#1497) --- .eslintignore | 1 + .../eslint-plugin/src/rules/comma-spacing.ts | 25 ++--- packages/eslint-plugin/src/util/astUtils.ts | 10 +- .../eslint-plugin/typings/eslint-utils.d.ts | 28 ++--- .../src/ts-eslint/SourceCode.ts | 101 +++++++++--------- .../typescript-estree/src/convert-comments.ts | 6 +- packages/typescript-estree/src/node-utils.ts | 34 +++--- .../src/ts-estree/ts-estree.ts | 74 +++++++++++-- 8 files changed, 172 insertions(+), 107 deletions(-) diff --git a/.eslintignore b/.eslintignore index 92693b863825..3c9816ccb5cc 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,5 +4,6 @@ jest.config.js fixtures shared-fixtures coverage +__snapshots__ packages/eslint-plugin-tslint/tests diff --git a/packages/eslint-plugin/src/rules/comma-spacing.ts b/packages/eslint-plugin/src/rules/comma-spacing.ts index 0651142efcbe..d8ab4b42b8d9 100644 --- a/packages/eslint-plugin/src/rules/comma-spacing.ts +++ b/packages/eslint-plugin/src/rules/comma-spacing.ts @@ -54,7 +54,7 @@ export default createRule({ create(context, [{ before: spaceBefore, after: spaceAfter }]) { const sourceCode = context.getSourceCode(); const tokensAndComments = sourceCode.tokensAndComments; - const ignoredTokens = new Set(); + const ignoredTokens = new Set(); /** * Adds null elements of the ArrayExpression or ArrayPattern node to the ignore list @@ -67,7 +67,7 @@ export default createRule({ for (const element of node.elements) { let token: TSESTree.Token | null; if (element === null) { - token = sourceCode.getTokenAfter(previousToken as TSESTree.Token); + token = sourceCode.getTokenAfter(previousToken!); if (token && isCommaToken(token)) { ignoredTokens.add(token); } @@ -100,9 +100,9 @@ export default createRule({ * @param nextToken The first token after the comma */ function validateCommaSpacing( - commaToken: TSESTree.Token, - prevToken: TSESTree.Token | null, - nextToken: TSESTree.Token | null, + commaToken: TSESTree.PunctuatorToken, + prevToken: TSESTree.Token | TSESTree.Comment | null, + nextToken: TSESTree.Token | TSESTree.Comment | null, ): void { if ( prevToken && @@ -166,20 +166,15 @@ export default createRule({ return; } - if (token.type === AST_TOKEN_TYPES.JSXText) { - return; - } - - const commaToken = token as TSESTree.Token; - const prevToken = tokensAndComments[i - 1] as TSESTree.Token; - const nextToken = tokensAndComments[i + 1] as TSESTree.Token; + const prevToken = tokensAndComments[i - 1]; + const nextToken = tokensAndComments[i + 1]; validateCommaSpacing( - commaToken, - isCommaToken(prevToken) || ignoredTokens.has(commaToken) + token, + isCommaToken(prevToken) || ignoredTokens.has(token) ? null : prevToken, - isCommaToken(nextToken) || ignoredTokens.has(commaToken) + isCommaToken(nextToken) || ignoredTokens.has(token) ? null : nextToken, ); diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 060165a28edc..6c92d90b637c 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -8,7 +8,7 @@ const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/; function isOptionalChainPunctuator( token: TSESTree.Token | TSESTree.Comment, -): boolean { +): token is TSESTree.PunctuatorToken & { value: '?.' } { return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '?.'; } function isNotOptionalChainPunctuator( @@ -19,7 +19,7 @@ function isNotOptionalChainPunctuator( function isNonNullAssertionPunctuator( token: TSESTree.Token | TSESTree.Comment, -): boolean { +): token is TSESTree.PunctuatorToken & { value: '!' } { return token.type === AST_TOKEN_TYPES.Punctuator && token.value === '!'; } function isNotNonNullAssertionPunctuator( @@ -33,7 +33,7 @@ function isNotNonNullAssertionPunctuator( */ function isOptionalOptionalChain( node: TSESTree.Node, -): node is TSESTree.OptionalCallExpression { +): node is TSESTree.OptionalCallExpression & { optional: true } { return ( node.type === AST_NODE_TYPES.OptionalCallExpression && // this flag means the call expression itself is option @@ -45,7 +45,9 @@ function isOptionalOptionalChain( /** * Returns true if and only if the node represents logical OR */ -function isLogicalOrOperator(node: TSESTree.Node): boolean { +function isLogicalOrOperator( + node: TSESTree.Node, +): node is TSESTree.LogicalExpression & { operator: '||' } { return ( node.type === AST_NODE_TYPES.LogicalExpression && node.operator === '||' ); diff --git a/packages/eslint-plugin/typings/eslint-utils.d.ts b/packages/eslint-plugin/typings/eslint-utils.d.ts index 6b3b1827a907..f2fc090c7a6f 100644 --- a/packages/eslint-plugin/typings/eslint-utils.d.ts +++ b/packages/eslint-plugin/typings/eslint-utils.d.ts @@ -113,67 +113,67 @@ declare module 'eslint-utils' { export function isArrowToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: '=>' }; export function isNotArrowToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isClosingBraceToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: '}' }; export function isNotClosingBraceToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isClosingBracketToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: ']' }; export function isNotClosingBracketToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isClosingParenToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: ')' }; export function isNotClosingParenToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isColonToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: ':' }; export function isNotColonToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isCommaToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: ',' }; export function isNotCommaToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isCommentToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; - export function isNotCommentToken( - token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.Comment; + export function isNotCommentToken< + T extends TSESTree.Token | TSESTree.Comment + >(token: T): token is Exclude; export function isOpeningBraceToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: '{' }; export function isNotOpeningBraceToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isOpeningBracketToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: '[' }; export function isNotOpeningBracketToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isOpeningParenToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: '(' }; export function isNotOpeningParenToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; export function isSemicolonToken( token: TSESTree.Token | TSESTree.Comment, - ): boolean; + ): token is TSESTree.PunctuatorToken & { value: ';' }; export function isNotSemicolonToken( token: TSESTree.Token | TSESTree.Comment, ): boolean; diff --git a/packages/experimental-utils/src/ts-eslint/SourceCode.ts b/packages/experimental-utils/src/ts-eslint/SourceCode.ts index 6744e988d8d4..eeaa906f37dc 100644 --- a/packages/experimental-utils/src/ts-eslint/SourceCode.ts +++ b/packages/experimental-utils/src/ts-eslint/SourceCode.ts @@ -33,8 +33,8 @@ declare interface SourceCode { getNodeByRangeIndex(index: number): TSESTree.Node | null; isSpaceBetween( - first: TSESTree.Token | TSESTree.Node, - second: TSESTree.Token | TSESTree.Node, + first: TSESTree.Token | TSESTree.Comment | TSESTree.Node, + second: TSESTree.Token | TSESTree.Comment | TSESTree.Node, ): boolean; /** @@ -49,93 +49,90 @@ declare interface SourceCode { // Inherited methods from TokenStore // --------------------------------- - getTokenByRangeStart( + getTokenByRangeStart( offset: number, - options?: { includeComments?: boolean }, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getFirstToken( + getFirstToken( node: TSESTree.Node, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getFirstTokens( + getFirstTokens( node: TSESTree.Node, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getLastToken( + getLastToken( node: TSESTree.Node, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getLastTokens( + getLastTokens( node: TSESTree.Node, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getTokenBefore( + getTokenBefore( node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getTokensBefore( + getTokensBefore( node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getTokenAfter( + getTokenAfter( node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getTokensAfter( + getTokensAfter( node: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getFirstTokenBetween( + getFirstTokenBetween( left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getFirstTokensBetween( + getFirstTokensBetween( left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getLastTokenBetween( + getLastTokenBetween( left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithSkipOptions, - ): TSESTree.Token | null; + options?: T, + ): SourceCode.ReturnTypeFromOptions | null; - getLastTokensBetween( + getLastTokensBetween( left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - options?: SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options?: T, + ): SourceCode.ReturnTypeFromOptions[]; - getTokensBetween( + getTokensBetween( left: TSESTree.Node | TSESTree.Token | TSESTree.Comment, right: TSESTree.Node | TSESTree.Token | TSESTree.Comment, - padding?: - | number - | SourceCode.FilterPredicate - | SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + padding?: T, + ): SourceCode.ReturnTypeFromOptions[]; getTokens( node: TSESTree.Node, beforeCount?: number, afterCount?: number, ): TSESTree.Token[]; - getTokens( + getTokens( node: TSESTree.Node, - options: SourceCode.FilterPredicate | SourceCode.CursorWithCountOptions, - ): TSESTree.Token[]; + options: T, + ): SourceCode.ReturnTypeFromOptions[]; commentsExistBetween( left: TSESTree.Node | TSESTree.Token, @@ -175,6 +172,10 @@ namespace SourceCode { tokenOrComment: TSESTree.Token | TSESTree.Comment, ) => boolean; + export type ReturnTypeFromOptions = T extends { includeComments: true } + ? TSESTree.Token | TSESTree.Comment + : TSESTree.Token; + export type CursorWithSkipOptions = | number | FilterPredicate diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 753e82f7b558..737b01b242f8 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -1,7 +1,7 @@ import * as ts from 'typescript'; import { forEachComment } from 'tsutils/util/util'; import { getLocFor } from './node-utils'; -import { TSESTree } from './ts-estree'; +import { AST_TOKEN_TYPES, TSESTree } from './ts-estree'; /** * Convert all comments for the given AST. @@ -21,8 +21,8 @@ export function convertComments( (_, comment) => { const type = comment.kind == ts.SyntaxKind.SingleLineCommentTrivia - ? 'Line' - : 'Block'; + ? AST_TOKEN_TYPES.Line + : AST_TOKEN_TYPES.Block; const range: TSESTree.Range = [comment.pos, comment.end]; const loc = getLocFor(range[0], range[1], ast); diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 3f9e4549bc5d..6cbc6b0ba82b 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -455,7 +455,7 @@ export function isOptional(node: { */ export function getTokenType( token: ts.Identifier | ts.Token, -): AST_TOKEN_TYPES { +): Exclude { if ('originalKeywordKind' in token && token.originalKeywordKind) { if (token.originalKeywordKind === SyntaxKind.NullKeyword) { return AST_TOKEN_TYPES.Null; @@ -561,21 +561,27 @@ export function convertToken( : token.getStart(ast); const end = token.getEnd(); const value = ast.text.slice(start, end); - const newToken: TSESTree.Token = { - type: getTokenType(token), - value, - range: [start, end], - loc: getLocFor(start, end, ast), - }; - - if (newToken.type === AST_TOKEN_TYPES.RegularExpression) { - newToken.regex = { - pattern: value.slice(1, value.lastIndexOf('/')), - flags: value.slice(value.lastIndexOf('/') + 1), + const tokenType = getTokenType(token); + + if (tokenType === AST_TOKEN_TYPES.RegularExpression) { + return { + type: tokenType, + value, + range: [start, end], + loc: getLocFor(start, end, ast), + regex: { + pattern: value.slice(1, value.lastIndexOf('/')), + flags: value.slice(value.lastIndexOf('/') + 1), + }, + }; + } else { + return { + type: tokenType, + value, + range: [start, end], + loc: getLocFor(start, end, ast), }; } - - return newToken; } /** diff --git a/packages/typescript-estree/src/ts-estree/ts-estree.ts b/packages/typescript-estree/src/ts-estree/ts-estree.ts index d0aa4b17c6ce..94d4b7c24408 100644 --- a/packages/typescript-estree/src/ts-estree/ts-estree.ts +++ b/packages/typescript-estree/src/ts-estree/ts-estree.ts @@ -52,20 +52,80 @@ export interface BaseNode { * They are not included in the `Node` union below on purpose because they * are not ever included as part of the standard AST tree. */ - -export interface Token extends BaseNode { - type: AST_TOKEN_TYPES; +interface BaseToken extends BaseNode { value: string; - regex?: { +} + +export interface BooleanToken extends BaseToken { + type: AST_TOKEN_TYPES.Boolean; +} + +export interface IdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.Identifier; +} + +export interface JSXIdentifierToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXIdentifier; +} + +export interface JSXTextToken extends BaseToken { + type: AST_TOKEN_TYPES.JSXText; +} + +export interface KeywordToken extends BaseToken { + type: AST_TOKEN_TYPES.Keyword; +} + +export interface NullToken extends BaseToken { + type: AST_TOKEN_TYPES.Null; +} + +export interface NumericToken extends BaseToken { + type: AST_TOKEN_TYPES.Numeric; +} + +export interface PunctuatorToken extends BaseToken { + type: AST_TOKEN_TYPES.Punctuator; +} + +export interface RegularExpressionToken extends BaseToken { + type: AST_TOKEN_TYPES.RegularExpression; + regex: { pattern: string; flags: string; }; } -export interface Comment extends BaseNode { - type: 'Line' | 'Block'; - value: string; + +export interface StringToken extends BaseToken { + type: AST_TOKEN_TYPES.String; } +export interface TemplateToken extends BaseToken { + type: AST_TOKEN_TYPES.Template; +} + +export interface BlockComment extends BaseToken { + type: AST_TOKEN_TYPES.Block; +} + +export interface LineComment extends BaseToken { + type: AST_TOKEN_TYPES.Line; +} + +export type Comment = BlockComment | LineComment; +export type Token = + | BooleanToken + | IdentifierToken + | JSXIdentifierToken + | JSXTextToken + | KeywordToken + | NullToken + | NumericToken + | PunctuatorToken + | RegularExpressionToken + | StringToken + | TemplateToken; + export type OptionalRangeAndLoc = Pick< T, Exclude From 06731e79f01dc0b49b26c30a7b5e97dc840c80e6 Mon Sep 17 00:00:00 2001 From: Armano Date: Fri, 24 Jan 2020 05:11:34 +0100 Subject: [PATCH 16/30] test(eslint-plugin): cleanup no-use-before-define tests (#1505) --- .../eslint-rules/no-use-before-define.test.ts | 85 ------ .../tests/rules/no-use-before-define.test.ts | 241 ++++++++---------- 2 files changed, 100 insertions(+), 226 deletions(-) delete mode 100644 packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts diff --git a/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts deleted file mode 100644 index 4571cd04afbb..000000000000 --- a/packages/eslint-plugin/tests/eslint-rules/no-use-before-define.test.ts +++ /dev/null @@ -1,85 +0,0 @@ -import rule from 'eslint/lib/rules/no-use-before-define'; -import { RuleTester } from '../RuleTester'; - -const ruleTester = new RuleTester({ - parserOptions: { - ecmaVersion: 6, - sourceType: 'module', - ecmaFeatures: {}, - }, - parser: '@typescript-eslint/parser', -}); - -ruleTester.run('no-use-before-define', rule, { - valid: [ - ` -const updatedAt = data?.updatedAt; - `, - ` -function f() { - return function t() {}; -} -f()?.(); - `, - ` -var a = { b: 5 }; -alert(a?.b); - `, - ], - invalid: [ - { - code: ` -f(); -function f() {} - `, - errors: [ - { - message: "'f' was used before it was defined.", - // the base rule doesn't use messageId - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } as any, - ], - }, - { - code: ` -alert(a); -var a = 10; - `, - errors: [ - { - message: "'a' was used before it was defined.", - // the base rule doesn't use messageId - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } as any, - ], - }, - { - code: ` -f()?.(); -function f() { - return function t() {}; -} - `, - errors: [ - { - message: "'f' was used before it was defined.", - // the base rule doesn't use messageId - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } as any, - ], - }, - { - code: ` -alert(a?.b); -var a = { b: 5 }; - `, - errors: [ - { - message: "'a' was used before it was defined.", - // the base rule doesn't use messageId - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } as any, - ], - }, - ], -}); diff --git a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts index 9d9434397fd4..70d91022816d 100644 --- a/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts +++ b/packages/eslint-plugin/tests/rules/no-use-before-define.test.ts @@ -22,6 +22,15 @@ const x: Foo = {}; 'function a() { alert(arguments);}', 'declare function a()', 'declare class a { foo() }', + `const updatedAt = data?.updatedAt;`, + ` +function f() { return function t() {}; } +f()?.(); + `, + ` +var a = { b: 5 }; +alert(a?.b); + `, { code: ` a(); @@ -239,11 +248,7 @@ enum Foo { FOO, } `, - options: [ - { - enums: false, - }, - ], + options: [{ enums: false }], }, { code: ` @@ -253,11 +258,7 @@ enum Foo { FOO, } `, - options: [ - { - enums: false, - }, - ], + options: [{ enums: false }], }, { code: ` @@ -271,11 +272,7 @@ enum Foo { FOO, } `, - options: [ - { - enums: false, - }, - ], + options: [{ enums: false }], }, ], invalid: [ @@ -288,9 +285,7 @@ var a=19; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -304,9 +299,7 @@ var a=19; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -319,9 +312,7 @@ var a=19; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -334,9 +325,7 @@ var a=function() {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -349,9 +338,7 @@ var a=[1,3]; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -368,16 +355,12 @@ function a() { errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, { messageId: 'noUseBeforeDefine', - data: { - name: 'b', - }, + data: { name: 'b' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -392,9 +375,7 @@ var a=function() {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -412,9 +393,7 @@ var a=function() {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -430,9 +409,7 @@ function a() { } errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -449,9 +426,7 @@ a(); errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -468,9 +443,7 @@ try { errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -484,9 +457,7 @@ var a; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -500,9 +471,7 @@ class A {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -518,9 +487,7 @@ class A {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -534,9 +501,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -552,9 +517,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -572,9 +535,7 @@ a++; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -591,9 +552,7 @@ a++; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -609,9 +568,7 @@ a++; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -629,9 +586,7 @@ switch (foo) { errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -649,9 +604,7 @@ if (true) { errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -667,9 +620,7 @@ var a=function() {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -684,9 +635,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -703,9 +652,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'A', - }, + data: { name: 'A' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -717,9 +664,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -730,9 +675,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -743,9 +686,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -756,9 +697,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -769,9 +708,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -782,9 +719,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -795,9 +730,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -808,9 +741,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -821,9 +752,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -834,9 +763,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -846,9 +773,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -859,9 +784,7 @@ var A = class {}; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'a', - }, + data: { name: 'a' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -881,9 +804,7 @@ var bar; errors: [ { messageId: 'noUseBeforeDefine', - data: { - name: 'bar', - }, + data: { name: 'bar' }, type: AST_NODE_TYPES.Identifier, }, ], @@ -900,11 +821,7 @@ enum Foo { FOO, } `, - options: [ - { - enums: true, - }, - ], + options: [{ enums: true }], errors: [ { messageId: 'noUseBeforeDefine', @@ -921,11 +838,7 @@ enum Foo { FOO, } `, - options: [ - { - enums: true, - }, - ], + options: [{ enums: true }], errors: [ { messageId: 'noUseBeforeDefine', @@ -940,14 +853,60 @@ enum Foo { FOO, } `, - options: [ + options: [{ enums: true }], + errors: [ { - enums: true, + messageId: 'noUseBeforeDefine', }, ], + }, + { + code: ` +f(); +function f() {} + `, + errors: [ + { + messageId: 'noUseBeforeDefine', + data: { name: 'f' }, + }, + ], + }, + { + code: ` +alert(a); +var a = 10; + `, + errors: [ + { + messageId: 'noUseBeforeDefine', + data: { name: 'a' }, + }, + ], + }, + { + code: ` +f()?.(); +function f() { + return function t() {}; +} + `, + errors: [ + { + messageId: 'noUseBeforeDefine', + data: { name: 'f' }, + }, + ], + }, + { + code: ` +alert(a?.b); +var a = { b: 5 }; + `, errors: [ { messageId: 'noUseBeforeDefine', + data: { name: 'a' }, }, ], }, From d89e8e8a1114989e2727351bee7aadb6579f312b Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 24 Jan 2020 21:06:36 +1300 Subject: [PATCH 17/30] fix(eslint-plugin): fix property access on undefined error (#1507) --- .../eslint-plugin/src/rules/no-unnecessary-type-arguments.ts | 2 +- .../tests/rules/no-unnecessary-type-arguments.test.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts index e900a0b07072..b68538e41d6c 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-arguments.ts @@ -51,7 +51,7 @@ export default util.createRule<[], MessageIds>({ // TODO: would like checker.areTypesEquivalent. https://github.com/Microsoft/TypeScript/issues/13502 if ( - !param.default || + !param?.default || param.default.getText() !== sourceCode.getText(arg) ) { return; diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index 51c1acf3285f..ca81774d3ddd 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -17,6 +17,7 @@ ruleTester.run('no-unnecessary-type-arguments', rule, { valid: [ `f<>();`, `f();`, + `expect().toBe<>();`, `class Foo extends Bar<> {}`, `class Foo extends Bar {}`, `class Foo implements Bar<> {}`, From 9ca65dc82c77afdf7db30d4f4cc825c954200632 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 25 Jan 2020 05:46:48 +1300 Subject: [PATCH 18/30] chore: update `istanbul-reports` to make tests quiet (#1509) --- yarn.lock | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index e4ad700bcc8f..08a15491ef79 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1430,7 +1430,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA== -"@types/node@*", "@types/node@^12.12.7", "@types/node@>= 8": +"@types/node@*", "@types/node@>= 8", "@types/node@^12.12.7": version "12.12.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== @@ -4068,7 +4068,7 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" integrity sha1-8QdIy+dq+WS3yWyTxrzCivEgwIE= -handlebars@^4.1.2, handlebars@^4.4.0: +handlebars@^4.4.0: version "4.7.2" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.2.tgz#01127b3840156a0927058779482031afe0e730d7" integrity sha512-4PwqDL2laXtTWZghzzCtunQUTLbo31pcCJrd/B/9JP8XbhVzpS5ZXuKqlOzsd1rtcaLo4KqAn8nl8mkknS4MHw== @@ -4176,6 +4176,11 @@ html-encoding-sniffer@^1.0.2: dependencies: whatwg-encoding "^1.0.1" +html-escaper@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.0.tgz#71e87f931de3fe09e56661ab9a29aadec707b491" + integrity sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig== + http-cache-semantics@^3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" @@ -4766,11 +4771,11 @@ istanbul-lib-source-maps@^3.0.1: source-map "^0.6.1" istanbul-reports@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" - integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== + version "2.2.7" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.7.tgz#5d939f6237d7b48393cc0959eab40cd4fd056931" + integrity sha512-uu1F/L1o5Y6LzPVSVZXNOoD/KXpJue9aeLRd0sM9uMXfZvzomB0WxVamWb5ue8kA2vVWEmW7EG+A5n3f1kqHKg== dependencies: - handlebars "^4.1.2" + html-escaper "^2.0.0" iterable-to-stream@^1.0.1: version "1.0.1" From 802e3471ed1a1664dfd74d5716237934b08875ca Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 24 Jan 2020 09:02:00 -0800 Subject: [PATCH 19/30] chore(eslint-plugin): use getFixturesRootDir in tests (#1506) --- .../tests/rules/no-dynamic-delete.test.ts | 11 +++++------ .../tests/rules/no-unnecessary-condition.test.ts | 13 ++++++------- .../tests/rules/no-unnecessary-qualifier.test.ts | 13 ++++++------- .../rules/no-unnecessary-type-arguments.test.ts | 11 +++++------ .../rules/no-unnecessary-type-assertion.test.ts | 2 +- .../tests/rules/prefer-includes.test.ts | 9 ++++----- .../tests/rules/prefer-nullish-coalescing.test.ts | 5 ++--- .../tests/rules/prefer-regexp-exec.test.ts | 5 ++--- .../rules/prefer-string-starts-ends-with.test.ts | 5 ++--- .../tests/rules/require-array-sort-compare.test.ts | 5 ++--- .../tests/rules/restrict-plus-operands.test.ts | 5 ++--- .../rules/restrict-template-expressions.test.ts | 5 ++--- .../tests/rules/strict-boolean-expressions.test.ts | 5 ++--- .../tests/rules/unbound-method.test.ts | 5 ++--- 14 files changed, 43 insertions(+), 56 deletions(-) diff --git a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts index aa12c33c9e50..5a88fbff10ca 100644 --- a/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts +++ b/packages/eslint-plugin/tests/rules/no-dynamic-delete.test.ts @@ -1,15 +1,14 @@ -import path from 'path'; import rule from '../../src/rules/no-dynamic-delete'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; + +const rootPath = getFixturesRootDir(); -const rootDir = path.join(process.cwd(), 'tests/fixtures'); const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2015, - tsconfigRootDir: rootDir, + tsconfigRootDir: rootPath, project: './tsconfig.json', }, - parser: '@typescript-eslint/parser', }); ruleTester.run('no-dynamic-delete', rule, { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts index 1a7abc30f465..0728b9202b9f 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-condition.test.ts @@ -1,15 +1,14 @@ -import path from 'path'; -import rule, { - Options, - MessageId, -} from '../../src/rules/no-unnecessary-condition'; -import { RuleTester } from '../RuleTester'; import { TestCaseError, InvalidTestCase, } from '@typescript-eslint/experimental-utils/dist/ts-eslint'; +import rule, { + Options, + MessageId, +} from '../../src/rules/no-unnecessary-condition'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts index 75236704c853..68e0e258383d 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-qualifier.test.ts @@ -1,21 +1,20 @@ -import path from 'path'; -import rule from '../../src/rules/no-unnecessary-qualifier'; -import { RuleTester } from '../RuleTester'; import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; +import rule from '../../src/rules/no-unnecessary-qualifier'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const messageId = 'unnecessaryQualifier'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', parserOptions: { + sourceType: 'module', tsconfigRootDir: rootPath, project: './tsconfig.json', - sourceType: 'module', - ecmaVersion: 6, }, }); +const messageId = 'unnecessaryQualifier'; + ruleTester.run('no-unnecessary-qualifier', rule, { valid: [ ` diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts index ca81774d3ddd..11ff8344698e 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-arguments.test.ts @@ -1,16 +1,15 @@ -import path from 'path'; import rule from '../../src/rules/no-unnecessary-type-arguments'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; + +const rootPath = getFixturesRootDir(); -const rootDir = path.join(process.cwd(), 'tests/fixtures'); const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', parserOptions: { - ecmaVersion: 2015, sourceType: 'module', - tsconfigRootDir: rootDir, + tsconfigRootDir: rootPath, project: './tsconfig.json', }, - parser: '@typescript-eslint/parser', }); ruleTester.run('no-unnecessary-type-arguments', rule, { diff --git a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts index 3d5c958c3cc6..e7248a9693ef 100644 --- a/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unnecessary-type-assertion.test.ts @@ -5,7 +5,7 @@ import { RuleTester } from '../RuleTester'; const rootDir = path.resolve(__dirname, '../fixtures/'); const ruleTester = new RuleTester({ parserOptions: { - ecmaVersion: 2015, + sourceType: 'module', tsconfigRootDir: rootDir, project: './tsconfig.json', }, diff --git a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts index 6094f3adee69..dac14615851d 100644 --- a/packages/eslint-plugin/tests/rules/prefer-includes.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-includes.test.ts @@ -1,12 +1,9 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; -import path from 'path'; import rule from '../../src/rules/prefer-includes'; import * as util from '../../src/util'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); - -type MessageIds = util.InferMessageIdsTypeFromRule; +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', @@ -16,6 +13,8 @@ const ruleTester = new RuleTester({ }, }); +type MessageIds = util.InferMessageIdsTypeFromRule; + type InvalidTestCase = TSESLint.InvalidTestCase; type ValidTestCase = TSESLint.ValidTestCase | string; function addOptional(cases: ValidTestCase[]): ValidTestCase[]; diff --git a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts index 6a12c6d2138f..40a8916317c0 100644 --- a/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-nullish-coalescing.test.ts @@ -1,12 +1,11 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; -import path from 'path'; import rule, { MessageIds, Options, } from '../../src/rules/prefer-nullish-coalescing'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts b/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts index 98381cda6a1c..045c36206ee7 100644 --- a/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-regexp-exec.test.ts @@ -1,8 +1,7 @@ -import path from 'path'; import rule from '../../src/rules/prefer-regexp-exec'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts index 416fab6e02ea..0022c37cb2f7 100644 --- a/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-string-starts-ends-with.test.ts @@ -1,9 +1,8 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; -import path from 'path'; import rule from '../../src/rules/prefer-string-starts-ends-with'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts index 1dae0d37f3d5..d3a49c60f658 100644 --- a/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts +++ b/packages/eslint-plugin/tests/rules/require-array-sort-compare.test.ts @@ -1,8 +1,7 @@ -import path from 'path'; import rule from '../../src/rules/require-array-sort-compare'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts index 5d979706f84d..6270b61eec3d 100644 --- a/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-plus-operands.test.ts @@ -1,8 +1,7 @@ -import path from 'path'; import rule from '../../src/rules/restrict-plus-operands'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts index ef7657d6a002..cdf59b0c8197 100644 --- a/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/restrict-template-expressions.test.ts @@ -1,8 +1,7 @@ -import path from 'path'; import rule from '../../src/rules/restrict-template-expressions'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts index 244d8511dba4..cf6dbd5cd361 100644 --- a/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts +++ b/packages/eslint-plugin/tests/rules/strict-boolean-expressions.test.ts @@ -1,8 +1,7 @@ -import path from 'path'; import rule from '../../src/rules/strict-boolean-expressions'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin/tests/rules/unbound-method.test.ts b/packages/eslint-plugin/tests/rules/unbound-method.test.ts index 6b5fd5500d46..dcf58b6447e7 100644 --- a/packages/eslint-plugin/tests/rules/unbound-method.test.ts +++ b/packages/eslint-plugin/tests/rules/unbound-method.test.ts @@ -1,9 +1,8 @@ import { TSESLint } from '@typescript-eslint/experimental-utils'; -import path from 'path'; import rule, { MessageIds, Options } from '../../src/rules/unbound-method'; -import { RuleTester } from '../RuleTester'; +import { RuleTester, getFixturesRootDir } from '../RuleTester'; -const rootPath = path.join(process.cwd(), 'tests/fixtures/'); +const rootPath = getFixturesRootDir(); const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser', From 718cd889c155a75413c571ac006c33fbc271dcc5 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Fri, 24 Jan 2020 09:06:01 -0800 Subject: [PATCH 20/30] fix(eslint-plugin): [naming-convention] fix filter option (#1482) --- .../docs/rules/naming-convention.md | 2 +- .../src/rules/naming-convention.ts | 6 +++--- .../tests/rules/naming-convention.test.ts | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/eslint-plugin/docs/rules/naming-convention.md b/packages/eslint-plugin/docs/rules/naming-convention.md index df0cdb02e597..99823a164c18 100644 --- a/packages/eslint-plugin/docs/rules/naming-convention.md +++ b/packages/eslint-plugin/docs/rules/naming-convention.md @@ -115,7 +115,7 @@ This can be useful if you want to enforce no particular format for a specific se The `custom` option defines a custom regex that the identifier must (or must not) match. This option allows you to have a bit more finer-grained control over identifiers, letting you ban (or force) certain patterns and substrings. Accepts an object with the following properties: -- `regex` - accepts a regular expression (anything accepted into `new RegExp(filter)`). +- `regex` - accepts a regular expression (anything accepted into `new RegExp(regex)`). - `match` - true if the identifier _must_ match the `regex`, false if the identifier _must not_ match the `regex`. #### `leadingUnderscore` / `trailingUnderscore` diff --git a/packages/eslint-plugin/src/rules/naming-convention.ts b/packages/eslint-plugin/src/rules/naming-convention.ts index 8f3fe91ed5d3..1938d383a50c 100644 --- a/packages/eslint-plugin/src/rules/naming-convention.ts +++ b/packages/eslint-plugin/src/rules/naming-convention.ts @@ -766,8 +766,8 @@ function createValidator( .sort((a, b) => { if (a.selector === b.selector) { // in the event of the same selector, order by modifier weight - // sort ascending - the type modifiers are "more important" - return a.modifierWeight - b.modifierWeight; + // sort descending - the type modifiers are "more important" + return b.modifierWeight - a.modifierWeight; } /* @@ -797,7 +797,7 @@ function createValidator( // return will break the loop and stop checking configs // it is only used when the name is known to have failed or succeeded a config. for (const config of configs) { - if (config.filter?.test(originalName)) { + if (config.filter?.test(originalName) === false) { // name does not match the filter continue; } diff --git a/packages/eslint-plugin/tests/rules/naming-convention.test.ts b/packages/eslint-plugin/tests/rules/naming-convention.test.ts index 04d83717522a..f8270225e58e 100644 --- a/packages/eslint-plugin/tests/rules/naming-convention.test.ts +++ b/packages/eslint-plugin/tests/rules/naming-convention.test.ts @@ -80,6 +80,7 @@ const formatTestNames: Readonly[] { options: [ { ...options, - filter: '[iI]gnored', + filter: IGNORED_REGEX.source, }, ], code: `// ${JSON.stringify(options)}\n${test.code @@ -205,7 +206,7 @@ function createInvalidTestCases( options: [ { ...options, - filter: '[iI]gnored', + filter: IGNORED_REGEX.source, }, ], code: `// ${JSON.stringify(options)}\n${test.code @@ -724,6 +725,20 @@ ruleTester.run('naming-convention', rule, { }, ], }, + // https://github.com/typescript-eslint/typescript-eslint/issues/1478 + { + code: ` + const child_process = require('child_process'); + `, + options: [ + { selector: 'variable', format: ['camelCase', 'UPPER_CASE'] }, + { + selector: 'variable', + format: ['snake_case'], + filter: 'child_process', + }, + ], + }, ], invalid: [ ...createInvalidTestCases(cases), From c3d0a3a6bdff0cae226a279f0a0a9b00952ca925 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 25 Jan 2020 14:33:36 +1300 Subject: [PATCH 21/30] feat(eslint-plugin-internal): add `prefer-ast-types-enum` (#1508) Co-authored-by: Brad Zacher --- .../eslint-plugin-internal/src/rules/index.ts | 2 + .../src/rules/prefer-ast-types-enum.ts | 70 +++++++++++++++++++ .../tests/rules/prefer-ast-types-enum.test.ts | 50 +++++++++++++ 3 files changed, 122 insertions(+) create mode 100755 packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts create mode 100644 packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts diff --git a/packages/eslint-plugin-internal/src/rules/index.ts b/packages/eslint-plugin-internal/src/rules/index.ts index 800c448e041b..f781e01e6df1 100644 --- a/packages/eslint-plugin-internal/src/rules/index.ts +++ b/packages/eslint-plugin-internal/src/rules/index.ts @@ -1,7 +1,9 @@ import noTypescriptDefaultImport from './no-typescript-default-import'; import noTypescriptEstreeImport from './no-typescript-estree-import'; +import preferASTTypesEnum from './prefer-ast-types-enum'; export default { 'no-typescript-default-import': noTypescriptDefaultImport, 'no-typescript-estree-import': noTypescriptEstreeImport, + 'prefer-ast-types-enum': preferASTTypesEnum, }; diff --git a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts new file mode 100755 index 000000000000..09398ea11dff --- /dev/null +++ b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts @@ -0,0 +1,70 @@ +import { + AST_NODE_TYPES, + AST_TOKEN_TYPES, + ESLintUtils, + TSESTree, +} from '@typescript-eslint/experimental-utils'; + +const isStringLiteral = ( + node: TSESTree.Literal, +): node is TSESTree.StringLiteral => typeof node.value === 'string'; + +export = ESLintUtils.RuleCreator(name => name)({ + name: __filename, + meta: { + type: 'problem', + docs: { + category: 'Best Practices', + recommended: 'error', + description: + 'Ensures consistent usage of AST_NODE_TYPES & AST_TOKEN_TYPES enums.', + }, + messages: { + preferEnum: 'Prefer {{ enumName }}.{{ literal }} over raw literal', + }, + fixable: 'code', + schema: [], + }, + defaultOptions: [], + create(context) { + const report = ( + enumName: 'AST_NODE_TYPES' | 'AST_TOKEN_TYPES', + literal: TSESTree.StringLiteral, + ): void => + context.report({ + data: { enumName, literal: literal.value }, + messageId: 'preferEnum', + node: literal, + fix: fixer => + fixer.replaceText(literal, `${enumName}.${literal.value}`), + }); + + return { + Literal(node: TSESTree.Literal): void { + if ( + node.parent?.type === AST_NODE_TYPES.TSEnumMember && + node.parent.parent?.type === AST_NODE_TYPES.TSEnumDeclaration && + ['AST_NODE_TYPES', 'AST_TOKEN_TYPES'].includes( + node.parent.parent.id.name, + ) + ) { + return; + } + + if (!isStringLiteral(node)) { + return; + } + + const value = node.value; + + if (Object.prototype.hasOwnProperty.call(AST_NODE_TYPES, value)) { + report('AST_NODE_TYPES', node); + } + + if (Object.prototype.hasOwnProperty.call(AST_TOKEN_TYPES, value)) { + report('AST_TOKEN_TYPES', node); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts new file mode 100644 index 000000000000..52cab8b69c08 --- /dev/null +++ b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts @@ -0,0 +1,50 @@ +import rule from '../../src/rules/prefer-ast-types-enum'; +import { RuleTester, batchedSingleLineTests } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', + parserOptions: { + sourceType: 'module', + }, +}); + +ruleTester.run('prefer-ast-types-enum', rule, { + valid: [ + 'node.type === "constructor"', + 'node.type === AST_NODE_TYPES.Literal', + 'node.type === AST_TOKEN_TYPES.Keyword', + 'node.type === 1', + ` + enum MY_ENUM { + Literal = 1 + } + `, + ` + enum AST_NODE_TYPES { + Literal = 'Literal' + } + `, + ], + invalid: batchedSingleLineTests({ + code: ` +node.type === 'Literal' +node.type === 'Keyword' + `, + output: ` +node.type === AST_NODE_TYPES.Literal +node.type === AST_TOKEN_TYPES.Keyword + `, + errors: [ + { + data: { enumName: 'AST_NODE_TYPES', literal: 'Literal' }, + messageId: 'preferEnum', + line: 2, + }, + { + data: { enumName: 'AST_TOKEN_TYPES', literal: 'Keyword' }, + messageId: 'preferEnum', + line: 3, + }, + ], + }), +}); From afa7900285ad6d31d2acaff0107fbd19bad4ff06 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 25 Jan 2020 15:26:09 +1300 Subject: [PATCH 22/30] chore: enable `prefer-ast-types-enum` internal rule (#1514) --- .eslintrc.js | 1 + .../src/rules/prefer-ast-types-enum.ts | 4 +- .../tests/rules/prefer-ast-types-enum.test.ts | 8 ++- .../eslint-plugin/src/rules/ban-ts-comment.ts | 3 +- .../eslint-plugin/src/rules/ban-ts-ignore.ts | 3 +- .../src/rules/indent-new-do-not-use/index.ts | 2 +- .../src/rules/no-inferrable-types.ts | 2 + .../eslint-plugin/src/rules/no-type-alias.ts | 1 + .../src/rules/no-unused-vars-experimental.ts | 2 + .../src/rules/triple-slash-reference.ts | 7 ++- .../tests/rules/ban-types.test.ts | 9 +++ .../tests/rules/indent/indent-eslint.test.ts | 39 ++++++++---- .../tests/rules/indent/indent.test.ts | 63 ++++++++++--------- .../rules/no-unused-vars-experimental.test.ts | 7 +++ .../rules/no-useless-constructor.test.ts | 3 +- .../experimental-utils/src/ts-eslint/Scope.ts | 7 ++- packages/parser/src/parser.ts | 2 +- packages/parser/tests/lib/basics.ts | 9 ++- .../tests/ast-alignment/utils.ts | 14 ++--- .../tests/lib/visitor-keys.ts | 2 +- 20 files changed, 122 insertions(+), 66 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 3271a33e83ed..39ca61de5168 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -124,6 +124,7 @@ module.exports = { // Internal repo rules // '@typescript-eslint/internal/no-typescript-default-import': 'error', + '@typescript-eslint/internal/prefer-ast-types-enum': 'error', }, parserOptions: { sourceType: 'module', diff --git a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts index 09398ea11dff..8a5ec63bb4eb 100755 --- a/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts +++ b/packages/eslint-plugin-internal/src/rules/prefer-ast-types-enum.ts @@ -1,15 +1,15 @@ import { AST_NODE_TYPES, AST_TOKEN_TYPES, - ESLintUtils, TSESTree, } from '@typescript-eslint/experimental-utils'; +import { createRule } from '../util'; const isStringLiteral = ( node: TSESTree.Literal, ): node is TSESTree.StringLiteral => typeof node.value === 'string'; -export = ESLintUtils.RuleCreator(name => name)({ +export default createRule({ name: __filename, meta: { type: 'problem', diff --git a/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts index 52cab8b69c08..2688e035b59c 100644 --- a/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts +++ b/packages/eslint-plugin-internal/tests/rules/prefer-ast-types-enum.test.ts @@ -1,3 +1,7 @@ +import { + AST_NODE_TYPES, + AST_TOKEN_TYPES, +} from '@typescript-eslint/experimental-utils'; import rule from '../../src/rules/prefer-ast-types-enum'; import { RuleTester, batchedSingleLineTests } from '../RuleTester'; @@ -36,12 +40,12 @@ node.type === AST_TOKEN_TYPES.Keyword `, errors: [ { - data: { enumName: 'AST_NODE_TYPES', literal: 'Literal' }, + data: { enumName: 'AST_NODE_TYPES', literal: AST_NODE_TYPES.Literal }, messageId: 'preferEnum', line: 2, }, { - data: { enumName: 'AST_TOKEN_TYPES', literal: 'Keyword' }, + data: { enumName: 'AST_TOKEN_TYPES', literal: AST_TOKEN_TYPES.Keyword }, messageId: 'preferEnum', line: 3, }, diff --git a/packages/eslint-plugin/src/rules/ban-ts-comment.ts b/packages/eslint-plugin/src/rules/ban-ts-comment.ts index 6370ef029f58..54e2394415bb 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-comment.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-comment.ts @@ -1,3 +1,4 @@ +import { AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; interface Options { @@ -60,7 +61,7 @@ export default util.createRule<[Options], MessageIds>({ const comments = sourceCode.getAllComments(); comments.forEach(comment => { - if (comment.type !== 'Line') { + if (comment.type !== AST_TOKEN_TYPES.Line) { return; } diff --git a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts index a00b4a4f67d0..7551df8d0224 100644 --- a/packages/eslint-plugin/src/rules/ban-ts-ignore.ts +++ b/packages/eslint-plugin/src/rules/ban-ts-ignore.ts @@ -1,3 +1,4 @@ +import { AST_TOKEN_TYPES } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; export default util.createRule({ @@ -27,7 +28,7 @@ export default util.createRule({ const comments = sourceCode.getAllComments(); comments.forEach(comment => { - if (comment.type !== 'Line') { + if (comment.type !== AST_TOKEN_TYPES.Line) { return; } if (tsIgnoreRegExp.test(comment.value)) { diff --git a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts index 6427439e7b81..923423dbc146 100644 --- a/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts +++ b/packages/eslint-plugin/src/rules/indent-new-do-not-use/index.ts @@ -245,7 +245,7 @@ type MessageIds = 'wrongIndentation'; type AppliedOptions = ExcludeKeys< // slight hack to make interface work with Record RequireKeys, keyof IndentConfig>, - 'VariableDeclarator' + AST_NODE_TYPES.VariableDeclarator > & { VariableDeclarator: 'off' | VariableDeclaratorObj; }; diff --git a/packages/eslint-plugin/src/rules/no-inferrable-types.ts b/packages/eslint-plugin/src/rules/no-inferrable-types.ts index 057958da0d4c..898a3294fd7a 100644 --- a/packages/eslint-plugin/src/rules/no-inferrable-types.ts +++ b/packages/eslint-plugin/src/rules/no-inferrable-types.ts @@ -125,6 +125,7 @@ export default util.createRule({ case AST_NODE_TYPES.TSBooleanKeyword: return ( hasUnaryPrefix(init, '!') || + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum isFunctionCall(init, 'Boolean') || isLiteral(init, 'boolean') ); @@ -146,6 +147,7 @@ export default util.createRule({ case AST_NODE_TYPES.TSStringKeyword: return ( + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum isFunctionCall(init, 'String') || isLiteral(init, 'string') || init.type === AST_NODE_TYPES.TemplateLiteral diff --git a/packages/eslint-plugin/src/rules/no-type-alias.ts b/packages/eslint-plugin/src/rules/no-type-alias.ts index d8e22e9d2196..597127561638 100644 --- a/packages/eslint-plugin/src/rules/no-type-alias.ts +++ b/packages/eslint-plugin/src/rules/no-type-alias.ts @@ -260,6 +260,7 @@ export default util.createRule({ // tuple types checkAndReport(allowTupleTypes!, isTopLevel, type, 'Tuple Types'); } else if ( + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type.node.type.endsWith('Keyword') || aliasTypes.has(type.node.type) ) { diff --git a/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts b/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts index 0c1ac212380a..920a23199251 100644 --- a/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts +++ b/packages/eslint-plugin/src/rules/no-unused-vars-experimental.ts @@ -141,6 +141,7 @@ export default util.createRule({ case ts.SyntaxKind.ImportSpecifier: // a namespace import is NOT used, but the default import is used case ts.SyntaxKind.NamespaceImport: + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum report('Import'); break; @@ -160,6 +161,7 @@ export default util.createRule({ break; case ts.SyntaxKind.PropertyDeclaration: + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum report('Property'); break; diff --git a/packages/eslint-plugin/src/rules/triple-slash-reference.ts b/packages/eslint-plugin/src/rules/triple-slash-reference.ts index 6669fe940bcb..1bb16c229a11 100644 --- a/packages/eslint-plugin/src/rules/triple-slash-reference.ts +++ b/packages/eslint-plugin/src/rules/triple-slash-reference.ts @@ -1,5 +1,8 @@ +import { + AST_TOKEN_TYPES, + TSESTree, +} from '@typescript-eslint/experimental-utils'; import * as util from '../util'; -import { TSESTree } from '@typescript-eslint/experimental-utils'; type Options = [ { @@ -92,7 +95,7 @@ export default util.createRule({ const commentsBefore = sourceCode.getCommentsBefore(programNode); commentsBefore.forEach(comment => { - if (comment.type !== 'Line') { + if (comment.type !== AST_TOKEN_TYPES.Line) { return; } const referenceResult = referenceRegExp.exec(comment.value); diff --git a/packages/eslint-plugin/tests/rules/ban-types.test.ts b/packages/eslint-plugin/tests/rules/ban-types.test.ts index 416c71a1e7a9..bbf2ab29db48 100644 --- a/packages/eslint-plugin/tests/rules/ban-types.test.ts +++ b/packages/eslint-plugin/tests/rules/ban-types.test.ts @@ -96,6 +96,7 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -112,6 +113,7 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -128,6 +130,7 @@ ruleTester.run('ban-types', rule, { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -172,6 +175,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -181,6 +185,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -199,6 +204,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -223,6 +229,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -232,6 +239,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, @@ -241,6 +249,7 @@ class Foo extends Bar implements Baz { { messageId: 'bannedTypeMessage', data: { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum name: 'String', customMessage: ' Use string instead.', }, diff --git a/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts b/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts index e27a037074f2..d726a5e2c95f 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent-eslint.test.ts @@ -4586,7 +4586,7 @@ ruleTester.run('indent', rule, { ? bar : baz `, - options: [4, { ignoredNodes: ['ConditionalExpression'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.ConditionalExpression] }], }, { code: unIndent` @@ -4596,7 +4596,7 @@ ruleTester.run('indent', rule, { } } `, - options: [4, { ignoredNodes: ['ClassBody'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.ClassBody] }], }, { code: unIndent` @@ -4608,7 +4608,12 @@ ruleTester.run('indent', rule, { `, options: [ 4, - { ignoredNodes: ['ClassBody', AST_NODE_TYPES.BlockStatement] }, + { + ignoredNodes: [ + AST_NODE_TYPES.ClassBody, + AST_NODE_TYPES.BlockStatement, + ], + }, ], }, { @@ -4630,7 +4635,7 @@ ruleTester.run('indent', rule, { foo .bar `, - options: [4, { ignoredNodes: ['MemberExpression'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.MemberExpression] }], }, { code: unIndent` @@ -4655,7 +4660,7 @@ ruleTester.run('indent', rule, { `, - options: [4, { ignoredNodes: ['JSXOpeningElement'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.JSXOpeningElement] }], }, { code: unIndent` @@ -4666,7 +4671,12 @@ ruleTester.run('indent', rule, { `, options: [ 4, - { ignoredNodes: ['JSXElement', AST_NODE_TYPES.JSXOpeningElement] }, + { + ignoredNodes: [ + AST_NODE_TYPES.JSXElement, + AST_NODE_TYPES.JSXOpeningElement, + ], + }, ], }, { @@ -4694,7 +4704,7 @@ ruleTester.run('indent', rule, { valueIfFalse ); `, - options: [4, { ignoredNodes: ['ConditionalExpression'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.ConditionalExpression] }], }, { code: unIndent` @@ -4722,7 +4732,7 @@ ruleTester.run('indent', rule, { ? qux : boop `, - options: [4, { ignoredNodes: ['ConditionalExpression'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.ConditionalExpression] }], }, { code: unIndent` @@ -4733,7 +4743,7 @@ ruleTester.run('indent', rule, { } FROM THE_DATABASE \` `, - options: [4, { ignoredNodes: ['TemplateLiteral'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.TemplateLiteral] }], }, { code: unIndent` @@ -4743,7 +4753,7 @@ ruleTester.run('indent', rule, { Text `, - options: [4, { ignoredNodes: ['JSXOpeningElement'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.JSXOpeningElement] }], }, { code: unIndent` @@ -4760,7 +4770,7 @@ ruleTester.run('indent', rule, { y = 2; var z; `, - options: ['tab', { ignoredNodes: ['VariableDeclarator'] }], + options: ['tab', { ignoredNodes: [AST_NODE_TYPES.VariableDeclarator] }], }, { code: unIndent` @@ -4771,7 +4781,10 @@ ruleTester.run('indent', rule, { `, options: [ 'tab', - { ArrayExpression: 'first', ignoredNodes: ['CallExpression'] }, + { + ArrayExpression: 'first', + ignoredNodes: [AST_NODE_TYPES.CallExpression], + }, ], }, { @@ -9453,7 +9466,7 @@ ruleTester.run('indent', rule, { } } `, - options: [4, { ignoredNodes: ['ClassBody'] }], + options: [4, { ignoredNodes: [AST_NODE_TYPES.ClassBody] }], errors: expectedErrors([3, 4, 0, AST_TOKEN_TYPES.Identifier]), }, { diff --git a/packages/eslint-plugin/tests/rules/indent/indent.test.ts b/packages/eslint-plugin/tests/rules/indent/indent.test.ts index fca5629655b7..fe88d3de17a0 100644 --- a/packages/eslint-plugin/tests/rules/indent/indent.test.ts +++ b/packages/eslint-plugin/tests/rules/indent/indent.test.ts @@ -1,4 +1,7 @@ -import { TSESLint } from '@typescript-eslint/experimental-utils'; +import { + AST_NODE_TYPES, + TSESLint, +} from '@typescript-eslint/experimental-utils'; import { RuleTester } from '../../RuleTester'; import rule from '../../../src/rules/indent'; import { @@ -18,7 +21,7 @@ function nonTsTestCase(example: TemplateStringsArray): string { const individualNodeTests = [ { - node: 'ClassDeclaration', + node: AST_NODE_TYPES.ClassDeclaration, code: [ ` abstract class Foo { @@ -31,7 +34,7 @@ abstract class Foo { ], }, { - node: 'TSAbstractClassProperty', + node: AST_NODE_TYPES.TSAbstractClassProperty, code: [ ` class Foo { @@ -45,7 +48,7 @@ class Foo { ], }, { - node: 'TSAbstractMethodDefinition', + node: AST_NODE_TYPES.TSAbstractMethodDefinition, code: [ ` class Foo { @@ -59,7 +62,7 @@ class Foo { ], }, { - node: 'TSArrayType', + node: AST_NODE_TYPES.TSArrayType, code: [ ` type foo = ArrType[]; @@ -67,7 +70,7 @@ type foo = ArrType[]; ], }, { - node: 'TSAsExpression', + node: AST_NODE_TYPES.TSAsExpression, code: [ ` const foo = {} as { @@ -92,7 +95,7 @@ const foo = {} as ], }, { - node: 'TSConditionalType', + node: AST_NODE_TYPES.TSConditionalType, code: [ nonTsTestCase` const Foo = T @@ -129,7 +132,7 @@ type Foo = T extends string ? { ], }, { - node: 'TSConstructorType', + node: AST_NODE_TYPES.TSConstructorType, code: [ ` type Constructor = new ( @@ -153,7 +156,7 @@ interface Foo { ], }, { - node: 'TSDeclareFunction', + node: AST_NODE_TYPES.TSDeclareFunction, code: [ ` declare function foo() : { @@ -164,7 +167,7 @@ declare function foo() : { ], }, { - node: 'TSEmptyBodyFunctionExpression', + node: AST_NODE_TYPES.TSEmptyBodyFunctionExpression, code: [ ` class Foo { @@ -190,7 +193,7 @@ enum Foo { ], }, { - node: 'TSExportAssignment', + node: AST_NODE_TYPES.TSExportAssignment, code: [ ` export = { @@ -201,7 +204,7 @@ export = { ], }, { - node: 'TSFunctionType', + node: AST_NODE_TYPES.TSFunctionType, code: [ ` const foo: () => void = () => ({ @@ -242,7 +245,7 @@ const foo: ({ ], }, { - node: 'TSImportType', + node: AST_NODE_TYPES.TSImportType, code: [ ` const foo: import("bar") = { @@ -261,7 +264,7 @@ const foo: import( ], }, { - node: 'TSIndexedAccessType', + node: AST_NODE_TYPES.TSIndexedAccessType, code: [ nonTsTestCase` const Foo = Bar[ @@ -276,7 +279,7 @@ type Foo = Bar[ ], }, { - node: 'TSIndexSignature', + node: AST_NODE_TYPES.TSIndexSignature, code: [ ` type Foo = { @@ -289,7 +292,7 @@ type Foo = { ], }, { - node: 'TSInferType', + node: AST_NODE_TYPES.TSInferType, code: [ ` type Foo = T extends string @@ -315,7 +318,7 @@ interface Foo { ], }, { - node: 'TSInterfaceHeritage', + node: AST_NODE_TYPES.TSInterfaceHeritage, code: [ ` interface Foo extends Bar { @@ -329,7 +332,7 @@ interface Foo extends Bar { ], }, { - node: 'TSIntersectionType', + node: AST_NODE_TYPES.TSIntersectionType, code: [ ` type Foo = "string" & { @@ -355,7 +358,7 @@ import foo = require( }, // TSLiteralType { - node: 'TSMappedType', + node: AST_NODE_TYPES.TSMappedType, code: [ ` type Partial = { @@ -383,7 +386,7 @@ type Partial = { ], }, { - node: 'TSMethodSignature', + node: AST_NODE_TYPES.TSMethodSignature, code: [ ` interface Foo { @@ -411,7 +414,7 @@ declare module "foo" { ], }, { - node: 'TSNonNullExpression', + node: AST_NODE_TYPES.TSNonNullExpression, code: [ nonTsTestCase` const foo = a @@ -426,7 +429,7 @@ const foo = a! ], }, { - node: 'TSParameterProperty', + node: AST_NODE_TYPES.TSParameterProperty, code: [ ` class Foo { @@ -444,7 +447,7 @@ class Foo { ], }, { - node: 'TSParenthesizedType', + node: AST_NODE_TYPES.TSParenthesizedType, code: [ ` const x: Array<( @@ -468,7 +471,7 @@ const x: Array<( }, // TSPlusToken - tested in TSMappedType { - node: 'TSPropertySignature', + node: AST_NODE_TYPES.TSPropertySignature, code: [ ` interface Foo { @@ -482,7 +485,7 @@ interface Foo { ], }, { - node: 'TSQualifiedName', + node: AST_NODE_TYPES.TSQualifiedName, code: [ ` const a: Foo.bar = { @@ -510,7 +513,7 @@ const a: Foo. }, // TSQuestionToken - tested in TSMappedType { - node: 'TSRestType', + node: AST_NODE_TYPES.TSRestType, code: [ ` type foo = [ @@ -521,7 +524,7 @@ type foo = [ ], }, { - node: 'TSThisType', + node: AST_NODE_TYPES.TSThisType, code: [ ` declare class MyArray extends Array { @@ -534,7 +537,7 @@ declare class MyArray extends Array { ], }, { - node: 'TSTupleType', + node: AST_NODE_TYPES.TSTupleType, code: [ nonTsTestCase` const foo = [ @@ -569,7 +572,7 @@ type foo = [ // TSTypeAnnotation - tested in everything.. // TSTypeLiteral - tested in everything.. { - node: 'TSTypeOperator', + node: AST_NODE_TYPES.TSTypeOperator, code: [ ` type T = keyof { @@ -600,7 +603,7 @@ function foo< }, // TSTypeReference - tested in everything.. { - node: 'TSUnionType', + node: AST_NODE_TYPES.TSUnionType, code: [ ` type Foo = string | { diff --git a/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts b/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts index 6cb2a24e5a3a..335b3986437e 100644 --- a/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts +++ b/packages/eslint-plugin/tests/rules/no-unused-vars-experimental.test.ts @@ -543,6 +543,7 @@ export class Foo { messageId: 'unusedWithIgnorePattern', data: { name: 'foo', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Property', pattern: DEFAULT_IGNORED_REGEX, }, @@ -970,6 +971,7 @@ export function foo([[a]], used) { messageId: 'unusedWithIgnorePattern', data: { name: 'foo', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, @@ -1044,6 +1046,7 @@ console.log(named); messageId: 'unusedWithIgnorePattern', data: { name: 'defaultImp', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, @@ -1063,6 +1066,7 @@ console.log(named); messageId: 'unusedWithIgnorePattern', data: { name: 'defaultImp', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, @@ -1082,6 +1086,7 @@ console.log(defaultImp); messageId: 'unusedWithIgnorePattern', data: { name: 'named', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, @@ -1101,6 +1106,7 @@ console.log(defaultImp); messageId: 'unusedWithIgnorePattern', data: { name: 'named', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, @@ -1120,6 +1126,7 @@ console.log(named1); messageId: 'unusedWithIgnorePattern', data: { name: 'named2', + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum type: 'Import', pattern: DEFAULT_IGNORED_REGEX, }, diff --git a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts index 2a5d97a4cf88..49b362f4d9f7 100644 --- a/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts +++ b/packages/eslint-plugin/tests/rules/no-useless-constructor.test.ts @@ -1,3 +1,4 @@ +import { AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; import rule from '../../src/rules/no-useless-constructor'; import { RuleTester } from '../RuleTester'; @@ -13,7 +14,7 @@ const ruleTester = new RuleTester({ // eslint-disable-next-line @typescript-eslint/no-explicit-any const error: any = { message: 'Useless constructor.', - type: 'MethodDefinition', + type: AST_NODE_TYPES.MethodDefinition, }; ruleTester.run('no-useless-constructor', rule, { diff --git a/packages/experimental-utils/src/ts-eslint/Scope.ts b/packages/experimental-utils/src/ts-eslint/Scope.ts index 6a85042f2b89..03c6bc663952 100644 --- a/packages/experimental-utils/src/ts-eslint/Scope.ts +++ b/packages/experimental-utils/src/ts-eslint/Scope.ts @@ -65,7 +65,12 @@ namespace Scope { } export type DefinitionType = - | { type: 'CatchClause'; node: TSESTree.CatchClause; parent: null } + | { + // eslint-disable-next-line @typescript-eslint/internal/prefer-ast-types-enum + type: 'CatchClause'; + node: TSESTree.CatchClause; + parent: null; + } | { type: 'ClassName'; node: TSESTree.ClassDeclaration | TSESTree.ClassExpression; diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index 46878a9cdea7..86469cea2552 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -99,7 +99,7 @@ export function parseForESLint( enter(node) { switch (node.type) { // Function#body cannot be null in ESTree spec. - case 'FunctionExpression': + case AST_NODE_TYPES.FunctionExpression: if (!node.body) { // eslint-disable-next-line @typescript-eslint/no-explicit-any node.type = `TSEmptyBody${node.type}` as any; diff --git a/packages/parser/tests/lib/basics.ts b/packages/parser/tests/lib/basics.ts index c06e8e57be12..b1ab1d9a96a8 100644 --- a/packages/parser/tests/lib/basics.ts +++ b/packages/parser/tests/lib/basics.ts @@ -1,4 +1,7 @@ -import { TSESLint } from '@typescript-eslint/experimental-utils'; +import { + AST_NODE_TYPES, + TSESLint, +} from '@typescript-eslint/experimental-utils'; import fs from 'fs'; import glob from 'glob'; import * as parser from '../../src/parser'; @@ -61,7 +64,7 @@ export const Price: React.SFC = function Price(props) {} endLine: 2, line: 2, message: 'called on React.SFC', - nodeType: 'TSTypeReference', + nodeType: AST_NODE_TYPES.TSTypeReference, ruleId: 'test', severity: 2, }, @@ -71,7 +74,7 @@ export const Price: React.SFC = function Price(props) {} endLine: 2, line: 2, message: 'called on PriceProps', - nodeType: 'TSTypeReference', + nodeType: AST_NODE_TYPES.TSTypeReference, ruleId: 'test', severity: 2, }, diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 1ad1ba3bba17..002a4c66dcbd 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -157,7 +157,7 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { * ts-estree: TSAbstractClassProperty */ if (node.abstract) { - node.type = 'TSAbstractClassProperty'; + node.type = AST_NODE_TYPES.TSAbstractClassProperty; delete node.abstract; } /** @@ -170,20 +170,20 @@ export function preprocessBabylonAST(ast: BabelTypes.File): any { } }, TSExpressionWithTypeArguments(node, parent: any) { - if (parent.type === 'TSInterfaceDeclaration') { - node.type = 'TSInterfaceHeritage'; + if (parent.type === AST_NODE_TYPES.TSInterfaceDeclaration) { + node.type = AST_NODE_TYPES.TSInterfaceHeritage; } else if ( - parent.type === 'ClassExpression' || - parent.type === 'ClassDeclaration' + parent.type === AST_NODE_TYPES.ClassExpression || + parent.type === AST_NODE_TYPES.ClassDeclaration ) { - node.type = 'TSClassImplements'; + node.type = AST_NODE_TYPES.TSClassImplements; } }, /** * @see https://github.com/prettier/prettier/issues/5817 */ FunctionExpression(node: any, parent: any) { - if (parent.typeParameters && parent.type === 'Property') { + if (parent.typeParameters && parent.type === AST_NODE_TYPES.Property) { node.typeParameters = parent.typeParameters; delete parent.typeParameters; } diff --git a/packages/typescript-estree/tests/lib/visitor-keys.ts b/packages/typescript-estree/tests/lib/visitor-keys.ts index 6d16e90d00bf..aceb5b75eb5c 100644 --- a/packages/typescript-estree/tests/lib/visitor-keys.ts +++ b/packages/typescript-estree/tests/lib/visitor-keys.ts @@ -6,7 +6,7 @@ import { visitorKeys } from '../../src/visitor-keys'; //------------------------------------------------------------------------------ const astTypes = Object.keys(AST_NODE_TYPES); -astTypes.push('TSEmptyBodyFunctionExpression'); // node created by parser.ts +astTypes.push(AST_NODE_TYPES.TSEmptyBodyFunctionExpression); // node created by parser.ts //------------------------------------------------------------------------------ // Tests From 67784d680564139f4b959d549736d54beeaaa08d Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Sat, 25 Jan 2020 11:35:09 -0500 Subject: [PATCH 23/30] docs: extra 'a' in CONTRIBUTING.md (#1518) --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bb3db1264208..1df1de8f857d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,7 +76,7 @@ And `` is the name of the package you have made changes within (`eslint And `` is a succinct title for the PR. -Within the body of your PR, make sure you reference the issue that you have worked on, as well as a pointing out anything of note you wish us to look at during our review. +Within the body of your PR, make sure you reference the issue that you have worked on, as well as pointing out anything of note you wish us to look at during our review. Make sure you use the "Fixes #xxx" format to reference issues, so that GitHub automatically closes the issues when we merge the PR. Also note that if you are fixing multiple issues at once, you can only reference one issue per line, and must put one "Fixes #xxx" per issue number. From b515e47af2bc914c7ebcfa4be813409dcd86b1c3 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 27 Jan 2020 09:00:52 +1300 Subject: [PATCH 24/30] fix(experimental-utils): widen type of `settings` property (#1527) --- packages/experimental-utils/src/ts-eslint/Rule.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 4623e8758ae0..6e7733da663a 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -179,7 +179,7 @@ interface RuleContext< * The shared settings from configuration. * We do not have any shared settings in this plugin. */ - settings: {}; + settings: Record; /** * The name of the parser from configuration. */ From 6d1d2a22958fb565277b8dedfe1a09161b8deab0 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 26 Jan 2020 21:03:03 +0100 Subject: [PATCH 25/30] test: fix coverage reports from codecov (#1528) * test: attempt to fix coverage reports from codecov * test: drop CI_BUILD_ID as is already set correctly --- azure-pipelines.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4f941eba01df..172a64beab75 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,8 +44,9 @@ jobs: yarn integration-tests displayName: 'Run integrations tests' - - script: | - bash <(curl -s https://codecov.io/bash) -t $(CODECOV_TOKEN) + - bash: bash <(curl -s https://codecov.io/bash) -P "$SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" + env: + CODECOV_TOKEN: $(CODECOV_TOKEN) displayName: 'Publish code coverage report' - job: unit_tests_on_other_node_versions From c8dfac3d2f066e50fa9d2b5a86beffdaafddb643 Mon Sep 17 00:00:00 2001 From: Armano Date: Sun, 26 Jan 2020 21:41:03 +0100 Subject: [PATCH 26/30] fix(typescript-estree): error on unexpected jsdoc nodes (#1525) --- packages/typescript-estree/src/convert.ts | 13 + .../tests/lib/__snapshots__/convert.ts.snap | 310 +----------------- .../typescript-estree/tests/lib/convert.ts | 53 ++- 3 files changed, 71 insertions(+), 305 deletions(-) diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 1f079b710552..9a9be6bcd330 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -379,7 +379,19 @@ export class Converter { * property instead of a kind property. Recursively copies all children. */ private deeplyCopy(node: TSNode): any { + if ( + node.kind >= SyntaxKind.FirstJSDocNode && + node.kind <= SyntaxKind.LastJSDocNode + ) { + throw createError( + this.ast, + node.pos, + 'JSDoc types can only be used inside documentation comments.', + ); + } + const customType = `TS${SyntaxKind[node.kind]}` as AST_NODE_TYPES; + /** * If the "errorOnUnknownASTType" option is set to true, throw an error, * otherwise fallback to just including the unknown type as-is. @@ -387,6 +399,7 @@ export class Converter { if (this.options.errorOnUnknownASTType && !AST_NODE_TYPES[customType]) { throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`); } + const result = this.createNode(node, { type: customType, }); diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap index b7266a75dd07..82c53ddf8cb9 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.ts.snap @@ -179,24 +179,6 @@ exports[`convert deeplyCopy should convert node correctly 1`] = ` Object { "body": Array [ Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 1, - }, - "start": Object { - "column": 5, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 5, - 8, - ], - "type": "Identifier", - }, "loc": Object { "end": Object { "column": 35, @@ -207,294 +189,34 @@ Object { "line": 1, }, }, - "range": Array [ - 0, - 35, - ], - "type": "TSTypeAliasDeclaration", - "typeAnnotation": Object { + "modifiers": undefined, + "name": Object { + "escapedText": "foo", "loc": Object { "end": Object { - "column": 35, + "column": 8, "line": 1, }, "start": Object { - "column": 11, + "column": 5, "line": 1, }, }, "range": Array [ - 11, - 35, + 5, + 8, ], "transformFlags": 0, - "type": "TSJSDocNullableType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 11, - "line": 1, - }, - }, - "range": Array [ - 11, - 35, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 35, - ], - "type": "TSUnionType", - "types": Array [ - Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "range": Array [ - 12, - 18, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 1, - }, - "start": Object { - "column": 12, - "line": 1, - }, - }, - "name": "foo", - "range": Array [ - 12, - 15, - ], - "type": "Identifier", - }, - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 18, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "range": Array [ - 16, - 17, - ], - "type": "TSTypeReference", - "typeName": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 1, - }, - "start": Object { - "column": 16, - "line": 1, - }, - }, - "name": "T", - "range": Array [ - 16, - 17, - ], - "type": "Identifier", - }, - "typeParameters": undefined, - }, - ], - "range": Array [ - 15, - 18, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 35, - ], - "transformFlags": 0, - "type": "TSJSDocNullableType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 35, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 35, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 35, - ], - "transformFlags": 0, - "type": "TSJSDocNullableType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 21, - "line": 1, - }, - }, - "range": Array [ - 21, - 34, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 34, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 34, - ], - "type": "TSParenthesizedType", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 23, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 23, - 33, - ], - "returnType": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 26, - "line": 1, - }, - }, - "range": Array [ - 26, - 33, - ], - "type": "TSTypeAnnotation", - "typeAnnotation": Object { - "loc": Object { - "end": Object { - "column": 33, - "line": 1, - }, - "start": Object { - "column": 29, - "line": 1, - }, - }, - "range": Array [ - 29, - 33, - ], - "type": "TSVoidKeyword", - }, - }, - "type": "TSFunctionType", - }, - }, - }, - }, - }, - }, - ], - }, - }, + "type": "TSUnparsedPrologue", }, + "range": Array [ + 0, + 35, + ], + "transformFlags": 0, + "type": "TSUnparsedPrologue", + "typeAnnotation": null, + "typeParameters": null, }, ], "loc": Object { diff --git a/packages/typescript-estree/tests/lib/convert.ts b/packages/typescript-estree/tests/lib/convert.ts index e4217be7d222..208513d1aed0 100644 --- a/packages/typescript-estree/tests/lib/convert.ts +++ b/packages/typescript-estree/tests/lib/convert.ts @@ -17,6 +17,13 @@ describe('convert', () => { it('deeplyCopy should convert node correctly', () => { const ast = convertCode('type foo = ?foo | ?(() => void)?'); + function fakeUnknownKind(node: ts.Node): void { + ts.forEachChild(node, fakeUnknownKind); + node.kind = ts.SyntaxKind.UnparsedPrologue; + } + + ts.forEachChild(ast, fakeUnknownKind); + const instance = new Converter(ast, { errorOnUnknownASTType: false, useJSXTextNode: false, @@ -32,8 +39,9 @@ describe('convert', () => { errorOnUnknownASTType: false, useJSXTextNode: false, shouldPreserveNodeMaps: false, - }); - expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }) as any; + + expect(instance.deeplyCopy(ast.statements[0])).toMatchSnapshot(); }); it('deeplyCopy should convert node with type parameters correctly', () => { @@ -43,8 +51,9 @@ describe('convert', () => { errorOnUnknownASTType: false, useJSXTextNode: false, shouldPreserveNodeMaps: false, - }); - expect((instance as any).deeplyCopy(ast.statements[0])).toMatchSnapshot(); + }) as any; + + expect(instance.deeplyCopy(ast.statements[0])).toMatchSnapshot(); }); it('deeplyCopy should convert node with type arguments correctly', () => { @@ -54,9 +63,10 @@ describe('convert', () => { errorOnUnknownASTType: false, useJSXTextNode: false, shouldPreserveNodeMaps: false, - }); + }) as any; + expect( - (instance as any).deeplyCopy((ast.statements[0] as any).expression), + instance.deeplyCopy((ast.statements[0] as any).expression), ).toMatchSnapshot(); }); @@ -67,8 +77,8 @@ describe('convert', () => { errorOnUnknownASTType: false, useJSXTextNode: false, shouldPreserveNodeMaps: false, - }); - expect((instance as any).deeplyCopy(ast)).toMatchSnapshot(); + }) as any; + expect(instance.deeplyCopy(ast)).toMatchSnapshot(); }); it('deeplyCopy should fail on unknown node', () => { @@ -78,9 +88,10 @@ describe('convert', () => { errorOnUnknownASTType: true, useJSXTextNode: false, shouldPreserveNodeMaps: false, - }); - expect(() => instance.convertProgram()).toThrow( - 'Unknown AST_NODE_TYPE: "TSJSDocNullableType"', + }) as any; + + expect(() => instance.deeplyCopy(ast)).toThrow( + 'Unknown AST_NODE_TYPE: "TSSourceFile"', ); }); @@ -225,4 +236,24 @@ describe('convert', () => { range: [0, 20], }); }); + + it('should throw error on jsDoc node', () => { + const jsDocCode = [ + 'type foo = ?foo | ?(() => void)?', + 'var a: function(b): c;', + ]; + + for (const code of jsDocCode) { + const ast = convertCode(code); + + const instance = new Converter(ast, { + errorOnUnknownASTType: false, + useJSXTextNode: false, + shouldPreserveNodeMaps: false, + }); + expect(() => instance.convertProgram()).toThrow( + 'JSDoc types can only be used inside documentation comments.', + ); + } + }); }); From f991764fad7d56e85a789ffa191919b0895d781a Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Sun, 26 Jan 2020 14:04:07 -0800 Subject: [PATCH 27/30] chore(eslint-plugin): refactor explicit return type rules to share code (#1493) Co-authored-by: Armano --- .vscode/settings.json | 10 +- .../rules/explicit-function-return-type.ts | 326 ++------------- .../rules/explicit-module-boundary-types.ts | 385 +++--------------- packages/eslint-plugin/src/util/astUtils.ts | 45 +- .../src/util/explicitReturnTypeUtils.ts | 314 ++++++++++++++ .../explicit-module-boundary-types.test.ts | 17 +- 6 files changed, 452 insertions(+), 645 deletions(-) create mode 100644 packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts diff --git a/.vscode/settings.json b/.vscode/settings.json index 0174acc7be36..c03c3aac4dd4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,14 +4,8 @@ "eslint.validate": [ "javascript", "javascriptreact", - { - "language": "typescript", - "autoFix": true - }, - { - "language": "typescriptreact", - "autoFix": true - } + "typescript", + "typescriptreact" ], // When enabled, will trim trailing whitespace when saving a file. diff --git a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts index b8542098011a..b8ee7ff584b3 100644 --- a/packages/eslint-plugin/src/rules/explicit-function-return-type.ts +++ b/packages/eslint-plugin/src/rules/explicit-function-return-type.ts @@ -1,9 +1,9 @@ -import { - TSESTree, - AST_NODE_TYPES, - AST_TOKEN_TYPES, -} from '@typescript-eslint/experimental-utils'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; +import { + checkFunctionReturnType, + checkFunctionExpressionReturnType, +} from '../util/explicitReturnTypeUtils'; type Options = [ { @@ -60,303 +60,27 @@ export default util.createRule({ create(context, [options]) { const sourceCode = context.getSourceCode(); - /** - * Returns start column position - * @param node - */ - function getLocStart( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression, - ): TSESTree.LineAndColumnData { - /* highlight method name */ - const parent = node.parent; - if ( - parent && - (parent.type === AST_NODE_TYPES.MethodDefinition || - (parent.type === AST_NODE_TYPES.Property && parent.method)) - ) { - return parent.loc.start; - } - - return node.loc.start; - } - - /** - * Returns end column position - * @param node - */ - function getLocEnd( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression, - ): TSESTree.LineAndColumnData { - /* highlight `=>` */ - if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { - return sourceCode.getTokenBefore( - node.body, - token => - token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', - )!.loc.end; - } - - return sourceCode.getTokenBefore(node.body!)!.loc.end; - } - - /** - * Checks if a node is a constructor. - * @param node The node to check - */ - function isConstructor(node: TSESTree.Node | undefined): boolean { - return ( - !!node && - node.type === AST_NODE_TYPES.MethodDefinition && - node.kind === 'constructor' - ); - } - - /** - * Checks if a node is a setter. - */ - function isSetter(node: TSESTree.Node | undefined): boolean { - return ( - !!node && - (node.type === AST_NODE_TYPES.MethodDefinition || - node.type === AST_NODE_TYPES.Property) && - node.kind === 'set' - ); - } - - /** - * Checks if a node is a variable declarator with a type annotation. - * `const x: Foo = ...` - */ - function isVariableDeclaratorWithTypeAnnotation( - node: TSESTree.Node, - ): boolean { - return ( - node.type === AST_NODE_TYPES.VariableDeclarator && - !!node.id.typeAnnotation - ); - } - - /** - * Checks if a node is a class property with a type annotation. - * `public x: Foo = ...` - */ - function isClassPropertyWithTypeAnnotation(node: TSESTree.Node): boolean { - return ( - node.type === AST_NODE_TYPES.ClassProperty && !!node.typeAnnotation - ); - } - - /** - * Checks if a node belongs to: - * new Foo(() => {}) - * ^^^^^^^^ - */ - function isConstructorArgument(parent: TSESTree.Node): boolean { - return parent.type === AST_NODE_TYPES.NewExpression; - } - - /** - * Checks if a node belongs to: - * `const x: Foo = { prop: () => {} }` - * `const x = { prop: () => {} } as Foo` - * `const x = { prop: () => {} }` - */ - function isPropertyOfObjectWithType( - property: TSESTree.Node | undefined, - ): boolean { - if (!property || property.type !== AST_NODE_TYPES.Property) { - return false; - } - const objectExpr = property.parent; // this shouldn't happen, checking just in case - /* istanbul ignore if */ if ( - !objectExpr || - objectExpr.type !== AST_NODE_TYPES.ObjectExpression - ) { - return false; - } - - const parent = objectExpr.parent; // this shouldn't happen, checking just in case - /* istanbul ignore if */ if (!parent) { - return false; - } - - return ( - util.isTypeAssertion(parent) || - isClassPropertyWithTypeAnnotation(parent) || - isVariableDeclaratorWithTypeAnnotation(parent) || - isFunctionArgument(parent) - ); - } - - /** - * Checks if a function belongs to: - * `() => () => ...` - * `() => function () { ... }` - * `() => { return () => ... }` - * `() => { return function () { ... } }` - * `function fn() { return () => ... }` - * `function fn() { return function() { ... } }` - */ - function doesImmediatelyReturnFunctionExpression({ - body, - }: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression): boolean { - // Should always have a body; really checking just in case - /* istanbul ignore if */ if (!body) { - return false; - } - - // Check if body is a block with a single statement - if ( - body.type === AST_NODE_TYPES.BlockStatement && - body.body.length === 1 - ) { - const [statement] = body.body; - - // Check if that statement is a return statement with an argument - if ( - statement.type === AST_NODE_TYPES.ReturnStatement && - !!statement.argument - ) { - // If so, check that returned argument as body - body = statement.argument; - } - } - - // Check if the body being returned is a function expression - return ( - body.type === AST_NODE_TYPES.ArrowFunctionExpression || - body.type === AST_NODE_TYPES.FunctionExpression - ); - } - - /** - * Checks if a node belongs to: - * `foo(() => 1)` - */ - function isFunctionArgument( - parent: TSESTree.Node, - callee?: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, - ): boolean { - return ( - (parent.type === AST_NODE_TYPES.CallExpression || - parent.type === AST_NODE_TYPES.OptionalCallExpression) && - // make sure this isn't an IIFE - parent.callee !== callee - ); - } - - /** - * Checks if a function belongs to: - * `() => ({ action: 'xxx' }) as const` - */ - function returnsConstAssertionDirectly( - node: TSESTree.ArrowFunctionExpression, - ): boolean { - const { body } = node; - if (util.isTypeAssertion(body)) { - const { typeAnnotation } = body; - if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) { - const { typeName } = typeAnnotation; - if ( - typeName.type === AST_NODE_TYPES.Identifier && - typeName.name === 'const' - ) { - return true; - } - } - } - - return false; - } - - /** - * Checks if a function declaration/expression has a return type. - */ - function checkFunctionReturnType( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression, - ): void { - if ( - options.allowHigherOrderFunctions && - doesImmediatelyReturnFunctionExpression(node) - ) { - return; - } - - if ( - node.returnType || - isConstructor(node.parent) || - isSetter(node.parent) - ) { - return; - } - - context.report({ - node, - loc: { start: getLocStart(node), end: getLocEnd(node) }, - messageId: 'missingReturnType', - }); - } - - /** - * Checks if a function declaration/expression has a return type. - */ - function checkFunctionExpressionReturnType( - node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, - ): void { - // Should always have a parent; checking just in case - /* istanbul ignore else */ if (node.parent) { - if (options.allowTypedFunctionExpressions) { - if ( - util.isTypeAssertion(node.parent) || - isVariableDeclaratorWithTypeAnnotation(node.parent) || - isClassPropertyWithTypeAnnotation(node.parent) || - isPropertyOfObjectWithType(node.parent) || - isFunctionArgument(node.parent, node) || - isConstructorArgument(node.parent) - ) { - return; - } - } - - if ( - options.allowExpressions && - node.parent.type !== AST_NODE_TYPES.VariableDeclarator && - node.parent.type !== AST_NODE_TYPES.MethodDefinition && - node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && - node.parent.type !== AST_NODE_TYPES.ClassProperty - ) { - return; - } - } - - // https://github.com/typescript-eslint/typescript-eslint/issues/653 - if ( - node.type === AST_NODE_TYPES.ArrowFunctionExpression && - options.allowDirectConstAssertionInArrowFunctions && - returnsConstAssertionDirectly(node) - ) { - return; - } - - checkFunctionReturnType(node); - } - return { - ArrowFunctionExpression: checkFunctionExpressionReturnType, - FunctionDeclaration: checkFunctionReturnType, - FunctionExpression: checkFunctionExpressionReturnType, + 'ArrowFunctionExpression, FunctionExpression'( + node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, + ): void { + checkFunctionExpressionReturnType(node, options, sourceCode, loc => + context.report({ + node, + loc, + messageId: 'missingReturnType', + }), + ); + }, + FunctionDeclaration(node): void { + checkFunctionReturnType(node, options, sourceCode, loc => + context.report({ + node, + loc, + messageId: 'missingReturnType', + }), + ); + }, }; }, }); diff --git a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts index 7871035672f9..0bd872622f11 100644 --- a/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts +++ b/packages/eslint-plugin/src/rules/explicit-module-boundary-types.ts @@ -1,9 +1,12 @@ import { TSESTree, AST_NODE_TYPES, - AST_TOKEN_TYPES, } from '@typescript-eslint/experimental-utils'; import * as util from '../util'; +import { + checkFunctionExpressionReturnType, + checkFunctionReturnType, +} from '../util/explicitReturnTypeUtils'; type Options = [ { @@ -64,152 +67,6 @@ export default util.createRule({ create(context, [options]) { const sourceCode = context.getSourceCode(); - /** - * Returns start column position - * @param node - */ - function getLocStart( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression, - ): TSESTree.LineAndColumnData { - /* highlight method name */ - const parent = node.parent; - if ( - parent && - (parent.type === AST_NODE_TYPES.MethodDefinition || - (parent.type === AST_NODE_TYPES.Property && parent.method)) - ) { - return parent.loc.start; - } - - return node.loc.start; - } - - /** - * Returns end column position - * @param node - */ - function getLocEnd( - node: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression, - ): TSESTree.LineAndColumnData { - /* highlight `=>` */ - if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { - return sourceCode.getTokenBefore( - node.body, - token => - token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', - )!.loc.end; - } - - return sourceCode.getTokenBefore(node.body!)!.loc.end; - } - - /** - * Checks if a node is a constructor. - * @param node The node to check - */ - function isConstructor(node: TSESTree.Node | undefined): boolean { - return ( - !!node && - node.type === AST_NODE_TYPES.MethodDefinition && - node.kind === 'constructor' - ); - } - - /** - * Checks if a node is a setter. - */ - function isSetter(node: TSESTree.Node | undefined): boolean { - return ( - !!node && - (node.type === AST_NODE_TYPES.MethodDefinition || - node.type === AST_NODE_TYPES.Property) && - node.kind === 'set' - ); - } - - /** - * Checks if a node is a variable declarator with a type annotation. - * `const x: Foo = ...` - */ - function isVariableDeclaratorWithTypeAnnotation( - node: TSESTree.Node, - ): boolean { - return ( - node.type === AST_NODE_TYPES.VariableDeclarator && - !!node.id.typeAnnotation - ); - } - - /** - * Checks if a node is a class property with a type annotation. - * `public x: Foo = ...` - */ - function isClassPropertyWithTypeAnnotation(node: TSESTree.Node): boolean { - return ( - node.type === AST_NODE_TYPES.ClassProperty && !!node.typeAnnotation - ); - } - - /** - * Checks if a node belongs to: - * new Foo(() => {}) - * ^^^^^^^^ - */ - function isConstructorArgument(parent: TSESTree.Node): boolean { - return parent.type === AST_NODE_TYPES.NewExpression; - } - - /** - * Checks if a node is a type cast - * `(() => {}) as Foo` - * `(() => {})` - */ - function isTypeCast(node: TSESTree.Node): boolean { - return ( - node.type === AST_NODE_TYPES.TSAsExpression || - node.type === AST_NODE_TYPES.TSTypeAssertion - ); - } - - /** - * Checks if a node belongs to: - * `const x: Foo = { prop: () => {} }` - * `const x = { prop: () => {} } as Foo` - * `const x = { prop: () => {} }` - */ - function isPropertyOfObjectWithType( - property: TSESTree.Node | undefined, - ): boolean { - if (!property || property.type !== AST_NODE_TYPES.Property) { - return false; - } - const objectExpr = property.parent; // this shouldn't happen, checking just in case - /* istanbul ignore if */ if ( - !objectExpr || - objectExpr.type !== AST_NODE_TYPES.ObjectExpression - ) { - return false; - } - - const parent = objectExpr.parent; // this shouldn't happen, checking just in case - /* istanbul ignore if */ if (!parent) { - return false; - } - - return ( - isTypeCast(parent) || - isClassPropertyWithTypeAnnotation(parent) || - isVariableDeclaratorWithTypeAnnotation(parent) || - isFunctionArgument(parent) - ); - } - function isUnexported(node: TSESTree.Node | undefined): boolean { let isReturnedValue = false; while (node) { @@ -243,189 +100,33 @@ export default util.createRule({ return true; } - function isPrivateMethod( - node: TSESTree.MethodDefinition | TSESTree.TSAbstractMethodDefinition, - ): boolean { - return node.accessibility === 'private'; - } - - /** - * Checks if a function belongs to: - * `() => () => ...` - * `() => function () { ... }` - * `() => { return () => ... }` - * `() => { return function () { ... } }` - * `function fn() { return () => ... }` - * `function fn() { return function() { ... } }` - */ - function doesImmediatelyReturnFunctionExpression({ - body, - }: - | TSESTree.ArrowFunctionExpression - | TSESTree.FunctionDeclaration - | TSESTree.FunctionExpression): boolean { - // Should always have a body; really checking just in case - /* istanbul ignore if */ if (!body) { - return false; - } - - // Check if body is a block with a single statement - if ( - body.type === AST_NODE_TYPES.BlockStatement && - body.body.length === 1 - ) { - const [statement] = body.body; - - // Check if that statement is a return statement with an argument - if ( - statement.type === AST_NODE_TYPES.ReturnStatement && - !!statement.argument - ) { - // If so, check that returned argument as body - body = statement.argument; - } - } - - // Check if the body being returned is a function expression - return ( - body.type === AST_NODE_TYPES.ArrowFunctionExpression || - body.type === AST_NODE_TYPES.FunctionExpression - ); - } - - /** - * Checks if a node belongs to: - * `foo(() => 1)` - */ - function isFunctionArgument( - parent: TSESTree.Node, - callee?: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, - ): boolean { + function isArgumentUntyped(node: TSESTree.Identifier): boolean { return ( - (parent.type === AST_NODE_TYPES.CallExpression || - parent.type === AST_NODE_TYPES.OptionalCallExpression) && - // make sure this isn't an IIFE - parent.callee !== callee + !node.typeAnnotation || + node.typeAnnotation.typeAnnotation.type === AST_NODE_TYPES.TSAnyKeyword ); } - /** - * Checks if a function belongs to: - * `() => ({ action: 'xxx' }) as const` - */ - function returnsConstAssertionDirectly( - node: TSESTree.ArrowFunctionExpression, - ): boolean { - const { body } = node; - if (body.type === AST_NODE_TYPES.TSAsExpression) { - const { typeAnnotation } = body; - if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) { - const { typeName } = typeAnnotation; - if ( - typeName.type === AST_NODE_TYPES.Identifier && - typeName.name === 'const' - ) { - return true; - } - } - } - - return false; - } - /** * Checks if a function declaration/expression has a return type. */ - function checkFunctionReturnType( + function checkArguments( node: | TSESTree.ArrowFunctionExpression | TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, ): void { - const paramIdentifiers = node.params.filter( - param => param.type === AST_NODE_TYPES.Identifier, - ) as TSESTree.Identifier[]; + const paramIdentifiers = node.params.filter(util.isIdentifier); const untypedArgs = paramIdentifiers.filter(isArgumentUntyped); - if (untypedArgs.length) { - untypedArgs.forEach(untypedArg => - context.report({ - node, - messageId: 'missingArgType', - data: { - name: untypedArg.name, - }, - }), - ); - } - - if (isAllowedName(node.parent)) { - return; - } - - if (isUnexported(node.parent)) { - return; - } - - if ( - options.allowHigherOrderFunctions && - doesImmediatelyReturnFunctionExpression(node) - ) { - return; - } - - if ( - node.returnType || - isConstructor(node.parent) || - isSetter(node.parent) - ) { - return; - } - - context.report({ - node, - loc: { start: getLocStart(node), end: getLocEnd(node) }, - messageId: 'missingReturnType', - }); - } - - /** - * Checks if a function declaration/expression has a return type. - */ - function checkFunctionExpressionReturnType( - node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, - ): void { - // Should always have a parent; checking just in case - /* istanbul ignore else */ if (node.parent) { - if ( - node.parent.type === AST_NODE_TYPES.MethodDefinition && - isPrivateMethod(node.parent) - ) { - return; - } - - if (options.allowTypedFunctionExpressions) { - if ( - isTypeCast(node.parent) || - isVariableDeclaratorWithTypeAnnotation(node.parent) || - isClassPropertyWithTypeAnnotation(node.parent) || - isPropertyOfObjectWithType(node.parent) || - isFunctionArgument(node.parent, node) || - isConstructorArgument(node.parent) - ) { - return; - } - } - } - - if ( - node.type === AST_NODE_TYPES.ArrowFunctionExpression && - options.allowDirectConstAssertionInArrowFunctions && - returnsConstAssertionDirectly(node) - ) { - return; - } - - checkFunctionReturnType(node); + untypedArgs.forEach(untypedArg => + context.report({ + node, + messageId: 'missingArgType', + data: { + name: untypedArg.name, + }, + }), + ); } /** @@ -465,17 +166,47 @@ export default util.createRule({ return false; } - function isArgumentUntyped(node: TSESTree.Identifier): boolean { - return ( - !node.typeAnnotation || - node.typeAnnotation.typeAnnotation.type === AST_NODE_TYPES.TSAnyKeyword - ); - } - return { - ArrowFunctionExpression: checkFunctionExpressionReturnType, - FunctionDeclaration: checkFunctionReturnType, - FunctionExpression: checkFunctionExpressionReturnType, + 'ArrowFunctionExpression, FunctionExpression'( + node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, + ): void { + if ( + node.parent?.type === AST_NODE_TYPES.MethodDefinition && + node.parent.accessibility === 'private' + ) { + // don't check private methods as they aren't part of the public signature + return; + } + + if (isAllowedName(node.parent) || isUnexported(node)) { + return; + } + + checkFunctionExpressionReturnType(node, options, sourceCode, loc => + context.report({ + node, + loc, + messageId: 'missingReturnType', + }), + ); + + checkArguments(node); + }, + FunctionDeclaration(node): void { + if (isAllowedName(node.parent) || isUnexported(node)) { + return; + } + + checkFunctionReturnType(node, options, sourceCode, loc => + context.report({ + node, + loc, + messageId: 'missingReturnType', + }), + ); + + checkArguments(node); + }, }; }, }); diff --git a/packages/eslint-plugin/src/util/astUtils.ts b/packages/eslint-plugin/src/util/astUtils.ts index 6c92d90b637c..367bd93350bb 100644 --- a/packages/eslint-plugin/src/util/astUtils.ts +++ b/packages/eslint-plugin/src/util/astUtils.ts @@ -65,8 +65,10 @@ function isTokenOnSameLine( /** * Checks if a node is a type assertion: - * - x as foo - * - x + * ``` + * x as foo + * x + * ``` */ function isTypeAssertion( node: TSESTree.Node | undefined | null, @@ -80,14 +82,49 @@ function isTypeAssertion( ); } +/** + * Checks if a node is a constructor method. + */ +function isConstructor( + node: TSESTree.Node | undefined, +): node is TSESTree.MethodDefinition { + return ( + node?.type === AST_NODE_TYPES.MethodDefinition && + node.kind === 'constructor' + ); +} + +/** + * Checks if a node is a setter method. + */ +function isSetter( + node: TSESTree.Node | undefined, +): node is TSESTree.MethodDefinition | TSESTree.Property { + return ( + !!node && + (node.type === AST_NODE_TYPES.MethodDefinition || + node.type === AST_NODE_TYPES.Property) && + node.kind === 'set' + ); +} + +function isIdentifier( + node: TSESTree.Node | undefined, +): node is TSESTree.Identifier { + return node?.type === AST_NODE_TYPES.Identifier; +} + export { - isTypeAssertion, + isConstructor, + isIdentifier, + isLogicalOrOperator, isNonNullAssertionPunctuator, isNotNonNullAssertionPunctuator, isNotOptionalChainPunctuator, isOptionalChainPunctuator, isOptionalOptionalChain, + isSetter, isTokenOnSameLine, - isLogicalOrOperator, + isTypeAssertion, LINEBREAK_MATCHER, }; diff --git a/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts new file mode 100644 index 000000000000..81d43590eab0 --- /dev/null +++ b/packages/eslint-plugin/src/util/explicitReturnTypeUtils.ts @@ -0,0 +1,314 @@ +import { + TSESTree, + AST_NODE_TYPES, + TSESLint, + AST_TOKEN_TYPES, +} from '@typescript-eslint/experimental-utils'; +import { isTypeAssertion, isConstructor, isSetter } from './astUtils'; + +type FunctionNode = + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression; + +/** + * Creates a report location for the given function. + * The location only encompasses the "start" of the function, and not the body + * + * eg. + * function foo(args) {} + * ^^^^^^^^^^^^^^^^^^ + * + * get y(args) {} + * ^^^^^^^^^^^ + * + * const x = (args) => {} + * ^^^^^^^^^ + */ +function getReporLoc( + node: FunctionNode, + sourceCode: TSESLint.SourceCode, +): TSESTree.SourceLocation { + /** + * Returns start column position + * @param node + */ + function getLocStart(): TSESTree.LineAndColumnData { + /* highlight method name */ + const parent = node.parent; + if ( + parent && + (parent.type === AST_NODE_TYPES.MethodDefinition || + (parent.type === AST_NODE_TYPES.Property && parent.method)) + ) { + return parent.loc.start; + } + + return node.loc.start; + } + + /** + * Returns end column position + * @param node + */ + function getLocEnd(): TSESTree.LineAndColumnData { + /* highlight `=>` */ + if (node.type === AST_NODE_TYPES.ArrowFunctionExpression) { + return sourceCode.getTokenBefore( + node.body, + token => + token.type === AST_TOKEN_TYPES.Punctuator && token.value === '=>', + )!.loc.end; + } + + return sourceCode.getTokenBefore(node.body!)!.loc.end; + } + + return { + start: getLocStart(), + end: getLocEnd(), + }; +} + +/** + * Checks if a node is a variable declarator with a type annotation. + * ``` + * const x: Foo = ... + * ``` + */ +function isVariableDeclaratorWithTypeAnnotation( + node: TSESTree.Node, +): node is TSESTree.VariableDeclarator { + return ( + node.type === AST_NODE_TYPES.VariableDeclarator && !!node.id.typeAnnotation + ); +} + +/** + * Checks if a node is a class property with a type annotation. + * ``` + * public x: Foo = ... + * ``` + */ +function isClassPropertyWithTypeAnnotation( + node: TSESTree.Node, +): node is TSESTree.ClassProperty { + return node.type === AST_NODE_TYPES.ClassProperty && !!node.typeAnnotation; +} + +/** + * Checks if a node belongs to: + * ``` + * new Foo(() => {}) + * ^^^^^^^^ + * ``` + */ +function isConstructorArgument( + node: TSESTree.Node, +): node is TSESTree.NewExpression { + return node.type === AST_NODE_TYPES.NewExpression; +} + +/** + * Checks if a node belongs to: + * ``` + * const x: Foo = { prop: () => {} } + * const x = { prop: () => {} } as Foo + * const x = { prop: () => {} } + * ``` + */ +function isPropertyOfObjectWithType( + property: TSESTree.Node | undefined, +): boolean { + if (!property || property.type !== AST_NODE_TYPES.Property) { + return false; + } + const objectExpr = property.parent; // this shouldn't happen, checking just in case + /* istanbul ignore if */ if ( + !objectExpr || + objectExpr.type !== AST_NODE_TYPES.ObjectExpression + ) { + return false; + } + + const parent = objectExpr.parent; // this shouldn't happen, checking just in case + /* istanbul ignore if */ if (!parent) { + return false; + } + + return ( + isTypeAssertion(parent) || + isClassPropertyWithTypeAnnotation(parent) || + isVariableDeclaratorWithTypeAnnotation(parent) || + isFunctionArgument(parent) + ); +} + +/** + * Checks if a function belongs to: + * ``` + * () => () => ... + * () => function () { ... } + * () => { return () => ... } + * () => { return function () { ... } } + * function fn() { return () => ... } + * function fn() { return function() { ... } } + * ``` + */ +function doesImmediatelyReturnFunctionExpression({ + body, +}: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression): boolean { + // Should always have a body; really checking just in case + /* istanbul ignore if */ if (!body) { + return false; + } + + // Check if body is a block with a single statement + if (body.type === AST_NODE_TYPES.BlockStatement && body.body.length === 1) { + const [statement] = body.body; + + // Check if that statement is a return statement with an argument + if ( + statement.type === AST_NODE_TYPES.ReturnStatement && + !!statement.argument + ) { + // If so, check that returned argument as body + body = statement.argument; + } + } + + // Check if the body being returned is a function expression + return ( + body.type === AST_NODE_TYPES.ArrowFunctionExpression || + body.type === AST_NODE_TYPES.FunctionExpression + ); +} + +/** + * Checks if a node belongs to: + * ``` + * foo(() => 1) + * ``` + */ +function isFunctionArgument( + parent: TSESTree.Node, + callee?: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, +): parent is TSESTree.CallExpression | TSESTree.OptionalCallExpression { + return ( + (parent.type === AST_NODE_TYPES.CallExpression || + parent.type === AST_NODE_TYPES.OptionalCallExpression) && + // make sure this isn't an IIFE + parent.callee !== callee + ); +} + +/** + * Checks if a function belongs to: + * ``` + * () => ({ action: 'xxx' } as const) + * ``` + */ +function returnsConstAssertionDirectly( + node: TSESTree.ArrowFunctionExpression, +): boolean { + const { body } = node; + if (isTypeAssertion(body)) { + const { typeAnnotation } = body; + if (typeAnnotation.type === AST_NODE_TYPES.TSTypeReference) { + const { typeName } = typeAnnotation; + if ( + typeName.type === AST_NODE_TYPES.Identifier && + typeName.name === 'const' + ) { + return true; + } + } + } + + return false; +} + +interface Options { + allowExpressions?: boolean; + allowTypedFunctionExpressions?: boolean; + allowHigherOrderFunctions?: boolean; + allowDirectConstAssertionInArrowFunctions?: boolean; +} + +/** + * Checks if a function declaration/expression has a return type. + */ +function checkFunctionReturnType( + node: + | TSESTree.ArrowFunctionExpression + | TSESTree.FunctionDeclaration + | TSESTree.FunctionExpression, + options: Options, + sourceCode: TSESLint.SourceCode, + report: (loc: TSESTree.SourceLocation) => void, +): void { + if ( + options.allowHigherOrderFunctions && + doesImmediatelyReturnFunctionExpression(node) + ) { + return; + } + + if (node.returnType || isConstructor(node.parent) || isSetter(node.parent)) { + return; + } + + report(getReporLoc(node, sourceCode)); +} + +/** + * Checks if a function declaration/expression has a return type. + */ +function checkFunctionExpressionReturnType( + node: TSESTree.ArrowFunctionExpression | TSESTree.FunctionExpression, + options: Options, + sourceCode: TSESLint.SourceCode, + report: (loc: TSESTree.SourceLocation) => void, +): void { + // Should always have a parent; checking just in case + /* istanbul ignore else */ if (node.parent) { + if (options.allowTypedFunctionExpressions) { + if ( + isTypeAssertion(node.parent) || + isVariableDeclaratorWithTypeAnnotation(node.parent) || + isClassPropertyWithTypeAnnotation(node.parent) || + isPropertyOfObjectWithType(node.parent) || + isFunctionArgument(node.parent, node) || + isConstructorArgument(node.parent) + ) { + return; + } + } + + if ( + options.allowExpressions && + node.parent.type !== AST_NODE_TYPES.VariableDeclarator && + node.parent.type !== AST_NODE_TYPES.MethodDefinition && + node.parent.type !== AST_NODE_TYPES.ExportDefaultDeclaration && + node.parent.type !== AST_NODE_TYPES.ClassProperty + ) { + return; + } + } + + // https://github.com/typescript-eslint/typescript-eslint/issues/653 + if ( + node.type === AST_NODE_TYPES.ArrowFunctionExpression && + options.allowDirectConstAssertionInArrowFunctions && + returnsConstAssertionDirectly(node) + ) { + return; + } + + checkFunctionReturnType(node, options, sourceCode, report); +} + +export { checkFunctionReturnType, checkFunctionExpressionReturnType }; diff --git a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts index c257d60f715d..fc2413ba0119 100644 --- a/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts +++ b/packages/eslint-plugin/tests/rules/explicit-module-boundary-types.test.ts @@ -394,7 +394,7 @@ export class Test { get prop() { return 1; } - set prop() {} + set prop(value) {} method() { return; } @@ -412,6 +412,13 @@ export class Test { column: 3, endColumn: 13, }, + { + messageId: 'missingArgType', + line: 7, + endLine: 7, + column: 11, + endColumn: 21, + }, { messageId: 'missingReturnType', line: 8, @@ -420,18 +427,18 @@ export class Test { endColumn: 11, }, { - messageId: 'missingArgType', + messageId: 'missingReturnType', line: 11, endLine: 11, column: 11, - endColumn: 27, + endColumn: 19, }, { - messageId: 'missingReturnType', + messageId: 'missingArgType', line: 11, endLine: 11, column: 11, - endColumn: 19, + endColumn: 27, }, ], }, From 03221d2ed1f07625fa80cf4638f96239536aad9a Mon Sep 17 00:00:00 2001 From: Armano Date: Mon, 27 Jan 2020 00:26:59 +0100 Subject: [PATCH 28/30] test: fix vscode launch configuration for windows (#1523) --- .vscode/launch.json | 144 ++++++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 64 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 9f1633f32aba..eee0937502c8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,69 +4,85 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Jest Test Current eslint-plugin Rule", - "cwd": "${workspaceFolder}/packages/eslint-plugin/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-coverage", - // needs the '' around it so that the () are properly handled - "'tests/(.+/)?${fileBasenameNoExtension}'" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, - { - "type": "node", - "request": "launch", - "name": "Jest Test Current eslint-plugin-internal Rule", - "cwd": "${workspaceFolder}/packages/eslint-plugin-internal/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-coverage", - // needs the '' around it so that the () are properly handled - "'tests/(.+/)?${fileBasenameNoExtension}'" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, - { - "type": "node", - "request": "launch", - "name": "Run currently opened typescript-estree test", - "cwd": "${workspaceFolder}/packages/typescript-estree/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-cache", - "--no-coverage", - "${relativeFile}" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - }, - { - "type": "node", - "request": "launch", - "name": "Run currently opened parser test", - "cwd": "${workspaceFolder}/packages/parser/", - "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", - "args": [ - "--runInBand", - "--no-cache", - "--no-coverage", - "${relativeFile}" - ], - "sourceMaps": true, - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } + { + "type": "node", + "request": "launch", + "name": "Jest Test Current eslint-plugin Rule", + "cwd": "${workspaceFolder}/packages/eslint-plugin/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasenameNoExtension}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Jest Test Current eslint-plugin-internal Rule", + "cwd": "${workspaceFolder}/packages/eslint-plugin-internal/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasenameNoExtension}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened typescript-estree test", + "cwd": "${workspaceFolder}/packages/typescript-estree/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasename}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened parser test", + "cwd": "${workspaceFolder}/packages/parser/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasename}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened experimental-utils test", + "cwd": "${workspaceFolder}/packages/experimental-utils/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasenameNoExtension}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen" + } ] } From 367b18f0187ee503c4b21444864027f389a0c69a Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Mon, 27 Jan 2020 13:06:49 +1300 Subject: [PATCH 29/30] docs(eslint-plugin): add script to generate the readme tables (#1524) --- packages/eslint-plugin/README.md | 164 +++++++++--------- packages/eslint-plugin/package.json | 1 + .../tools/generate-rules-lists.ts | 129 ++++++++++++++ 3 files changed, 211 insertions(+), 83 deletions(-) create mode 100644 packages/eslint-plugin/tools/generate-rules-lists.ts diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index 91eaf17711e4..744f2513d9eb 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -92,67 +92,66 @@ Pro Tip: For larger codebases you may want to consider splitting our linting int **Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information - -| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | -| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | -| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | -| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/ban-ts-comment`](./docs/rules/ban-ts-comment.md) | Bans `// @ts-` comments from being used | | | | -| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions | :heavy_check_mark: | | | -| [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | -| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | -| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | | | -| [`@typescript-eslint/explicit-module-boundary-types`](./docs/rules/explicit-module-boundary-types.md) | Require explicit return and argument types on exported functions' and classes' public class methods | | | | -| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | -| [`@typescript-eslint/naming-convention`](./docs/rules/naming-convention.md) | Enforces naming conventions for everything across a codebase | | | :thought_balloon: | -| [`@typescript-eslint/no-dynamic-delete`](./docs/rules/no-dynamic-delete.md) | Disallow the delete operator with computed key expressions | | :wrench: | | -| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-extra-non-null-assertion`](./docs/rules/no-extra-non-null-assertion.md) | Disallow extra non-null assertion | | | | -| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | -| [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately | | | :thought_balloon: | -| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-implied-eval`](./docs/rules/no-implied-eval.md) | Disallow the use of `eval()`-like methods | | | :thought_balloon: | -| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :heavy_check_mark: | | | -| [`@typescript-eslint/no-non-null-asserted-optional-chain`](./docs/rules/no-non-null-asserted-optional-chain.md) | Disallows using a non-null assertion after an optional chain expression | | | | -| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :heavy_check_mark: | | | -| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | -| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | -| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | -| [`@typescript-eslint/no-throw-literal`](./docs/rules/no-throw-literal.md) | Disallow throwing literals as exceptions | | | :thought_balloon: | -| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | -| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Enforces that type arguments will not be used if not required | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-unused-vars-experimental`](./docs/rules/no-unused-vars-experimental.md) | Disallow unused variables and arguments | | | :thought_balloon: | -| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | -| [`@typescript-eslint/prefer-as-const`](./docs/rules/prefer-as-const.md) | Prefer usage of `as const` over literal type | | :wrench: | | -| [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | -| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | -| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | :heavy_check_mark: | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/prefer-nullish-coalescing`](./docs/rules/prefer-nullish-coalescing.md) | Enforce the usage of the nullish coalescing operator instead of logical chaining | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-optional-chain`](./docs/rules/prefer-optional-chain.md) | Prefer using concise optional chain expressions instead of chained logical ands | | :wrench: | | -| [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | :heavy_check_mark: | :wrench: | :thought_balloon: | -| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | | :thought_balloon: | -| [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Requires `Array#sort` calls to always provide a `compareFunction` | | | :thought_balloon: | -| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | -| [`@typescript-eslint/restrict-template-expressions`](./docs/rules/restrict-template-expressions.md) | Enforce template literal expressions to be of string type | | | :thought_balloon: | -| [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | | :thought_balloon: | -| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :heavy_check_mark: | | | -| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | -| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | +| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | +| --------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | +| [`@typescript-eslint/adjacent-overload-signatures`](./docs/rules/adjacent-overload-signatures.md) | Require that member overloads be consecutive | :heavy_check_mark: | | | +| [`@typescript-eslint/array-type`](./docs/rules/array-type.md) | Requires using either `T[]` or `Array` for arrays | | :wrench: | | +| [`@typescript-eslint/await-thenable`](./docs/rules/await-thenable.md) | Disallows awaiting a value that is not a Thenable | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/ban-ts-comment`](./docs/rules/ban-ts-comment.md) | Bans `// @ts-` comments from being used | | | | +| [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Bans specific types from being used | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/consistent-type-assertions`](./docs/rules/consistent-type-assertions.md) | Enforces consistent usage of type assertions | :heavy_check_mark: | | | +| [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | | :wrench: | | +| [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | +| [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | | | | +| [`@typescript-eslint/explicit-module-boundary-types`](./docs/rules/explicit-module-boundary-types.md) | Require explicit return and argument types on exported functions' and classes' public class methods | | | | +| [`@typescript-eslint/member-delimiter-style`](./docs/rules/member-delimiter-style.md) | Require a specific member delimiter style for interfaces and type literals | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | +| [`@typescript-eslint/naming-convention`](./docs/rules/naming-convention.md) | Enforces naming conventions for everything across a codebase | | | :thought_balloon: | +| [`@typescript-eslint/no-dynamic-delete`](./docs/rules/no-dynamic-delete.md) | Disallow the delete operator with computed key expressions | | :wrench: | | +| [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-extra-non-null-assertion`](./docs/rules/no-extra-non-null-assertion.md) | Disallow extra non-null assertion | | | | +| [`@typescript-eslint/no-extraneous-class`](./docs/rules/no-extraneous-class.md) | Forbids the use of classes as namespaces | | | | +| [`@typescript-eslint/no-floating-promises`](./docs/rules/no-floating-promises.md) | Requires Promise-like values to be handled appropriately | | | :thought_balloon: | +| [`@typescript-eslint/no-for-in-array`](./docs/rules/no-for-in-array.md) | Disallow iterating over an array with a for-in loop | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-implied-eval`](./docs/rules/no-implied-eval.md) | Disallow the use of `eval()`-like methods | | | :thought_balloon: | +| [`@typescript-eslint/no-inferrable-types`](./docs/rules/no-inferrable-types.md) | Disallows explicit type declarations for variables or parameters initialized to a number, string, or boolean | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-misused-new`](./docs/rules/no-misused-new.md) | Enforce valid definition of `new` and `constructor` | :heavy_check_mark: | | | +| [`@typescript-eslint/no-misused-promises`](./docs/rules/no-misused-promises.md) | Avoid using promises in places not designed to handle them | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/no-namespace`](./docs/rules/no-namespace.md) | Disallow the use of custom TypeScript modules and namespaces | :heavy_check_mark: | | | +| [`@typescript-eslint/no-non-null-asserted-optional-chain`](./docs/rules/no-non-null-asserted-optional-chain.md) | Disallows using a non-null assertion after an optional chain expression | | | | +| [`@typescript-eslint/no-non-null-assertion`](./docs/rules/no-non-null-assertion.md) | Disallows non-null assertions using the `!` postfix operator | :heavy_check_mark: | | | +| [`@typescript-eslint/no-parameter-properties`](./docs/rules/no-parameter-properties.md) | Disallow the use of parameter properties in class constructors | | | | +| [`@typescript-eslint/no-require-imports`](./docs/rules/no-require-imports.md) | Disallows invocation of `require()` | | | | +| [`@typescript-eslint/no-this-alias`](./docs/rules/no-this-alias.md) | Disallow aliasing `this` | :heavy_check_mark: | | | +| [`@typescript-eslint/no-throw-literal`](./docs/rules/no-throw-literal.md) | Disallow throwing literals as exceptions | | | :thought_balloon: | +| [`@typescript-eslint/no-type-alias`](./docs/rules/no-type-alias.md) | Disallow the use of type aliases | | | | +| [`@typescript-eslint/no-unnecessary-condition`](./docs/rules/no-unnecessary-condition.md) | Prevents conditionals where the type is always truthy or always falsy | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-qualifier`](./docs/rules/no-unnecessary-qualifier.md) | Warns when a namespace qualifier is unnecessary | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-arguments`](./docs/rules/no-unnecessary-type-arguments.md) | Enforces that type arguments will not be used if not required | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unnecessary-type-assertion`](./docs/rules/no-unnecessary-type-assertion.md) | Warns if a type assertion does not change the type of an expression | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/no-unused-vars-experimental`](./docs/rules/no-unused-vars-experimental.md) | Disallow unused variables and arguments | | | :thought_balloon: | +| [`@typescript-eslint/no-var-requires`](./docs/rules/no-var-requires.md) | Disallows the use of require statements except in import statements | :heavy_check_mark: | | | +| [`@typescript-eslint/prefer-as-const`](./docs/rules/prefer-as-const.md) | Prefer usage of `as const` over literal type | | :wrench: | | +| [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | +| [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | +| [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/prefer-nullish-coalescing`](./docs/rules/prefer-nullish-coalescing.md) | Enforce the usage of the nullish coalescing operator instead of logical chaining | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-optional-chain`](./docs/rules/prefer-optional-chain.md) | Prefer using concise optional chain expressions instead of chained logical ands | | :wrench: | | +| [`@typescript-eslint/prefer-readonly`](./docs/rules/prefer-readonly.md) | Requires that private members are marked as `readonly` if they're never modified outside of the constructor | | :wrench: | :thought_balloon: | +| [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Enforce that `RegExp#exec` is used instead of `String#match` if no global flag is provided | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | :heavy_check_mark: | :wrench: | :thought_balloon: | +| [`@typescript-eslint/promise-function-async`](./docs/rules/promise-function-async.md) | Requires any function or method that returns a Promise to be marked async | | | :thought_balloon: | +| [`@typescript-eslint/require-array-sort-compare`](./docs/rules/require-array-sort-compare.md) | Requires `Array#sort` calls to always provide a `compareFunction` | | | :thought_balloon: | +| [`@typescript-eslint/restrict-plus-operands`](./docs/rules/restrict-plus-operands.md) | When adding two variables, operands must both be of type number or of type string | | | :thought_balloon: | +| [`@typescript-eslint/restrict-template-expressions`](./docs/rules/restrict-template-expressions.md) | Enforce template literal expressions to be of string type | | | :thought_balloon: | +| [`@typescript-eslint/strict-boolean-expressions`](./docs/rules/strict-boolean-expressions.md) | Restricts the types allowed in boolean expressions | | | :thought_balloon: | +| [`@typescript-eslint/triple-slash-reference`](./docs/rules/triple-slash-reference.md) | Sets preference level for triple slash directives versus ES6-style import declarations | :heavy_check_mark: | | | +| [`@typescript-eslint/type-annotation-spacing`](./docs/rules/type-annotation-spacing.md) | Require consistent spacing around type annotations | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/typedef`](./docs/rules/typedef.md) | Requires type annotations to exist | | | | +| [`@typescript-eslint/unbound-method`](./docs/rules/unbound-method.md) | Enforces unbound methods are called with their expected scope | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/unified-signatures`](./docs/rules/unified-signatures.md) | Warns for any two overloads that could be unified into one by using a union or an optional/rest parameter | | | | @@ -165,28 +164,27 @@ In these cases, we create what we call an extension rule; a rule within our plug **Key**: :heavy_check_mark: = recommended, :wrench: = fixable, :thought_balloon: = requires type information - -| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | -| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -------- | ----------------- | -| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | -| [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | -| [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | -| [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | -| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | -| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | -| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :heavy_check_mark: | | | -| [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | -| [`@typescript-eslint/no-extra-semi`](./docs/rules/no-extra-semi.md) | Disallow unnecessary semicolons | | :wrench: | | -| [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallow magic numbers | | | | -| [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | -| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | -| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | -| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | -| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | -| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | -| [`@typescript-eslint/return-await`](./docs/rules/return-await.md) | Enforces consistent returning of awaited values | | | :thought_balloon: | -| [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | -| [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | Enforces consistent spacing before function parenthesis | | :wrench: | | +| Name | Description | :heavy_check_mark: | :wrench: | :thought_balloon: | +| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------ | -------- | ----------------- | +| [`@typescript-eslint/brace-style`](./docs/rules/brace-style.md) | Enforce consistent brace style for blocks | | :wrench: | | +| [`@typescript-eslint/comma-spacing`](./docs/rules/comma-spacing.md) | Enforces consistent spacing before and after commas | | :wrench: | | +| [`@typescript-eslint/default-param-last`](./docs/rules/default-param-last.md) | Enforce default parameters to be last | | | | +| [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | +| [`@typescript-eslint/indent`](./docs/rules/indent.md) | Enforce consistent indentation | | :wrench: | | +| [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | :heavy_check_mark: | | | +| [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | +| [`@typescript-eslint/no-extra-semi`](./docs/rules/no-extra-semi.md) | Disallow unnecessary semicolons | | :wrench: | | +| [`@typescript-eslint/no-magic-numbers`](./docs/rules/no-magic-numbers.md) | Disallow magic numbers | | | | +| [`@typescript-eslint/no-unused-expressions`](./docs/rules/no-unused-expressions.md) | Disallow unused expressions | | | | +| [`@typescript-eslint/no-unused-vars`](./docs/rules/no-unused-vars.md) | Disallow unused variables | :heavy_check_mark: | | | +| [`@typescript-eslint/no-use-before-define`](./docs/rules/no-use-before-define.md) | Disallow the use of variables before they are defined | :heavy_check_mark: | | | +| [`@typescript-eslint/no-useless-constructor`](./docs/rules/no-useless-constructor.md) | Disallow unnecessary constructors | | | | +| [`@typescript-eslint/quotes`](./docs/rules/quotes.md) | Enforce the consistent use of either backticks, double, or single quotes | | :wrench: | | +| [`@typescript-eslint/require-await`](./docs/rules/require-await.md) | Disallow async functions which have no `await` expression | :heavy_check_mark: | | :thought_balloon: | +| [`@typescript-eslint/return-await`](./docs/rules/return-await.md) | Enforces consistent returning of awaited values | | | :thought_balloon: | +| [`@typescript-eslint/semi`](./docs/rules/semi.md) | Require or disallow semicolons instead of ASI | | :wrench: | | +| [`@typescript-eslint/space-before-function-paren`](./docs/rules/space-before-function-paren.md) | Enforces consistent spacing before function parenthesis | | :wrench: | | diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index dc526268271f..c0eaf9e483cd 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -35,6 +35,7 @@ "clean": "tsc -b tsconfig.build.json --clean", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:configs": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-configs.ts", + "generate:rules-lists": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-rules-lists.ts", "lint": "eslint . --ext .js,.ts --ignore-path ../../.eslintignore", "test": "jest --coverage", "typecheck": "tsc -p tsconfig.json --noEmit" diff --git a/packages/eslint-plugin/tools/generate-rules-lists.ts b/packages/eslint-plugin/tools/generate-rules-lists.ts new file mode 100644 index 000000000000..cffe400692c8 --- /dev/null +++ b/packages/eslint-plugin/tools/generate-rules-lists.ts @@ -0,0 +1,129 @@ +#!/usr/bin/env ts-node + +import fs from 'fs'; +import path from 'path'; + +import rules from '../src/rules'; + +import prettier from 'prettier'; + +interface RuleDetails { + name: string; + description: string; + recommended: boolean; + fixable: boolean; + requiresTypeChecking: boolean; + extendsBaseRule: boolean; +} + +type RuleColumn = [ + string, + string, + ':heavy_check_mark:' | '', + ':wrench:' | '', + ':thought_balloon:' | '', +]; + +const emojiKey = { + recommended: ':heavy_check_mark:', + fixable: ':wrench:', + requiresTypeChecking: ':thought_balloon:', +} as const; + +const staticElements = { + rulesListKey: [ + `**Key**: ${emojiKey.recommended} = recommended`, + `${emojiKey.fixable} = fixable`, + `${emojiKey.requiresTypeChecking} = requires type information`, + ].join(', '), + listHeaderRow: [ + 'Name', + 'Description', + emojiKey.recommended, + emojiKey.fixable, + emojiKey.requiresTypeChecking, + ], + listSpacerRow: Array(5).fill('-'), +}; + +const returnEmojiIfTrue = ( + key: TKey, + obj: { [K in TKey]?: unknown }, +): typeof emojiKey[TKey] | '' => (obj[key] ? emojiKey[key] : ''); + +const createRuleLink = (ruleName: string): string => + `[\`@typescript-eslint/${ruleName}\`](./docs/rules/${ruleName}.md)`; + +const buildRuleRow = (rule: RuleDetails): RuleColumn => [ + createRuleLink(rule.name), + rule.description, + returnEmojiIfTrue('recommended', rule), + returnEmojiIfTrue('fixable', rule), + returnEmojiIfTrue('requiresTypeChecking', rule), +]; + +const buildRulesTable = (rules: RuleDetails[]): string[][] => [ + staticElements.listHeaderRow, + staticElements.listSpacerRow, + ...rules + .sort(({ name: ruleNameA }, { name: ruleNameB }) => + ruleNameA.localeCompare(ruleNameB), + ) + .map(buildRuleRow), +]; + +const generateRulesListMarkdown = (rules: RuleDetails[]): string => + [ + '', + staticElements.rulesListKey, + '', + ...buildRulesTable(rules).map(column => [...column, ' '].join('|')), + '', + ].join('\n'); + +const updateRulesList = ( + listName: 'base' | 'extension', + rules: RuleDetails[], + markdown: string, +): string => { + const listBeginMarker = ``; + const listEndMarker = ``; + + const listStartIndex = markdown.indexOf(listBeginMarker); + const listEndIndex = markdown.indexOf(listEndMarker); + + if (listStartIndex === -1 || listEndIndex === -1) { + throw new Error(`cannot find start or end of ${listName} list`); + } + + return [ + markdown.substring(0, listStartIndex - 1), + listBeginMarker, + '', + generateRulesListMarkdown(rules), // + markdown.substring(listEndIndex), + ].join('\n'); +}; + +const rulesDetails: RuleDetails[] = Object.entries(rules) + .filter(([, rule]) => rule.meta.deprecated !== true) + .map(([name, rule]) => ({ + name, + description: rule.meta.docs?.description ?? '', + recommended: !!rule.meta.docs?.recommended ?? false, + fixable: !!rule.meta.fixable, + requiresTypeChecking: rule.meta.docs?.requiresTypeChecking ?? false, + extendsBaseRule: !!rule.meta.docs?.extendsBaseRule ?? false, + })); + +const baseRules = rulesDetails.filter(rule => !rule.extendsBaseRule); +const extensionRules = rulesDetails.filter(rule => rule.extendsBaseRule); + +let readme = fs.readFileSync(path.resolve(__dirname, '../README.md'), 'utf8'); + +readme = updateRulesList('base', baseRules, readme); +readme = updateRulesList('extension', extensionRules, readme); + +readme = prettier.format(readme, { parser: 'markdown' }); + +fs.writeFileSync(path.resolve(__dirname, '../README.md'), readme, 'utf8'); From b835ec231c2ff8764b897d6784cb89d9de1f3af3 Mon Sep 17 00:00:00 2001 From: James Henry Date: Mon, 27 Jan 2020 18:01:52 +0000 Subject: [PATCH 30/30] chore: publish v2.18.0 --- CHANGELOG.md | 27 ++++++++++++++++++++ lerna.json | 2 +- packages/eslint-plugin-internal/CHANGELOG.md | 11 ++++++++ packages/eslint-plugin-internal/package.json | 4 +-- packages/eslint-plugin-tslint/CHANGELOG.md | 8 ++++++ packages/eslint-plugin-tslint/package.json | 6 ++--- packages/eslint-plugin/CHANGELOG.md | 22 ++++++++++++++++ packages/eslint-plugin/package.json | 4 +-- packages/experimental-utils/CHANGELOG.md | 18 +++++++++++++ packages/experimental-utils/package.json | 4 +-- packages/parser/CHANGELOG.md | 17 ++++++++++++ packages/parser/package.json | 8 +++--- packages/shared-fixtures/CHANGELOG.md | 11 ++++++++ packages/shared-fixtures/package.json | 2 +- packages/typescript-estree/CHANGELOG.md | 18 +++++++++++++ packages/typescript-estree/package.json | 4 +-- 16 files changed, 149 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09fb229a9173..7a6cb34eeaea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* **eslint-plugin:** [explicit-module-boundary-types] false positive for returned fns ([#1490](https://github.com/typescript-eslint/typescript-eslint/issues/1490)) ([5562ad5](https://github.com/typescript-eslint/typescript-eslint/commit/5562ad5ed902102d7c09a7fd47ca4ea7e50d6654)) +* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) +* **eslint-plugin:** [naming-convention] fix filter option ([#1482](https://github.com/typescript-eslint/typescript-eslint/issues/1482)) ([718cd88](https://github.com/typescript-eslint/typescript-eslint/commit/718cd889c155a75413c571ac006c33fbc271dcc5)) +* **eslint-plugin:** fix property access on undefined error ([#1507](https://github.com/typescript-eslint/typescript-eslint/issues/1507)) ([d89e8e8](https://github.com/typescript-eslint/typescript-eslint/commit/d89e8e8a1114989e2727351bee7aadb6579f312b)) +* **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) +* **typescript-estree:** error on unexpected jsdoc nodes ([#1525](https://github.com/typescript-eslint/typescript-eslint/issues/1525)) ([c8dfac3](https://github.com/typescript-eslint/typescript-eslint/commit/c8dfac3d2f066e50fa9d2b5a86beffdaafddb643)) +* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) + + +### Features + +* **eslint-plugin:** add comma-spacing ([#1495](https://github.com/typescript-eslint/typescript-eslint/issues/1495)) ([1fd86be](https://github.com/typescript-eslint/typescript-eslint/commit/1fd86befa6a940a0354c619dd2da08a5c5d69fb4)) +* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) +* **eslint-plugin:** create `ban-ts-comment` rule ([#1361](https://github.com/typescript-eslint/typescript-eslint/issues/1361)) ([2a83d13](https://github.com/typescript-eslint/typescript-eslint/commit/2a83d138a966cd5ce787d1eecf595b59b78232d4)) +* **eslint-plugin-internal:** add `prefer-ast-types-enum` ([#1508](https://github.com/typescript-eslint/typescript-eslint/issues/1508)) ([c3d0a3a](https://github.com/typescript-eslint/typescript-eslint/commit/c3d0a3a6bdff0cae226a279f0a0a9b00952ca925)) +* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) +* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) diff --git a/lerna.json b/lerna.json index ebaba89eec92..cffd5c79a334 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.17.0", + "version": "2.18.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 748b630f4dca..b261c1f4fd1e 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Features + +* **eslint-plugin-internal:** add `prefer-ast-types-enum` ([#1508](https://github.com/typescript-eslint/typescript-eslint/issues/1508)) ([c3d0a3a](https://github.com/typescript-eslint/typescript-eslint/commit/c3d0a3a6bdff0cae226a279f0a0a9b00952ca925)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index de73fd89a286..85ee5b4f99a7 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "2.17.0", + "version": "2.18.0", "private": true, "main": "dist/index.js", "scripts": { @@ -12,6 +12,6 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.17.0" + "@typescript-eslint/experimental-utils": "2.18.0" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index ad86e8b5a379..5765190211ea 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 471a6c118ea8..429d607ae422 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "2.17.0", + "version": "2.18.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.17.0", + "@typescript-eslint/experimental-utils": "2.18.0", "lodash": "^4.17.15" }, "peerDependencies": { @@ -41,6 +41,6 @@ }, "devDependencies": { "@types/lodash": "^4.14.149", - "@typescript-eslint/parser": "2.17.0" + "@typescript-eslint/parser": "2.18.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 34568bf986bb..a40abde0a9f1 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,28 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* **eslint-plugin:** [explicit-module-boundary-types] false positive for returned fns ([#1490](https://github.com/typescript-eslint/typescript-eslint/issues/1490)) ([5562ad5](https://github.com/typescript-eslint/typescript-eslint/commit/5562ad5ed902102d7c09a7fd47ca4ea7e50d6654)) +* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) +* **eslint-plugin:** [naming-convention] fix filter option ([#1482](https://github.com/typescript-eslint/typescript-eslint/issues/1482)) ([718cd88](https://github.com/typescript-eslint/typescript-eslint/commit/718cd889c155a75413c571ac006c33fbc271dcc5)) +* **eslint-plugin:** fix property access on undefined error ([#1507](https://github.com/typescript-eslint/typescript-eslint/issues/1507)) ([d89e8e8](https://github.com/typescript-eslint/typescript-eslint/commit/d89e8e8a1114989e2727351bee7aadb6579f312b)) + + +### Features + +* **eslint-plugin:** add comma-spacing ([#1495](https://github.com/typescript-eslint/typescript-eslint/issues/1495)) ([1fd86be](https://github.com/typescript-eslint/typescript-eslint/commit/1fd86befa6a940a0354c619dd2da08a5c5d69fb4)) +* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) +* **eslint-plugin:** create `ban-ts-comment` rule ([#1361](https://github.com/typescript-eslint/typescript-eslint/issues/1361)) ([2a83d13](https://github.com/typescript-eslint/typescript-eslint/commit/2a83d138a966cd5ce787d1eecf595b59b78232d4)) +* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index c0eaf9e483cd..9813a5777e51 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "2.17.0", + "version": "2.18.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -41,7 +41,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "2.17.0", + "@typescript-eslint/experimental-utils": "2.18.0", "eslint-utils": "^1.4.3", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 161617a9f47c..fcd114f500f6 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) +* **experimental-utils:** widen type of `settings` property ([#1527](https://github.com/typescript-eslint/typescript-eslint/issues/1527)) ([b515e47](https://github.com/typescript-eslint/typescript-eslint/commit/b515e47af2bc914c7ebcfa4be813409dcd86b1c3)) + + +### Features + +* **experimental-utils:** make RuleMetaData.docs optional ([#1462](https://github.com/typescript-eslint/typescript-eslint/issues/1462)) ([cde97ac](https://github.com/typescript-eslint/typescript-eslint/commit/cde97aca24df5a0f28f37006ed130ebc217fb2ad)) +* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 36ce440a646c..1d7d18f0bd9f 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "2.17.0", + "version": "2.18.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -37,7 +37,7 @@ }, "dependencies": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.17.0", + "@typescript-eslint/typescript-estree": "2.18.0", "eslint-scope": "^5.0.0" }, "peerDependencies": { diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index f103b12122b2..5e6567ed1097 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) + + +### Features + +* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) +* **parser:** clean up scope-analysis types ([#1481](https://github.com/typescript-eslint/typescript-eslint/issues/1481)) ([4a727fa](https://github.com/typescript-eslint/typescript-eslint/commit/4a727fa083d749dba9eaf39322856f5f69c28cd8)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 161f5fa58efb..2392baf8a7ab 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "2.17.0", + "version": "2.18.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -43,13 +43,13 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.17.0", - "@typescript-eslint/typescript-estree": "2.17.0", + "@typescript-eslint/experimental-utils": "2.18.0", + "@typescript-eslint/typescript-estree": "2.18.0", "eslint-visitor-keys": "^1.1.0" }, "devDependencies": { "@types/glob": "^7.1.1", - "@typescript-eslint/shared-fixtures": "2.17.0", + "@typescript-eslint/shared-fixtures": "2.18.0", "glob": "*" }, "peerDependenciesMeta": { diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index deef63fffb1e..fab5c6eef1c7 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 3af6d1d74fd7..ba7530dec822 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "2.17.0", + "version": "2.18.0", "private": true, "scripts": { "build": "tsc -b tsconfig.build.json", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 87b3504aa95f..03a7e17e3ee3 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,24 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [2.18.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.17.0...v2.18.0) (2020-01-27) + + +### Bug Fixes + +* improve token types and add missing type guards ([#1497](https://github.com/typescript-eslint/typescript-eslint/issues/1497)) ([ce41d7d](https://github.com/typescript-eslint/typescript-eslint/commit/ce41d7de33bcb7ccf96c03ac1438304c5a49ff54)) +* **typescript-estree:** error on unexpected jsdoc nodes ([#1525](https://github.com/typescript-eslint/typescript-eslint/issues/1525)) ([c8dfac3](https://github.com/typescript-eslint/typescript-eslint/commit/c8dfac3d2f066e50fa9d2b5a86beffdaafddb643)) +* **typescript-estree:** fix identifier tokens typed as `Keyword` ([#1487](https://github.com/typescript-eslint/typescript-eslint/issues/1487)) ([77a1caa](https://github.com/typescript-eslint/typescript-eslint/commit/77a1caa562638645b4717449800e410107d512c8)) + + +### Features + +* **eslint-plugin:** add new rule prefer-as-const ([#1431](https://github.com/typescript-eslint/typescript-eslint/issues/1431)) ([420db96](https://github.com/typescript-eslint/typescript-eslint/commit/420db96921435e8bf7fb484ae74552a912a6adde)) + + + + + # [2.17.0](https://github.com/typescript-eslint/typescript-eslint/compare/v2.16.0...v2.17.0) (2020-01-20) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index dc2a1ff1b329..3768c514dc8e 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "2.17.0", + "version": "2.18.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -58,7 +58,7 @@ "@types/lodash": "^4.14.149", "@types/semver": "^6.2.0", "@types/tmp": "^0.1.0", - "@typescript-eslint/shared-fixtures": "2.17.0", + "@typescript-eslint/shared-fixtures": "2.18.0", "tmp": "^0.1.0", "typescript": "*" },