From 556475c71fc2ed93c457aeef27a44238eb61875b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 13:07:59 +0100 Subject: [PATCH 01/47] add eslint-rules "module" and use it in eslintrc-file --- .eslintignore | 3 + .eslintrc.json | 49 +- build/lib/eslint/lib/index.js | 10 + build/lib/eslint/lib/index.ts | 12 + build/lib/eslint/lib/rules/layering.js | 81 +++ build/lib/eslint/lib/rules/layering.ts | 99 +++ build/lib/eslint/package.json | 20 + build/lib/eslint/yarn.lock | 931 +++++++++++++++++++++++++ package.json | 4 + yarn.lock | 371 +++++++++- 10 files changed, 1560 insertions(+), 20 deletions(-) create mode 100644 .eslintignore create mode 100644 build/lib/eslint/lib/index.js create mode 100644 build/lib/eslint/lib/index.ts create mode 100644 build/lib/eslint/lib/rules/layering.js create mode 100644 build/lib/eslint/lib/rules/layering.ts create mode 100644 build/lib/eslint/package.json create mode 100644 build/lib/eslint/yarn.lock diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000..d5192f87b10ad --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +**/insane/** +**/marked/** +**/test/**/*.js diff --git a/.eslintrc.json b/.eslintrc.json index 29efa7cbbc202..ae39ca4189361 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,20 +1,41 @@ { + "$schema": "http://json.schemastore.org/eslintrc", "root": true, - "env": { - "node": true, - "es6": true + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "project": "./src/tsconfig.json" }, + "plugins": [ + "code-oss-eslint" + ], "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": 1, - "no-extra-semi": "warn", - "semi": "warn" - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } + "no-extra-semi": "off", + "no-unused-vars": "off", + "semi": "warn", + "eqeqeq": "warn", + "no-duplicate-imports": "warn", + "code-oss-eslint/layering": [ + "warn", + { + "common": [], + "node": [ + "common" + ], + "browser": [ + "common" + ], + "electron-main": [ + "common", + "node" + ], + "electron-browser": [ + "common", + "browser", + "node" + ] + } + ] } } diff --git a/build/lib/eslint/lib/index.js b/build/lib/eslint/lib/index.js new file mode 100644 index 0000000000000..22f7bea62468e --- /dev/null +++ b/build/lib/eslint/lib/index.js @@ -0,0 +1,10 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const layering = require('./rules/layering'); +const rules = { + 'layering': layering +}; +module.exports = { rules }; diff --git a/build/lib/eslint/lib/index.ts b/build/lib/eslint/lib/index.ts new file mode 100644 index 0000000000000..0410e7e809b73 --- /dev/null +++ b/build/lib/eslint/lib/index.ts @@ -0,0 +1,12 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +const layering = require('./rules/layering'); + +const rules = { + 'layering': layering +}; + +export = { rules }; diff --git a/build/lib/eslint/lib/rules/layering.js b/build/lib/eslint/lib/rules/layering.js new file mode 100644 index 0000000000000..220b31f1f0118 --- /dev/null +++ b/build/lib/eslint/lib/rules/layering.js @@ -0,0 +1,81 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +module.exports = new class { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + } + }; + } + create(context) { + const fileDirname = path_1.dirname(context.getFilename()); + const parts = fileDirname.split(/\\|\//); + const ruleArgs = context.options[0]; + let config; + for (let i = parts.length - 1; i >= 0; i--) { + if (ruleArgs[parts[i]]) { + config = { + allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), + disallowed: new Set() + }; + Object.keys(ruleArgs).forEach(key => { + if (!config.allowed.has(key)) { + config.disallowed.add(key); + } + }); + break; + } + } + if (!config) { + // nothing + return {}; + } + return { + ImportDeclaration: (node) => { + this._checkImport(context, config, node, node.source.value); + }, + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + this._checkImport(context, config, node, args[0].value); + } + } + }; + } + _checkImport(context, config, node, path) { + if (typeof path !== 'string') { + return; + } + if (path[0] === '.') { + path = path_1.join(path_1.dirname(context.getFilename()), path); + } + const parts = path_1.dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + if (config.allowed.has(part)) { + // GOOD - same layer + break; + } + if (config.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + node, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config.allowed.keys()].join(', ') + } + }); + break; + } + } + } +}; diff --git a/build/lib/eslint/lib/rules/layering.ts b/build/lib/eslint/lib/rules/layering.ts new file mode 100644 index 0000000000000..52783f925c99c --- /dev/null +++ b/build/lib/eslint/lib/rules/layering.ts @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; +import { join, dirname } from 'path'; + +type Config = { + allowed: Set; + disallowed: Set; +}; + +export = new class implements eslint.Rule.RuleModule { + + meta = { + type: 'problem', + schema: {}, + messages: { + layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const fileDirname = dirname(context.getFilename()); + const parts = fileDirname.split(/\\|\//); + const ruleArgs = >context.options[0]; + + let config: Config | undefined; + for (let i = parts.length - 1; i >= 0; i--) { + if (ruleArgs[parts[i]]) { + config = { + allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), + disallowed: new Set() + }; + Object.keys(ruleArgs).forEach(key => { + if (!config!.allowed.has(key)) { + config!.disallowed.add(key); + } + }); + break; + } + } + + if (!config) { + // nothing + return {}; + } + + return { + ImportDeclaration: (node: estree.Node) => { + this._checkImport(context, config!, node, (node).source.value); + }, + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + this._checkImport(context, config!, node, (args[0]).value); + } + } + }; + } + + private _checkImport(context: eslint.Rule.RuleContext, config: Config, node: estree.Node, path: any) { + if (typeof path !== 'string') { + return; + } + + if (path[0] === '.') { + path = join(dirname(context.getFilename()), path); + } + + const parts = dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + + if (config!.allowed.has(part)) { + // GOOD - same layer + break; + } + + if (config!.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + node, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config!.allowed.keys()].join(', ') + } + }); + + break; + } + } + } +}; + diff --git a/build/lib/eslint/package.json b/build/lib/eslint/package.json new file mode 100644 index 0000000000000..546df538ea41d --- /dev/null +++ b/build/lib/eslint/package.json @@ -0,0 +1,20 @@ +{ + "name": "code-oss-eslint", + "version": "1.0.0", + "license": "MIT", + "description": "ESLint rules for code oss", + "engines": { + "node": ">=0.10.0" + }, + "keywords": [ + "eslint", + "eslintplugin", + "eslint-plugin" + ], + "author": "vscode", + "main": "lib/index.js", + "devDependencies": { + "@types/eslint": "4.16.1", + "eslint": "~3.9.1" + } +} diff --git a/build/lib/eslint/yarn.lock b/build/lib/eslint/yarn.lock new file mode 100644 index 0000000000000..c4a0a24fff3fc --- /dev/null +++ b/build/lib/eslint/yarn.lock @@ -0,0 +1,931 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/eslint@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-4.16.1.tgz#19730c9fcb66b6e44742d12b27a603fabfeb2f49" + integrity sha512-lRUXQAULl5geixTiP2K0iYvMUbCkEnuOwvLGjwff12I4ECxoW5QaWML5UUOZ1CvpQLILkddBdMPMZz4ByQizsg== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*": + version "0.0.41" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421" + integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA== + +"@types/json-schema@*": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" + integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== + +acorn-jsx@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" + integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= + dependencies: + acorn "^3.0.4" + +acorn@^3.0.4: + version "3.3.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" + integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= + +acorn@^5.5.0: + version "5.7.3" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" + integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== + +ajv-keywords@^1.0.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" + integrity sha1-MU3QpLM2j609/NxU7eYXG4htrzw= + +ajv@^4.7.0: + version "4.11.8" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" + integrity sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY= + dependencies: + co "^4.6.0" + json-stable-stringify "^1.0.1" + +ansi-escapes@^1.1.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" + integrity sha1-06ioOzGapneTZisT52HHkRQiMG4= + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +argparse@^1.0.7: + version "1.0.10" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" + integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== + dependencies: + sprintf-js "~1.0.2" + +babel-code-frame@^6.16.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +balanced-match@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +caller-path@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" + integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= + dependencies: + callsites "^0.2.0" + +callsites@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" + integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= + +chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +circular-json@^0.3.1: + version "0.3.3" + resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" + integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== + +cli-cursor@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" + integrity sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc= + dependencies: + restore-cursor "^1.0.1" + +cli-width@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" + integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= + +co@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" + integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= + +code-point-at@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + +concat-stream@^1.4.6: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +d@1, d@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== + dependencies: + es5-ext "^0.10.50" + type "^1.0.1" + +debug@^2.1.1: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +deep-is@~0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" + integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= + +doctrine@^1.2.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" + integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + +es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@~0.10.14: + version "0.10.53" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== + dependencies: + es6-iterator "~2.0.3" + es6-symbol "~3.1.3" + next-tick "~1.0.0" + +es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= + dependencies: + d "1" + es5-ext "^0.10.35" + es6-symbol "^3.1.1" + +es6-map@^0.1.3: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" + integrity sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA= + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-set "~0.1.5" + es6-symbol "~3.1.1" + event-emitter "~0.3.5" + +es6-set@~0.1.5: + version "0.1.5" + resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" + integrity sha1-0rPsXU2ADO2BjbU40ol02wpzzLE= + dependencies: + d "1" + es5-ext "~0.10.14" + es6-iterator "~2.0.1" + es6-symbol "3.1.1" + event-emitter "~0.3.5" + +es6-symbol@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" + integrity sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc= + dependencies: + d "1" + es5-ext "~0.10.14" + +es6-symbol@^3.1.1, es6-symbol@~3.1.1, es6-symbol@~3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== + dependencies: + d "^1.0.1" + ext "^1.1.2" + +es6-weak-map@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" + integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== + dependencies: + d "1" + es5-ext "^0.10.46" + es6-iterator "^2.0.3" + es6-symbol "^3.1.1" + +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +escope@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" + integrity sha1-4Bl16BJ4GhY6ba392AOY3GTIicM= + dependencies: + es6-map "^0.1.3" + es6-weak-map "^2.0.1" + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint@~3.9.1: + version "3.9.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.9.1.tgz#5a8597706fc6048bc6061ac754d4a211d28f4f5b" + integrity sha1-WoWXcG/GBIvGBhrHVNSiEdKPT1s= + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.4.6" + debug "^2.1.1" + doctrine "^1.2.2" + escope "^3.6.0" + espree "^3.3.1" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.2.0" + ignore "^3.1.5" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~1.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + +espree@^3.3.1: + version "3.5.4" + resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" + integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== + dependencies: + acorn "^5.5.0" + acorn-jsx "^3.0.0" + +esprima@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" + integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== + +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +event-emitter@~0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" + integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= + dependencies: + d "1" + es5-ext "~0.10.14" + +exit-hook@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" + integrity sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g= + +ext@^1.1.2: + version "1.4.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== + dependencies: + type "^2.0.0" + +fast-levenshtein@~2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= + +figures@^1.3.5: + version "1.7.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" + integrity sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4= + dependencies: + escape-string-regexp "^1.0.5" + object-assign "^4.1.0" + +file-entry-cache@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" + integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= + dependencies: + flat-cache "^1.2.1" + object-assign "^4.0.1" + +flat-cache@^1.2.1: + version "1.3.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" + integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== + dependencies: + circular-json "^0.3.1" + graceful-fs "^4.1.2" + rimraf "~2.6.2" + write "^0.2.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= + +generate-function@^2.0.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f" + integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ== + dependencies: + is-property "^1.0.2" + +generate-object-property@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" + integrity sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA= + dependencies: + is-property "^1.0.0" + +glob@^7.0.0, glob@^7.0.3, glob@^7.1.3: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + +globals@^9.2.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +graceful-fs@^4.1.2: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +ignore@^3.1.5: + version "3.3.10" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" + integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2, inherits@^2.0.3, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +inquirer@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" + integrity sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34= + dependencies: + ansi-escapes "^1.1.0" + ansi-regex "^2.0.0" + chalk "^1.0.0" + cli-cursor "^1.0.1" + cli-width "^2.0.0" + figures "^1.3.5" + lodash "^4.3.0" + readline2 "^1.0.1" + run-async "^0.1.0" + rx-lite "^3.1.2" + string-width "^1.0.1" + strip-ansi "^3.0.0" + through "^2.3.6" + +interpret@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" + integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== + +is-fullwidth-code-point@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= + dependencies: + number-is-nan "^1.0.0" + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-my-ip-valid@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" + integrity sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ== + +is-my-json-valid@^2.10.0: + version "2.20.0" + resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.20.0.tgz#1345a6fca3e8daefc10d0fa77067f54cedafd59a" + integrity sha512-XTHBZSIIxNsIsZXg7XB5l8z/OBFosl1Wao4tXLpeC7eKU4Vm/kdop2azkPqULwnfGQjmeDIyey9g7afMMtdWAA== + dependencies: + generate-function "^2.0.0" + generate-object-property "^1.1.0" + is-my-ip-valid "^1.0.0" + jsonpointer "^4.0.0" + xtend "^4.0.0" + +is-property@^1.0.0, is-property@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" + integrity sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ= + +is-resolvable@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" + integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== + +isarray@^1.0.0, isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +js-yaml@^3.5.1: + version "3.13.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" + integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== + dependencies: + argparse "^1.0.7" + esprima "^4.0.0" + +json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= + dependencies: + jsonify "~0.0.0" + +jsonify@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" + integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= + +jsonpointer@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + integrity sha1-T9kss04OnbPInIYi7PUfm5eMbLk= + +levn@^0.3.0, levn@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" + integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= + dependencies: + prelude-ls "~1.1.2" + type-check "~0.3.2" + +lodash@^4.0.0, lodash@^4.3.0: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +minimatch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + dependencies: + brace-expansion "^1.1.7" + +minimist@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" + integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= + +mkdirp@^0.5.0, mkdirp@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" + integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= + dependencies: + minimist "0.0.8" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +mute-stream@0.0.5: + version "0.0.5" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" + integrity sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA= + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= + +next-tick@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= + +number-is-nan@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= + +object-assign@^4.0.1, object-assign@^4.1.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" + integrity sha1-ofeDj4MUxRbwXs78vEzP4EtO14k= + +optionator@^0.8.2: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + +os-homedir@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" + integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= + +path-is-absolute@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= + +path-is-inside@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" + integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +pluralize@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" + integrity sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU= + +prelude-ls@~1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" + integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +progress@^1.1.8: + version "1.1.8" + resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" + integrity sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74= + +readable-stream@^2.2.2: + version "2.3.6" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" + integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readline2@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" + integrity sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + mute-stream "0.0.5" + +rechoir@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" + integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= + dependencies: + resolve "^1.1.6" + +require-uncached@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" + integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= + dependencies: + caller-path "^0.1.0" + resolve-from "^1.0.0" + +resolve-from@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" + integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= + +resolve@^1.1.6: + version "1.14.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff" + integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg== + dependencies: + path-parse "^1.0.6" + +restore-cursor@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" + integrity sha1-NGYfRohjJ/7SmRR5FSJS35LapUE= + dependencies: + exit-hook "^1.0.0" + onetime "^1.0.0" + +rimraf@~2.6.2: + version "2.6.3" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" + integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== + dependencies: + glob "^7.1.3" + +run-async@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" + integrity sha1-yK1KXhEGYeQCp9IbUw4AnyX444k= + dependencies: + once "^1.3.0" + +rx-lite@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" + integrity sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI= + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +shelljs@^0.7.5: + version "0.7.8" + resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" + integrity sha1-3svPh0sNHl+3LhSxZKloMEjprLM= + dependencies: + glob "^7.0.0" + interpret "^1.0.0" + rechoir "^0.6.2" + +slice-ansi@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" + integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= + +sprintf-js@~1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" + integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= + +string-width@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= + dependencies: + code-point-at "^1.0.0" + is-fullwidth-code-point "^1.0.0" + strip-ansi "^3.0.0" + +string-width@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-json-comments@~1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" + integrity sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E= + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +table@^3.7.8: + version "3.8.3" + resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" + integrity sha1-K7xULw/amGGnVdOUf+/Ys/UThV8= + dependencies: + ajv "^4.7.0" + ajv-keywords "^1.0.0" + chalk "^1.1.1" + lodash "^4.0.0" + slice-ansi "0.0.4" + string-width "^2.0.0" + +text-table@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= + +through@^2.3.6: + version "2.3.8" + resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" + integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= + +type-check@~0.3.2: + version "0.3.2" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" + integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= + dependencies: + prelude-ls "~1.1.2" + +type@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== + +type@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" + integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +user-home@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" + integrity sha1-nHC/2Babwdy/SGBODwS4tJzenp8= + dependencies: + os-homedir "^1.0.0" + +util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +write@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" + integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= + dependencies: + mkdirp "^0.5.1" + +xtend@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" + integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== diff --git a/package.json b/package.json index fa917351db56a..72e3e60f4f034 100644 --- a/package.json +++ b/package.json @@ -80,14 +80,18 @@ "@types/winreg": "^1.2.30", "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", + "@typescript-eslint/parser": "^2.12.0", "ansi-colors": "^3.2.3", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", + "code-oss-eslint": "file:./build/lib/eslint/", "copy-webpack-plugin": "^4.5.2", "coveralls": "^2.11.11", "cson-parser": "^1.3.3", "debounce": "^1.0.0", "electron": "6.1.6", + "eslint": "6.8.0", + "eslint-plugin-code-oss-eslint": "file:./build/lib/eslint/", "event-stream": "3.3.4", "express": "^4.13.1", "fancy-log": "^1.3.3", diff --git a/yarn.lock b/yarn.lock index 2263495575167..2aced698516e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -121,6 +121,11 @@ resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.3.3.tgz#85bc74ba782fb7aa3a514d11767832b0e3bc6803" integrity sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow== +"@types/eslint-visitor-keys@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" + integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== + "@types/fancy-log@1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@types/fancy-log/-/fancy-log-1.3.0.tgz#a61ab476e5e628cd07a846330df53b85e05c8ce0" @@ -147,6 +152,11 @@ dependencies: "@types/node" "*" +"@types/json-schema@^7.0.3": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" + integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== + "@types/keytar@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@types/keytar/-/keytar-4.4.0.tgz#ca24e6ee6d0df10c003aafe26e93113b8faf0d8e" @@ -248,6 +258,38 @@ dependencies: "@types/node" "*" +"@typescript-eslint/experimental-utils@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.13.0.tgz#958614faa6f77599ee2b241740e0ea402482533d" + integrity sha512-+Hss3clwa6aNiC8ZjA45wEm4FutDV5HsVXPl/rDug1THq6gEtOYRGLqS3JlTk7mSnL5TbJz0LpEbzbPnKvY6sw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/parser@^2.12.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.13.0.tgz#ea1ab394cf9ca17467e3da7f96eca9309f57c326" + integrity sha512-vbDeLr5QRJ1K7x5iRK8J9wuGwR9OVyd1zDAY9XFAQvAosHVjSVbDgkm328ayE6hx2QWVGhwvGaEhedcqAbfQcA== + dependencies: + "@types/eslint-visitor-keys" "^1.0.0" + "@typescript-eslint/experimental-utils" "2.13.0" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-visitor-keys "^1.1.0" + +"@typescript-eslint/typescript-estree@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.13.0.tgz#a2e746867da772c857c13853219fced10d2566bc" + integrity sha512-t21Mg5cc8T3ADEUGwDisHLIubgXKjuNRbkpzDMLb7/JMmgCe/gHM9FaaujokLey+gwTuLF5ndSQ7/EfQqrQx4g== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + "@webassemblyjs/ast@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" @@ -427,6 +469,11 @@ acorn-jsx@^5.0.0: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +acorn-jsx@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.1.0.tgz#294adb71b57398b0680015f0a38c563ee1db5384" + integrity sha512-tMUqwBWfLFbJbizRmEcWSLw6HnFzfdJs2sOJEOwwtVPMoH/0Ay+E703oZz78VSXZiiDcZrQ5XKjPIUQixhmgVw== + acorn@^5.0.0, acorn@^5.6.2: version "5.7.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8" @@ -437,6 +484,11 @@ acorn@^6.0.2: resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.7.tgz#490180ce18337270232d9488a44be83d9afb7fd3" integrity sha512-HNJNgE60C9eOTgn974Tlp3dpLZdUr+SoxxDwPaY9J/kDNOLQTkaDgwBUXAF4SSsrAwD9RpdxuHK/EbuF+W9Ahw== +acorn@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" + integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ== + agent-base@4: version "4.2.0" resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.0.tgz#9838b5c3392b962bad031e6a4c5e1024abec45ce" @@ -493,6 +545,16 @@ ajv@^6.1.0: json-schema-traverse "^0.4.1" uri-js "^4.2.1" +ajv@^6.10.0, ajv@^6.10.2: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ajv@^6.5.3, ajv@^6.6.1: version "6.8.1" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.8.1.tgz#0890b93742985ebf8973cd365c5b23920ce3cb20" @@ -537,6 +599,13 @@ ansi-escapes@^3.2.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== +ansi-escapes@^4.2.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.0.tgz#a4ce2b33d6b214b7950d8595c212f12ac9cc569d" + integrity sha512-EiYhwo0v255HUL6eDyuLrXEkTi7WwVCLAw+SeOQ7M7qdun1z1pum4DEm/nuqIVbPvi9RPPc9k9LbyBv6H0DwVg== + dependencies: + type-fest "^0.8.1" + ansi-gray@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" @@ -571,6 +640,11 @@ ansi-regex@^4.1.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -1595,6 +1669,13 @@ cli-cursor@^2.1.0: dependencies: restore-cursor "^2.0.0" +cli-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-3.1.0.tgz#264305a7ae490d1d03bf0c9ba7c925d1753af307" + integrity sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw== + dependencies: + restore-cursor "^3.1.0" + cli-width@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" @@ -1673,6 +1754,12 @@ coa@~1.0.1: dependencies: q "^1.1.2" +"code-oss-eslint@file:./build/lib/eslint": + version "1.0.0" + +"code-oss-eslint@file:./build/lib/eslint/": + version "1.0.0" + code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -2412,6 +2499,13 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-serializer@0, dom-serializer@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.1.0.tgz#073c697546ce0780ce23be4a28e293e40bc30c82" @@ -2581,6 +2675,11 @@ emoji-regex@^7.0.1: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + emojis-list@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" @@ -2693,6 +2792,9 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.3, escape-string-regexp@^ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +"eslint-plugin-code-oss-eslint@file:./build/lib/eslint": + version "1.0.0" + eslint-scope@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.0.tgz#50bf3071e9338bcdc43331794a0cb533f0136172" @@ -2701,16 +2803,79 @@ eslint-scope@^4.0.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + eslint-utils@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== +eslint-utils@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" + integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== + dependencies: + eslint-visitor-keys "^1.1.0" + eslint-visitor-keys@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + +eslint@6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== + dependencies: + "@babel/code-frame" "^7.0.0" + ajv "^6.10.0" + chalk "^2.1.0" + cross-spawn "^6.0.5" + debug "^4.0.1" + doctrine "^3.0.0" + eslint-scope "^5.0.0" + eslint-utils "^1.4.3" + eslint-visitor-keys "^1.1.0" + espree "^6.1.2" + esquery "^1.0.1" + esutils "^2.0.2" + file-entry-cache "^5.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.0.0" + globals "^12.1.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + inquirer "^7.0.0" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.3.0" + lodash "^4.17.14" + minimatch "^3.0.4" + mkdirp "^0.5.1" + natural-compare "^1.4.0" + optionator "^0.8.3" + progress "^2.0.0" + regexpp "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" + table "^5.2.3" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + eslint@^5.0.1: version "5.13.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.13.0.tgz#ce71cc529c450eed9504530939aa97527861ede9" @@ -2762,6 +2927,15 @@ espree@^5.0.0: acorn-jsx "^5.0.0" eslint-visitor-keys "^1.0.0" +espree@^6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.2.tgz#6c272650932b4f91c3714e5e7b5f5e2ecf47262d" + integrity sha512-2iUPuuPP+yW1PZaMSDM9eyVf8D5P0Hi8h83YtZ5bPc/zHYjII5khoixIUTMO794NOY8F/ThF1Bo8ncZILarUTA== + dependencies: + acorn "^7.1.0" + acorn-jsx "^5.1.0" + eslint-visitor-keys "^1.1.0" + esprima@^2.6.0: version "2.7.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581" @@ -3040,7 +3214,7 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= -fast-levenshtein@~2.0.4: +fast-levenshtein@~2.0.4, fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= @@ -3071,6 +3245,13 @@ figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" +figures@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/figures/-/figures-3.1.0.tgz#4b198dd07d8d71530642864af2d45dd9e459c4ec" + integrity sha512-ravh8VRXqHuMvZt/d8GblBeqDMkdJMBdv/2KntFH+ra5MXkO7nxNKpzQ3n6QD/2da1kH0aWmNISdvhM7gl2gVg== + dependencies: + escape-string-regexp "^1.0.5" + file-entry-cache@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" @@ -3079,6 +3260,13 @@ file-entry-cache@^2.0.0: flat-cache "^1.2.1" object-assign "^4.0.1" +file-entry-cache@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" + integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== + dependencies: + flat-cache "^2.0.1" + file-uri-to-path@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz#553a7b8446ff6f684359c445f1e37a05dacc33dd" @@ -3217,6 +3405,20 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" +flat-cache@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" + integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== + dependencies: + flatted "^2.0.0" + rimraf "2.6.3" + write "1.0.3" + +flatted@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" + integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== + flatten@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" @@ -3526,7 +3728,7 @@ glob-parent@^3.0.0, glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" -glob-parent@~5.1.0: +glob-parent@^5.0.0, glob-parent@~5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== @@ -3629,6 +3831,18 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + global-modules@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" @@ -3675,6 +3889,13 @@ globals@^11.7.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.10.0.tgz#1e09776dffda5e01816b3bb4077c8b59c24eaa50" integrity sha512-0GZF1RiPKU97IHUO5TORo9w1PwrH/NBPl+fS7oMLdaTRiYmYbwK4NWoZWrAdd0/abG9R2BU+OiwyQpTpE6pdfQ== +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== + dependencies: + type-fest "^0.8.1" + globby@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d" @@ -4388,6 +4609,25 @@ inquirer@^6.1.0: strip-ansi "^5.0.0" through "^2.3.6" +inquirer@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.1.tgz#13f7980eedc73c689feff3994b109c4e799c6ebb" + integrity sha512-V1FFQ3TIO15det8PijPLFR9M9baSlnRs9nL7zWu1MNVA2T9YVl9ZbrHJhYs7e9X8jeMZ3lr2JH/rdHFgNCBdYw== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.5.3" + string-width "^4.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + interpret@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" @@ -4581,6 +4821,11 @@ is-fullwidth-code-point@^2.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-glob@^2.0.0, is-glob@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" @@ -4909,7 +5154,7 @@ js-yaml@^3.12.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.13.0: +js-yaml@^3.13.0, js-yaml@^3.13.1: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -5286,6 +5531,11 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "~3.0.0" +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" @@ -5306,6 +5556,11 @@ lodash@^4.17.11, lodash@^4.17.4, lodash@^4.17.5: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@^4.17.14, lodash@^4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-driver@1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.5.tgz#7ae4ec257302fd790d557cb10c97100d857b0056" @@ -5616,7 +5871,7 @@ mimic-fn@^1.0.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.1.0.tgz#e667783d92e89dbd342818b5230b9d62a672ad18" integrity sha1-5md4PZLonb00KBi1IwudYqZyrRg= -mimic-fn@^2.0.0: +mimic-fn@^2.0.0, mimic-fn@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== @@ -5805,6 +6060,11 @@ mute-stream@0.0.7, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + nan@2.14.0, nan@^2.10.0, nan@^2.13.2, nan@^2.14.0: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" @@ -6227,6 +6487,13 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + onigasm-umd@2.2.5: version "2.2.5" resolved "https://registry.yarnpkg.com/onigasm-umd/-/onigasm-umd-2.2.5.tgz#f104247334a543accd3f8d641a4d99b3d908d6a1" @@ -6273,6 +6540,18 @@ optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" +optionator@^0.8.3: + version "0.8.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" + integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== + dependencies: + deep-is "~0.1.3" + fast-levenshtein "~2.0.6" + levn "~0.3.0" + prelude-ls "~1.1.2" + type-check "~0.3.2" + word-wrap "~1.2.3" + ordered-read-streams@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/ordered-read-streams/-/ordered-read-streams-0.3.0.tgz#7137e69b3298bb342247a1bbee3881c80e2fd78b" @@ -7652,12 +7931,20 @@ restore-cursor@^2.0.0: onetime "^2.0.0" signal-exit "^3.0.2" +restore-cursor@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" + integrity sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA== + dependencies: + onetime "^5.1.0" + signal-exit "^3.0.2" + ret@~0.1.10: version "0.1.15" resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== -rimraf@2, rimraf@^2.6.3: +rimraf@2, rimraf@2.6.3, rimraf@^2.6.3: version "2.6.3" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== @@ -7712,6 +7999,13 @@ rxjs@^6.4.0: dependencies: tslib "^1.9.0" +rxjs@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" + integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.1, safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -7799,6 +8093,11 @@ semver@^6.0.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== +semver@^6.1.2, 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== + send@0.16.1: version "0.16.1" resolved "https://registry.yarnpkg.com/send/-/send-0.16.1.tgz#a70e1ca21d1382c11d0d9f6231deb281080d7ab3" @@ -7949,7 +8248,7 @@ slash@^1.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55" integrity sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU= -slice-ansi@^2.0.0: +slice-ansi@^2.0.0, slice-ansi@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== @@ -8275,6 +8574,15 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" +string-width@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + string_decoder@^1.0.0, string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -8334,6 +8642,13 @@ strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + strip-bom-stream@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-1.0.0.tgz#e7144398577d51a6bed0fa1994fa05f43fd988ee" @@ -8366,6 +8681,11 @@ strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + sudo-prompt@9.1.1: version "9.1.1" resolved "https://registry.yarnpkg.com/sudo-prompt/-/sudo-prompt-9.1.1.tgz#73853d729770392caec029e2470db9c221754db0" @@ -8454,6 +8774,16 @@ table@^5.0.2: slice-ansi "^2.0.0" string-width "^2.1.1" +table@^5.2.3: + version "5.4.6" + resolved "https://registry.yarnpkg.com/table/-/table-5.4.6.tgz#1292d19500ce3f86053b05f0e8e7e4a3bb21079e" + integrity sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug== + dependencies: + ajv "^6.10.2" + lodash "^4.17.14" + slice-ansi "^2.1.0" + string-width "^3.0.0" + tapable@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/tapable/-/tapable-1.0.0.tgz#cbb639d9002eed9c6b5975eb20598d7936f1f9f2" @@ -8771,6 +9101,13 @@ tsutils@^2.29.0: dependencies: tslib "^1.8.1" +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tty-browserify@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6" @@ -8805,6 +9142,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + type-is@~1.6.15: version "1.6.15" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.15.tgz#cab10fb4909e441c82842eafe1ad646c81804410" @@ -9055,6 +9397,11 @@ v8-compile-cache@2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe" integrity sha512-CNmdbwQMBjwr9Gsmohvm0pbL954tJrNzf6gWL3K+QMQf00PF7ERGrEiLgjuU3mKreLC2MeGhUsNV9ybTbLgd3w== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + v8-inspect-profiler@^0.0.20: version "0.0.20" resolved "https://registry.yarnpkg.com/v8-inspect-profiler/-/v8-inspect-profiler-0.0.20.tgz#f7ad0f8178dcea2f1504334e8844ef38181792ab" @@ -9488,6 +9835,11 @@ windows-process-tree@0.2.4: dependencies: nan "^2.13.2" +word-wrap@~1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" + integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== + wordwrap@~0.0.2: version "0.0.3" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" @@ -9527,6 +9879,13 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= +write@1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" + integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== + dependencies: + mkdirp "^0.5.1" + write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" From ce0d7058a6f4fca824a6fd949c1f5db313ca3c55 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 13:23:57 +0100 Subject: [PATCH 02/47] add package.json script --- .eslintrc.json | 3 +-- package.json | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ae39ca4189361..4aa3042f86795 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,8 +4,7 @@ "parser": "@typescript-eslint/parser", "parserOptions": { "ecmaVersion": 6, - "sourceType": "module", - "project": "./src/tsconfig.json" + "sourceType": "module" }, "plugins": [ "code-oss-eslint" diff --git a/package.json b/package.json index 72e3e60f4f034..a3128b1e83360 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "monaco-compile-check": "tsc -p src/tsconfig.monaco.json --noEmit", "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", - "web": "node scripts/code-web.js" + "web": "node scripts/code-web.js", + "eslint": "eslint -c .eslintrc.json ./src/vs/ --ext .ts" }, "dependencies": { "applicationinsights": "1.0.8", From 31d049f3294bc2274f772172c124587ac02762cb Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 13:51:11 +0100 Subject: [PATCH 03/47] use (most of) generated eslintrc-file --- .eslintignore | 3 --- .eslintrc.json | 48 ++++++++++------------------------ package.json | 3 ++- src/.eslintrc.json | 64 ++++++++++++++++++++++++++++++++++++++++++++++ yarn.lock | 37 +++++++++++++++++++++++---- 5 files changed, 112 insertions(+), 43 deletions(-) delete mode 100644 .eslintignore create mode 100644 src/.eslintrc.json diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index d5192f87b10ad..0000000000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -**/insane/** -**/marked/** -**/test/**/*.js diff --git a/.eslintrc.json b/.eslintrc.json index 4aa3042f86795..29efa7cbbc202 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,40 +1,20 @@ { - "$schema": "http://json.schemastore.org/eslintrc", "root": true, - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 6, - "sourceType": "module" + "env": { + "node": true, + "es6": true }, - "plugins": [ - "code-oss-eslint" - ], "rules": { - "no-extra-semi": "off", - "no-unused-vars": "off", - "semi": "warn", - "eqeqeq": "warn", - "no-duplicate-imports": "warn", - "code-oss-eslint/layering": [ - "warn", - { - "common": [], - "node": [ - "common" - ], - "browser": [ - "common" - ], - "electron-main": [ - "common", - "node" - ], - "electron-browser": [ - "common", - "browser", - "node" - ] - } - ] + "no-console": 0, + "no-cond-assign": 0, + "no-unused-vars": 1, + "no-extra-semi": "warn", + "semi": "warn" + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } } } diff --git a/package.json b/package.json index a3128b1e83360..43ce87c7f6259 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", "web": "node scripts/code-web.js", - "eslint": "eslint -c .eslintrc.json ./src/vs/ --ext .ts" + "eslint": "eslint -c ./src/.eslintrc.json ./src/vs --ext .ts" }, "dependencies": { "applicationinsights": "1.0.8", @@ -82,6 +82,7 @@ "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", "@typescript-eslint/parser": "^2.12.0", + "@typescript-eslint/eslint-plugin": "2.3.2", "ansi-colors": "^3.2.3", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", diff --git a/src/.eslintrc.json b/src/.eslintrc.json new file mode 100644 index 0000000000000..8590d0e5c5c26 --- /dev/null +++ b/src/.eslintrc.json @@ -0,0 +1,64 @@ +{ + "$schema": "http://json.schemastore.org/eslintrc", + "root": true, + "ignorePatterns": [ + "**/insane/**", + "**/marked/**", + "**/test/**/*.js" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "project": "src/tsconfig.json", + "sourceType": "module" + }, + "plugins": [ + "code-oss-eslint", + "@typescript-eslint" + ], + "rules": { + "no-extra-semi": "off", + "no-unused-vars": "off", + "semi": "warn", + "eqeqeq": "warn", + "no-duplicate-imports": "warn", + "code-oss-eslint/layering": [ + "warn", + { + "common": [], + "node": [ + "common" + ], + "browser": [ + "common" + ], + "electron-main": [ + "common", + "node" + ], + "electron-browser": [ + "common", + "browser", + "node" + ] + } + ], + "@typescript-eslint/class-name-casing": "warn", + "@typescript-eslint/no-for-in-array": "warn", + "@typescript-eslint/semi": [ + "warn", + "always" + ], + "constructor-super": "warn", + "curly": "warn", + "no-caller": "warn", + "no-debugger": "warn", + "no-duplicate-case": "warn", + "no-eval": "warn", + "no-new-wrappers": "warn", + "no-sparse-arrays": "warn", + "no-throw-literal": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-var": "warn" + } +} diff --git a/yarn.lock b/yarn.lock index 2aced698516e9..0f9867933e3ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -258,6 +258,17 @@ dependencies: "@types/node" "*" +"@typescript-eslint/eslint-plugin@2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.3.2.tgz#7e112ca0bb29044d915baf10163a8199a20f7c69" + integrity sha512-tcnpksq1bXzcIRbYLeXkgp6l+ggEMXXUcl1wsSvL807fRtmvVQKygElwEUf4hBA76dNag3VAK1q2m3vd7qJaZA== + dependencies: + "@typescript-eslint/experimental-utils" "2.3.2" + eslint-utils "^1.4.2" + functional-red-black-tree "^1.0.1" + regexpp "^2.0.1" + tsutils "^3.17.1" + "@typescript-eslint/experimental-utils@2.13.0": version "2.13.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.13.0.tgz#958614faa6f77599ee2b241740e0ea402482533d" @@ -267,6 +278,15 @@ "@typescript-eslint/typescript-estree" "2.13.0" eslint-scope "^5.0.0" +"@typescript-eslint/experimental-utils@2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.3.2.tgz#e50f31264507e6fec7b33840bb6af260c24f4ea8" + integrity sha512-t+JGdTT6dRbmvKDlhlVkEueoZa0fhJNfG6z2cpnRPLwm3VwYr2BjR//acJGC1Yza0I9ZNcDfRY7ubQEvvfG6Jg== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.3.2" + eslint-scope "^5.0.0" + "@typescript-eslint/parser@^2.12.0": version "2.13.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.13.0.tgz#ea1ab394cf9ca17467e3da7f96eca9309f57c326" @@ -290,6 +310,16 @@ semver "^6.3.0" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@2.3.2": + version "2.3.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.3.2.tgz#107414aa04e689fe6f7251eb63fb500217f2b7f4" + integrity sha512-eZNEAai16nwyhIVIEaWQlaUgAU3S9CkQ58qvK0+3IuSdLJD3W1PNuehQFMIhW/mTP1oFR9GNoTcLg7gtXz6lzA== + dependencies: + glob "^7.1.4" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + "@webassemblyjs/ast@1.5.13": version "1.5.13" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.5.13.tgz#81155a570bd5803a30ec31436bc2c9c0ede38f25" @@ -1757,9 +1787,6 @@ coa@~1.0.1: "code-oss-eslint@file:./build/lib/eslint": version "1.0.0" -"code-oss-eslint@file:./build/lib/eslint/": - version "1.0.0" - code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -2816,7 +2843,7 @@ eslint-utils@^1.3.1: resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== -eslint-utils@^1.4.3: +eslint-utils@^1.4.2, eslint-utils@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.3.tgz#74fec7c54d0776b6f67e0251040b5806564e981f" integrity sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q== @@ -3831,7 +3858,7 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.6: +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== From 21bc306204c447146e4e12b795b320163abb0ada Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 15:13:49 +0100 Subject: [PATCH 04/47] script run check JS and TS files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 43ce87c7f6259..d97cbae1f7426 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", "web": "node scripts/code-web.js", - "eslint": "eslint -c ./src/.eslintrc.json ./src/vs --ext .ts" + "eslint": "eslint -c ./src/.eslintrc.json ./src/vs --ext .ts --ext .js" }, "dependencies": { "applicationinsights": "1.0.8", From d0e72fe1c37f4c67d58d2d5b97fa30474e1c624b Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 15:18:15 +0100 Subject: [PATCH 05/47] ignore generated files --- src/.eslintrc.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/.eslintrc.json b/src/.eslintrc.json index 8590d0e5c5c26..879564055edc2 100644 --- a/src/.eslintrc.json +++ b/src/.eslintrc.json @@ -2,6 +2,12 @@ "$schema": "http://json.schemastore.org/eslintrc", "root": true, "ignorePatterns": [ + "**/vs/nls.build.js", + "**/vs/nls.js", + "**/vs/css.build.js", + "**/vs/css.js", + "**/vs/loader.js", + "**/promise-polyfill/**", "**/insane/**", "**/marked/**", "**/test/**/*.js" From a1047421ff11eca2c377f5af6e57d503f7ff800e Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 24 Dec 2019 16:01:35 +0100 Subject: [PATCH 06/47] use single eslintrc-file for extensions/ and src/, no type check rules --- .eslintignore | 13 ++++++++ .eslintrc.json | 70 +++++++++++++++++++++++++++++---------- build/gulpfile.hygiene.js | 6 ++-- package.json | 2 +- src/.eslintrc | 19 ----------- src/.eslintrc.json | 70 --------------------------------------- 6 files changed, 69 insertions(+), 111 deletions(-) create mode 100644 .eslintignore delete mode 100644 src/.eslintrc delete mode 100644 src/.eslintrc.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000..54f0bce7b748f --- /dev/null +++ b/.eslintignore @@ -0,0 +1,13 @@ +**/vs/nls.build.js +**/vs/nls.js +**/vs/css.build.js +**/vs/css.js +**/vs/loader.js +**/promise-polyfill/** +**/insane/** +**/marked/** +**/test/**/*.js +**/node_modules/** +**/vscode-api-tests/testWorkspace/** +**/extensions/**/out/** +**/extensions/**/build/** diff --git a/.eslintrc.json b/.eslintrc.json index 29efa7cbbc202..66628b052d95a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,20 +1,54 @@ { - "root": true, - "env": { - "node": true, - "es6": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": 1, - "no-extra-semi": "warn", - "semi": "warn" - }, - "extends": "eslint:recommended", - "parserOptions": { - "ecmaFeatures": { - "experimentalObjectRestSpread": true - } - } + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "code-oss-eslint", + "@typescript-eslint" + ], + "rules": { + "no-extra-semi": "off", + "no-unused-vars": "off", + "eqeqeq": "warn", + "semi": "off", + "@typescript-eslint/semi": "warn", + "no-duplicate-imports": "warn", + "code-oss-eslint/layering": [ + "warn", + { + "common": [], + "node": [ + "common" + ], + "browser": [ + "common" + ], + "electron-main": [ + "common", + "node" + ], + "electron-browser": [ + "common", + "browser", + "node" + ] + } + ], + "@typescript-eslint/class-name-casing": "warn", + "constructor-super": "warn", + "curly": "warn", + "no-caller": "warn", + "no-debugger": "warn", + "no-duplicate-case": "warn", + "no-eval": "warn", + "no-new-wrappers": "warn", + "no-sparse-arrays": "warn", + "no-throw-literal": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-var": "warn" + } } diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index afde823d0b69d..3185e325d5cdd 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -186,7 +186,7 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(gulpeslint('.eslintrc.json')) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); }); @@ -227,7 +227,7 @@ function checkPackageJSON(actualPath) { const checkPackageJSONTask = task.define('check-package-json', () => { return gulp.src('package.json') - .pipe(es.through(function() { + .pipe(es.through(function () { checkPackageJSON.call(this, 'remote/package.json'); checkPackageJSON.call(this, 'remote/web/package.json'); })); @@ -359,7 +359,7 @@ function hygiene(some) { const javascript = result .pipe(filter(eslintFilter)) - .pipe(gulpeslint('src/.eslintrc')) + .pipe(gulpeslint('.eslintrc.json')) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); diff --git a/package.json b/package.json index d97cbae1f7426..9f91624475faf 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", "web": "node scripts/code-web.js", - "eslint": "eslint -c ./src/.eslintrc.json ./src/vs --ext .ts --ext .js" + "eslint": "eslint -c .eslintrc.json --ext .ts --ext .js ./src/vs ./extensions" }, "dependencies": { "applicationinsights": "1.0.8", diff --git a/src/.eslintrc b/src/.eslintrc deleted file mode 100644 index c25b0d558c2c3..0000000000000 --- a/src/.eslintrc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "parserOptions": { - "ecmaVersion": 6 - }, - "env": { - "node": true, - "es6": true, - "browser": true, - "amd": true - }, - "rules": { - "no-console": 0, - "no-cond-assign": 0, - "no-unused-vars": "error", - "no-extra-semi": "error", - "semi": "error", - "no-inner-declarations": 0 - } -} \ No newline at end of file diff --git a/src/.eslintrc.json b/src/.eslintrc.json deleted file mode 100644 index 879564055edc2..0000000000000 --- a/src/.eslintrc.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/eslintrc", - "root": true, - "ignorePatterns": [ - "**/vs/nls.build.js", - "**/vs/nls.js", - "**/vs/css.build.js", - "**/vs/css.js", - "**/vs/loader.js", - "**/promise-polyfill/**", - "**/insane/**", - "**/marked/**", - "**/test/**/*.js" - ], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "project": "src/tsconfig.json", - "sourceType": "module" - }, - "plugins": [ - "code-oss-eslint", - "@typescript-eslint" - ], - "rules": { - "no-extra-semi": "off", - "no-unused-vars": "off", - "semi": "warn", - "eqeqeq": "warn", - "no-duplicate-imports": "warn", - "code-oss-eslint/layering": [ - "warn", - { - "common": [], - "node": [ - "common" - ], - "browser": [ - "common" - ], - "electron-main": [ - "common", - "node" - ], - "electron-browser": [ - "common", - "browser", - "node" - ] - } - ], - "@typescript-eslint/class-name-casing": "warn", - "@typescript-eslint/no-for-in-array": "warn", - "@typescript-eslint/semi": [ - "warn", - "always" - ], - "constructor-super": "warn", - "curly": "warn", - "no-caller": "warn", - "no-debugger": "warn", - "no-duplicate-case": "warn", - "no-eval": "warn", - "no-new-wrappers": "warn", - "no-sparse-arrays": "warn", - "no-throw-literal": "warn", - "no-unsafe-finally": "warn", - "no-unused-labels": "warn", - "no-var": "warn" - } -} From 1075b91187653de137ed42eff62026722052231a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 09:24:56 +0100 Subject: [PATCH 07/47] tweaks --- build/lib/eslint/lib/rules/layering.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/lib/eslint/lib/rules/layering.ts b/build/lib/eslint/lib/rules/layering.ts index 52783f925c99c..83962de0c0a11 100644 --- a/build/lib/eslint/lib/rules/layering.ts +++ b/build/lib/eslint/lib/rules/layering.ts @@ -14,7 +14,7 @@ type Config = { export = new class implements eslint.Rule.RuleModule { - meta = { + readonly meta = { type: 'problem', schema: {}, messages: { @@ -75,19 +75,19 @@ export = new class implements eslint.Rule.RuleModule { for (let i = parts.length - 1; i >= 0; i--) { const part = parts[i]; - if (config!.allowed.has(part)) { + if (config.allowed.has(part)) { // GOOD - same layer break; } - if (config!.disallowed.has(part)) { + if (config.disallowed.has(part)) { // BAD - wrong layer context.report({ node, messageId: 'layerbreaker', data: { from: part, - allowed: [...config!.allowed.keys()].join(', ') + allowed: [...config.allowed.keys()].join(', ') } }); From b0d38052b5468e2b8be554d7d3c8bda5a50db9ec Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 09:46:58 +0100 Subject: [PATCH 08/47] use rulesdir instead of rules-module --- .eslintrc.json | 3 +- .../rules/layering.js => code-layering.js} | 0 .../rules/layering.ts => code-layering.ts} | 0 build/lib/eslint/lib/index.js | 10 - build/lib/eslint/lib/index.ts | 12 - build/lib/eslint/package.json | 20 - build/lib/eslint/yarn.lock | 931 ------------------ build/package.json | 1 + build/yarn.lock | 18 + package.json | 3 +- 10 files changed, 21 insertions(+), 977 deletions(-) rename build/lib/eslint/{lib/rules/layering.js => code-layering.js} (100%) rename build/lib/eslint/{lib/rules/layering.ts => code-layering.ts} (100%) delete mode 100644 build/lib/eslint/lib/index.js delete mode 100644 build/lib/eslint/lib/index.ts delete mode 100644 build/lib/eslint/package.json delete mode 100644 build/lib/eslint/yarn.lock diff --git a/.eslintrc.json b/.eslintrc.json index 66628b052d95a..d25d11ba25fee 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,6 @@ "sourceType": "module" }, "plugins": [ - "code-oss-eslint", "@typescript-eslint" ], "rules": { @@ -16,7 +15,7 @@ "semi": "off", "@typescript-eslint/semi": "warn", "no-duplicate-imports": "warn", - "code-oss-eslint/layering": [ + "code-layering": [ "warn", { "common": [], diff --git a/build/lib/eslint/lib/rules/layering.js b/build/lib/eslint/code-layering.js similarity index 100% rename from build/lib/eslint/lib/rules/layering.js rename to build/lib/eslint/code-layering.js diff --git a/build/lib/eslint/lib/rules/layering.ts b/build/lib/eslint/code-layering.ts similarity index 100% rename from build/lib/eslint/lib/rules/layering.ts rename to build/lib/eslint/code-layering.ts diff --git a/build/lib/eslint/lib/index.js b/build/lib/eslint/lib/index.js deleted file mode 100644 index 22f7bea62468e..0000000000000 --- a/build/lib/eslint/lib/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -const layering = require('./rules/layering'); -const rules = { - 'layering': layering -}; -module.exports = { rules }; diff --git a/build/lib/eslint/lib/index.ts b/build/lib/eslint/lib/index.ts deleted file mode 100644 index 0410e7e809b73..0000000000000 --- a/build/lib/eslint/lib/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -const layering = require('./rules/layering'); - -const rules = { - 'layering': layering -}; - -export = { rules }; diff --git a/build/lib/eslint/package.json b/build/lib/eslint/package.json deleted file mode 100644 index 546df538ea41d..0000000000000 --- a/build/lib/eslint/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "code-oss-eslint", - "version": "1.0.0", - "license": "MIT", - "description": "ESLint rules for code oss", - "engines": { - "node": ">=0.10.0" - }, - "keywords": [ - "eslint", - "eslintplugin", - "eslint-plugin" - ], - "author": "vscode", - "main": "lib/index.js", - "devDependencies": { - "@types/eslint": "4.16.1", - "eslint": "~3.9.1" - } -} diff --git a/build/lib/eslint/yarn.lock b/build/lib/eslint/yarn.lock deleted file mode 100644 index c4a0a24fff3fc..0000000000000 --- a/build/lib/eslint/yarn.lock +++ /dev/null @@ -1,931 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@types/eslint@4.16.1": - version "4.16.1" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-4.16.1.tgz#19730c9fcb66b6e44742d12b27a603fabfeb2f49" - integrity sha512-lRUXQAULl5geixTiP2K0iYvMUbCkEnuOwvLGjwff12I4ECxoW5QaWML5UUOZ1CvpQLILkddBdMPMZz4ByQizsg== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*": - version "0.0.41" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421" - integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA== - -"@types/json-schema@*": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" - integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== - -acorn-jsx@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" - integrity sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s= - dependencies: - acorn "^3.0.4" - -acorn@^3.0.4: - version "3.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" - integrity sha1-ReN/s56No/JbruP/U2niu18iAXo= - -acorn@^5.5.0: - version "5.7.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" - integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== - -ajv-keywords@^1.0.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" - integrity sha1-MU3QpLM2j609/NxU7eYXG4htrzw= - -ajv@^4.7.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" - integrity sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY= - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - -ansi-escapes@^1.1.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" - integrity sha1-06ioOzGapneTZisT52HHkRQiMG4= - -ansi-regex@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" - integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= - -ansi-regex@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" - integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= - -ansi-styles@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" - integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= - -argparse@^1.0.7: - version "1.0.10" - resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" - integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== - dependencies: - sprintf-js "~1.0.2" - -babel-code-frame@^6.16.0: - version "6.26.0" - resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" - integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= - dependencies: - chalk "^1.1.3" - esutils "^2.0.2" - js-tokens "^3.0.2" - -balanced-match@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" - integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -buffer-from@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" - integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== - -caller-path@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f" - integrity sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8= - dependencies: - callsites "^0.2.0" - -callsites@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca" - integrity sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo= - -chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" - integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= - dependencies: - ansi-styles "^2.2.1" - escape-string-regexp "^1.0.2" - has-ansi "^2.0.0" - strip-ansi "^3.0.0" - supports-color "^2.0.0" - -circular-json@^0.3.1: - version "0.3.3" - resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66" - integrity sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A== - -cli-cursor@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" - integrity sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc= - dependencies: - restore-cursor "^1.0.1" - -cli-width@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639" - integrity sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk= - -co@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" - integrity sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ= - -code-point-at@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" - integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= - -concat-stream@^1.4.6: - version "1.6.2" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" - integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== - dependencies: - buffer-from "^1.0.0" - inherits "^2.0.3" - readable-stream "^2.2.2" - typedarray "^0.0.6" - -core-util-is@~1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" - integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= - -d@1, d@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" - integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== - dependencies: - es5-ext "^0.10.50" - type "^1.0.1" - -debug@^2.1.1: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" - integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== - dependencies: - ms "2.0.0" - -deep-is@~0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" - integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= - -doctrine@^1.2.2: - version "1.5.0" - resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" - integrity sha1-N53Ocw9hZvds76TmcHoVmwLFpvo= - dependencies: - esutils "^2.0.2" - isarray "^1.0.0" - -es5-ext@^0.10.35, es5-ext@^0.10.46, es5-ext@^0.10.50, es5-ext@~0.10.14: - version "0.10.53" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" - integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== - dependencies: - es6-iterator "~2.0.3" - es6-symbol "~3.1.3" - next-tick "~1.0.0" - -es6-iterator@^2.0.3, es6-iterator@~2.0.1, es6-iterator@~2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" - integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= - dependencies: - d "1" - es5-ext "^0.10.35" - es6-symbol "^3.1.1" - -es6-map@^0.1.3: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-map/-/es6-map-0.1.5.tgz#9136e0503dcc06a301690f0bb14ff4e364e949f0" - integrity sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA= - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-set "~0.1.5" - es6-symbol "~3.1.1" - event-emitter "~0.3.5" - -es6-set@~0.1.5: - version "0.1.5" - resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1" - integrity sha1-0rPsXU2ADO2BjbU40ol02wpzzLE= - dependencies: - d "1" - es5-ext "~0.10.14" - es6-iterator "~2.0.1" - es6-symbol "3.1.1" - event-emitter "~0.3.5" - -es6-symbol@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77" - integrity sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc= - dependencies: - d "1" - es5-ext "~0.10.14" - -es6-symbol@^3.1.1, es6-symbol@~3.1.1, es6-symbol@~3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" - integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== - dependencies: - d "^1.0.1" - ext "^1.1.2" - -es6-weak-map@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/es6-weak-map/-/es6-weak-map-2.0.3.tgz#b6da1f16cc2cc0d9be43e6bdbfc5e7dfcdf31d53" - integrity sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA== - dependencies: - d "1" - es5-ext "^0.10.46" - es6-iterator "^2.0.3" - es6-symbol "^3.1.1" - -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -escope@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/escope/-/escope-3.6.0.tgz#e01975e812781a163a6dadfdd80398dc64c889c3" - integrity sha1-4Bl16BJ4GhY6ba392AOY3GTIicM= - dependencies: - es6-map "^0.1.3" - es6-weak-map "^2.0.1" - esrecurse "^4.1.0" - estraverse "^4.1.1" - -eslint@~3.9.1: - version "3.9.1" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.9.1.tgz#5a8597706fc6048bc6061ac754d4a211d28f4f5b" - integrity sha1-WoWXcG/GBIvGBhrHVNSiEdKPT1s= - dependencies: - babel-code-frame "^6.16.0" - chalk "^1.1.3" - concat-stream "^1.4.6" - debug "^2.1.1" - doctrine "^1.2.2" - escope "^3.6.0" - espree "^3.3.1" - estraverse "^4.2.0" - esutils "^2.0.2" - file-entry-cache "^2.0.0" - glob "^7.0.3" - globals "^9.2.0" - ignore "^3.1.5" - imurmurhash "^0.1.4" - inquirer "^0.12.0" - is-my-json-valid "^2.10.0" - is-resolvable "^1.0.0" - js-yaml "^3.5.1" - json-stable-stringify "^1.0.0" - levn "^0.3.0" - lodash "^4.0.0" - mkdirp "^0.5.0" - natural-compare "^1.4.0" - optionator "^0.8.2" - path-is-inside "^1.0.1" - pluralize "^1.2.1" - progress "^1.1.8" - require-uncached "^1.0.2" - shelljs "^0.7.5" - strip-bom "^3.0.0" - strip-json-comments "~1.0.1" - table "^3.7.8" - text-table "~0.2.0" - user-home "^2.0.0" - -espree@^3.3.1: - version "3.5.4" - resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7" - integrity sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A== - dependencies: - acorn "^5.5.0" - acorn-jsx "^3.0.0" - -esprima@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" - integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== - -esrecurse@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" - integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== - dependencies: - estraverse "^4.1.0" - -estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" - integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== - -esutils@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" - integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== - -event-emitter@~0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/event-emitter/-/event-emitter-0.3.5.tgz#df8c69eef1647923c7157b9ce83840610b02cc39" - integrity sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk= - dependencies: - d "1" - es5-ext "~0.10.14" - -exit-hook@^1.0.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" - integrity sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g= - -ext@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" - integrity sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A== - dependencies: - type "^2.0.0" - -fast-levenshtein@~2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" - integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= - -figures@^1.3.5: - version "1.7.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" - integrity sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4= - dependencies: - escape-string-regexp "^1.0.5" - object-assign "^4.1.0" - -file-entry-cache@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361" - integrity sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E= - dependencies: - flat-cache "^1.2.1" - object-assign "^4.0.1" - -flat-cache@^1.2.1: - version "1.3.4" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.4.tgz#2c2ef77525cc2929007dfffa1dd314aa9c9dee6f" - integrity sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg== - dependencies: - circular-json "^0.3.1" - graceful-fs "^4.1.2" - rimraf "~2.6.2" - write "^0.2.1" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= - -generate-function@^2.0.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/generate-function/-/generate-function-2.3.1.tgz#f069617690c10c868e73b8465746764f97c3479f" - integrity sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ== - dependencies: - is-property "^1.0.2" - -generate-object-property@^1.1.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/generate-object-property/-/generate-object-property-1.2.0.tgz#9c0e1c40308ce804f4783618b937fa88f99d50d0" - integrity sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA= - dependencies: - is-property "^1.0.0" - -glob@^7.0.0, glob@^7.0.3, glob@^7.1.3: - version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" - integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -globals@^9.2.0: - version "9.18.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" - integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== - -graceful-fs@^4.1.2: - version "4.2.3" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" - integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== - -has-ansi@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" - integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= - dependencies: - ansi-regex "^2.0.0" - -ignore@^3.1.5: - version "3.3.10" - resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" - integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== - -imurmurhash@^0.1.4: - version "0.1.4" - resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" - integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@~2.0.3: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -inquirer@^0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-0.12.0.tgz#1ef2bfd63504df0bc75785fff8c2c41df12f077e" - integrity sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34= - dependencies: - ansi-escapes "^1.1.0" - ansi-regex "^2.0.0" - chalk "^1.0.0" - cli-cursor "^1.0.1" - cli-width "^2.0.0" - figures "^1.3.5" - lodash "^4.3.0" - readline2 "^1.0.1" - run-async "^0.1.0" - rx-lite "^3.1.2" - string-width "^1.0.1" - strip-ansi "^3.0.0" - through "^2.3.6" - -interpret@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.2.0.tgz#d5061a6224be58e8083985f5014d844359576296" - integrity sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw== - -is-fullwidth-code-point@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" - integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= - dependencies: - number-is-nan "^1.0.0" - -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= - -is-my-ip-valid@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz#7b351b8e8edd4d3995d4d066680e664d94696824" - integrity sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ== - -is-my-json-valid@^2.10.0: - version "2.20.0" - resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.20.0.tgz#1345a6fca3e8daefc10d0fa77067f54cedafd59a" - integrity sha512-XTHBZSIIxNsIsZXg7XB5l8z/OBFosl1Wao4tXLpeC7eKU4Vm/kdop2azkPqULwnfGQjmeDIyey9g7afMMtdWAA== - dependencies: - generate-function "^2.0.0" - generate-object-property "^1.1.0" - is-my-ip-valid "^1.0.0" - jsonpointer "^4.0.0" - xtend "^4.0.0" - -is-property@^1.0.0, is-property@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" - integrity sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ= - -is-resolvable@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88" - integrity sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg== - -isarray@^1.0.0, isarray@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" - integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= - -js-tokens@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" - integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= - -js-yaml@^3.5.1: - version "3.13.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" - integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== - dependencies: - argparse "^1.0.7" - esprima "^4.0.0" - -json-stable-stringify@^1.0.0, json-stable-stringify@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" - integrity sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8= - dependencies: - jsonify "~0.0.0" - -jsonify@~0.0.0: - version "0.0.0" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" - integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM= - -jsonpointer@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" - integrity sha1-T9kss04OnbPInIYi7PUfm5eMbLk= - -levn@^0.3.0, levn@~0.3.0: - version "0.3.0" - resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" - integrity sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4= - dependencies: - prelude-ls "~1.1.2" - type-check "~0.3.2" - -lodash@^4.0.0, lodash@^4.3.0: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" - integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== - -minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== - dependencies: - brace-expansion "^1.1.7" - -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -mkdirp@^0.5.0, mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" - -ms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" - integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= - -mute-stream@0.0.5: - version "0.0.5" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0" - integrity sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA= - -natural-compare@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" - integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= - -next-tick@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" - integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= - -number-is-nan@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" - integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= - -object-assign@^4.0.1, object-assign@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" - integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -onetime@^1.0.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789" - integrity sha1-ofeDj4MUxRbwXs78vEzP4EtO14k= - -optionator@^0.8.2: - version "0.8.3" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" - integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.6" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - word-wrap "~1.2.3" - -os-homedir@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" - integrity sha1-/7xJiDNuDoM94MFox+8VISGqf7M= - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-is-inside@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" - integrity sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM= - -path-parse@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" - integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== - -pluralize@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" - integrity sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU= - -prelude-ls@~1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" - integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= - -process-nextick-args@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" - integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== - -progress@^1.1.8: - version "1.1.8" - resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" - integrity sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74= - -readable-stream@^2.2.2: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw== - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - -readline2@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/readline2/-/readline2-1.0.1.tgz#41059608ffc154757b715d9989d199ffbf372e35" - integrity sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - mute-stream "0.0.5" - -rechoir@^0.6.2: - version "0.6.2" - resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384" - integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q= - dependencies: - resolve "^1.1.6" - -require-uncached@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3" - integrity sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM= - dependencies: - caller-path "^0.1.0" - resolve-from "^1.0.0" - -resolve-from@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" - integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY= - -resolve@^1.1.6: - version "1.14.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.14.1.tgz#9e018c540fcf0c427d678b9931cbf45e984bcaff" - integrity sha512-fn5Wobh4cxbLzuHaE+nphztHy43/b++4M6SsGFC2gB8uYwf0C8LcarfCz1un7UTW8OFQg9iNjZ4xpcFVGebDPg== - dependencies: - path-parse "^1.0.6" - -restore-cursor@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" - integrity sha1-NGYfRohjJ/7SmRR5FSJS35LapUE= - dependencies: - exit-hook "^1.0.0" - onetime "^1.0.0" - -rimraf@~2.6.2: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== - dependencies: - glob "^7.1.3" - -run-async@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389" - integrity sha1-yK1KXhEGYeQCp9IbUw4AnyX444k= - dependencies: - once "^1.3.0" - -rx-lite@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" - integrity sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI= - -safe-buffer@~5.1.0, safe-buffer@~5.1.1: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== - -shelljs@^0.7.5: - version "0.7.8" - resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.8.tgz#decbcf874b0d1e5fb72e14b164a9683048e9acb3" - integrity sha1-3svPh0sNHl+3LhSxZKloMEjprLM= - dependencies: - glob "^7.0.0" - interpret "^1.0.0" - rechoir "^0.6.2" - -slice-ansi@0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-0.0.4.tgz#edbf8903f66f7ce2f8eafd6ceed65e264c831b35" - integrity sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU= - -sprintf-js@~1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" - integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= - -string-width@^1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" - integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= - dependencies: - code-point-at "^1.0.0" - is-fullwidth-code-point "^1.0.0" - strip-ansi "^3.0.0" - -string-width@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" - integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== - dependencies: - is-fullwidth-code-point "^2.0.0" - strip-ansi "^4.0.0" - -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" - integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== - dependencies: - safe-buffer "~5.1.0" - -strip-ansi@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" - integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= - dependencies: - ansi-regex "^2.0.0" - -strip-ansi@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" - integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= - dependencies: - ansi-regex "^3.0.0" - -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= - -strip-json-comments@~1.0.1: - version "1.0.4" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91" - integrity sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E= - -supports-color@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" - integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= - -table@^3.7.8: - version "3.8.3" - resolved "https://registry.yarnpkg.com/table/-/table-3.8.3.tgz#2bbc542f0fda9861a755d3947fefd8b3f513855f" - integrity sha1-K7xULw/amGGnVdOUf+/Ys/UThV8= - dependencies: - ajv "^4.7.0" - ajv-keywords "^1.0.0" - chalk "^1.1.1" - lodash "^4.0.0" - slice-ansi "0.0.4" - string-width "^2.0.0" - -text-table@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" - integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= - -through@^2.3.6: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - -type-check@~0.3.2: - version "0.3.2" - resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72" - integrity sha1-WITKtRLPHTVeP7eE8wgEsrUg23I= - dependencies: - prelude-ls "~1.1.2" - -type@^1.0.1: - version "1.2.0" - resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" - integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== - -type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" - integrity sha512-KBt58xCHry4Cejnc2ISQAF7QY+ORngsWfxezO68+12hKV6lQY8P/psIkcbjeHWn7MqcgciWJyCCevFMJdIXpow== - -typedarray@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" - integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - -user-home@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" - integrity sha1-nHC/2Babwdy/SGBODwS4tJzenp8= - dependencies: - os-homedir "^1.0.0" - -util-deprecate@~1.0.1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" - integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= - -word-wrap@~1.2.3: - version "1.2.3" - resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" - integrity sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ== - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= - -write@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757" - integrity sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c= - dependencies: - mkdirp "^0.5.1" - -xtend@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== diff --git a/build/package.json b/build/package.json index 7d72317ff5e0b..ae55442cb18c1 100644 --- a/build/package.json +++ b/build/package.json @@ -6,6 +6,7 @@ "@types/ansi-colors": "^3.2.0", "@types/azure": "0.9.19", "@types/debounce": "^1.0.0", + "@types/eslint": "4.16.1", "@types/fancy-log": "^1.3.0", "@types/glob": "^7.1.1", "@types/gulp": "^4.0.5", diff --git a/build/yarn.lock b/build/yarn.lock index 3f9e5f1cda793..c8f1d29a9207c 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -90,6 +90,19 @@ resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd" integrity sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ== +"@types/eslint@4.16.1": + version "4.16.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-4.16.1.tgz#19730c9fcb66b6e44742d12b27a603fabfeb2f49" + integrity sha512-lRUXQAULl5geixTiP2K0iYvMUbCkEnuOwvLGjwff12I4ECxoW5QaWML5UUOZ1CvpQLILkddBdMPMZz4ByQizsg== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*": + version "0.0.41" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.41.tgz#fd90754150b57432b72bf560530500597ff04421" + integrity sha512-rIAmXyJlqw4KEBO7+u9gxZZSQHaCNnIzYrnNmYVpgfJhxTqO0brCX0SYpqUTkVI5mwwUwzmtspLBGBKroMeynA== + "@types/events@*": version "1.2.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" @@ -184,6 +197,11 @@ resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c" integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA== +"@types/json-schema@*": + version "7.0.4" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" + integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== + "@types/mime@0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b" diff --git a/package.json b/package.json index 735767636a829..97341660725ec 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "strict-function-types-watch": "tsc --watch -p src/tsconfig.json --noEmit --strictFunctionTypes", "update-distro": "node build/npm/update-distro.js", "web": "node scripts/code-web.js", - "eslint": "eslint -c .eslintrc.json --ext .ts --ext .js ./src/vs ./extensions" + "eslint": "eslint -c .eslintrc.json --rulesdir ./build/lib/eslint --ext .ts --ext .js ./src/vs ./extensions" }, "dependencies": { "applicationinsights": "1.0.8", @@ -87,7 +87,6 @@ "ansi-colors": "^3.2.3", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", - "code-oss-eslint": "file:./build/lib/eslint/", "copy-webpack-plugin": "^4.5.2", "coveralls": "^2.11.11", "cson-parser": "^1.3.3", From 9819da68aba0d5a40489aacbcccad7d3a8d1a390 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 10:03:52 +0100 Subject: [PATCH 09/47] migrate import-patterns rule to eslint --- .eslintrc.json | 578 ++++++++++++++++++++++- build/lib/eslint/code-import-patterns.js | 71 +++ build/lib/eslint/code-import-patterns.ts | 87 ++++ 3 files changed, 722 insertions(+), 14 deletions(-) create mode 100644 build/lib/eslint/code-import-patterns.js create mode 100644 build/lib/eslint/code-import-patterns.ts diff --git a/.eslintrc.json b/.eslintrc.json index d25d11ba25fee..f99cf583d9266 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,9 +12,22 @@ "no-extra-semi": "off", "no-unused-vars": "off", "eqeqeq": "warn", + "no-duplicate-imports": "warn", + "constructor-super": "warn", + "curly": "warn", + "no-caller": "warn", + "no-debugger": "warn", + "no-duplicate-case": "warn", + "no-eval": "warn", + "no-new-wrappers": "warn", + "no-sparse-arrays": "warn", + "no-throw-literal": "warn", + "no-unsafe-finally": "warn", + "no-unused-labels": "warn", + "no-var": "warn", "semi": "off", "@typescript-eslint/semi": "warn", - "no-duplicate-imports": "warn", + "@typescript-eslint/class-name-casing": "warn", "code-layering": [ "warn", { @@ -36,18 +49,555 @@ ] } ], - "@typescript-eslint/class-name-casing": "warn", - "constructor-super": "warn", - "curly": "warn", - "no-caller": "warn", - "no-debugger": "warn", - "no-duplicate-case": "warn", - "no-eval": "warn", - "no-new-wrappers": "warn", - "no-sparse-arrays": "warn", - "no-throw-literal": "warn", - "no-unsafe-finally": "warn", - "no-unused-labels": "warn", - "no-var": "warn" + "code-import-patterns": [ + "warn", + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + // !!! Do not relax these rules !!! + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + { + "target": "**/vs/base/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**" + ] + }, + { + "target": "**/vs/base/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/test/common/**" + ] + }, + { + "target": "**/vs/base/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + // vs/base/test/browser contains tests for vs/base/browser + "target": "**/vs/base/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/base/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/parts/*/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**" + ] + }, + { + "target": "**/vs/base/parts/*/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**" + ] + }, + { + "target": "**/vs/base/parts/*/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "**/vs/base/parts/*/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/base/parts/*/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/base/parts/*/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node,electron-main}/**", + "**/vs/base/parts/*/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**", + "**/vs/platform/*/common/**" + ] + }, + { + "target": "**/vs/platform/*/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**" + ] + }, + { + "target": "**/vs/platform/*/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**" + ] + }, + { + "target": "**/vs/platform/*/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node}/**", + "**/vs/base/parts/*/{common,node}/**", + "**/vs/platform/*/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "**/vs/platform/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/{common,node,electron-main}/**", + "**/vs/base/parts/*/{common,node,electron-main}/**", + "**/vs/platform/*/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/platform/*/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/worker/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**" + ] + }, + { + "target": "**/vs/editor/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**", + "**/vs/editor/common/**", + "**/vs/editor/test/common/**" + ] + }, + { + "target": "**/vs/editor/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/standalone/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/standalone/common/**" + ] + }, + { + "target": "**/vs/editor/standalone/test/common/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/platform/*/test/common/**", + "**/vs/editor/common/**", + "**/vs/editor/test/common/**" + ] + }, + { + "target": "**/vs/editor/standalone/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**", + "**/vs/editor/standalone/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/standalone/test/browser/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/standalone/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**" + ] + }, + { + "target": "**/vs/editor/contrib/*/test/**", + "restrictions": [ + "assert", + "sinon", + "vs/nls", + "**/vs/base/{common,browser}/**", + "**/vs/base/test/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/platform/*/test/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/test/{common,browser}/**", + "**/vs/editor/contrib/**" + ] + }, + { + "target": "**/vs/editor/contrib/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**" + ] + }, + { + "target": "**/vs/workbench/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/common/**", + "**/vs/base/parts/*/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/contrib/*/common/**", + "**/vs/workbench/common/**", + "**/vs/workbench/services/*/common/**", + "assert" + ] + }, + { + "target": "**/vs/workbench/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser}/**", + "**/vs/base/parts/*/{common,browser}/**", + "**/vs/platform/*/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/{common,browser}/**", + "**/vs/workbench/services/*/{common,browser}/**", + "assert" + ] + }, + { + "target": "**/vs/workbench/workbench.desktop.main.ts", + "restrictions": [ + "**" + ] + }, + { + "target": "**/vs/workbench/api/common/**", + "restrictions": [ + "vscode", + "vs/nls", + "**/vs/base/common/**", + "**/vs/platform/*/common/**", + "**/vs/editor/common/**", + "**/vs/editor/contrib/*/common/**", + "**/vs/workbench/api/common/**", + "**/vs/workbench/common/**", + "**/vs/workbench/services/*/common/**", + "**/vs/workbench/contrib/*/common/**" + ] + }, + { + "target": "**/vs/workbench/api/worker/**", + "restrictions": [ + "vscode", + "vs/nls", + "**/vs/**/{common,worker}/**" + ] + }, + { + "target": "**/vs/workbench/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", + "**/vs/platform/*/{common,browser,node,electron-browser}/**", + "**/vs/editor/{common,browser,node,electron-browser}/**", + "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention + "**/vs/workbench/{common,browser,node,electron-browser,api}/**", + "**/vs/workbench/services/*/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/test/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**", + "**/vs/platform/**", + "**/vs/editor/**", + "**/vs/workbench/{common,browser,node,electron-browser}/**", + "vs/workbench/contrib/files/common/editors/fileEditorInput", + "**/vs/workbench/services/**", + "**/vs/workbench/test/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/common/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/common/**", + "**/vs/platform/**/common/**", + "**/vs/editor/common/**", + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/common/**", + "**/vs/workbench/services/**/common/**", + "**/vs/workbench/api/**/common/**", + "vscode-textmate" + ] + }, + { + "target": "**/vs/workbench/services/**/worker/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/common/**", + "**/vs/platform/**/common/**", + "**/vs/editor/common/**", + "**/vs/workbench/**/common/**", + "**/vs/workbench/**/worker/**", + "**/vs/workbench/services/**/common/**", + "vscode" + ] + }, + { + "target": "**/vs/workbench/services/**/browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,worker}/**", + "**/vs/platform/**/{common,browser}/**", + "**/vs/editor/{common,browser}/**", + "**/vs/workbench/workbench.web.api", + "**/vs/workbench/{common,browser}/**", + "**/vs/workbench/api/{common,browser}/**", + "**/vs/workbench/services/**/{common,browser}/**", + "vscode-textmate", + "onigasm-umd" + ] + }, + { + "target": "**/vs/workbench/services/**/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/editor/{common,node}/**", + "**/vs/workbench/{common,node}/**", + "**/vs/workbench/api/{common,node}/**", + "**/vs/workbench/services/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/services/**/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,worker,node,electron-browser}/**", + "**/vs/platform/**/{common,browser,node,electron-browser}/**", + "**/vs/editor/**", + "**/vs/workbench/{common,browser,node,electron-browser,api}/**", + "**/vs/workbench/services/**/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/workbench/contrib/terminal/browser/**", + "restrictions": [ + // xterm and its addons are strictly browser-only components + "xterm", + "xterm-addon-*", + "**/vs/**" + ] + }, + { + "target": "**/vs/workbench/contrib/extensions/browser/**", + "restrictions": [ + "semver-umd", + "**/vs/**" + ] + }, + { + "target": "**/vs/workbench/contrib/update/browser/update.ts", + "restrictions": [ + "semver-umd", + "**/vs/**" + ] + }, + { + "target": "**/vs/code/node/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/base/parts/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/code/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/code/electron-browser/**", + "restrictions": [ + "vs/nls", + "vs/css!./**/*", + "**/vs/base/**/{common,browser,node,electron-browser}/**", + "**/vs/base/parts/**/{common,browser,node,electron-browser}/**", + "**/vs/platform/**/{common,browser,node,electron-browser}/**", + "**/vs/code/**/{common,browser,node,electron-browser}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/code/electron-main/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node,electron-main}/**", + "**/vs/base/parts/**/{common,node,electron-main}/**", + "**/vs/platform/**/{common,node,electron-main}/**", + "**/vs/code/**/{common,node,electron-main}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/vs/server/**", + "restrictions": [ + "vs/nls", + "**/vs/base/**/{common,node}/**", + "**/vs/base/parts/**/{common,node}/**", + "**/vs/platform/**/{common,node}/**", + "**/vs/workbench/**/{common,node}/**", + "**/vs/server/**", + "**/vs/code/**/{common,node}/**", + "!path" // node modules (except path where we have our own impl) + ] + }, + { + "target": "**/{node,electron-browser,electron-main}/**", + "restrictions": "**/*" + }, + { + "target": "**/extensions/**", + "restrictions": "**/*" + }, + { + "target": "**/test/smoke/**", + "restrictions": [ + "**/test/smoke/**", + "*" + ] + }, + { + "target": "**/test/automation/**", + "restrictions": [ + "**/test/automation/**", + "*" + ] + }, + { + "target": "{**/**.test.ts,**/test/**}", + "restrictions": "{**/vs/**,assert,sinon,crypto}" + }, + { + "target": "**/{common,browser,workbench}/**", + "restrictions": "**/vs/**" + } + ] } } diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js new file mode 100644 index 0000000000000..dca00604b17fc --- /dev/null +++ b/build/lib/eslint/code-import-patterns.js @@ -0,0 +1,71 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +const minimatch = require("minimatch"); +module.exports = new class { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + } + }; + } + create(context) { + const configs = context.options; + for (const config of configs) { + if (minimatch(context.getFilename(), config.target)) { + return { + ImportDeclaration: (node) => { + this._checkImport(context, config, node, node.source.value); + }, + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + this._checkImport(context, config, node, args[0].value); + } + } + }; + } + } + return {}; + } + _checkImport(context, config, node, path) { + if (typeof path !== 'string') { + return; + } + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + let restrictions; + if (typeof config.restrictions === 'string') { + restrictions = [config.restrictions]; + } + else { + restrictions = config.restrictions; + } + let matched = false; + for (const pattern of restrictions) { + if (minimatch(path, pattern)) { + matched = true; + break; + } + } + if (!matched) { + // None of the restrictions matched + context.report({ + node, + messageId: 'badImport', + data: { + restrictions: restrictions.join(' or ') + } + }); + } + } +}; diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts new file mode 100644 index 0000000000000..743f4bfdc6e06 --- /dev/null +++ b/build/lib/eslint/code-import-patterns.ts @@ -0,0 +1,87 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; +import { join } from 'path'; +import * as minimatch from 'minimatch'; + +interface ImportPatternsConfig { + target: string; + restrictions: string | string[]; +} + +export = new class implements eslint.Rule.RuleModule { + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const configs = context.options; + + for (const config of configs) { + if (minimatch(context.getFilename(), config.target)) { + return { + ImportDeclaration: (node: estree.Node) => { + this._checkImport(context, config!, node, (node).source.value); + }, + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + this._checkImport(context, config!, node, (args[0]).value); + } + } + }; + } + } + + return {}; + + } + + private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: estree.Node, path: any) { + if (typeof path !== 'string') { + return; + } + + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + let restrictions: string[]; + if (typeof config.restrictions === 'string') { + restrictions = [config.restrictions]; + } else { + restrictions = config.restrictions; + } + + let matched = false; + for (const pattern of restrictions) { + if (minimatch(path, pattern)) { + matched = true; + break; + } + } + + if (!matched) { + // None of the restrictions matched + context.report({ + node, + messageId: 'badImport', + data: { + restrictions: restrictions.join(' or ') + } + }); + } + } +}; + From 291ee0058a8f4dff8e42bb0c5b3a42a2a1f54c43 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 10:06:37 +0100 Subject: [PATCH 10/47] add no-buffer-ctor rule --- .eslintrc.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index f99cf583d9266..09d3512a58893 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,21 +9,22 @@ "@typescript-eslint" ], "rules": { - "no-extra-semi": "off", - "no-unused-vars": "off", - "eqeqeq": "warn", - "no-duplicate-imports": "warn", "constructor-super": "warn", "curly": "warn", + "eqeqeq": "warn", + "no-buffer-constructor": "warn", "no-caller": "warn", "no-debugger": "warn", "no-duplicate-case": "warn", + "no-duplicate-imports": "warn", "no-eval": "warn", + "no-extra-semi": "off", "no-new-wrappers": "warn", "no-sparse-arrays": "warn", "no-throw-literal": "warn", "no-unsafe-finally": "warn", "no-unused-labels": "warn", + "no-unused-vars": "off", "no-var": "warn", "semi": "off", "@typescript-eslint/semi": "warn", From a7ca3a5b100d6f35129579f5afa2db7057deaa44 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 10:29:28 +0100 Subject: [PATCH 11/47] rulesdir/rulePaths for gulp-eslint --- build/gulpfile.hygiene.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 3185e325d5cdd..6efdc15470ddc 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -186,7 +186,10 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) .pipe(filter(eslintFilter)) - .pipe(gulpeslint('.eslintrc.json')) + .pipe(gulpeslint({ + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'] + })) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); }); From 54d20309fab9abf6bc5c0d9f6b5266ea9f2efce6 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 10:51:58 +0100 Subject: [PATCH 12/47] tweak rules and excludes --- .eslintignore | 2 ++ .eslintrc.json | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintignore b/.eslintignore index 54f0bce7b748f..aaa375e9bad6d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,3 +11,5 @@ **/vscode-api-tests/testWorkspace/** **/extensions/**/out/** **/extensions/**/build/** +**/extensions/markdown-language-features/media/** +**/extensions/typescript-basics/test/colorize-fixtures/** diff --git a/.eslintrc.json b/.eslintrc.json index 09d3512a58893..1a8ef02a16922 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -24,7 +24,6 @@ "no-throw-literal": "warn", "no-unsafe-finally": "warn", "no-unused-labels": "warn", - "no-unused-vars": "off", "no-var": "warn", "semi": "off", "@typescript-eslint/semi": "warn", From a3bd6046273957d2b0ebe3056abf08de45d7f036 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 11:09:38 +0100 Subject: [PATCH 13/47] migrate translation remind rule --- .eslintrc.json | 1 + build/lib/eslint/code-translation-remind.js | 68 ++++++++++++++++++ build/lib/eslint/code-translation-remind.ts | 79 +++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 build/lib/eslint/code-translation-remind.js create mode 100644 build/lib/eslint/code-translation-remind.ts diff --git a/.eslintrc.json b/.eslintrc.json index 1a8ef02a16922..94736aca17ded 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,6 +28,7 @@ "semi": "off", "@typescript-eslint/semi": "warn", "@typescript-eslint/class-name-casing": "warn", + "code-translation-remind": "warn", "code-layering": [ "warn", { diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js new file mode 100644 index 0000000000000..a6a86d5040813 --- /dev/null +++ b/build/lib/eslint/code-translation-remind.js @@ -0,0 +1,68 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const fs_1 = require("fs"); +module.exports = new (_a = class TranslationRemind { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' + } + }; + } + create(context) { + return { + ImportDeclaration: (node) => { + this._checkImport(context, node, node.source.value); + }, + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + this._checkImport(context, node, args[0].value); + } + } + }; + } + _checkImport(context, node, path) { + if (path === TranslationRemind.NLS_MODULE) { + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + const resource = matchService ? matchService[0] : matchPart[0]; + let resourceDefined = false; + let json; + try { + json = fs_1.readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } + catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + workbenchResources.forEach((existingResource) => { + if (existingResource.name === resource) { + resourceDefined = true; + return; + } + }); + if (!resourceDefined) { + context.report({ + node, + messageId: 'missing', + data: { resource } + }); + } + } + } + }, + _a.NLS_MODULE = 'vs/nls', + _a); diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts new file mode 100644 index 0000000000000..5af5a8a219533 --- /dev/null +++ b/build/lib/eslint/code-translation-remind.ts @@ -0,0 +1,79 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; +import { readFileSync } from 'fs'; + + +export = new class TranslationRemind implements eslint.Rule.RuleModule { + + private static NLS_MODULE = 'vs/nls'; + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + return { + ImportDeclaration: (node: estree.Node) => { + this._checkImport(context, node, (node).source.value); + }, + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + this._checkImport(context, node, (args[0]).value); + } + } + }; + } + + private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { + + if (path === TranslationRemind.NLS_MODULE) { + + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + + const resource = matchService ? matchService[0] : matchPart![0]; + let resourceDefined = false; + + let json; + try { + json = readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + + workbenchResources.forEach((existingResource: any) => { + if (existingResource.name === resource) { + resourceDefined = true; + return; + } + }); + + if (!resourceDefined) { + context.report({ + node, + messageId: 'missing', + data: { resource } + }); + } + } + + } +}; + From 2ea9132cab688d99dd2c9fa57fb12f3b91b1d689 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 11:19:24 +0100 Subject: [PATCH 14/47] migrate no-nls-in-standalone-editor rule --- .eslintrc.json | 1 + .../code-no-nls-in-standalone-editor.js | 54 +++++++++++++++ .../code-no-nls-in-standalone-editor.ts | 67 +++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 build/lib/eslint/code-no-nls-in-standalone-editor.js create mode 100644 build/lib/eslint/code-no-nls-in-standalone-editor.ts diff --git a/.eslintrc.json b/.eslintrc.json index 94736aca17ded..69a7bd2fd035b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -29,6 +29,7 @@ "@typescript-eslint/semi": "warn", "@typescript-eslint/class-name-casing": "warn", "code-translation-remind": "warn", + "code-no-nls-in-standalone-editor": "warn", "code-layering": [ "warn", { diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js new file mode 100644 index 0000000000000..8a13a1c8f1754 --- /dev/null +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -0,0 +1,54 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' + } + }; + } + create(context) { + const fileName = context.getFilename(); + if (!(/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName))) { + return {}; + } + return { + ImportDeclaration: (node) => { + this._checkImport(context, node, node.source.value); + }, + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + this._checkImport(context, node, args[0].value); + } + } + }; + } + _checkImport(context, node, path) { + if (typeof path !== 'string') { + return; + } + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + if (/vs(\/|\\)nls/.test(path)) { + context.report({ + node, + messageId: 'noNls' + }); + } + } +}; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts new file mode 100644 index 0000000000000..060ce57949759 --- /dev/null +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.ts @@ -0,0 +1,67 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; +import { join } from 'path'; + +export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const fileName = context.getFilename(); + if (!( + /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName) + )) { + return {}; + } + + return { + ImportDeclaration: (node: estree.Node) => { + this._checkImport(context, node, (node).source.value); + }, + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + this._checkImport(context, node, (args[0]).value); + } + } + }; + } + + private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { + if (typeof path !== 'string') { + return; + } + + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + if ( + /vs(\/|\\)nls/.test(path) + ) { + context.report({ + node, + messageId: 'noNls' + }); + } + + } +}; + From b05b48126571d8121dbbf55c6dde6e966dbf762c Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 11:23:53 +0100 Subject: [PATCH 15/47] migrate no-standalone-editor rule --- .eslintrc.json | 1 + build/lib/eslint/code-no-standalone-editor.js | 54 ++++++++++++++++ build/lib/eslint/code-no-standalone-editor.ts | 64 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 build/lib/eslint/code-no-standalone-editor.js create mode 100644 build/lib/eslint/code-no-standalone-editor.ts diff --git a/.eslintrc.json b/.eslintrc.json index 69a7bd2fd035b..4ef8fce2ffff7 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -30,6 +30,7 @@ "@typescript-eslint/class-name-casing": "warn", "code-translation-remind": "warn", "code-no-nls-in-standalone-editor": "warn", + "code-no-standalone-editor": "warn", "code-layering": [ "warn", { diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js new file mode 100644 index 0000000000000..249c6a6996596 --- /dev/null +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -0,0 +1,54 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +const path_1 = require("path"); +module.exports = new class NoNlsInStandaloneEditorRule { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + badImport: 'Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + } + }; + } + create(context) { + if (/vs(\/|\\)editor/.test(context.getFilename())) { + // the vs/editor folder is allowed to use the standalone editor + return {}; + } + return { + ImportDeclaration: (node) => { + this._checkImport(context, node, node.source.value); + }, + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + this._checkImport(context, node, args[0].value); + } + } + }; + } + _checkImport(context, node, path) { + if (typeof path !== 'string') { + return; + } + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { + context.report({ + node, + messageId: 'badImport' + }); + } + } +}; diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts new file mode 100644 index 0000000000000..bd748663e66bb --- /dev/null +++ b/build/lib/eslint/code-no-standalone-editor.ts @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; +import { join } from 'path'; + +export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + badImport: 'Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + if (/vs(\/|\\)editor/.test(context.getFilename())) { + // the vs/editor folder is allowed to use the standalone editor + return {}; + } + + return { + ImportDeclaration: (node: estree.Node) => { + this._checkImport(context, node, (node).source.value); + }, + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + this._checkImport(context, node, (args[0]).value); + } + } + }; + } + + private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { + if (typeof path !== 'string') { + return; + } + + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } + + if ( + /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) + ) { + context.report({ + node, + messageId: 'badImport' + }); + } + } +}; + From 808865cf579947e9b53492af85aa79963dab81a3 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 13:01:33 +0100 Subject: [PATCH 16/47] extract import path detection into util --- build/lib/eslint/code-import-patterns.js | 17 +---- build/lib/eslint/code-import-patterns.ts | 19 +---- build/lib/eslint/code-layering.js | 62 ++++++---------- build/lib/eslint/code-layering.ts | 65 ++++++---------- .../code-no-nls-in-standalone-editor.js | 42 ++++------- .../code-no-nls-in-standalone-editor.ts | 49 ++++-------- build/lib/eslint/code-no-standalone-editor.js | 46 ++++-------- build/lib/eslint/code-no-standalone-editor.ts | 53 +++++-------- build/lib/eslint/code-translation-remind.js | 71 ++++++++---------- build/lib/eslint/code-translation-remind.ts | 74 ++++++++----------- build/lib/eslint/utils.js | 36 +++++++++ build/lib/eslint/utils.ts | 46 ++++++++++++ 12 files changed, 263 insertions(+), 317 deletions(-) create mode 100644 build/lib/eslint/utils.js create mode 100644 build/lib/eslint/utils.ts diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js index dca00604b17fc..144f7cc9b62fd 100644 --- a/build/lib/eslint/code-import-patterns.js +++ b/build/lib/eslint/code-import-patterns.js @@ -5,6 +5,7 @@ *--------------------------------------------------------------------------------------------*/ const path_1 = require("path"); const minimatch = require("minimatch"); +const utils_1 = require("./utils"); module.exports = new class { constructor() { this.meta = { @@ -19,26 +20,12 @@ module.exports = new class { const configs = context.options; for (const config of configs) { if (minimatch(context.getFilename(), config.target)) { - return { - ImportDeclaration: (node) => { - this._checkImport(context, config, node, node.source.value); - }, - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - this._checkImport(context, config, node, args[0].value); - } - } - }; + return utils_1.createImportRuleListener((node, value) => this._checkImport(context, config, node, value)); } } return {}; } _checkImport(context, config, node, path) { - if (typeof path !== 'string') { - return; - } // resolve relative paths if (path[0] === '.') { path = path_1.join(context.getFilename(), path); diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts index 743f4bfdc6e06..eac15ebfa0547 100644 --- a/build/lib/eslint/code-import-patterns.ts +++ b/build/lib/eslint/code-import-patterns.ts @@ -7,6 +7,7 @@ import * as eslint from 'eslint'; import * as estree from 'estree'; import { join } from 'path'; import * as minimatch from 'minimatch'; +import { createImportRuleListener } from './utils'; interface ImportPatternsConfig { target: string; @@ -29,28 +30,14 @@ export = new class implements eslint.Rule.RuleModule { for (const config of configs) { if (minimatch(context.getFilename(), config.target)) { - return { - ImportDeclaration: (node: estree.Node) => { - this._checkImport(context, config!, node, (node).source.value); - }, - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { - this._checkImport(context, config!, node, (args[0]).value); - } - } - }; + return createImportRuleListener((node, value) => this._checkImport(context, config, node, value)); } } return {}; - } - private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: estree.Node, path: any) { - if (typeof path !== 'string') { - return; - } + private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: estree.Node, path: string) { // resolve relative paths if (path[0] === '.') { diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js index 220b31f1f0118..a033ca96c047d 100644 --- a/build/lib/eslint/code-layering.js +++ b/build/lib/eslint/code-layering.js @@ -4,6 +4,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ const path_1 = require("path"); +const utils_1 = require("./utils"); module.exports = new class { constructor() { this.meta = { @@ -37,45 +38,30 @@ module.exports = new class { // nothing return {}; } - return { - ImportDeclaration: (node) => { - this._checkImport(context, config, node, node.source.value); - }, - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - this._checkImport(context, config, node, args[0].value); - } - } - }; - } - _checkImport(context, config, node, path) { - if (typeof path !== 'string') { - return; - } - if (path[0] === '.') { - path = path_1.join(path_1.dirname(context.getFilename()), path); - } - const parts = path_1.dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (config.allowed.has(part)) { - // GOOD - same layer - break; + return utils_1.createImportRuleListener((node, path) => { + if (path[0] === '.') { + path = path_1.join(path_1.dirname(context.getFilename()), path); } - if (config.disallowed.has(part)) { - // BAD - wrong layer - context.report({ - node, - messageId: 'layerbreaker', - data: { - from: part, - allowed: [...config.allowed.keys()].join(', ') - } - }); - break; + const parts = path_1.dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + if (config.allowed.has(part)) { + // GOOD - same layer + break; + } + if (config.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + node, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config.allowed.keys()].join(', ') + } + }); + break; + } } - } + }); } }; diff --git a/build/lib/eslint/code-layering.ts b/build/lib/eslint/code-layering.ts index 83962de0c0a11..83775e9adbd45 100644 --- a/build/lib/eslint/code-layering.ts +++ b/build/lib/eslint/code-layering.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; import { join, dirname } from 'path'; +import { createImportRuleListener } from './utils'; type Config = { allowed: Set; @@ -49,51 +49,34 @@ export = new class implements eslint.Rule.RuleModule { return {}; } - return { - ImportDeclaration: (node: estree.Node) => { - this._checkImport(context, config!, node, (node).source.value); - }, - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { - this._checkImport(context, config!, node, (args[0]).value); - } + return createImportRuleListener((node, path) => { + if (path[0] === '.') { + path = join(dirname(context.getFilename()), path); } - }; - } - - private _checkImport(context: eslint.Rule.RuleContext, config: Config, node: estree.Node, path: any) { - if (typeof path !== 'string') { - return; - } - - if (path[0] === '.') { - path = join(dirname(context.getFilename()), path); - } - - const parts = dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (config.allowed.has(part)) { - // GOOD - same layer - break; - } + const parts = dirname(path).split(/\\|\//); + for (let i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; - if (config.disallowed.has(part)) { - // BAD - wrong layer - context.report({ - node, - messageId: 'layerbreaker', - data: { - from: part, - allowed: [...config.allowed.keys()].join(', ') - } - }); + if (config!.allowed.has(part)) { + // GOOD - same layer + break; + } - break; + if (config!.disallowed.has(part)) { + // BAD - wrong layer + context.report({ + node, + messageId: 'layerbreaker', + data: { + from: part, + allowed: [...config!.allowed.keys()].join(', ') + } + }); + break; + } } - } + }); } }; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js index 8a13a1c8f1754..176c0250a0793 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.js +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -4,6 +4,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ const path_1 = require("path"); +const utils_1 = require("./utils"); module.exports = new class NoNlsInStandaloneEditorRule { constructor() { this.meta = { @@ -16,39 +17,24 @@ module.exports = new class NoNlsInStandaloneEditorRule { } create(context) { const fileName = context.getFilename(); - if (!(/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName))) { - return {}; - } - return { - ImportDeclaration: (node) => { - this._checkImport(context, node, node.source.value); - }, - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - this._checkImport(context, node, args[0].value); + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName)) { + return utils_1.createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); + } + if (/vs(\/|\\)nls/.test(path)) { + context.report({ + node, + messageId: 'noNls' + }); } - } - }; - } - _checkImport(context, node, path) { - if (typeof path !== 'string') { - return; - } - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(context.getFilename(), path); - } - if (/vs(\/|\\)nls/.test(path)) { - context.report({ - node, - messageId: 'noNls' }); } + return {}; } }; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts index 060ce57949759..4bf0495853f09 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.ts +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; import { join } from 'path'; +import { createImportRuleListener } from './utils'; export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { @@ -20,48 +20,31 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { const fileName = context.getFilename(); - if (!( + if ( /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(fileName) || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(fileName) || /vs(\/|\\)editor(\/|\\)editor.api/.test(fileName) || /vs(\/|\\)editor(\/|\\)editor.main/.test(fileName) || /vs(\/|\\)editor(\/|\\)editor.worker/.test(fileName) - )) { - return {}; - } - - return { - ImportDeclaration: (node: estree.Node) => { - this._checkImport(context, node, (node).source.value); - }, - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { - this._checkImport(context, node, (args[0]).value); + ) { + return createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); } - } - }; - } - - private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { - if (typeof path !== 'string') { - return; - } - - // resolve relative paths - if (path[0] === '.') { - path = join(context.getFilename(), path); - } - if ( - /vs(\/|\\)nls/.test(path) - ) { - context.report({ - node, - messageId: 'noNls' + if ( + /vs(\/|\\)nls/.test(path) + ) { + context.report({ + node, + messageId: 'noNls' + }); + } }); } + return {}; } }; diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js index 249c6a6996596..576bc60f58054 100644 --- a/build/lib/eslint/code-no-standalone-editor.js +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -4,6 +4,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ const path_1 = require("path"); +const utils_1 = require("./utils"); module.exports = new class NoNlsInStandaloneEditorRule { constructor() { this.meta = { @@ -19,36 +20,21 @@ module.exports = new class NoNlsInStandaloneEditorRule { // the vs/editor folder is allowed to use the standalone editor return {}; } - return { - ImportDeclaration: (node) => { - this._checkImport(context, node, node.source.value); - }, - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - this._checkImport(context, node, args[0].value); - } + return utils_1.createImportRuleListener((node, path) => { + // resolve relative paths + if (path[0] === '.') { + path = path_1.join(context.getFilename(), path); } - }; - } - _checkImport(context, node, path) { - if (typeof path !== 'string') { - return; - } - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(context.getFilename(), path); - } - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { - context.report({ - node, - messageId: 'badImport' - }); - } + if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { + context.report({ + node, + messageId: 'badImport' + }); + } + }); } }; diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts index bd748663e66bb..5d42c8266449c 100644 --- a/build/lib/eslint/code-no-standalone-editor.ts +++ b/build/lib/eslint/code-no-standalone-editor.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; import { join } from 'path'; +import { createImportRuleListener } from './utils'; export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { @@ -24,41 +24,26 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule return {}; } - return { - ImportDeclaration: (node: estree.Node) => { - this._checkImport(context, node, (node).source.value); - }, - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { - this._checkImport(context, node, (args[0]).value); - } - } - }; - } - - private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { - if (typeof path !== 'string') { - return; - } + return createImportRuleListener((node, path) => { - // resolve relative paths - if (path[0] === '.') { - path = join(context.getFilename(), path); - } + // resolve relative paths + if (path[0] === '.') { + path = join(context.getFilename(), path); + } - if ( - /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) - ) { - context.report({ - node, - messageId: 'badImport' - }); - } + if ( + /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) + || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) + ) { + context.report({ + node, + messageId: 'badImport' + }); + } + }); } }; diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js index a6a86d5040813..1f181d888481b 100644 --- a/build/lib/eslint/code-translation-remind.js +++ b/build/lib/eslint/code-translation-remind.js @@ -5,6 +5,7 @@ *--------------------------------------------------------------------------------------------*/ var _a; const fs_1 = require("fs"); +const utils_1 = require("./utils"); module.exports = new (_a = class TranslationRemind { constructor() { this.meta = { @@ -16,51 +17,41 @@ module.exports = new (_a = class TranslationRemind { }; } create(context) { - return { - ImportDeclaration: (node) => { - this._checkImport(context, node, node.source.value); - }, - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - this._checkImport(context, node, args[0].value); - } - } - }; + return utils_1.createImportRuleListener((node, path) => this._checkImport(context, node, path)); } _checkImport(context, node, path) { - if (path === TranslationRemind.NLS_MODULE) { - const currentFile = context.getFilename(); - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - const resource = matchService ? matchService[0] : matchPart[0]; - let resourceDefined = false; - let json; - try { - json = fs_1.readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } - catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + if (path !== TranslationRemind.NLS_MODULE) { + return; + } + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } + const resource = matchService ? matchService[0] : matchPart[0]; + let resourceDefined = false; + let json; + try { + json = fs_1.readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } + catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + workbenchResources.forEach((existingResource) => { + if (existingResource.name === resource) { + resourceDefined = true; return; } - const workbenchResources = JSON.parse(json).workbench; - workbenchResources.forEach((existingResource) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } + }); + if (!resourceDefined) { + context.report({ + node, + messageId: 'missing', + data: { resource } }); - if (!resourceDefined) { - context.report({ - node, - messageId: 'missing', - data: { resource } - }); - } } } }, diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts index 5af5a8a219533..a95840c86f82d 100644 --- a/build/lib/eslint/code-translation-remind.ts +++ b/build/lib/eslint/code-translation-remind.ts @@ -6,6 +6,7 @@ import * as eslint from 'eslint'; import * as estree from 'estree'; import { readFileSync } from 'fs'; +import { createImportRuleListener } from './utils'; export = new class TranslationRemind implements eslint.Rule.RuleModule { @@ -21,59 +22,48 @@ export = new class TranslationRemind implements eslint.Rule.RuleModule { }; create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { - - return { - ImportDeclaration: (node: estree.Node) => { - this._checkImport(context, node, (node).source.value); - }, - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { - this._checkImport(context, node, (args[0]).value); - } - } - }; + return createImportRuleListener((node, path) => this._checkImport(context, node, path)); } - private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: any) { + private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: string) { - if (path === TranslationRemind.NLS_MODULE) { + if (path !== TranslationRemind.NLS_MODULE) { + return; + } - const currentFile = context.getFilename(); - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } + const currentFile = context.getFilename(); + const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); + const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); + if (!matchService && !matchPart) { + return; + } - const resource = matchService ? matchService[0] : matchPart![0]; - let resourceDefined = false; + const resource = matchService ? matchService[0] : matchPart![0]; + let resourceDefined = false; - let json; - try { - json = readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + let json; + try { + json = readFileSync('./build/lib/i18n.resources.json', 'utf8'); + } catch (e) { + console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); + return; + } + const workbenchResources = JSON.parse(json).workbench; + + workbenchResources.forEach((existingResource: any) => { + if (existingResource.name === resource) { + resourceDefined = true; return; } - const workbenchResources = JSON.parse(json).workbench; + }); - workbenchResources.forEach((existingResource: any) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } + if (!resourceDefined) { + context.report({ + node, + messageId: 'missing', + data: { resource } }); - - if (!resourceDefined) { - context.report({ - node, - messageId: 'missing', - data: { resource } - }); - } } - } }; diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js new file mode 100644 index 0000000000000..8730958c8e729 --- /dev/null +++ b/build/lib/eslint/utils.js @@ -0,0 +1,36 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +Object.defineProperty(exports, "__esModule", { value: true }); +function createImportRuleListener(validateImport) { + function _checkImport(node) { + if (node && node.type === 'Literal' && typeof node.value === 'string') { + validateImport(node, node.value); + } + } + return { + // import ??? from 'module' + ImportDeclaration: (node) => { + _checkImport(node.source); + }, + // import('module').then(...) + CallExpression: (node) => { + var _a; + const { callee, arguments: args } = node; + if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + _checkImport(args[0]); + } + }, + // export ?? from 'module' + ExportAllDeclaration: (node) => { + _checkImport(node.source); + }, + // export {foo} from 'module' + ExportNamedDeclaration: (node) => { + _checkImport(node.source); + } + }; +} +exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint/utils.ts new file mode 100644 index 0000000000000..42da8c4b78d6d --- /dev/null +++ b/build/lib/eslint/utils.ts @@ -0,0 +1,46 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import * as estree from 'estree'; + +//https://github.com/estree/estree/blob/master/es2015.md#exportnameddeclaration +declare interface ExportNamedDeclaration { + type: "ExportNamedDeclaration"; + declaration: estree.Declaration | null; + specifiers: [estree.ExportSpecifier]; + source: estree.Literal | null; +} + +export function createImportRuleListener(validateImport: (node: estree.SimpleLiteral, value: string) => any): eslint.Rule.RuleListener { + + function _checkImport(node: estree.Literal | null) { + if (node && node.type === 'Literal' && typeof node.value === 'string') { + validateImport(node, node.value); + } + } + + return { + // import ??? from 'module' + ImportDeclaration: (node: estree.Node) => { + _checkImport((node).source); + }, + // import('module').then(...) + CallExpression: (node: estree.Node) => { + const { callee, arguments: args } = node; + if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + _checkImport(args[0]); + } + }, + // export ?? from 'module' + ExportAllDeclaration: (node: estree.Node) => { + _checkImport((node).source); + }, + // export {foo} from 'module' + ExportNamedDeclaration: (node: estree.Node) => { + _checkImport((node).source); + } + }; +} From 11f9af09d7d4bd192b852cb1e9f3c22416630acf Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 13:33:42 +0100 Subject: [PATCH 17/47] check call expression argument length --- build/lib/eslint/utils.js | 2 +- build/lib/eslint/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js index 8730958c8e729..c3ccd6f45527f 100644 --- a/build/lib/eslint/utils.js +++ b/build/lib/eslint/utils.js @@ -19,7 +19,7 @@ function createImportRuleListener(validateImport) { CallExpression: (node) => { var _a; const { callee, arguments: args } = node; - if (callee.type === 'Import' && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { + if (callee.type === 'Import' && args.length > 0 && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { _checkImport(args[0]); } }, diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint/utils.ts index 42da8c4b78d6d..d992cb18e71a3 100644 --- a/build/lib/eslint/utils.ts +++ b/build/lib/eslint/utils.ts @@ -30,7 +30,7 @@ export function createImportRuleListener(validateImport: (node: estree.SimpleLit // import('module').then(...) CallExpression: (node: estree.Node) => { const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args[0]?.type === 'Literal') { + if ((callee.type) === 'Import' && args.length > 0 && args[0]?.type === 'Literal') { _checkImport(args[0]); } }, From 4db80066b44f623c6a3a540062973fcaa7e71787 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 14:08:44 +0100 Subject: [PATCH 18/47] use ts-es-tree-typings, support import-equals --- build/lib/eslint/code-import-patterns.js | 2 +- build/lib/eslint/code-import-patterns.ts | 6 +- build/lib/eslint/code-layering.js | 2 +- build/lib/eslint/code-layering.ts | 2 +- .../code-no-nls-in-standalone-editor.js | 2 +- .../code-no-nls-in-standalone-editor.ts | 2 +- build/lib/eslint/code-no-standalone-editor.js | 2 +- build/lib/eslint/code-no-standalone-editor.ts | 2 +- build/lib/eslint/code-translation-remind.js | 2 +- build/lib/eslint/code-translation-remind.ts | 6 +- build/lib/eslint/utils.js | 10 ++- build/lib/eslint/utils.ts | 44 +++++------ build/package.json | 1 + build/yarn.lock | 78 ++++++++++++++++++- 14 files changed, 123 insertions(+), 38 deletions(-) diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js index 144f7cc9b62fd..8292f7d46cf01 100644 --- a/build/lib/eslint/code-import-patterns.js +++ b/build/lib/eslint/code-import-patterns.js @@ -47,7 +47,7 @@ module.exports = new class { if (!matched) { // None of the restrictions matched context.report({ - node, + loc: node.loc, messageId: 'badImport', data: { restrictions: restrictions.join(' or ') diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts index eac15ebfa0547..ae29e471080d0 100644 --- a/build/lib/eslint/code-import-patterns.ts +++ b/build/lib/eslint/code-import-patterns.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; import { join } from 'path'; import * as minimatch from 'minimatch'; import { createImportRuleListener } from './utils'; @@ -37,7 +37,7 @@ export = new class implements eslint.Rule.RuleModule { return {}; } - private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: estree.Node, path: string) { + private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, path: string) { // resolve relative paths if (path[0] === '.') { @@ -62,7 +62,7 @@ export = new class implements eslint.Rule.RuleModule { if (!matched) { // None of the restrictions matched context.report({ - node, + loc: node.loc, messageId: 'badImport', data: { restrictions: restrictions.join(' or ') diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js index a033ca96c047d..8c1ce8f80c4dd 100644 --- a/build/lib/eslint/code-layering.js +++ b/build/lib/eslint/code-layering.js @@ -52,7 +52,7 @@ module.exports = new class { if (config.disallowed.has(part)) { // BAD - wrong layer context.report({ - node, + loc: node.loc, messageId: 'layerbreaker', data: { from: part, diff --git a/build/lib/eslint/code-layering.ts b/build/lib/eslint/code-layering.ts index 83775e9adbd45..539d13f79f1ec 100644 --- a/build/lib/eslint/code-layering.ts +++ b/build/lib/eslint/code-layering.ts @@ -66,7 +66,7 @@ export = new class implements eslint.Rule.RuleModule { if (config!.disallowed.has(part)) { // BAD - wrong layer context.report({ - node, + loc: node.loc, messageId: 'layerbreaker', data: { from: part, diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js index 176c0250a0793..735b87c3961a0 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.js +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -29,7 +29,7 @@ module.exports = new class NoNlsInStandaloneEditorRule { } if (/vs(\/|\\)nls/.test(path)) { context.report({ - node, + loc: node.loc, messageId: 'noNls' }); } diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts index 4bf0495853f09..69063fe58421e 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.ts +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.ts @@ -37,7 +37,7 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule /vs(\/|\\)nls/.test(path) ) { context.report({ - node, + loc: node.loc, messageId: 'noNls' }); } diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js index 576bc60f58054..617b2483dd163 100644 --- a/build/lib/eslint/code-no-standalone-editor.js +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -31,7 +31,7 @@ module.exports = new class NoNlsInStandaloneEditorRule { || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { context.report({ - node, + loc: node.loc, messageId: 'badImport' }); } diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts index 5d42c8266449c..52fbbea043f30 100644 --- a/build/lib/eslint/code-no-standalone-editor.ts +++ b/build/lib/eslint/code-no-standalone-editor.ts @@ -39,7 +39,7 @@ export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) ) { context.report({ - node, + loc: node.loc, messageId: 'badImport' }); } diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js index 1f181d888481b..34071d76ef013 100644 --- a/build/lib/eslint/code-translation-remind.js +++ b/build/lib/eslint/code-translation-remind.js @@ -48,7 +48,7 @@ module.exports = new (_a = class TranslationRemind { }); if (!resourceDefined) { context.report({ - node, + loc: node.loc, messageId: 'missing', data: { resource } }); diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts index a95840c86f82d..d482d3ff4616e 100644 --- a/build/lib/eslint/code-translation-remind.ts +++ b/build/lib/eslint/code-translation-remind.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; import { readFileSync } from 'fs'; import { createImportRuleListener } from './utils'; @@ -25,7 +25,7 @@ export = new class TranslationRemind implements eslint.Rule.RuleModule { return createImportRuleListener((node, path) => this._checkImport(context, node, path)); } - private _checkImport(context: eslint.Rule.RuleContext, node: estree.Node, path: string) { + private _checkImport(context: eslint.Rule.RuleContext, node: TSESTree.Node, path: string) { if (path !== TranslationRemind.NLS_MODULE) { return; @@ -59,7 +59,7 @@ export = new class TranslationRemind implements eslint.Rule.RuleModule { if (!resourceDefined) { context.report({ - node, + loc: node.loc, messageId: 'missing', data: { resource } }); diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js index c3ccd6f45527f..1cdd1837e8959 100644 --- a/build/lib/eslint/utils.js +++ b/build/lib/eslint/utils.js @@ -4,6 +4,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); function createImportRuleListener(validateImport) { function _checkImport(node) { if (node && node.type === 'Literal' && typeof node.value === 'string') { @@ -23,6 +24,13 @@ function createImportRuleListener(validateImport) { _checkImport(args[0]); } }, + // import foo = ... + [experimental_utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration]: (node) => { + const { moduleReference } = node; + if (moduleReference.type === experimental_utils_1.AST_NODE_TYPES.TSExternalModuleReference) { + _checkImport(moduleReference.expression); + } + }, // export ?? from 'module' ExportAllDeclaration: (node) => { _checkImport(node.source); @@ -30,7 +38,7 @@ function createImportRuleListener(validateImport) { // export {foo} from 'module' ExportNamedDeclaration: (node) => { _checkImport(node.source); - } + }, }; } exports.createImportRuleListener = createImportRuleListener; diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint/utils.ts index d992cb18e71a3..c48e174b70236 100644 --- a/build/lib/eslint/utils.ts +++ b/build/lib/eslint/utils.ts @@ -4,43 +4,43 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import * as estree from 'estree'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; -//https://github.com/estree/estree/blob/master/es2015.md#exportnameddeclaration -declare interface ExportNamedDeclaration { - type: "ExportNamedDeclaration"; - declaration: estree.Declaration | null; - specifiers: [estree.ExportSpecifier]; - source: estree.Literal | null; -} - -export function createImportRuleListener(validateImport: (node: estree.SimpleLiteral, value: string) => any): eslint.Rule.RuleListener { +export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener { - function _checkImport(node: estree.Literal | null) { + function _checkImport(node: TSESTree.Node | null) { if (node && node.type === 'Literal' && typeof node.value === 'string') { - validateImport(node, node.value); + validateImport(node, node.value); } } return { // import ??? from 'module' - ImportDeclaration: (node: estree.Node) => { - _checkImport((node).source); + ImportDeclaration: (node: any) => { + _checkImport((node).source); }, // import('module').then(...) - CallExpression: (node: estree.Node) => { - const { callee, arguments: args } = node; + CallExpression: (node: any) => { + const { callee, arguments: args } = node; if ((callee.type) === 'Import' && args.length > 0 && args[0]?.type === 'Literal') { - _checkImport(args[0]); + _checkImport(args[0]); + } + }, + // import foo = ... + [AST_NODE_TYPES.TSImportEqualsDeclaration]: (node: any) => { + const { moduleReference } = (node); + if (moduleReference.type === AST_NODE_TYPES.TSExternalModuleReference) { + _checkImport(((moduleReference).expression)); } }, // export ?? from 'module' - ExportAllDeclaration: (node: estree.Node) => { - _checkImport((node).source); + ExportAllDeclaration: (node: any) => { + _checkImport((node).source); }, // export {foo} from 'module' - ExportNamedDeclaration: (node: estree.Node) => { - _checkImport((node).source); - } + ExportNamedDeclaration: (node: any) => { + _checkImport((node).source); + }, + }; } diff --git a/build/package.json b/build/package.json index ae55442cb18c1..24570a9648e64 100644 --- a/build/package.json +++ b/build/package.json @@ -29,6 +29,7 @@ "@types/through2": "^2.0.34", "@types/underscore": "^1.8.9", "@types/xml2js": "0.0.33", + "@typescript-eslint/experimental-utils": "~2.13.0", "applicationinsights": "1.0.8", "azure-storage": "^2.1.0", "github-releases": "^0.4.1", diff --git a/build/yarn.lock b/build/yarn.lock index c8f1d29a9207c..b98261cbfc131 100644 --- a/build/yarn.lock +++ b/build/yarn.lock @@ -197,7 +197,7 @@ resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c" integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA== -"@types/json-schema@*": +"@types/json-schema@*", "@types/json-schema@^7.0.3": version "7.0.4" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== @@ -330,6 +330,28 @@ resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.33.tgz#20c5dd6460245284d64a55690015b95e409fb7de" integrity sha1-IMXdZGAkUoTWSlVpABW5XkCft94= +"@typescript-eslint/experimental-utils@~2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.13.0.tgz#958614faa6f77599ee2b241740e0ea402482533d" + integrity sha512-+Hss3clwa6aNiC8ZjA45wEm4FutDV5HsVXPl/rDug1THq6gEtOYRGLqS3JlTk7mSnL5TbJz0LpEbzbPnKvY6sw== + dependencies: + "@types/json-schema" "^7.0.3" + "@typescript-eslint/typescript-estree" "2.13.0" + eslint-scope "^5.0.0" + +"@typescript-eslint/typescript-estree@2.13.0": + version "2.13.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.13.0.tgz#a2e746867da772c857c13853219fced10d2566bc" + integrity sha512-t21Mg5cc8T3ADEUGwDisHLIubgXKjuNRbkpzDMLb7/JMmgCe/gHM9FaaujokLey+gwTuLF5ndSQ7/EfQqrQx4g== + dependencies: + debug "^4.1.1" + eslint-visitor-keys "^1.1.0" + glob "^7.1.6" + is-glob "^4.0.1" + lodash.unescape "4.0.1" + semver "^6.3.0" + tsutils "^3.17.1" + acorn@4.X: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" @@ -923,11 +945,36 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-visitor-keys@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== +esrecurse@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf" + integrity sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ== + dependencies: + estraverse "^4.1.0" + +estraverse@^4.1.0, estraverse@^4.1.1: + version "4.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" + integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== + esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -1120,6 +1167,18 @@ glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^7.1.6: + version "7.1.6" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + globby@^10.0.1: version "10.0.1" resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" @@ -1659,6 +1718,11 @@ lodash.templatesettings@^3.0.0: lodash._reinterpolate "^3.0.0" lodash.escape "^3.0.0" +lodash.unescape@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.unescape/-/lodash.unescape-4.0.1.tgz#bf2249886ce514cda112fae9218cdc065211fc9c" + integrity sha1-vyJJiGzlFM2hEvrpIYzcBlIR/Jw= + lodash@^4.15.0, lodash@^4.17.10: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" @@ -2183,6 +2247,11 @@ semver@^5.5.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +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== + shebang-command@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" @@ -2434,6 +2503,13 @@ tsutils@^2.27.2: dependencies: tslib "^1.8.1" +tsutils@^3.17.1: + version "3.17.1" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759" + integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g== + dependencies: + tslib "^1.8.1" + tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" From 53d1dffaff509283d165f4d08e8ecd97956fc463 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 14:57:04 +0100 Subject: [PATCH 19/47] use AST selector to simplify things --- build/lib/eslint/utils.js | 18 +++++------------- build/lib/eslint/utils.ts | 18 ++++++------------ 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/build/lib/eslint/utils.js b/build/lib/eslint/utils.js index 1cdd1837e8959..ec59aef3b7d3c 100644 --- a/build/lib/eslint/utils.js +++ b/build/lib/eslint/utils.js @@ -4,7 +4,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); function createImportRuleListener(validateImport) { function _checkImport(node) { if (node && node.type === 'Literal' && typeof node.value === 'string') { @@ -16,20 +15,13 @@ function createImportRuleListener(validateImport) { ImportDeclaration: (node) => { _checkImport(node.source); }, - // import('module').then(...) - CallExpression: (node) => { - var _a; - const { callee, arguments: args } = node; - if (callee.type === 'Import' && args.length > 0 && ((_a = args[0]) === null || _a === void 0 ? void 0 : _a.type) === 'Literal') { - _checkImport(args[0]); - } + // import('module').then(...) OR await import('module') + ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => { + _checkImport(node); }, // import foo = ... - [experimental_utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration]: (node) => { - const { moduleReference } = node; - if (moduleReference.type === experimental_utils_1.AST_NODE_TYPES.TSExternalModuleReference) { - _checkImport(moduleReference.expression); - } + ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => { + _checkImport(node); }, // export ?? from 'module' ExportAllDeclaration: (node) => { diff --git a/build/lib/eslint/utils.ts b/build/lib/eslint/utils.ts index c48e174b70236..428832e9cf97a 100644 --- a/build/lib/eslint/utils.ts +++ b/build/lib/eslint/utils.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import * as eslint from 'eslint'; -import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; +import { TSESTree } from '@typescript-eslint/experimental-utils'; export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener { @@ -19,19 +19,13 @@ export function createImportRuleListener(validateImport: (node: TSESTree.Literal ImportDeclaration: (node: any) => { _checkImport((node).source); }, - // import('module').then(...) - CallExpression: (node: any) => { - const { callee, arguments: args } = node; - if ((callee.type) === 'Import' && args.length > 0 && args[0]?.type === 'Literal') { - _checkImport(args[0]); - } + // import('module').then(...) OR await import('module') + ['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node: any) => { + _checkImport(node); }, // import foo = ... - [AST_NODE_TYPES.TSImportEqualsDeclaration]: (node: any) => { - const { moduleReference } = (node); - if (moduleReference.type === AST_NODE_TYPES.TSExternalModuleReference) { - _checkImport(((moduleReference).expression)); - } + ['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node: any) => { + _checkImport(node); }, // export ?? from 'module' ExportAllDeclaration: (node: any) => { From a61f38eee52329c90d76ce817c527c99012fdb08 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 17:48:21 +0100 Subject: [PATCH 20/47] migrate no-unexternalized-strings rule (have two variants) --- .eslintrc.json | 12 + .../eslint/code-no-unexternalized-strings.js | 214 +++++++++++++++ .../eslint/code-no-unexternalized-strings.ts | 255 ++++++++++++++++++ .../eslint/code-no-unexternalized-strings2.js | 106 ++++++++ .../eslint/code-no-unexternalized-strings2.ts | 119 ++++++++ 5 files changed, 706 insertions(+) create mode 100644 build/lib/eslint/code-no-unexternalized-strings.js create mode 100644 build/lib/eslint/code-no-unexternalized-strings.ts create mode 100644 build/lib/eslint/code-no-unexternalized-strings2.js create mode 100644 build/lib/eslint/code-no-unexternalized-strings2.ts diff --git a/.eslintrc.json b/.eslintrc.json index 4ef8fce2ffff7..ed14c57a0db15 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,6 +31,18 @@ "code-translation-remind": "warn", "code-no-nls-in-standalone-editor": "warn", "code-no-standalone-editor": "warn", + "code-no-unexternalized-strings2": "warn", + "code-no-unexternalized-strings": [ + "off", + { + "signatures": [ + "localize", + "nls.localize" + ], + "keyIndex": 0, + "messageIndex": 1 + } + ], "code-layering": [ "warn", { diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js new file mode 100644 index 0000000000000..f0f43450d1e62 --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -0,0 +1,214 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +function isStringLiteral(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} +function isObjectLiteral(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression; +} +function isPropertyAssignment(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Property; +} +module.exports = new (_a = class NoUnexternalizedStringsRuleWalker { + constructor() { + this.signatures = Object.create(null); + this.ignores = Object.create(null); + this.usedKeys = Object.create(null); + this.meta = { + type: 'problem', + schema: {}, + messages: { + badQuotes: 'Do not use double quotes for imports.', + unexternalized: 'Unexternalized string.', + duplicateKey: `Duplicate key '{{key}}' with different message value.`, + badKey: `The key {{key}} doesn't conform to a valid localize identifier`, + emptyKey: 'Key is empty.', + whitespaceKey: 'Key is only whitespace.', + badMessage: `Message argument to '{{message}}' must be a string literal.` + } + }; + } + create(context) { + const first = context.options[0]; + if (first) { + if (Array.isArray(first.signatures)) { + first.signatures.forEach((signature) => this.signatures[signature] = true); + } + if (Array.isArray(first.ignores)) { + first.ignores.forEach((ignore) => this.ignores[ignore] = true); + } + if (typeof first.messageIndex !== 'undefined') { + this.messageIndex = first.messageIndex; + } + if (typeof first.keyIndex !== 'undefined') { + this.keyIndex = first.keyIndex; + } + } + return { + ['Program:exit']: () => { + this._checkProgramEnd(context); + }, + ['Literal']: (node) => { + if (typeof node.value === 'string') { + this._checkStringLiteral(context, node); + } + }, + }; + } + _checkProgramEnd(context) { + Object.keys(this.usedKeys).forEach(key => { + // Keys are quoted. + const identifier = key.substr(1, key.length - 2); + const occurrences = this.usedKeys[key]; + // bad key + if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { + context.report({ + loc: occurrences[0].key.loc, + messageId: 'badKey', + data: { key: occurrences[0].key.value } + }); + } + // duplicates key + if (occurrences.length > 1) { + occurrences.forEach(occurrence => { + context.report({ + loc: occurrence.key.loc, + messageId: 'duplicateKey', + data: { key: occurrence.key.value } + }); + }); + } + }); + } + _checkStringLiteral(context, node) { + var _a; + const text = node.raw; + const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; + const info = this._findDescribingParent(node); + // Ignore strings in import and export nodes. + if (info && info.isImport && doubleQuoted) { + context.report({ + loc: node.loc, + messageId: 'badQuotes' + }); + return; + } + const callInfo = info ? info.callInfo : null; + const functionName = callInfo && isStringLiteral(callInfo.callExpression.callee) + ? callInfo.callExpression.callee.value + : null; + if (functionName && this.ignores[functionName]) { + return; + } + if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) { + context.report({ + loc: node.loc, + messageId: 'unexternalized' + }); + return; + } + // We have a single quoted string outside a localize function name. + if (!doubleQuoted && !this.signatures[functionName]) { + return; + } + // We have a string that is a direct argument into the localize call. + const keyArg = callInfo && callInfo.argIndex === this.keyIndex + ? callInfo.callExpression.arguments[this.keyIndex] + : null; + if (keyArg) { + if (isStringLiteral(keyArg)) { + this.recordKey(context, keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + } + else if (isObjectLiteral(keyArg)) { + for (const property of keyArg.properties) { + if (isPropertyAssignment(property)) { + const name = NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), property.key); + if (name === 'key') { + const initializer = property.value; + if (isStringLiteral(initializer)) { + this.recordKey(context, initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + } + break; + } + } + } + } + } + const messageArg = callInfo.callExpression.arguments[this.messageIndex]; + if (messageArg && !isStringLiteral(messageArg)) { + context.report({ + loc: messageArg.loc, + messageId: 'badMessage', + data: { message: NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), (_a = callInfo) === null || _a === void 0 ? void 0 : _a.callExpression.callee) } + }); + return; + } + } + recordKey(context, keyNode, messageNode) { + const text = keyNode.raw; + // We have an empty key + if (text.match(/(['"]) *\1/)) { + if (messageNode) { + context.report({ + loc: keyNode.loc, + messageId: 'whitespaceKey' + }); + } + else { + context.report({ + loc: keyNode.loc, + messageId: 'emptyKey' + }); + } + return; + } + let occurrences = this.usedKeys[text]; + if (!occurrences) { + occurrences = []; + this.usedKeys[text] = occurrences; + } + if (messageNode) { + if (occurrences.some(pair => pair.message ? NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), pair.message) === NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), messageNode) : false)) { + return; + } + } + occurrences.push({ key: keyNode, message: messageNode }); + } + _findDescribingParent(node) { + let parent; + while ((parent = node.parent)) { + const kind = parent.type; + if (kind === experimental_utils_1.AST_NODE_TYPES.CallExpression) { + const callExpression = parent; + return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; + } + else if (kind === experimental_utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.ImportDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.ExportNamedDeclaration) { + return { isImport: true }; + } + else if (kind === experimental_utils_1.AST_NODE_TYPES.VariableDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.FunctionDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature + || kind === experimental_utils_1.AST_NODE_TYPES.TSMethodSignature || kind === experimental_utils_1.AST_NODE_TYPES.TSInterfaceDeclaration + || kind === experimental_utils_1.AST_NODE_TYPES.ClassDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSEnumDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSModuleDeclaration + || kind === experimental_utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.Program) { + return null; + } + node = parent; + } + return null; + } + static _getText(source, node) { + if (node.type === experimental_utils_1.AST_NODE_TYPES.Literal) { + return String(node.value); + } + const start = source.getIndexFromLoc(node.loc.start); + const end = source.getIndexFromLoc(node.loc.end); + return source.getText().substring(start, end); + } + }, + _a.DOUBLE_QUOTE = '"', + _a.IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, + _a); diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts new file mode 100644 index 0000000000000..096f1b44802de --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -0,0 +1,255 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; + +interface Map { + [key: string]: V; +} + +interface UnexternalizedStringsOptions { + signatures?: string[]; + messageIndex?: number; + keyIndex?: number; + ignores?: string[]; +} + +function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral { + return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} + +function isObjectLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.ObjectExpression { + return !!node && node.type === AST_NODE_TYPES.ObjectExpression; +} + +function isPropertyAssignment(node: TSESTree.Node | null | undefined): node is TSESTree.Property { + return !!node && node.type === AST_NODE_TYPES.Property; +} + +interface KeyMessagePair { + key: TSESTree.StringLiteral; + message: TSESTree.Node | undefined; +} + +export = new class NoUnexternalizedStringsRuleWalker implements eslint.Rule.RuleModule { + + private static DOUBLE_QUOTE: string = '"'; + private static IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; + + private signatures: Map = Object.create(null); + private messageIndex: number | undefined; + private keyIndex: number | undefined; + private ignores: Map = Object.create(null); + + private usedKeys: Map = Object.create(null); + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + badQuotes: 'Do not use double quotes for imports.', + unexternalized: 'Unexternalized string.', + duplicateKey: `Duplicate key '{{key}}' with different message value.`, + badKey: `The key {{key}} doesn't conform to a valid localize identifier`, + emptyKey: 'Key is empty.', + whitespaceKey: 'Key is only whitespace.', + badMessage: `Message argument to '{{message}}' must be a string literal.` + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const first = context.options[0]; + if (first) { + if (Array.isArray(first.signatures)) { + first.signatures.forEach((signature: string) => this.signatures[signature] = true); + } + if (Array.isArray(first.ignores)) { + first.ignores.forEach((ignore: string) => this.ignores[ignore] = true); + } + if (typeof first.messageIndex !== 'undefined') { + this.messageIndex = first.messageIndex; + } + if (typeof first.keyIndex !== 'undefined') { + this.keyIndex = first.keyIndex; + } + } + + return { + ['Program:exit']: () => { + this._checkProgramEnd(context); + }, + ['Literal']: (node: any) => { + if (typeof (node).value === 'string') { + this._checkStringLiteral(context, node); + } + }, + }; + } + + protected _checkProgramEnd(context: eslint.Rule.RuleContext): void { + Object.keys(this.usedKeys).forEach(key => { + // Keys are quoted. + const identifier = key.substr(1, key.length - 2); + const occurrences = this.usedKeys[key]; + + // bad key + if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { + context.report({ + loc: occurrences[0].key.loc, + messageId: 'badKey', + data: { key: occurrences[0].key.value } + }); + } + + // duplicates key + if (occurrences.length > 1) { + occurrences.forEach(occurrence => { + context.report({ + loc: occurrence.key.loc, + messageId: 'duplicateKey', + data: { key: occurrence.key.value } + }); + }); + } + }); + } + + private _checkStringLiteral(context: eslint.Rule.RuleContext, node: TSESTree.StringLiteral): void { + const text = node.raw; + const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; + const info = this._findDescribingParent(node); + + // Ignore strings in import and export nodes. + if (info && info.isImport && doubleQuoted) { + context.report({ + loc: node.loc, + messageId: 'badQuotes' + }); + return; + } + + const callInfo = info ? info.callInfo : null; + const functionName = callInfo && isStringLiteral(callInfo.callExpression.callee) + ? callInfo.callExpression.callee.value + : null; + + if (functionName && this.ignores[functionName]) { + return; + } + + if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName!])) { + context.report({ + loc: node.loc, + messageId: 'unexternalized' + }); + return; + } + + // We have a single quoted string outside a localize function name. + if (!doubleQuoted && !this.signatures[functionName!]) { + return; + } + // We have a string that is a direct argument into the localize call. + const keyArg: TSESTree.Expression | null = callInfo && callInfo.argIndex === this.keyIndex + ? callInfo.callExpression.arguments[this.keyIndex] + : null; + + if (keyArg) { + if (isStringLiteral(keyArg)) { + this.recordKey(context, keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + + } else if (isObjectLiteral(keyArg)) { + for (const property of keyArg.properties) { + if (isPropertyAssignment(property)) { + const name = NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), property.key); + if (name === 'key') { + const initializer = property.value; + if (isStringLiteral(initializer)) { + this.recordKey(context, initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + } + break; + } + } + } + } + } + + const messageArg = callInfo!.callExpression.arguments[this.messageIndex!]; + + if (messageArg && !isStringLiteral(messageArg)) { + context.report({ + loc: messageArg.loc, + messageId: 'badMessage', + data: { message: NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), callInfo?.callExpression.callee!) } + }); + return; + } + } + + private recordKey(context: eslint.Rule.RuleContext, keyNode: TSESTree.StringLiteral, messageNode: TSESTree.Node | undefined) { + const text = keyNode.raw; + // We have an empty key + if (text.match(/(['"]) *\1/)) { + if (messageNode) { + context.report({ + loc: keyNode.loc, + messageId: 'whitespaceKey' + }); + } else { + context.report({ + loc: keyNode.loc, + messageId: 'emptyKey' + }); + } + return; + } + let occurrences: KeyMessagePair[] = this.usedKeys[text]; + if (!occurrences) { + occurrences = []; + this.usedKeys[text] = occurrences; + } + if (messageNode) { + if (occurrences.some(pair => pair.message ? NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), pair.message) === NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), messageNode) : false)) { + return; + } + } + occurrences.push({ key: keyNode, message: messageNode }); + } + + private _findDescribingParent(node: TSESTree.Node): { callInfo?: { callExpression: TSESTree.CallExpression, argIndex: number }, isImport?: boolean; } | null { + let parent: TSESTree.Node | undefined; + while ((parent = node.parent)) { + const kind = parent.type; + if (kind === AST_NODE_TYPES.CallExpression) { + const callExpression = parent as TSESTree.CallExpression; + return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; + + } else if (kind === AST_NODE_TYPES.TSImportEqualsDeclaration || kind === AST_NODE_TYPES.ImportDeclaration || kind === AST_NODE_TYPES.ExportNamedDeclaration) { + return { isImport: true }; + + } else if (kind === AST_NODE_TYPES.VariableDeclaration || kind === AST_NODE_TYPES.FunctionDeclaration || kind === AST_NODE_TYPES.TSPropertySignature + || kind === AST_NODE_TYPES.TSMethodSignature || kind === AST_NODE_TYPES.TSInterfaceDeclaration + || kind === AST_NODE_TYPES.ClassDeclaration || kind === AST_NODE_TYPES.TSEnumDeclaration || kind === AST_NODE_TYPES.TSModuleDeclaration + || kind === AST_NODE_TYPES.TSTypeAliasDeclaration || kind === AST_NODE_TYPES.Program) { + return null; + } + node = parent; + } + return null; + } + + private static _getText(source: eslint.SourceCode, node: TSESTree.Node): string { + if (node.type === AST_NODE_TYPES.Literal) { + return String(node.value); + } + const start = source.getIndexFromLoc(node.loc.start); + const end = source.getIndexFromLoc(node.loc.end); + return source.getText().substring(start, end); + } + +}; + diff --git a/build/lib/eslint/code-no-unexternalized-strings2.js b/build/lib/eslint/code-no-unexternalized-strings2.js new file mode 100644 index 0000000000000..4219c5c911f22 --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings2.js @@ -0,0 +1,106 @@ +"use strict"; +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +var _a; +const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); +function isStringLiteral(node) { + return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} +function isDoubleQuoted(node) { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; +} +module.exports = new (_a = class NoUnexternalizedStrings { + constructor() { + this.meta = { + type: 'problem', + schema: {}, + messages: { + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' + } + }; + } + create(context) { + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + return { + ['Literal']: (node) => { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + }, + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => { + // localize(key, message) + const [keyNode, messageNode] = node.arguments; + // (1) + // extract key so that it can be checked later + let key; + if (isStringLiteral(keyNode)) { + key = keyNode.value; + } + else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + key = property.value.value; + break; + } + } + } + } + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + }, + ['Program:exit']: () => { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + for (const [key, values] of externalizedStringLiterals) { + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } + } + }, + }; + } + }, + _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, + _a); diff --git a/build/lib/eslint/code-no-unexternalized-strings2.ts b/build/lib/eslint/code-no-unexternalized-strings2.ts new file mode 100644 index 0000000000000..234d076fb4e05 --- /dev/null +++ b/build/lib/eslint/code-no-unexternalized-strings2.ts @@ -0,0 +1,119 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as eslint from 'eslint'; +import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; + +function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral { + return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string'; +} + +function isDoubleQuoted(node: TSESTree.StringLiteral): boolean { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; +} + +export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { + + private static _rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; + + readonly meta = { + type: 'problem', + schema: {}, + messages: { + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' + } + }; + + create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { + + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + + return { + ['Literal']: (node: any) => { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + }, + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => { + + // localize(key, message) + const [keyNode, messageNode] = (node).arguments; + + // (1) + // extract key so that it can be checked later + let key: string | undefined; + if (isStringLiteral(keyNode)) { + key = keyNode.value; + + } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + key = property.value.value; + break; + } + } + } + } + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } + + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + }, + ['Program:exit']: () => { + + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + + for (const [key, values] of externalizedStringLiterals) { + + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } + } + }, + }; + } +}; + From c9179d1e6a4d4177798f0ec2b42ad86a0fd67d36 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 18:39:30 +0100 Subject: [PATCH 21/47] fix nls-rule when using member-expression --- .../eslint/code-no-unexternalized-strings2.js | 128 ++++++++-------- .../eslint/code-no-unexternalized-strings2.ts | 138 +++++++++--------- 2 files changed, 138 insertions(+), 128 deletions(-) diff --git a/build/lib/eslint/code-no-unexternalized-strings2.js b/build/lib/eslint/code-no-unexternalized-strings2.js index 4219c5c911f22..a9aa9ee402de1 100644 --- a/build/lib/eslint/code-no-unexternalized-strings2.js +++ b/build/lib/eslint/code-no-unexternalized-strings2.js @@ -27,78 +27,82 @@ module.exports = new (_a = class NoUnexternalizedStrings { create(context) { const externalizedStringLiterals = new Map(); const doubleQuotedStringLiterals = new Set(); - return { - ['Literal']: (node) => { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - }, - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => { - // localize(key, message) - const [keyNode, messageNode] = node.arguments; - // (1) - // extract key so that it can be checked later - let key; - if (isStringLiteral(keyNode)) { - key = keyNode.value; - } - else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { - for (let property of keyNode.properties) { - if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - key = property.value.value; - break; - } + function collectDoubleQuotedStrings(node) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + } + function visitLocalizeCall(node) { + // localize(key, message) + const [keyNode, messageNode] = node.arguments; + // (1) + // extract key so that it can be checked later + let key; + if (isStringLiteral(keyNode)) { + key = keyNode.value; + } + else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + key = property.value.value; + break; } } } } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); } + array.push({ call: node, message: messageNode }); + } + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + } + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } + for (const [key, values] of externalizedStringLiterals) { // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); - } - }, - ['Program:exit']: () => { - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } - for (const [key, values] of externalizedStringLiterals) { - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (let value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); } - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } + } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); } } } - }, + } + } + return { + ['Literal']: (node) => collectDoubleQuotedStrings(node), + ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, }; } }, diff --git a/build/lib/eslint/code-no-unexternalized-strings2.ts b/build/lib/eslint/code-no-unexternalized-strings2.ts index 234d076fb4e05..41738c63b6feb 100644 --- a/build/lib/eslint/code-no-unexternalized-strings2.ts +++ b/build/lib/eslint/code-no-unexternalized-strings2.ts @@ -34,85 +34,91 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { const externalizedStringLiterals = new Map(); const doubleQuotedStringLiterals = new Set(); - return { - ['Literal']: (node: any) => { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - }, - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => { - - // localize(key, message) - const [keyNode, messageNode] = (node).arguments; - - // (1) - // extract key so that it can be checked later - let key: string | undefined; - if (isStringLiteral(keyNode)) { - key = keyNode.value; - - } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { - for (let property of keyNode.properties) { - if (property.type === AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - key = property.value.value; - break; - } + function collectDoubleQuotedStrings(node: TSESTree.Literal) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); + } + } + + function visitLocalizeCall(node: TSESTree.CallExpression) { + + // localize(key, message) + const [keyNode, messageNode] = (node).arguments; + + // (1) + // extract key so that it can be checked later + let key: string | undefined; + if (isStringLiteral(keyNode)) { + key = keyNode.value; + + } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + key = property.value.value; + break; } } } } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); - } - - // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); + } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); } - }, - ['Program:exit']: () => { + array.push({ call: node, message: messageNode }); + } + + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { + context.report({ + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } + }); + } + } - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); + } - for (const [key, values] of externalizedStringLiterals) { + for (const [key, values] of externalizedStringLiterals) { - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (let value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); } + } - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); } } } - }, + } + } + + return { + ['Literal']: (node: any) => collectDoubleQuotedStrings(node), + ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, }; } }; From 9fefd2b6fbb21d918d157481455e0c2cb48731d8 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Mon, 30 Dec 2019 18:45:00 +0100 Subject: [PATCH 22/47] relax and allow double quoted strings appearing inside localize call --- build/lib/eslint/code-no-unexternalized-strings2.js | 2 ++ build/lib/eslint/code-no-unexternalized-strings2.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build/lib/eslint/code-no-unexternalized-strings2.js b/build/lib/eslint/code-no-unexternalized-strings2.js index a9aa9ee402de1..c4cdbe597baa1 100644 --- a/build/lib/eslint/code-no-unexternalized-strings2.js +++ b/build/lib/eslint/code-no-unexternalized-strings2.js @@ -39,6 +39,7 @@ module.exports = new (_a = class NoUnexternalizedStrings { // extract key so that it can be checked later let key; if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider key = keyNode.value; } else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { @@ -46,6 +47,7 @@ module.exports = new (_a = class NoUnexternalizedStrings { if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider key = property.value.value; break; } diff --git a/build/lib/eslint/code-no-unexternalized-strings2.ts b/build/lib/eslint/code-no-unexternalized-strings2.ts index 41738c63b6feb..3bc1156d397c9 100644 --- a/build/lib/eslint/code-no-unexternalized-strings2.ts +++ b/build/lib/eslint/code-no-unexternalized-strings2.ts @@ -49,6 +49,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { // extract key so that it can be checked later let key: string | undefined; if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider key = keyNode.value; } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { @@ -56,6 +57,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { if (property.type === AST_NODE_TYPES.Property && !property.computed) { if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider key = property.value.value; break; } From f885d7769a8aeb3323285788897d967c78d34dae Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 09:11:11 +0100 Subject: [PATCH 23/47] remove unused dependency --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 97341660725ec..4cff79f83be99 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,6 @@ "debounce": "^1.0.0", "electron": "6.1.6", "eslint": "6.8.0", - "eslint-plugin-code-oss-eslint": "file:./build/lib/eslint/", "event-stream": "3.3.4", "express": "^4.13.1", "fancy-log": "^1.3.3", From e27d7cafa164ea97cee478f79eddbf063ed6b2ec Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 09:14:07 +0100 Subject: [PATCH 24/47] only one double-qoute string rule --- .eslintrc.json | 13 +- .../eslint/code-no-unexternalized-strings.js | 248 +++++---------- .../eslint/code-no-unexternalized-strings.ts | 288 +++++------------- .../eslint/code-no-unexternalized-strings2.js | 112 ------- .../eslint/code-no-unexternalized-strings2.ts | 127 -------- 5 files changed, 154 insertions(+), 634 deletions(-) delete mode 100644 build/lib/eslint/code-no-unexternalized-strings2.js delete mode 100644 build/lib/eslint/code-no-unexternalized-strings2.ts diff --git a/.eslintrc.json b/.eslintrc.json index ed14c57a0db15..ad255a10130fd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,18 +31,7 @@ "code-translation-remind": "warn", "code-no-nls-in-standalone-editor": "warn", "code-no-standalone-editor": "warn", - "code-no-unexternalized-strings2": "warn", - "code-no-unexternalized-strings": [ - "off", - { - "signatures": [ - "localize", - "nls.localize" - ], - "keyIndex": 0, - "messageIndex": 1 - } - ], + "code-no-unexternalized-strings": "warn", "code-layering": [ "warn", { diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js index f0f43450d1e62..c4cdbe597baa1 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.js +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -8,207 +8,105 @@ const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); function isStringLiteral(node) { return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; } -function isObjectLiteral(node) { - return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression; +function isDoubleQuoted(node) { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; } -function isPropertyAssignment(node) { - return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Property; -} -module.exports = new (_a = class NoUnexternalizedStringsRuleWalker { +module.exports = new (_a = class NoUnexternalizedStrings { constructor() { - this.signatures = Object.create(null); - this.ignores = Object.create(null); - this.usedKeys = Object.create(null); this.meta = { type: 'problem', schema: {}, messages: { - badQuotes: 'Do not use double quotes for imports.', - unexternalized: 'Unexternalized string.', - duplicateKey: `Duplicate key '{{key}}' with different message value.`, - badKey: `The key {{key}} doesn't conform to a valid localize identifier`, - emptyKey: 'Key is empty.', - whitespaceKey: 'Key is only whitespace.', - badMessage: `Message argument to '{{message}}' must be a string literal.` + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' } }; } create(context) { - const first = context.options[0]; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); + function collectDoubleQuotedStrings(node) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); } } - return { - ['Program:exit']: () => { - this._checkProgramEnd(context); - }, - ['Literal']: (node) => { - if (typeof node.value === 'string') { - this._checkStringLiteral(context, node); - } - }, - }; - } - _checkProgramEnd(context) { - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - const identifier = key.substr(1, key.length - 2); - const occurrences = this.usedKeys[key]; - // bad key - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - context.report({ - loc: occurrences[0].key.loc, - messageId: 'badKey', - data: { key: occurrences[0].key.value } - }); + function visitLocalizeCall(node) { + // localize(key, message) + const [keyNode, messageNode] = node.arguments; + // (1) + // extract key so that it can be checked later + let key; + if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider + key = keyNode.value; } - // duplicates key - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - context.report({ - loc: occurrence.key.loc, - messageId: 'duplicateKey', - data: { key: occurrence.key.value } - }); - }); - } - }); - } - _checkStringLiteral(context, node) { - var _a; - const text = node.raw; - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this._findDescribingParent(node); - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - context.report({ - loc: node.loc, - messageId: 'badQuotes' - }); - return; - } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo && isStringLiteral(callInfo.callExpression.callee) - ? callInfo.callExpression.callee.value - : null; - if (functionName && this.ignores[functionName]) { - return; - } - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) { - context.report({ - loc: node.loc, - messageId: 'unexternalized' - }); - return; - } - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(context, keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), property.key); - if (name === 'key') { - const initializer = property.value; - if (isStringLiteral(initializer)) { - this.recordKey(context, initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider + key = property.value.value; + break; } - break; } } } } - } - const messageArg = callInfo.callExpression.arguments[this.messageIndex]; - if (messageArg && !isStringLiteral(messageArg)) { - context.report({ - loc: messageArg.loc, - messageId: 'badMessage', - data: { message: NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), (_a = callInfo) === null || _a === void 0 ? void 0 : _a.callExpression.callee) } - }); - return; - } - } - recordKey(context, keyNode, messageNode) { - const text = keyNode.raw; - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { - context.report({ - loc: keyNode.loc, - messageId: 'whitespaceKey' - }); + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); } - else { + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { context.report({ - loc: keyNode.loc, - messageId: 'emptyKey' + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } }); } - return; } - let occurrences = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; - } - if (messageNode) { - if (occurrences.some(pair => pair.message ? NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), pair.message) === NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), messageNode) : false)) { - return; - } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - _findDescribingParent(node) { - let parent; - while ((parent = node.parent)) { - const kind = parent.type; - if (kind === experimental_utils_1.AST_NODE_TYPES.CallExpression) { - const callExpression = parent; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - } - else if (kind === experimental_utils_1.AST_NODE_TYPES.TSImportEqualsDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.ImportDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.ExportNamedDeclaration) { - return { isImport: true }; + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); } - else if (kind === experimental_utils_1.AST_NODE_TYPES.VariableDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.FunctionDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSPropertySignature - || kind === experimental_utils_1.AST_NODE_TYPES.TSMethodSignature || kind === experimental_utils_1.AST_NODE_TYPES.TSInterfaceDeclaration - || kind === experimental_utils_1.AST_NODE_TYPES.ClassDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSEnumDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.TSModuleDeclaration - || kind === experimental_utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration || kind === experimental_utils_1.AST_NODE_TYPES.Program) { - return null; + for (const [key, values] of externalizedStringLiterals) { + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } } - node = parent; } - return null; - } - static _getText(source, node) { - if (node.type === experimental_utils_1.AST_NODE_TYPES.Literal) { - return String(node.value); - } - const start = source.getIndexFromLoc(node.loc.start); - const end = source.getIndexFromLoc(node.loc.end); - return source.getText().substring(start, end); + return { + ['Literal']: (node) => collectDoubleQuotedStrings(node), + ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, + }; } }, - _a.DOUBLE_QUOTE = '"', - _a.IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, + _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, _a); diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts index 096f1b44802de..3bc1156d397c9 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.ts +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -6,250 +6,122 @@ import * as eslint from 'eslint'; import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; -interface Map { - [key: string]: V; -} - -interface UnexternalizedStringsOptions { - signatures?: string[]; - messageIndex?: number; - keyIndex?: number; - ignores?: string[]; -} - function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral { return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string'; } -function isObjectLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.ObjectExpression { - return !!node && node.type === AST_NODE_TYPES.ObjectExpression; -} - -function isPropertyAssignment(node: TSESTree.Node | null | undefined): node is TSESTree.Property { - return !!node && node.type === AST_NODE_TYPES.Property; -} - -interface KeyMessagePair { - key: TSESTree.StringLiteral; - message: TSESTree.Node | undefined; +function isDoubleQuoted(node: TSESTree.StringLiteral): boolean { + return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; } -export = new class NoUnexternalizedStringsRuleWalker implements eslint.Rule.RuleModule { +export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { - private static DOUBLE_QUOTE: string = '"'; - private static IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; - - private signatures: Map = Object.create(null); - private messageIndex: number | undefined; - private keyIndex: number | undefined; - private ignores: Map = Object.create(null); - - private usedKeys: Map = Object.create(null); + private static _rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; readonly meta = { type: 'problem', schema: {}, messages: { - badQuotes: 'Do not use double quotes for imports.', - unexternalized: 'Unexternalized string.', - duplicateKey: `Duplicate key '{{key}}' with different message value.`, - badKey: `The key {{key}} doesn't conform to a valid localize identifier`, - emptyKey: 'Key is empty.', - whitespaceKey: 'Key is only whitespace.', - badMessage: `Message argument to '{{message}}' must be a string literal.` + doubleQuoted: 'Only use double-quoted strings for externalized strings.', + badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', + duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', + badMessage: 'Message argument to \'{{message}}\' must be a string literal.' } }; create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { - const first = context.options[0]; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature: string) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore: string) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; - } - } - - return { - ['Program:exit']: () => { - this._checkProgramEnd(context); - }, - ['Literal']: (node: any) => { - if (typeof (node).value === 'string') { - this._checkStringLiteral(context, node); - } - }, - }; - } - - protected _checkProgramEnd(context: eslint.Rule.RuleContext): void { - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - const identifier = key.substr(1, key.length - 2); - const occurrences = this.usedKeys[key]; + const externalizedStringLiterals = new Map(); + const doubleQuotedStringLiterals = new Set(); - // bad key - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - context.report({ - loc: occurrences[0].key.loc, - messageId: 'badKey', - data: { key: occurrences[0].key.value } - }); + function collectDoubleQuotedStrings(node: TSESTree.Literal) { + if (isStringLiteral(node) && isDoubleQuoted(node)) { + doubleQuotedStringLiterals.add(node); } - - // duplicates key - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - context.report({ - loc: occurrence.key.loc, - messageId: 'duplicateKey', - data: { key: occurrence.key.value } - }); - }); - } - }); - } - - private _checkStringLiteral(context: eslint.Rule.RuleContext, node: TSESTree.StringLiteral): void { - const text = node.raw; - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this._findDescribingParent(node); - - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - context.report({ - loc: node.loc, - messageId: 'badQuotes' - }); - return; } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo && isStringLiteral(callInfo.callExpression.callee) - ? callInfo.callExpression.callee.value - : null; - - if (functionName && this.ignores[functionName]) { - return; - } - - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName!])) { - context.report({ - loc: node.loc, - messageId: 'unexternalized' - }); - return; - } - - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName!]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg: TSESTree.Expression | null = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(context, keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - - } else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), property.key); - if (name === 'key') { - const initializer = property.value; - if (isStringLiteral(initializer)) { - this.recordKey(context, initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); + function visitLocalizeCall(node: TSESTree.CallExpression) { + + // localize(key, message) + const [keyNode, messageNode] = (node).arguments; + + // (1) + // extract key so that it can be checked later + let key: string | undefined; + if (isStringLiteral(keyNode)) { + doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider + key = keyNode.value; + + } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { + for (let property of keyNode.properties) { + if (property.type === AST_NODE_TYPES.Property && !property.computed) { + if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { + if (isStringLiteral(property.value)) { + doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider + key = property.value.value; + break; } - break; } } } } - } - - const messageArg = callInfo!.callExpression.arguments[this.messageIndex!]; - - if (messageArg && !isStringLiteral(messageArg)) { - context.report({ - loc: messageArg.loc, - messageId: 'badMessage', - data: { message: NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), callInfo?.callExpression.callee!) } - }); - return; - } - } + if (typeof key === 'string') { + let array = externalizedStringLiterals.get(key); + if (!array) { + array = []; + externalizedStringLiterals.set(key, array); + } + array.push({ call: node, message: messageNode }); + } - private recordKey(context: eslint.Rule.RuleContext, keyNode: TSESTree.StringLiteral, messageNode: TSESTree.Node | undefined) { - const text = keyNode.raw; - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { + // (2) + // remove message-argument from doubleQuoted list and make + // sure it is a string-literal + doubleQuotedStringLiterals.delete(messageNode); + if (!isStringLiteral(messageNode)) { context.report({ - loc: keyNode.loc, - messageId: 'whitespaceKey' - }); - } else { - context.report({ - loc: keyNode.loc, - messageId: 'emptyKey' + loc: messageNode.loc, + messageId: 'badMessage', + data: { message: context.getSourceCode().getText(node) } }); } - return; - } - let occurrences: KeyMessagePair[] = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; } - if (messageNode) { - if (occurrences.some(pair => pair.message ? NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), pair.message) === NoUnexternalizedStringsRuleWalker._getText(context.getSourceCode(), messageNode) : false)) { - return; + + function reportBadStringsAndBadKeys() { + // (1) + // report all strings that are in double quotes + for (const node of doubleQuotedStringLiterals) { + context.report({ loc: node.loc, messageId: 'doubleQuoted' }); } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - private _findDescribingParent(node: TSESTree.Node): { callInfo?: { callExpression: TSESTree.CallExpression, argIndex: number }, isImport?: boolean; } | null { - let parent: TSESTree.Node | undefined; - while ((parent = node.parent)) { - const kind = parent.type; - if (kind === AST_NODE_TYPES.CallExpression) { - const callExpression = parent as TSESTree.CallExpression; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - - } else if (kind === AST_NODE_TYPES.TSImportEqualsDeclaration || kind === AST_NODE_TYPES.ImportDeclaration || kind === AST_NODE_TYPES.ExportNamedDeclaration) { - return { isImport: true }; - - } else if (kind === AST_NODE_TYPES.VariableDeclaration || kind === AST_NODE_TYPES.FunctionDeclaration || kind === AST_NODE_TYPES.TSPropertySignature - || kind === AST_NODE_TYPES.TSMethodSignature || kind === AST_NODE_TYPES.TSInterfaceDeclaration - || kind === AST_NODE_TYPES.ClassDeclaration || kind === AST_NODE_TYPES.TSEnumDeclaration || kind === AST_NODE_TYPES.TSModuleDeclaration - || kind === AST_NODE_TYPES.TSTypeAliasDeclaration || kind === AST_NODE_TYPES.Program) { - return null; + for (const [key, values] of externalizedStringLiterals) { + + // (2) + // report all invalid NLS keys + if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { + for (let value of values) { + context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); + } + } + + // (2) + // report all invalid duplicates (same key, different message) + if (values.length > 1) { + for (let i = 1; i < values.length; i++) { + if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { + context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); + } + } + } } - node = parent; } - return null; - } - private static _getText(source: eslint.SourceCode, node: TSESTree.Node): string { - if (node.type === AST_NODE_TYPES.Literal) { - return String(node.value); - } - const start = source.getIndexFromLoc(node.loc.start); - const end = source.getIndexFromLoc(node.loc.end); - return source.getText().substring(start, end); + return { + ['Literal']: (node: any) => collectDoubleQuotedStrings(node), + ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node), + ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node), + ['Program:exit']: reportBadStringsAndBadKeys, + }; } - }; diff --git a/build/lib/eslint/code-no-unexternalized-strings2.js b/build/lib/eslint/code-no-unexternalized-strings2.js deleted file mode 100644 index c4cdbe597baa1..0000000000000 --- a/build/lib/eslint/code-no-unexternalized-strings2.js +++ /dev/null @@ -1,112 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -var _a; -const experimental_utils_1 = require("@typescript-eslint/experimental-utils"); -function isStringLiteral(node) { - return !!node && node.type === experimental_utils_1.AST_NODE_TYPES.Literal && typeof node.value === 'string'; -} -function isDoubleQuoted(node) { - return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; -} -module.exports = new (_a = class NoUnexternalizedStrings { - constructor() { - this.meta = { - type: 'problem', - schema: {}, - messages: { - doubleQuoted: 'Only use double-quoted strings for externalized strings.', - badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', - duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', - badMessage: 'Message argument to \'{{message}}\' must be a string literal.' - } - }; - } - create(context) { - const externalizedStringLiterals = new Map(); - const doubleQuotedStringLiterals = new Set(); - function collectDoubleQuotedStrings(node) { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - } - function visitLocalizeCall(node) { - // localize(key, message) - const [keyNode, messageNode] = node.arguments; - // (1) - // extract key so that it can be checked later - let key; - if (isStringLiteral(keyNode)) { - doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider - key = keyNode.value; - } - else if (keyNode.type === experimental_utils_1.AST_NODE_TYPES.ObjectExpression) { - for (let property of keyNode.properties) { - if (property.type === experimental_utils_1.AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === experimental_utils_1.AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider - key = property.value.value; - break; - } - } - } - } - } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); - } - // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); - } - } - function reportBadStringsAndBadKeys() { - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } - for (const [key, values] of externalizedStringLiterals) { - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (let value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } - } - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } - } - } - } - } - return { - ['Literal']: (node) => collectDoubleQuotedStrings(node), - ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), - ['Program:exit']: reportBadStringsAndBadKeys, - }; - } - }, - _a._rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/, - _a); diff --git a/build/lib/eslint/code-no-unexternalized-strings2.ts b/build/lib/eslint/code-no-unexternalized-strings2.ts deleted file mode 100644 index 3bc1156d397c9..0000000000000 --- a/build/lib/eslint/code-no-unexternalized-strings2.ts +++ /dev/null @@ -1,127 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as eslint from 'eslint'; -import { TSESTree, AST_NODE_TYPES } from '@typescript-eslint/experimental-utils'; - -function isStringLiteral(node: TSESTree.Node | null | undefined): node is TSESTree.StringLiteral { - return !!node && node.type === AST_NODE_TYPES.Literal && typeof node.value === 'string'; -} - -function isDoubleQuoted(node: TSESTree.StringLiteral): boolean { - return node.raw[0] === '"' && node.raw[node.raw.length - 1] === '"'; -} - -export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { - - private static _rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; - - readonly meta = { - type: 'problem', - schema: {}, - messages: { - doubleQuoted: 'Only use double-quoted strings for externalized strings.', - badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', - duplicateKey: 'Duplicate key \'{{key}}\' with different message value.', - badMessage: 'Message argument to \'{{message}}\' must be a string literal.' - } - }; - - create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener { - - const externalizedStringLiterals = new Map(); - const doubleQuotedStringLiterals = new Set(); - - function collectDoubleQuotedStrings(node: TSESTree.Literal) { - if (isStringLiteral(node) && isDoubleQuoted(node)) { - doubleQuotedStringLiterals.add(node); - } - } - - function visitLocalizeCall(node: TSESTree.CallExpression) { - - // localize(key, message) - const [keyNode, messageNode] = (node).arguments; - - // (1) - // extract key so that it can be checked later - let key: string | undefined; - if (isStringLiteral(keyNode)) { - doubleQuotedStringLiterals.delete(keyNode); //todo@joh reconsider - key = keyNode.value; - - } else if (keyNode.type === AST_NODE_TYPES.ObjectExpression) { - for (let property of keyNode.properties) { - if (property.type === AST_NODE_TYPES.Property && !property.computed) { - if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === 'key') { - if (isStringLiteral(property.value)) { - doubleQuotedStringLiterals.delete(property.value); //todo@joh reconsider - key = property.value.value; - break; - } - } - } - } - } - if (typeof key === 'string') { - let array = externalizedStringLiterals.get(key); - if (!array) { - array = []; - externalizedStringLiterals.set(key, array); - } - array.push({ call: node, message: messageNode }); - } - - // (2) - // remove message-argument from doubleQuoted list and make - // sure it is a string-literal - doubleQuotedStringLiterals.delete(messageNode); - if (!isStringLiteral(messageNode)) { - context.report({ - loc: messageNode.loc, - messageId: 'badMessage', - data: { message: context.getSourceCode().getText(node) } - }); - } - } - - function reportBadStringsAndBadKeys() { - // (1) - // report all strings that are in double quotes - for (const node of doubleQuotedStringLiterals) { - context.report({ loc: node.loc, messageId: 'doubleQuoted' }); - } - - for (const [key, values] of externalizedStringLiterals) { - - // (2) - // report all invalid NLS keys - if (!key.match(NoUnexternalizedStrings._rNlsKeys)) { - for (let value of values) { - context.report({ loc: value.call.loc, messageId: 'badKey', data: { key } }); - } - } - - // (2) - // report all invalid duplicates (same key, different message) - if (values.length > 1) { - for (let i = 1; i < values.length; i++) { - if (context.getSourceCode().getText(values[i - 1].message) !== context.getSourceCode().getText(values[i].message)) { - context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } }); - } - } - } - } - } - - return { - ['Literal']: (node: any) => collectDoubleQuotedStrings(node), - ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node), - ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node), - ['Program:exit']: reportBadStringsAndBadKeys, - }; - } -}; - From 600fdedbacaf064a8df954dfe29efaf5308afc4a Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 09:29:41 +0100 Subject: [PATCH 25/47] correctly configure rule paths in hygiene task --- build/gulpfile.hygiene.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 6efdc15470ddc..8ce595bf2edb8 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -362,7 +362,10 @@ function hygiene(some) { const javascript = result .pipe(filter(eslintFilter)) - .pipe(gulpeslint('.eslintrc.json')) + .pipe(gulpeslint({ + configFile: '.eslintrc.json', + rulePaths: ['./build/lib/eslint'] + })) .pipe(gulpeslint.formatEach('compact')) .pipe(gulpeslint.failAfterError()); From dc84c7121312e1c3c768e9493819359823757f08 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 10:36:33 +0100 Subject: [PATCH 26/47] update 'gulp eslint' and 'gulp hygiene' so that eslint also seens TS files --- build/gulpfile.hygiene.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 8ce595bf2edb8..bd8c84f27ee25 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -185,7 +185,7 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(eslintFilter)) + .pipe(filter(eslintFilter.concat(tslintHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] @@ -361,7 +361,7 @@ function hygiene(some) { } const javascript = result - .pipe(filter(eslintFilter)) + .pipe(filter(eslintFilter.concat(tslintHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] From 2bd15957aae680e78eda82fd396b7685fb404976 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 10:39:33 +0100 Subject: [PATCH 27/47] tweak ignore file --- .eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintignore b/.eslintignore index aaa375e9bad6d..dda0884b38115 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,6 +9,7 @@ **/test/**/*.js **/node_modules/** **/vscode-api-tests/testWorkspace/** +**/vscode-api-tests/testWorkspace2/** **/extensions/**/out/** **/extensions/**/build/** **/extensions/markdown-language-features/media/** From 50d16a37d99389aabaad8e19dc6b7c7f636cf713 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 11:20:42 +0100 Subject: [PATCH 28/47] add rulePaths-option for eslint extension --- .vscode/settings.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index ef1f7370d26e3..e0fd4e2342841 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -37,6 +37,11 @@ } } ], + "eslint.options": { + "rulePaths": [ + "./build/lib/eslint" + ] + }, "typescript.tsdk": "node_modules/typescript/lib", "npm.exclude": "**/extensions/**", "npm.packageManager": "yarn", From 324764a4dfadb8be90fe9dd06bb3e8d9639b2cf5 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 11:32:41 +0100 Subject: [PATCH 29/47] cleanup rule meta data, add links when possible --- build/lib/eslint/code-import-patterns.js | 7 ++++--- build/lib/eslint/code-import-patterns.ts | 9 +++++---- build/lib/eslint/code-layering.js | 5 +++-- build/lib/eslint/code-layering.ts | 7 ++++--- build/lib/eslint/code-no-nls-in-standalone-editor.js | 2 -- build/lib/eslint/code-no-nls-in-standalone-editor.ts | 4 +--- build/lib/eslint/code-no-standalone-editor.js | 7 ++++--- build/lib/eslint/code-no-standalone-editor.ts | 9 +++++---- build/lib/eslint/code-no-unexternalized-strings.js | 2 -- build/lib/eslint/code-no-unexternalized-strings.ts | 4 +--- build/lib/eslint/code-translation-remind.js | 2 -- build/lib/eslint/code-translation-remind.ts | 4 +--- 12 files changed, 28 insertions(+), 34 deletions(-) diff --git a/build/lib/eslint/code-import-patterns.js b/build/lib/eslint/code-import-patterns.js index 8292f7d46cf01..0d508d1d00e37 100644 --- a/build/lib/eslint/code-import-patterns.js +++ b/build/lib/eslint/code-import-patterns.js @@ -9,10 +9,11 @@ const utils_1 = require("./utils"); module.exports = new class { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { - badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; } diff --git a/build/lib/eslint/code-import-patterns.ts b/build/lib/eslint/code-import-patterns.ts index ae29e471080d0..c3daadbf59a0d 100644 --- a/build/lib/eslint/code-import-patterns.ts +++ b/build/lib/eslint/code-import-patterns.ts @@ -16,11 +16,12 @@ interface ImportPatternsConfig { export = new class implements eslint.Rule.RuleModule { - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { - badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + badImport: 'Imports violates \'{{restrictions}}\' restrictions. See https://github.com/microsoft/vscode/wiki/Source-Code-Organization' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; diff --git a/build/lib/eslint/code-layering.js b/build/lib/eslint/code-layering.js index 8c1ce8f80c4dd..db591f789c72c 100644 --- a/build/lib/eslint/code-layering.js +++ b/build/lib/eslint/code-layering.js @@ -8,10 +8,11 @@ const utils_1 = require("./utils"); module.exports = new class { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; } diff --git a/build/lib/eslint/code-layering.ts b/build/lib/eslint/code-layering.ts index 539d13f79f1ec..cca72eeec71e4 100644 --- a/build/lib/eslint/code-layering.ts +++ b/build/lib/eslint/code-layering.ts @@ -14,11 +14,12 @@ type Config = { export = new class implements eslint.Rule.RuleModule { - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { layerbreaker: 'Bad layering. You are not allowed to access {{from}} from here, allowed layers are: [{{allowed}}]' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.js b/build/lib/eslint/code-no-nls-in-standalone-editor.js index 735b87c3961a0..d8955507bedc9 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.js +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.js @@ -8,8 +8,6 @@ const utils_1 = require("./utils"); module.exports = new class NoNlsInStandaloneEditorRule { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' } diff --git a/build/lib/eslint/code-no-nls-in-standalone-editor.ts b/build/lib/eslint/code-no-nls-in-standalone-editor.ts index 69063fe58421e..90c80dee70c9d 100644 --- a/build/lib/eslint/code-no-nls-in-standalone-editor.ts +++ b/build/lib/eslint/code-no-nls-in-standalone-editor.ts @@ -9,9 +9,7 @@ import { createImportRuleListener } from './utils'; export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { noNls: 'Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts' } diff --git a/build/lib/eslint/code-no-standalone-editor.js b/build/lib/eslint/code-no-standalone-editor.js index 617b2483dd163..d9d6bb55b872f 100644 --- a/build/lib/eslint/code-no-standalone-editor.js +++ b/build/lib/eslint/code-no-standalone-editor.js @@ -8,10 +8,11 @@ const utils_1 = require("./utils"); module.exports = new class NoNlsInStandaloneEditorRule { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { - badImport: 'Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + badImport: 'Not allowed to import standalone editor modules.' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; } diff --git a/build/lib/eslint/code-no-standalone-editor.ts b/build/lib/eslint/code-no-standalone-editor.ts index 52fbbea043f30..898886d17d203 100644 --- a/build/lib/eslint/code-no-standalone-editor.ts +++ b/build/lib/eslint/code-no-standalone-editor.ts @@ -9,11 +9,12 @@ import { createImportRuleListener } from './utils'; export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule { - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { - badImport: 'Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization' + badImport: 'Not allowed to import standalone editor modules.' + }, + docs: { + url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization' } }; diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js index c4cdbe597baa1..1039890996c00 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.js +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -14,8 +14,6 @@ function isDoubleQuoted(node) { module.exports = new (_a = class NoUnexternalizedStrings { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { doubleQuoted: 'Only use double-quoted strings for externalized strings.', badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts index 3bc1156d397c9..b7a35d6471fc5 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.ts +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -18,9 +18,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { private static _rNlsKeys = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { doubleQuoted: 'Only use double-quoted strings for externalized strings.', badKey: 'The key \'{{key}}\' doesn\'t conform to a valid localize identifier.', diff --git a/build/lib/eslint/code-translation-remind.js b/build/lib/eslint/code-translation-remind.js index 34071d76ef013..a276e7c0028aa 100644 --- a/build/lib/eslint/code-translation-remind.js +++ b/build/lib/eslint/code-translation-remind.js @@ -9,8 +9,6 @@ const utils_1 = require("./utils"); module.exports = new (_a = class TranslationRemind { constructor() { this.meta = { - type: 'problem', - schema: {}, messages: { missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' } diff --git a/build/lib/eslint/code-translation-remind.ts b/build/lib/eslint/code-translation-remind.ts index d482d3ff4616e..1ce01107a72a5 100644 --- a/build/lib/eslint/code-translation-remind.ts +++ b/build/lib/eslint/code-translation-remind.ts @@ -13,9 +13,7 @@ export = new class TranslationRemind implements eslint.Rule.RuleModule { private static NLS_MODULE = 'vs/nls'; - readonly meta = { - type: 'problem', - schema: {}, + readonly meta: eslint.Rule.RuleMetaData = { messages: { missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.' } From e6d9b41a8c4dd551a1f219814d950bb3723030cc Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 11:59:27 +0100 Subject: [PATCH 30/47] makes eslint fail the hygiene checks --- build/gulpfile.hygiene.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index bd8c84f27ee25..c1a3db6072dbb 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -191,7 +191,11 @@ gulp.task('eslint', () => { rulePaths: ['./build/lib/eslint'] })) .pipe(gulpeslint.formatEach('compact')) - .pipe(gulpeslint.failAfterError()); + .pipe(gulpeslint.results(results => { + if (results.warningCount > 0 || results.errorCount > 0) { + throw new Error('eslint failed with warnings and/or errors'); + } + })); }); gulp.task('tslint', () => { @@ -307,7 +311,7 @@ function hygiene(some) { let formatted = result.dest.replace(/\r\n/gm, '\n'); if (original !== formatted) { - console.error("File not formatted. Run the 'Format Document' command to fix it:", file.relative); + console.error('File not formatted. Run the \'Format Document\' command to fix it:', file.relative); errorCount++; } cb(null, file); @@ -367,7 +371,10 @@ function hygiene(some) { rulePaths: ['./build/lib/eslint'] })) .pipe(gulpeslint.formatEach('compact')) - .pipe(gulpeslint.failAfterError()); + .pipe(gulpeslint.results(results => { + errorCount += results.warningCount; + errorCount += results.errorCount; + })); let count = 0; return es.merge(typescript, javascript) From e22be576d6ea89afcc3384ac81889918a3d68c14 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Tue, 31 Dec 2019 12:55:41 +0100 Subject: [PATCH 31/47] add disabled rules for being more complete with our tslint config... --- .eslintrc.json | 6 +++++- package.json | 3 ++- yarn.lock | 56 +++++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index ad255a10130fd..0a7fb5ca8b633 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -6,7 +6,8 @@ "sourceType": "module" }, "plugins": [ - "@typescript-eslint" + "@typescript-eslint", + "jsdoc" ], "rules": { "constructor-super": "warn", @@ -20,11 +21,14 @@ "no-eval": "warn", "no-extra-semi": "off", "no-new-wrappers": "warn", + "no-redeclare": "off", "no-sparse-arrays": "warn", "no-throw-literal": "warn", "no-unsafe-finally": "warn", + "no-unused-expressions": "off", "no-unused-labels": "warn", "no-var": "warn", + "jsdoc/no-types": "off", "semi": "off", "@typescript-eslint/semi": "warn", "@typescript-eslint/class-name-casing": "warn", diff --git a/package.json b/package.json index 3b28e8527d917..db6ee7e2d9523 100644 --- a/package.json +++ b/package.json @@ -82,8 +82,8 @@ "@types/winreg": "^1.2.30", "@types/yauzl": "^2.9.1", "@types/yazl": "^2.4.2", - "@typescript-eslint/parser": "^2.12.0", "@typescript-eslint/eslint-plugin": "2.3.2", + "@typescript-eslint/parser": "^2.12.0", "ansi-colors": "^3.2.3", "asar": "^0.14.0", "chromium-pickle-js": "^0.2.0", @@ -93,6 +93,7 @@ "debounce": "^1.0.0", "electron": "6.1.6", "eslint": "6.8.0", + "eslint-plugin-jsdoc": "^19.1.0", "event-stream": "3.3.4", "express": "^4.13.1", "fancy-log": "^1.3.3", diff --git a/yarn.lock b/yarn.lock index 0f9867933e3ac..f5aa9b27731fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1784,9 +1784,6 @@ coa@~1.0.1: dependencies: q "^1.1.2" -"code-oss-eslint@file:./build/lib/eslint": - version "1.0.0" - code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -1927,6 +1924,11 @@ commandpost@^1.0.0: resolved "https://registry.yarnpkg.com/commandpost/-/commandpost-1.2.1.tgz#2e9c4c7508b9dc704afefaa91cab92ee6054cc68" integrity sha512-V1wzc+DTFsO96te2W/U+fKNRSOWtOwXhkkZH2WRLLbucrY+YrDNsRr4vtfSf83MUZVF3E6B4nwT30fqaTpzipQ== +comment-parser@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-0.7.2.tgz#baf6d99b42038678b81096f15b630d18142f4b8a" + integrity sha512-4Rjb1FnxtOcv9qsfuaNuVsmmVn4ooVoBHzYfyKteiXwIU84PClyGA5jASoFMwPV93+FPh9spwueXauxFJZkGAg== + commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -2819,8 +2821,19 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.3, escape-string-regexp@^ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -"eslint-plugin-code-oss-eslint@file:./build/lib/eslint": - version "1.0.0" +eslint-plugin-jsdoc@^19.1.0: + version "19.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-19.1.0.tgz#fcc17f0378fdd6ee1c847a79b7211745cb05d014" + integrity sha512-rw8ouveUzz41dgSCyjlZgh5cKuQIyBzsrJnKeGYoY74+9AXuOygAQMwvyN4bMRp0hJu0DYQptKyQiSBqOnXmTg== + dependencies: + comment-parser "^0.7.2" + debug "^4.1.1" + jsdoctypeparser "^6.1.0" + lodash "^4.17.15" + object.entries-ponyfill "^1.0.1" + regextras "^0.7.0" + semver "^6.3.0" + spdx-expression-parse "^3.0.0" eslint-scope@^4.0.0: version "4.0.0" @@ -5207,6 +5220,11 @@ jschardet@2.1.1: resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-2.1.1.tgz#af6f8fd0b3b0f5d46a8fd9614a4fce490575c184" integrity sha512-pA5qG9Zwm8CBpGlK/lo2GE9jPxwqRgMV7Lzc/1iaPccw6v4Rhj8Zg2BTyrdmHmxlJojnbLupLeRnaPLsq03x6Q== +jsdoctypeparser@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsdoctypeparser/-/jsdoctypeparser-6.1.0.tgz#acfb936c26300d98f1405cb03e20b06748e512a8" + integrity sha512-UCQBZ3xCUBv/PLfwKAJhp6jmGOSLFNKzrotXGNgbKhWvz27wPsCsVeP7gIcHPElQw2agBmynAitXqhxR58XAmA== + jsdom-no-contextify@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/jsdom-no-contextify/-/jsdom-no-contextify-3.1.0.tgz#0d8beaf610c2ff23894f54dfa7f89dd22fd0f7ab" @@ -6462,6 +6480,11 @@ object.defaults@^1.0.0, object.defaults@^1.1.0: for-own "^1.0.0" isobject "^3.0.0" +object.entries-ponyfill@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object.entries-ponyfill/-/object.entries-ponyfill-1.0.1.tgz#29abdf77cbfbd26566dd1aa24e9d88f65433d256" + integrity sha1-Kavfd8v70mVm3RqiTp2I9lQz0lY= + object.map@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object.map/-/object.map-1.0.1.tgz#cf83e59dc8fcc0ad5f4250e1f78b3b81bd801d37" @@ -7716,6 +7739,11 @@ regexpp@^2.0.1: resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== +regextras@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/regextras/-/regextras-0.7.0.tgz#2298bef8cfb92b1b7e3b9b12aa8f69547b7d71e4" + integrity sha512-ds+fL+Vhl918gbAUb0k2gVKbTZLsg84Re3DI6p85Et0U0tYME3hyW4nMK8Px4dtDaBA2qNjvG5uWyW7eK5gfmw== + remove-bom-buffer@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/remove-bom-buffer/-/remove-bom-buffer-3.0.0.tgz#c2bf1e377520d324f623892e33c10cac2c252b53" @@ -8415,6 +8443,19 @@ spdx-correct@~1.0.0: dependencies: spdx-license-ids "^1.0.2" +spdx-exceptions@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" + integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== + +spdx-expression-parse@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" + integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== + dependencies: + spdx-exceptions "^2.1.0" + spdx-license-ids "^3.0.0" + spdx-expression-parse@~1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz#9bdf2f20e1f40ed447fbe273266191fced51626c" @@ -8425,6 +8466,11 @@ spdx-license-ids@^1.0.2: resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz#c9df7a3424594ade6bd11900d596696dc06bac57" integrity sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc= +spdx-license-ids@^3.0.0: + version "3.0.5" + resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" + integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== + speedometer@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/speedometer/-/speedometer-0.1.4.tgz#9876dbd2a169d3115402d48e6ea6329c8816a50d" From ee4dccd069cc139f507d79e00962b381f7d62ecd Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:10:05 +0100 Subject: [PATCH 32/47] disable tslint in hygiene check --- build/gulpfile.hygiene.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index c1a3db6072dbb..d7a5ee8463782 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -321,16 +321,6 @@ function hygiene(some) { }); }); - const tslintConfiguration = tslint.Configuration.findConfiguration('tslint.json', '.'); - const tslintOptions = { fix: false, formatter: 'json' }; - const tsLinter = new tslint.Linter(tslintOptions); - - const tsl = es.through(function (file) { - const contents = file.contents.toString('utf8'); - tsLinter.lint(file.relative, contents, tslintConfiguration.results); - this.emit('data', file); - }); - let input; if (Array.isArray(some) || typeof some === 'string' || !some) { @@ -356,14 +346,10 @@ function hygiene(some) { .pipe(filter(copyrightFilter)) .pipe(copyrights); - let typescript = result + const typescript = result .pipe(filter(tslintHygieneFilter)) .pipe(formatting); - if (!process.argv.some(arg => arg === '--skip-tslint')) { - typescript = typescript.pipe(tsl); - } - const javascript = result .pipe(filter(eslintFilter.concat(tslintHygieneFilter))) .pipe(gulpeslint({ @@ -386,20 +372,6 @@ function hygiene(some) { this.emit('data', data); }, function () { process.stdout.write('\n'); - - const tslintResult = tsLinter.getResult(); - if (tslintResult.failures.length > 0) { - for (const failure of tslintResult.failures) { - const name = failure.getFileName(); - const position = failure.getStartPosition(); - const line = position.getLineAndCharacter().line; - const character = position.getLineAndCharacter().character; - - console.error(`${name}:${line + 1}:${character + 1}:${failure.getFailure()}`); - } - errorCount += tslintResult.failures.length; - } - if (errorCount > 0) { this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.'); } else { From 856d0852798b4dd860be680c842fc013ae3e7c99 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:14:09 +0100 Subject: [PATCH 33/47] run "eslint --fix" to get some changes for free --- extensions/emmet/src/test/partialParsingStylesheet.test.ts | 2 +- extensions/markdown-language-features/preview-src/index.ts | 2 +- src/vs/platform/contextkey/test/common/contextkey.test.ts | 4 +++- src/vs/workbench/browser/parts/quickinput/quickInputBox.ts | 6 +++--- src/vs/workbench/contrib/markers/browser/messages.ts | 2 +- src/vs/workbench/contrib/search/browser/searchView.ts | 6 +++--- src/vs/workbench/contrib/search/browser/searchWidget.ts | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/extensions/emmet/src/test/partialParsingStylesheet.test.ts b/extensions/emmet/src/test/partialParsingStylesheet.test.ts index 7a115bd47aad1..0c19d06b6453f 100644 --- a/extensions/emmet/src/test/partialParsingStylesheet.test.ts +++ b/extensions/emmet/src/test/partialParsingStylesheet.test.ts @@ -40,7 +40,7 @@ p { new vscode.Range(3, 13, 3, 14), // p just before ending of block comment new vscode.Range(6, 2, 6, 3) // p after ending of block - ] + ]; rangesForEmmet.forEach(range => { assert.equal(isValid(doc, range, 'css'), true); }); diff --git a/extensions/markdown-language-features/preview-src/index.ts b/extensions/markdown-language-features/preview-src/index.ts index 311c40b62d672..092148e19a4cd 100644 --- a/extensions/markdown-language-features/preview-src/index.ts +++ b/extensions/markdown-language-features/preview-src/index.ts @@ -10,7 +10,7 @@ import { getEditorLineNumberForPageOffset, scrollToRevealSourceLine, getLineElem import { getSettings, getData } from './settings'; import throttle = require('lodash.throttle'); -declare var acquireVsCodeApi: any; +declare let acquireVsCodeApi: any; let scrollDisabled = true; const marker = new ActiveLineMarker(); diff --git a/src/vs/platform/contextkey/test/common/contextkey.test.ts b/src/vs/platform/contextkey/test/common/contextkey.test.ts index 9db3782da3177..c1748e10ea09b 100644 --- a/src/vs/platform/contextkey/test/common/contextkey.test.ts +++ b/src/vs/platform/contextkey/test/common/contextkey.test.ts @@ -70,6 +70,7 @@ suite('ContextKeyExpr', () => { assert.equal(rules!.evaluate(context), expected, expr); } function testBatch(expr: string, value: any): void { + /* eslint-disable eqeqeq */ testExpression(expr, !!value); testExpression(expr + ' == true', !!value); testExpression(expr + ' != true', !value); @@ -80,6 +81,7 @@ suite('ContextKeyExpr', () => { testExpression('!' + expr, !value); testExpression(expr + ' =~ /d.*/', /d.*/.test(value)); testExpression(expr + ' =~ /D/i', /D/i.test(value)); + /* eslint-enable eqeqeq */ } testBatch('a', true); @@ -90,7 +92,7 @@ suite('ContextKeyExpr', () => { testExpression('a && !b', true && !false); testExpression('a && b', true && false); - testExpression('a && !b && c == 5', true && !false && '5' == '5'); + testExpression('a && !b && c == 5', true && !false && '5' === '5'); testExpression('d =~ /e.*/', false); /* tslint:enable:triple-equals */ diff --git a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts b/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts index f78fc4363b7b4..ea21d8ff5f4c1 100644 --- a/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts +++ b/src/vs/workbench/browser/parts/quickinput/quickInputBox.ts @@ -32,17 +32,17 @@ export class QuickInputBox extends Disposable { return dom.addDisposableListener(this.inputBox.inputElement, dom.EventType.KEY_DOWN, (e: KeyboardEvent) => { handler(new StandardKeyboardEvent(e)); }); - } + }; onMouseDown = (handler: (event: StandardMouseEvent) => void): IDisposable => { return dom.addDisposableListener(this.inputBox.inputElement, dom.EventType.MOUSE_DOWN, (e: MouseEvent) => { handler(new StandardMouseEvent(e)); }); - } + }; onDidChange = (handler: (event: string) => void): IDisposable => { return this.inputBox.onDidChange(handler); - } + }; get value() { return this.inputBox.value; diff --git a/src/vs/workbench/contrib/markers/browser/messages.ts b/src/vs/workbench/contrib/markers/browser/messages.ts index 7275dc27c439c..4fbffb9d7d434 100644 --- a/src/vs/workbench/contrib/markers/browser/messages.ts +++ b/src/vs/workbench/contrib/markers/browser/messages.ts @@ -67,7 +67,7 @@ export default class Messages { return marker.marker.source ? nls.localize('problems.tree.aria.label.marker', "Problem generated by {0}: {1} at line {2} and character {3}.{4}", marker.marker.source, marker.marker.message, marker.marker.startLineNumber, marker.marker.startColumn, relatedInformationMessage) : nls.localize('problems.tree.aria.label.marker.nosource', "Problem: {0} at line {1} and character {2}.{3}", marker.marker.message, marker.marker.startLineNumber, marker.marker.startColumn, relatedInformationMessage); } - } + }; public static readonly MARKERS_TREE_ARIA_LABEL_RELATED_INFORMATION = (relatedInformation: IRelatedInformation): string => nls.localize('problems.tree.aria.label.relatedinfo.message', "{0} at line {1} and character {2} in {3}", relatedInformation.message, relatedInformation.startLineNumber, relatedInformation.startColumn, basename(relatedInformation.resource)); public static SHOW_ERRORS_WARNINGS_ACTION_LABEL: string = nls.localize('errors.warnings.show.label', "Show Errors and Warnings"); } diff --git a/src/vs/workbench/contrib/search/browser/searchView.ts b/src/vs/workbench/contrib/search/browser/searchView.ts index 5a7ece35793cd..2a834ed343eec 100644 --- a/src/vs/workbench/contrib/search/browser/searchView.ts +++ b/src/vs/workbench/contrib/search/browser/searchView.ts @@ -1515,13 +1515,13 @@ export class SearchView extends ViewPane { event.stopPropagation(); } })); - } + }; private onOpenSettings = (e: dom.EventLike): void => { dom.EventHelper.stop(e, false); this.openSettings('.exclude'); - } + }; private openSettings(query: string): Promise { const options: ISettingsEditorOptions = { query }; @@ -1534,7 +1534,7 @@ export class SearchView extends ViewPane { dom.EventHelper.stop(e, false); this.openerService.open(URI.parse('https://go.microsoft.com/fwlink/?linkid=853977')); - } + }; private updateSearchResultCount(disregardExcludesAndIgnores?: boolean): void { const fileCount = this.viewModel.searchResult.fileCount(); diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index b339428b977b7..21c0ecebd20d2 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -103,7 +103,7 @@ export class SearchWidget extends Widget { private static readonly REPLACE_ALL_ENABLED_LABEL = (keyBindingService2: IKeybindingService): string => { const kb = keyBindingService2.lookupKeybinding(ReplaceAllAction.ID); return appendKeyBindingLabel(nls.localize('search.action.replaceAll.enabled.label', "Replace All"), kb, keyBindingService2); - } + }; domNode!: HTMLElement; From 90512e6c02cf32f86343ffbad74bb3bd4d44f1bf Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:26:52 +0100 Subject: [PATCH 34/47] tslint default severity is OFF --- tslint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tslint.json b/tslint.json index 9b5b07a5dd7a6..4083adf49b05c 100644 --- a/tslint.json +++ b/tslint.json @@ -615,5 +615,5 @@ "no-standalone-editor": true, "no-nls-in-standalone-editor": true }, - "defaultSeverity": "warning" + "defaultSeverity": "off" } From f80a6f9b9644d44b95541872a5859b66f4120fad Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:28:59 +0100 Subject: [PATCH 35/47] update rule-disablements (eslint-disable for tslint-disable) --- .../src/typescriptServiceClient.ts | 2 +- src/vs/base/common/uri.ts | 2 +- src/vs/base/test/common/event.test.ts | 1 + src/vs/base/test/node/keytar.test.ts | 2 +- src/vs/editor/test/node/classification/typescript-test.ts | 2 +- src/vs/platform/contextkey/common/contextkey.ts | 6 ++---- src/vs/platform/sign/node/signService.ts | 3 +-- src/vs/workbench/browser/parts/titlebar/menubarControl.ts | 5 +++-- src/vs/workbench/browser/parts/titlebar/titlebarPart.ts | 2 +- .../services/extensions/test/node/rpcProtocol.test.ts | 1 + 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/extensions/typescript-language-features/src/typescriptServiceClient.ts b/extensions/typescript-language-features/src/typescriptServiceClient.ts index ce01e4468e553..4433f18e97da3 100644 --- a/extensions/typescript-language-features/src/typescriptServiceClient.ts +++ b/extensions/typescript-language-features/src/typescriptServiceClient.ts @@ -118,7 +118,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType this.pathSeparator = path.sep; this.lastStart = Date.now(); - // tslint:disable-next-line: no-var-keyword + // eslint-disable-next-line no-var var p = new Promise((resolve, reject) => { this._onReady = { promise: p, resolve, reject }; }); diff --git a/src/vs/base/common/uri.ts b/src/vs/base/common/uri.ts index 19f89eec62678..78c9fda1d71ba 100644 --- a/src/vs/base/common/uri.ts +++ b/src/vs/base/common/uri.ts @@ -389,7 +389,7 @@ interface UriState extends UriComponents { const _pathSepMarker = isWindows ? 1 : undefined; -// tslint:disable-next-line:class-name +// eslint-disable-next-line @typescript-eslint/class-name-casing class _URI extends URI { _formatted: string | null = null; diff --git a/src/vs/base/test/common/event.test.ts b/src/vs/base/test/common/event.test.ts index a0e8ca9fcfa40..8c9d65ba20bb2 100644 --- a/src/vs/base/test/common/event.test.ts +++ b/src/vs/base/test/common/event.test.ts @@ -136,6 +136,7 @@ suite('Event', function () { let a = new Emitter(); let hit = false; a.event(function () { + // eslint-disable-next-line no-throw-literal throw 9; }); a.event(function () { diff --git a/src/vs/base/test/node/keytar.test.ts b/src/vs/base/test/node/keytar.test.ts index 53f1c31a1a64d..b2f7bab5042f4 100644 --- a/src/vs/base/test/node/keytar.test.ts +++ b/src/vs/base/test/node/keytar.test.ts @@ -28,7 +28,7 @@ suite('Keytar', () => { try { await keytar.deletePassword(name, 'foo'); } finally { - // tslint:disable-next-line: no-unsafe-finally + // eslint-disable-next-line no-unsafe-finally throw err; } } diff --git a/src/vs/editor/test/node/classification/typescript-test.ts b/src/vs/editor/test/node/classification/typescript-test.ts index bf8856d2f767d..f1a8a21c22d80 100644 --- a/src/vs/editor/test/node/classification/typescript-test.ts +++ b/src/vs/editor/test/node/classification/typescript-test.ts @@ -1,5 +1,5 @@ /// -/* tslint:disable */ +/* eslint-disable */ const x01 = "string"; /// ^^^^^^^^ string diff --git a/src/vs/platform/contextkey/common/contextkey.ts b/src/vs/platform/contextkey/common/contextkey.ts index d0654bc1caf81..a91b5ed598704 100644 --- a/src/vs/platform/contextkey/common/contextkey.ts +++ b/src/vs/platform/contextkey/common/contextkey.ts @@ -282,10 +282,9 @@ export class ContextKeyEqualsExpr implements ContextKeyExpr { } public evaluate(context: IContext): boolean { - /* tslint:disable:triple-equals */ // Intentional == + // eslint-disable-next-line eqeqeq return (context.getValue(this.key) == this.value); - /* tslint:enable:triple-equals */ } public serialize(): string { @@ -348,10 +347,9 @@ export class ContextKeyNotEqualsExpr implements ContextKeyExpr { } public evaluate(context: IContext): boolean { - /* tslint:disable:triple-equals */ // Intentional != + // eslint-disable-next-line eqeqeq return (context.getValue(this.key) != this.value); - /* tslint:enable:triple-equals */ } public serialize(): string { diff --git a/src/vs/platform/sign/node/signService.ts b/src/vs/platform/sign/node/signService.ts index dac29b90c0cdd..b6d0afd467cbf 100644 --- a/src/vs/platform/sign/node/signService.ts +++ b/src/vs/platform/sign/node/signService.ts @@ -5,9 +5,8 @@ import { ISignService } from 'vs/platform/sign/common/sign'; -/* tslint:disable */ - declare module vsda { + // eslint-disable-next-line @typescript-eslint/class-name-casing export class signer { sign(arg: any): any; } diff --git a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts index 50063ae1e88a5..93958775e4f9c 100644 --- a/src/vs/workbench/browser/parts/titlebar/menubarControl.ts +++ b/src/vs/workbench/browser/parts/titlebar/menubarControl.ts @@ -37,10 +37,11 @@ import { isFullscreen } from 'vs/base/browser/browser'; import { IHostService } from 'vs/workbench/services/host/browser/host'; // TODO@sbatten https://github.com/microsoft/vscode/issues/81360 -// tslint:disable-next-line: import-patterns layering TODO@sbatten +// eslint-disable-next-line code-layering, code-import-patterns import { IElectronService } from 'vs/platform/electron/node/electron'; import { optional } from 'vs/platform/instantiation/common/instantiation'; -// tslint:disable-next-line: import-patterns layering TODO@sbatten +// TODO@sbatten +// eslint-disable-next-line code-layering, code-import-patterns import { IElectronEnvironmentService } from 'vs/workbench/services/electron/electron-browser/electronEnvironmentService'; import { BrowserFeatures } from 'vs/base/browser/canIUse'; diff --git a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts index 2af28e59378bc..09a3338ddcc9b 100644 --- a/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts +++ b/src/vs/workbench/browser/parts/titlebar/titlebarPart.ts @@ -43,7 +43,7 @@ import { IProductService } from 'vs/platform/product/common/productService'; import { REMOTE_HOST_SCHEME } from 'vs/platform/remote/common/remoteHosts'; // TODO@sbatten https://github.com/microsoft/vscode/issues/81360 -// tslint:disable-next-line: import-patterns layering +// eslint-disable-next-line code-layering, code-import-patterns import { IElectronService } from 'vs/platform/electron/node/electron'; export class TitlebarPart extends Part implements ITitleService { diff --git a/src/vs/workbench/services/extensions/test/node/rpcProtocol.test.ts b/src/vs/workbench/services/extensions/test/node/rpcProtocol.test.ts index 404e8b259f6ec..51951f79e20cb 100644 --- a/src/vs/workbench/services/extensions/test/node/rpcProtocol.test.ts +++ b/src/vs/workbench/services/extensions/test/node/rpcProtocol.test.ts @@ -190,6 +190,7 @@ suite('RPCProtocol', () => { test('issue #72798: null errors are hard to digest', function (done) { delegate = (a1: number, a2: number) => { + // eslint-disable-next-line no-throw-literal throw { 'what': 'what' }; }; bProxy.$m(4, 1).then((res) => { From 84013e2ef0c85f7c3587c300441200092bfac2bc Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:31:00 +0100 Subject: [PATCH 36/47] fix double quote issues --- .../emmet/src/test/abbreviationAction.test.ts | 6 +- extensions/git/src/repository.ts | 2 +- .../server/lib/jquery.d.ts | 194 +++++++++--------- 3 files changed, 101 insertions(+), 101 deletions(-) diff --git a/extensions/emmet/src/test/abbreviationAction.test.ts b/extensions/emmet/src/test/abbreviationAction.test.ts index 31f46891965f8..cedf324490385 100644 --- a/extensions/emmet/src/test/abbreviationAction.test.ts +++ b/extensions/emmet/src/test/abbreviationAction.test.ts @@ -362,7 +362,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => { }); test('Expand html when inside script tag with javascript type if js is mapped to html (HTML)', async () => { - await workspace.getConfiguration('emmet').update('includeLanguages', { "javascript": "html" }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('includeLanguages', { 'javascript': 'html' }, ConfigurationTarget.Global); await withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => { editor.selection = new Selection(24, 10, 24, 10); let expandPromise = expandEmmetAbbreviation(null); @@ -378,7 +378,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => { test('Expand html in completion list when inside script tag with javascript type if js is mapped to html (HTML)', async () => { const abbreviation = 'span.bye'; const expandedText = ''; - await workspace.getConfiguration('emmet').update('includeLanguages', { "javascript": "html" }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('includeLanguages', { 'javascript': 'html' }, ConfigurationTarget.Global); await withRandomFileEditor(htmlContents, 'html', async (editor, _doc) => { editor.selection = new Selection(24, 10, 24, 10); const cancelSrc = new CancellationTokenSource(); @@ -448,7 +448,7 @@ suite('Tests for jsx, xml and xsl', () => { }); test('Expand abbreviation with single quotes for jsx', async () => { - await workspace.getConfiguration('emmet').update('syntaxProfiles', { jsx: { "attr_quotes": "single" } }, ConfigurationTarget.Global); + await workspace.getConfiguration('emmet').update('syntaxProfiles', { jsx: { 'attr_quotes': 'single' } }, ConfigurationTarget.Global); return withRandomFileEditor('img', 'javascriptreact', async (editor, _doc) => { editor.selection = new Selection(0, 6, 0, 6); await expandEmmetAbbreviation({ language: 'javascriptreact' }); diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts index 4edc79262d20c..47832f9e0f06e 100644 --- a/extensions/git/src/repository.ts +++ b/extensions/git/src/repository.ts @@ -1721,7 +1721,7 @@ export class Repository implements Disposable { if (branchName) { // '{0}' will be replaced by the corresponding key-command later in the process, which is why it needs to stay. - this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", "{0}", branchName); + this._sourceControl.inputBox.placeholder = localize('commitMessageWithHeadLabel', "Message ({0} to commit on '{1}')", '{0}', branchName); } else { this._sourceControl.inputBox.placeholder = localize('commitMessage', "Message ({0} to commit)"); } diff --git a/extensions/html-language-features/server/lib/jquery.d.ts b/extensions/html-language-features/server/lib/jquery.d.ts index 3dc9f0e12610f..d31bfe6c1b546 100644 --- a/extensions/html-language-features/server/lib/jquery.d.ts +++ b/extensions/html-language-features/server/lib/jquery.d.ts @@ -34,7 +34,7 @@ interface JQueryAjaxSettings { /** * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; + beforeSend?(jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; /** * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. */ @@ -42,7 +42,7 @@ interface JQueryAjaxSettings { /** * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; + complete?(jqXHR: JQueryXHR, textStatus: string): any; /** * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) */ @@ -72,7 +72,7 @@ interface JQueryAjaxSettings { /** * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. */ - dataFilter? (data: any, ty: any): any; + dataFilter?(data: any, ty: any): any; /** * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). */ @@ -80,7 +80,7 @@ interface JQueryAjaxSettings { /** * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; + error?(jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; /** * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. */ @@ -132,7 +132,7 @@ interface JQueryAjaxSettings { /** * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; + success?(data: any, textStatus: string, jqXHR: JQueryXHR): any; /** * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. */ @@ -284,7 +284,7 @@ interface JQueryGenericPromise { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; + then(doneFilter: (value?: T, ...values: any[]) => U | JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. @@ -303,7 +303,7 @@ interface JQueryPromiseCallback { } interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + (callback1: JQueryPromiseCallback | JQueryPromiseCallback[], ...callbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; } /** @@ -320,27 +320,27 @@ interface JQueryPromise extends JQueryGenericPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + always(alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...alwaysCallbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + done(doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...doneCallbackN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; + fail(failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...failCallbacksN: Array | JQueryPromiseCallback[]>): JQueryPromise; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; + progress(progressCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...progressCallbackN: Array | JQueryPromiseCallback[]>): JQueryPromise; // Deprecated - given no typings pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; @@ -367,27 +367,27 @@ interface JQueryDeferred extends JQueryGenericPromise { * @param alwaysCallbacks1 A function, or array of functions, that is called when the Deferred is resolved or rejected. * @param alwaysCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + always(alwaysCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...alwaysCallbacksN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is resolved. * * @param doneCallbacks1 A function, or array of functions, that are called when the Deferred is resolved. * @param doneCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + done(doneCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...doneCallbackN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object is rejected. * * @param failCallbacks1 A function, or array of functions, that are called when the Deferred is rejected. * @param failCallbacks2 Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbacksN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + fail(failCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...failCallbacksN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Add handlers to be called when the Deferred object generates progress notifications. * * @param progressCallbacks A function, or array of functions, to be called when the Deferred generates progress notifications. */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; + progress(progressCallback1?: JQueryPromiseCallback | JQueryPromiseCallback[], ...progressCallbackN: Array | JQueryPromiseCallback[]>): JQueryDeferred; /** * Call the progressCallbacks on a Deferred object with the given args. @@ -495,7 +495,7 @@ interface JQueryKeyEventObject extends JQueryInputEventObject { keyCode: number; } -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ +interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject { } /* @@ -518,7 +518,7 @@ interface JQuerySupport { opacity?: boolean; optDisabled?: boolean; optSelected?: boolean; - scriptEval? (): boolean; + scriptEval?(): boolean; style?: boolean; submitBubbles?: boolean; tbody?: boolean; @@ -549,7 +549,7 @@ interface JQueryParam { */ interface JQueryEventConstructor { (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; + new(name: string, eventProperties?: any): JQueryEventObject; } /** @@ -616,11 +616,11 @@ interface JQueryAnimationOptions { } interface JQueryEasingFunction { - ( percent: number ): number; + (percent: number): number; } interface JQueryEasingFunctions { - [ name: string ]: JQueryEasingFunction; + [name: string]: JQueryEasingFunction; linear: JQueryEasingFunction; swing: JQueryEasingFunction; } @@ -660,11 +660,11 @@ interface JQueryStatic { ajaxSettings: JQueryAjaxSettings; - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - */ + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + */ ajaxSetup(options: JQueryAjaxSettings): void; /** @@ -683,13 +683,13 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + get(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP GET request. * * @param settings The JQueryAjaxSettings to be used for the request */ - get(settings : JQueryAjaxSettings): JQueryXHR; + get(settings: JQueryAjaxSettings): JQueryXHR; /** * Load JSON-encoded data from the server using a GET HTTP request. * @@ -704,7 +704,7 @@ interface JQueryStatic { * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + getJSON(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** * Load a JavaScript file from the server using a GET HTTP request, then execute it. * @@ -734,13 +734,13 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + post(url: string, data?: Object | string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load data from the server using a HTTP POST request. * * @param settings The JQueryAjaxSettings to be used for the request */ - post(settings : JQueryAjaxSettings): JQueryXHR; + post(settings: JQueryAjaxSettings): JQueryXHR; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. * @@ -761,7 +761,7 @@ interface JQueryStatic { * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context */ - (selector: string, context?: Element|JQuery): JQuery; + (selector: string, context?: Element | JQuery): JQuery; /** * Accepts a string containing a CSS selector which is then used to match a set of elements. @@ -831,7 +831,7 @@ interface JQueryStatic { * * @param deferreds One or more Deferred objects, or plain JavaScript objects. */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; + when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; /** * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. @@ -987,7 +987,7 @@ interface JQueryStatic { each( collection: T[], callback: (indexInArray: number, valueOfElement: T) => any - ): any; + ): any; /** * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. @@ -998,7 +998,7 @@ interface JQueryStatic { each( collection: any, callback: (indexInArray: any, valueOfElement: any) => any - ): any; + ): any; /** * Merge the contents of two or more objects together into the first object. @@ -1228,7 +1228,7 @@ interface JQuery { * @param data A plain object or string that is sent to the server with the request. * @param complete A callback function that is executed when the request completes. */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; + load(url: string, data?: string | Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; /** * Encode a set of form elements as a string for submission. @@ -1269,14 +1269,14 @@ interface JQuery { * @param attributeName The name of the attribute to set. * @param value A value to set for the attribute. */ - attr(attributeName: string, value: string|number): JQuery; + attr(attributeName: string, value: string | number): JQuery; /** * Set one or more attributes for the set of matched elements. * * @param attributeName The name of the attribute to set. * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; + attr(attributeName: string, func: (index: number, attr: string) => string | number): JQuery; /** * Set one or more attributes for the set of matched elements. * @@ -1325,7 +1325,7 @@ interface JQuery { * @param propertyName The name of the property to set. * @param value A value to set for the property. */ - prop(propertyName: string, value: string|number|boolean): JQuery; + prop(propertyName: string, value: string | number | boolean): JQuery; /** * Set one or more properties for the set of matched elements. * @@ -1397,7 +1397,7 @@ interface JQuery { * * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. */ - val(value: string|string[]|number): JQuery; + val(value: string | string[] | number): JQuery; /** * Set the value of each element in the set of matched elements. * @@ -1418,14 +1418,14 @@ interface JQuery { * @param propertyName A CSS property name. * @param value A value to set for the property. */ - css(propertyName: string, value: string|number): JQuery; + css(propertyName: string, value: string | number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * * @param propertyName A CSS property name. * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; + css(propertyName: string, value: (index: number, value: string) => string | number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * @@ -1442,13 +1442,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). */ - height(value: number|string): JQuery; + height(value: number | string): JQuery; /** * Set the CSS height of every matched element. * * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. */ - height(func: (index: number, height: number) => number|string): JQuery; + height(func: (index: number, height: number) => number | string): JQuery; /** * Get the current computed height for the first element in the set of matched elements, including padding but not border. @@ -1460,7 +1460,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerHeight(height: number|string): JQuery; + innerHeight(height: number | string): JQuery; /** * Get the current computed width for the first element in the set of matched elements, including padding but not border. @@ -1472,7 +1472,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerWidth(width: number|string): JQuery; + innerWidth(width: number | string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. @@ -1503,7 +1503,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerHeight(height: number|string): JQuery; + outerHeight(height: number | string): JQuery; /** * Get the current computed width for the first element in the set of matched elements, including padding and border. @@ -1517,7 +1517,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerWidth(width: number|string): JQuery; + outerWidth(width: number | string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. @@ -1555,13 +1555,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - width(value: number|string): JQuery; + width(value: number | string): JQuery; /** * Set the CSS width of each element in the set of matched elements. * * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. */ - width(func: (index: number, width: number) => number|string): JQuery; + width(func: (index: number, width: number) => number | string): JQuery; /** * Remove from the queue all items that have not yet been run. @@ -1633,7 +1633,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; + animate(properties: Object, duration?: string | number, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1642,7 +1642,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. (default: swing) * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; + animate(properties: Object, duration?: string | number, easing?: string, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1665,7 +1665,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number|string, complete?: Function): JQuery; + fadeIn(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1673,7 +1673,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeIn(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1687,7 +1687,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number|string, complete?: Function): JQuery; + fadeOut(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -1695,7 +1695,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeOut(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -1710,7 +1710,7 @@ interface JQuery { * @param opacity A number between 0 and 1 denoting the target opacity. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; + fadeTo(duration: string | number, opacity: number, complete?: Function): JQuery; /** * Adjust the opacity of the matched elements. * @@ -1719,7 +1719,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; + fadeTo(duration: string | number, opacity: number, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. @@ -1727,7 +1727,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; + fadeToggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -1735,7 +1735,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + fadeToggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -1756,7 +1756,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - hide(duration?: number|string, complete?: Function): JQuery; + hide(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -1764,7 +1764,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; + hide(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -1778,7 +1778,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - show(duration?: number|string, complete?: Function): JQuery; + show(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -1786,7 +1786,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; + show(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -1800,7 +1800,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number|string, complete?: Function): JQuery; + slideDown(duration?: number | string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -1808,7 +1808,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideDown(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -1822,7 +1822,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number|string, complete?: Function): JQuery; + slideToggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -1830,7 +1830,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideToggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -1844,7 +1844,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number|string, complete?: Function): JQuery; + slideUp(duration?: number | string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -1852,7 +1852,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; + slideUp(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -1882,7 +1882,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number|string, complete?: Function): JQuery; + toggle(duration?: number | string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -1890,7 +1890,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; + toggle(duration?: number | string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -2344,7 +2344,7 @@ interface JQuery { * @param data Data to be passed to the handler in event.data when an event is triggered. * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; + on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; /** * Attach an event handler function for one or more events to the selected elements. * @@ -2515,14 +2515,14 @@ interface JQuery { * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; + trigger(eventType: string, extraParameters?: any[] | Object): JQuery; /** * Execute all handlers and behaviors attached to the matched elements for the given event type. * * @param event A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; + trigger(event: JQueryEventObject, extraParameters?: any[] | Object): JQuery; /** * Execute all handlers attached to an element for an event. @@ -2643,13 +2643,13 @@ interface JQuery { * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. */ - after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; + after(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. @@ -2657,20 +2657,20 @@ interface JQuery { * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. */ - append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; + append(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert every element in the set of matched elements to the end of the target. * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. */ - appendTo(target: JQuery|any[]|Element|string): JQuery; + appendTo(target: JQuery | any[] | Element | string): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. @@ -2678,13 +2678,13 @@ interface JQuery { * param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. */ - before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + before(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; + before(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Create a deep copy of the set of matched elements. @@ -2711,14 +2711,14 @@ interface JQuery { * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; + insertAfter(target: JQuery | any[] | Element | Text | string): JQuery; /** * Insert every element in the set of matched elements before the target. * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; + insertBefore(target: JQuery | any[] | Element | Text | string): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. @@ -2726,20 +2726,20 @@ interface JQuery { * param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. */ - prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; + prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. * * param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; + prepend(func: (index: number, html: string) => string | Element | JQuery): JQuery; /** * Insert every element in the set of matched elements to the beginning of the target. * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. */ - prependTo(target: JQuery|any[]|Element|string): JQuery; + prependTo(target: JQuery | any[] | Element | string): JQuery; /** * Remove the set of matched elements from the DOM. @@ -2753,20 +2753,20 @@ interface JQuery { * * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; + replaceAll(target: JQuery | any[] | Element | string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. * * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; + replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. * * param func A function that returns content with which to replace the set of matched elements. */ - replaceWith(func: () => Element|JQuery): JQuery; + replaceWith(func: () => Element | JQuery): JQuery; /** * Get the combined text contents of each element in the set of matched elements, including their descendants. @@ -2777,7 +2777,7 @@ interface JQuery { * * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. */ - text(text: string|number|boolean): JQuery; + text(text: string | number | boolean): JQuery; /** * Set the content of each element in the set of matched elements to the specified text. * @@ -2801,20 +2801,20 @@ interface JQuery { * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrap(wrappingElement: JQuery|Element|string): JQuery; + wrap(wrappingElement: JQuery | Element | string): JQuery; /** * Wrap an HTML structure around each element in the set of matched elements. * * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. */ - wrap(func: (index: number) => string|JQuery): JQuery; + wrap(func: (index: number) => string | JQuery): JQuery; /** * Wrap an HTML structure around all elements in the set of matched elements. * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; + wrapAll(wrappingElement: JQuery | Element | string): JQuery; wrapAll(func: (index: number) => string): JQuery; /** @@ -2822,7 +2822,7 @@ interface JQuery { * * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; + wrapInner(wrappingElement: JQuery | Element | string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. * @@ -2858,7 +2858,7 @@ interface JQuery { * * @param selector A selector representing a jQuery collection in which to look for an element. */ - index(selector: string|JQuery|Element): number; + index(selector: string | JQuery | Element): number; /** * The number of elements in the jQuery object. @@ -3109,7 +3109,7 @@ interface JQuery { * * @param elements One or more DOM elements to remove from the matched set. */ - not(elements: Element|Element[]): JQuery; + not(elements: Element | Element[]): JQuery; /** * Remove elements from the set of matched elements. * @@ -3242,7 +3242,7 @@ interface JQuery { */ queue(queueName: string, callback: Function): JQuery; } -declare module "jquery" { +declare module 'jquery' { export = $; } declare const jQuery: JQueryStatic; From 2141437fdcdf21a45f79c78c14645a8636ab1af2 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:35:07 +0100 Subject: [PATCH 37/47] fix eslint issues in build/gulpfile.* --- build/gulpfile.editor.js | 22 +++++++++++----------- build/gulpfile.reh.js | 2 +- build/gulpfile.vscode.js | 10 +++++----- build/gulpfile.vscode.linux.js | 4 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/build/gulpfile.editor.js b/build/gulpfile.editor.js index 938c82f57beab..7f52fbff35510 100644 --- a/build/gulpfile.editor.js +++ b/build/gulpfile.editor.js @@ -17,14 +17,14 @@ const compilation = require('./lib/compilation'); const monacoapi = require('./monaco/api'); const fs = require('fs'); -var root = path.dirname(__dirname); -var sha1 = util.getVersion(root); -var semver = require('./monaco/package.json').version; -var headerVersion = semver + '(' + sha1 + ')'; +let root = path.dirname(__dirname); +let sha1 = util.getVersion(root); +let semver = require('./monaco/package.json').version; +let headerVersion = semver + '(' + sha1 + ')'; // Build -var editorEntryPoints = [ +let editorEntryPoints = [ { name: 'vs/editor/editor.main', include: [], @@ -40,11 +40,11 @@ var editorEntryPoints = [ } ]; -var editorResources = [ +let editorResources = [ 'out-editor-build/vs/base/browser/ui/codiconLabel/**/*.ttf' ]; -var BUNDLED_FILE_HEADER = [ +let BUNDLED_FILE_HEADER = [ '/*!-----------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', ' * Version: ' + headerVersion, @@ -263,7 +263,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { // package.json gulp.src('build/monaco/package.json') .pipe(es.through(function (data) { - var json = JSON.parse(data.contents.toString()); + let json = JSON.parse(data.contents.toString()); json.private = false; data.contents = Buffer.from(JSON.stringify(json, null, ' ')); this.emit('data', data); @@ -307,10 +307,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => { return; } - var relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); + let relativePathToMap = path.relative(path.join(data.relative), path.join('min-maps', data.relative + '.map')); - var strContents = data.contents.toString(); - var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); + let strContents = data.contents.toString(); + let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/'); strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr); data.contents = Buffer.from(strContents); diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js index a956fba979ef6..f2ea1bd37010b 100644 --- a/build/gulpfile.reh.js +++ b/build/gulpfile.reh.js @@ -118,7 +118,7 @@ function mixinServer(watch) { const packageJSONPath = path.join(path.dirname(__dirname), 'package.json'); function exec(cmdLine) { console.log(cmdLine); - cp.execSync(cmdLine, { stdio: "inherit" }); + cp.execSync(cmdLine, { stdio: 'inherit' }); } function checkout() { const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString()); diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js index bb504fc09e970..4906bfdb1a24c 100644 --- a/build/gulpfile.vscode.js +++ b/build/gulpfile.vscode.js @@ -121,9 +121,9 @@ gulp.task(minifyVSCodeTask); * @return {Object} A map of paths to checksums. */ function computeChecksums(out, filenames) { - var result = {}; + let result = {}; filenames.forEach(function (filename) { - var fullPath = path.join(process.cwd(), out, filename); + let fullPath = path.join(process.cwd(), out, filename); result[filename] = computeChecksum(fullPath); }); return result; @@ -136,9 +136,9 @@ function computeChecksums(out, filenames) { * @return {string} The checksum for `filename`. */ function computeChecksum(filename) { - var contents = fs.readFileSync(filename); + let contents = fs.readFileSync(filename); - var hash = crypto + let hash = crypto .createHash('md5') .update(contents) .digest('base64') @@ -428,7 +428,7 @@ gulp.task('vscode-translations-pull', function () { }); gulp.task('vscode-translations-import', function () { - var options = minimist(process.argv.slice(2), { + let options = minimist(process.argv.slice(2), { string: 'location', default: { location: '../vscode-translations-import' diff --git a/build/gulpfile.vscode.linux.js b/build/gulpfile.vscode.linux.js index 9d3a7caa07e68..51c7002f5b12c 100644 --- a/build/gulpfile.vscode.linux.js +++ b/build/gulpfile.vscode.linux.js @@ -23,7 +23,7 @@ const commit = util.getVersion(root); const linuxPackageRevision = Math.floor(new Date().getTime() / 1000); function getDebPackageArch(arch) { - return { x64: 'amd64', arm: 'armhf', arm64: "arm64" }[arch]; + return { x64: 'amd64', arm: 'armhf', arm64: 'arm64' }[arch]; } function prepareDebPackage(arch) { @@ -117,7 +117,7 @@ function getRpmBuildPath(rpmArch) { } function getRpmPackageArch(arch) { - return { x64: 'x86_64', arm: 'armhf', arm64: "arm64" }[arch]; + return { x64: 'x86_64', arm: 'armhf', arm64: 'arm64' }[arch]; } function prepareRpmPackage(arch) { From 80e6e42a7e6f93294a705144344ed08d9e777332 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:43:58 +0100 Subject: [PATCH 38/47] adjust rule to allow double quotes for "use strict" and other directives --- build/lib/eslint/code-no-unexternalized-strings.js | 1 + build/lib/eslint/code-no-unexternalized-strings.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/build/lib/eslint/code-no-unexternalized-strings.js b/build/lib/eslint/code-no-unexternalized-strings.js index 1039890996c00..d1f2ffef6dc74 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.js +++ b/build/lib/eslint/code-no-unexternalized-strings.js @@ -100,6 +100,7 @@ module.exports = new (_a = class NoUnexternalizedStrings { } return { ['Literal']: (node) => collectDoubleQuotedStrings(node), + ['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node), ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node) => visitLocalizeCall(node), ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node) => visitLocalizeCall(node), ['Program:exit']: reportBadStringsAndBadKeys, diff --git a/build/lib/eslint/code-no-unexternalized-strings.ts b/build/lib/eslint/code-no-unexternalized-strings.ts index b7a35d6471fc5..390500ed4ae02 100644 --- a/build/lib/eslint/code-no-unexternalized-strings.ts +++ b/build/lib/eslint/code-no-unexternalized-strings.ts @@ -116,6 +116,7 @@ export = new class NoUnexternalizedStrings implements eslint.Rule.RuleModule { return { ['Literal']: (node: any) => collectDoubleQuotedStrings(node), + ['ExpressionStatement[directive] Literal:exit']: (node: any) => doubleQuotedStringLiterals.delete(node), ['CallExpression[callee.type="MemberExpression"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node), ['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node), ['Program:exit']: reportBadStringsAndBadKeys, From 2a71a96cd4cf7c6a9fe3a9ccbe6de09a0c8939c6 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 20:44:53 +0100 Subject: [PATCH 39/47] also disable tslint for build-folder --- build/tslint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/tslint.json b/build/tslint.json index 15275279139de..c826ba6e30443 100644 --- a/build/tslint.json +++ b/build/tslint.json @@ -10,5 +10,5 @@ ], "triple-equals": true }, - "defaultSeverity": "warning" -} \ No newline at end of file + "defaultSeverity": "off" +} From d18119e28814aa2555f4626f3e5a52db4ba1734d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 21:00:27 +0100 Subject: [PATCH 40/47] enable jsdoc/no-types rule for TS files --- .eslintrc.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 0a7fb5ca8b633..bc2ea02886251 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -28,7 +28,7 @@ "no-unused-expressions": "off", "no-unused-labels": "warn", "no-var": "warn", - "jsdoc/no-types": "off", + "jsdoc/no-types": "warn", "semi": "off", "@typescript-eslint/semi": "warn", "@typescript-eslint/class-name-casing": "warn", @@ -607,5 +607,15 @@ "restrictions": "**/vs/**" } ] - } + }, + "overrides": [ + { + "files": [ + "*.js" + ], + "rules": { + "jsdoc/no-types": "off" + } + } + ] } From 12eb715644f428a65f685ccda30e6d847a545a50 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Thu, 2 Jan 2020 21:12:03 +0100 Subject: [PATCH 41/47] (re)enable no-extra-semi rule --- .eslintrc.json | 2 +- extensions/vscode-colorize-tests/src/colorizer.test.ts | 2 +- .../test/electron-browser/api/extHostDiagnostics.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index bc2ea02886251..350c475103382 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -19,7 +19,7 @@ "no-duplicate-case": "warn", "no-duplicate-imports": "warn", "no-eval": "warn", - "no-extra-semi": "off", + "no-extra-semi": "warn", "no-new-wrappers": "warn", "no-redeclare": "off", "no-sparse-arrays": "warn", diff --git a/extensions/vscode-colorize-tests/src/colorizer.test.ts b/extensions/vscode-colorize-tests/src/colorizer.test.ts index 82892577bdfa2..28a992573b9cd 100644 --- a/extensions/vscode-colorize-tests/src/colorizer.test.ts +++ b/extensions/vscode-colorize-tests/src/colorizer.test.ts @@ -56,7 +56,7 @@ function hasThemeChange(d: any, p: any) : boolean { } } return false; -}; +} suite('colorization', () => { let extensionsFolder = normalize(join(__dirname, '../../')); diff --git a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts index 374f21e78d00f..6a1852d89905f 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts @@ -34,7 +34,7 @@ suite('ExtHostDiagnostics', () => { assert.throws(() => collection.clear()); assert.throws(() => collection.delete(URI.parse('aa:bb'))); // tslint:disable-next-line:semicolon - assert.throws(() => collection.forEach(() => { ; })); + assert.throws(() => collection.forEach(() => { })); assert.throws(() => collection.get(URI.parse('aa:bb'))); assert.throws(() => collection.has(URI.parse('aa:bb'))); assert.throws(() => collection.set(URI.parse('aa:bb'), [])); From 769bbe2dde2618d63892fb83e6dcf3141b98f3a5 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 08:05:23 +0100 Subject: [PATCH 42/47] remove tslint.json files --- build/tslint.json | 14 -- tslint.json | 619 ---------------------------------------------- 2 files changed, 633 deletions(-) delete mode 100644 build/tslint.json delete mode 100644 tslint.json diff --git a/build/tslint.json b/build/tslint.json deleted file mode 100644 index c826ba6e30443..0000000000000 --- a/build/tslint.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "rules": { - "no-unused-expression": true, - "no-duplicate-variable": true, - "curly": true, - "class-name": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": true - }, - "defaultSeverity": "off" -} diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 4083adf49b05c..0000000000000 --- a/tslint.json +++ /dev/null @@ -1,619 +0,0 @@ -{ - "rulesDirectory": [ - "build/lib/tslint" - ], - "rules": { - "no-arg": true, - "no-construct": true, - "no-debugger": true, - "no-duplicate-super": true, - "no-duplicate-switch-case": true, - "no-duplicate-variable": true, - "no-for-in-array": true, - "no-eval": true, - "no-redundant-jsdoc": true, - "no-restricted-globals": true, - "no-sparse-arrays": true, - "no-string-throw": true, - "no-unsafe-finally": true, - "no-unused-expression": true, - "no-var-keyword": true, - "number-literal-format": true, - "curly": true, - "class-name": true, - "label-position": true, - "semicolon": [ - true, - "always" - ], - "triple-equals": true, - "no-unexternalized-strings": [ - true, - { - "signatures": [ - "localize", - "nls.localize" - ], - "keyIndex": 0, - "messageIndex": 1 - } - ], - "layering": [ - true, - { - "common": [], - "node": [ - "common" - ], - "browser": [ - "common" - ], - "electron-main": [ - "common", - "node" - ], - "electron-browser": [ - "common", - "browser", - "node" - ] - } - ], - "import-patterns": [ - true, - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // !!! Do not relax these rules !!! - // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - { - "target": "**/vs/base/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**" - ] - }, - { - "target": "**/vs/base/test/common/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/common/**", - "**/vs/base/test/common/**" - ] - }, - { - "target": "**/vs/base/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**" - ] - }, - { - "target": "**/vs/base/node/**", - "restrictions": [ - "vs/nls", - "**/vs/base/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - // vs/base/test/browser contains tests for vs/base/browser - "target": "**/vs/base/test/browser/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/{common,browser}/**", - "**/vs/base/test/{common,browser}/**" - ] - }, - { - "target": "**/vs/base/parts/*/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**", - "**/vs/base/parts/*/common/**" - ] - }, - { - "target": "**/vs/base/parts/*/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**" - ] - }, - { - "target": "**/vs/base/parts/*/node/**", - "restrictions": [ - "vs/nls", - "**/vs/base/{common,node}/**", - "**/vs/base/parts/*/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/base/parts/*/electron-browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser,node,electron-browser}/**", - "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/base/parts/*/electron-main/**", - "restrictions": [ - "vs/nls", - "**/vs/base/{common,node,electron-main}/**", - "**/vs/base/parts/*/{common,node,electron-main}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/platform/*/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**", - "**/vs/base/parts/*/common/**", - "**/vs/platform/*/common/**" - ] - }, - { - "target": "**/vs/platform/*/test/common/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/common/**", - "**/vs/platform/*/common/**", - "**/vs/platform/*/test/common/**" - ] - }, - { - "target": "**/vs/platform/*/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**" - ] - }, - { - "target": "**/vs/platform/*/node/**", - "restrictions": [ - "vs/nls", - "**/vs/base/{common,node}/**", - "**/vs/base/parts/*/{common,node}/**", - "**/vs/platform/*/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/platform/*/electron-browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser,node}/**", - "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", - "**/vs/platform/*/{common,browser,node,electron-browser}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/platform/*/electron-main/**", - "restrictions": [ - "vs/nls", - "**/vs/base/{common,node,electron-main}/**", - "**/vs/base/parts/*/{common,node,electron-main}/**", - "**/vs/platform/*/{common,node,electron-main}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/platform/*/test/browser/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/platform/*/test/{common,browser}/**" - ] - }, - { - "target": "**/vs/editor/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**", - "**/vs/base/worker/**", - "**/vs/platform/*/common/**", - "**/vs/editor/common/**" - ] - }, - { - "target": "**/vs/editor/test/common/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/common/**", - "**/vs/platform/*/common/**", - "**/vs/platform/*/test/common/**", - "**/vs/editor/common/**", - "**/vs/editor/test/common/**" - ] - }, - { - "target": "**/vs/editor/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/editor/{common,browser}/**" - ] - }, - { - "target": "**/vs/editor/test/browser/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/platform/*/test/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/test/{common,browser}/**" - ] - }, - { - "target": "**/vs/editor/standalone/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**", - "**/vs/platform/*/common/**", - "**/vs/editor/common/**", - "**/vs/editor/standalone/common/**" - ] - }, - { - "target": "**/vs/editor/standalone/test/common/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/common/**", - "**/vs/platform/*/common/**", - "**/vs/platform/*/test/common/**", - "**/vs/editor/common/**", - "**/vs/editor/test/common/**" - ] - }, - { - "target": "**/vs/editor/standalone/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/contrib/**", - "**/vs/editor/standalone/{common,browser}/**" - ] - }, - { - "target": "**/vs/editor/standalone/test/browser/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/platform/*/test/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/standalone/{common,browser}/**", - "**/vs/editor/test/{common,browser}/**" - ] - }, - { - "target": "**/vs/editor/contrib/*/test/**", - "restrictions": [ - "assert", - "sinon", - "vs/nls", - "**/vs/base/{common,browser}/**", - "**/vs/base/test/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/platform/*/test/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/test/{common,browser}/**", - "**/vs/editor/contrib/**" - ] - }, - { - "target": "**/vs/editor/contrib/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**", - "**/vs/platform/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/contrib/**" - ] - }, - { - "target": "**/vs/workbench/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/common/**", - "**/vs/base/parts/*/common/**", - "**/vs/platform/*/common/**", - "**/vs/editor/common/**", - "**/vs/editor/contrib/*/common/**", - "**/vs/workbench/common/**", - "**/vs/workbench/services/*/common/**", - "assert" - ] - }, - { - "target": "**/vs/workbench/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser}/**", - "**/vs/base/parts/*/{common,browser}/**", - "**/vs/platform/*/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention - "**/vs/workbench/workbench.web.api", - "**/vs/workbench/{common,browser}/**", - "**/vs/workbench/services/*/{common,browser}/**", - "assert" - ] - }, - { - "target": "**/vs/workbench/workbench.desktop.main.ts", - "restrictions": [ - "**" - ] - }, - { - "target": "**/vs/workbench/api/common/**", - "restrictions": [ - "vscode", - "vs/nls", - "**/vs/base/common/**", - "**/vs/platform/*/common/**", - "**/vs/editor/common/**", - "**/vs/editor/contrib/*/common/**", - "**/vs/workbench/api/common/**", - "**/vs/workbench/common/**", - "**/vs/workbench/services/*/common/**", - "**/vs/workbench/contrib/*/common/**" - ] - }, - { - "target": "**/vs/workbench/api/worker/**", - "restrictions": [ - "vscode", - "vs/nls", - "**/vs/**/{common,worker}/**" - ] - }, - { - "target": "**/vs/workbench/electron-browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/{common,browser,node,electron-browser}/**", - "**/vs/base/parts/*/{common,browser,node,electron-browser}/**", - "**/vs/platform/*/{common,browser,node,electron-browser}/**", - "**/vs/editor/{common,browser,node,electron-browser}/**", - "**/vs/editor/contrib/**", // editor/contrib is equivalent to /browser/ by convention - "**/vs/workbench/{common,browser,node,electron-browser,api}/**", - "**/vs/workbench/services/*/{common,browser,node,electron-browser}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/workbench/services/**/test/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/**", - "**/vs/platform/**", - "**/vs/editor/**", - "**/vs/workbench/{common,browser,node,electron-browser}/**", - "vs/workbench/contrib/files/common/editors/fileEditorInput", - "**/vs/workbench/services/**", - "**/vs/workbench/test/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/workbench/services/**/common/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/common/**", - "**/vs/platform/**/common/**", - "**/vs/editor/common/**", - "**/vs/workbench/workbench.web.api", - "**/vs/workbench/common/**", - "**/vs/workbench/services/**/common/**", - "**/vs/workbench/api/**/common/**", - "vscode-textmate" - ] - }, - { - "target": "**/vs/workbench/services/**/worker/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/common/**", - "**/vs/platform/**/common/**", - "**/vs/editor/common/**", - "**/vs/workbench/**/common/**", - "**/vs/workbench/**/worker/**", - "**/vs/workbench/services/**/common/**", - "vscode" - ] - }, - { - "target": "**/vs/workbench/services/**/browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/**/{common,browser,worker}/**", - "**/vs/platform/**/{common,browser}/**", - "**/vs/editor/{common,browser}/**", - "**/vs/workbench/workbench.web.api", - "**/vs/workbench/{common,browser}/**", - "**/vs/workbench/api/{common,browser}/**", - "**/vs/workbench/services/**/{common,browser}/**", - "vscode-textmate", - "onigasm-umd" - ] - }, - { - "target": "**/vs/workbench/services/**/node/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/{common,node}/**", - "**/vs/platform/**/{common,node}/**", - "**/vs/editor/{common,node}/**", - "**/vs/workbench/{common,node}/**", - "**/vs/workbench/api/{common,node}/**", - "**/vs/workbench/services/**/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/workbench/services/**/electron-browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/**/{common,browser,worker,node,electron-browser}/**", - "**/vs/platform/**/{common,browser,node,electron-browser}/**", - "**/vs/editor/**", - "**/vs/workbench/{common,browser,node,electron-browser,api}/**", - "**/vs/workbench/services/**/{common,browser,node,electron-browser}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/workbench/contrib/terminal/browser/**", - "restrictions": [ - // xterm and its addons are strictly browser-only components - "xterm", - "xterm-addon-*", - "**/vs/**" - ] - }, - { - "target": "**/vs/workbench/contrib/extensions/browser/**", - "restrictions": [ - "semver-umd", - "**/vs/**" - ] - }, - { - "target": "**/vs/workbench/contrib/update/browser/update.ts", - "restrictions": [ - "semver-umd", - "**/vs/**" - ] - }, - { - "target": "**/vs/code/node/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/{common,node}/**", - "**/vs/base/parts/**/{common,node}/**", - "**/vs/platform/**/{common,node}/**", - "**/vs/code/**/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/code/electron-browser/**", - "restrictions": [ - "vs/nls", - "vs/css!./**/*", - "**/vs/base/**/{common,browser,node,electron-browser}/**", - "**/vs/base/parts/**/{common,browser,node,electron-browser}/**", - "**/vs/platform/**/{common,browser,node,electron-browser}/**", - "**/vs/code/**/{common,browser,node,electron-browser}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/code/electron-main/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/{common,node,electron-main}/**", - "**/vs/base/parts/**/{common,node,electron-main}/**", - "**/vs/platform/**/{common,node,electron-main}/**", - "**/vs/code/**/{common,node,electron-main}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/vs/server/**", - "restrictions": [ - "vs/nls", - "**/vs/base/**/{common,node}/**", - "**/vs/base/parts/**/{common,node}/**", - "**/vs/platform/**/{common,node}/**", - "**/vs/workbench/**/{common,node}/**", - "**/vs/server/**", - "**/vs/code/**/{common,node}/**", - "!path" // node modules (except path where we have our own impl) - ] - }, - { - "target": "**/{node,electron-browser,electron-main}/**", - "restrictions": "**/*" - }, - { - "target": "**/extensions/**", - "restrictions": "**/*" - }, - { - "target": "**/test/smoke/**", - "restrictions": [ - "**/test/smoke/**", - "*" - ] - }, - { - "target": "**/test/automation/**", - "restrictions": [ - "**/test/automation/**", - "*" - ] - }, - { - "target": "{**/**.test.ts,**/test/**}", - "restrictions": "{**/vs/**,assert,sinon,crypto}" - }, - { - "target": "**/{common,browser,workbench}/**", - "restrictions": "**/vs/**" - } - ], - "duplicate-imports": true, - "no-new-buffer": true, - "translation-remind": true, - "no-standalone-editor": true, - "no-nls-in-standalone-editor": true - }, - "defaultSeverity": "off" -} From 09ee89ca874958b04c695691c832970c317c5175 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 08:14:23 +0100 Subject: [PATCH 43/47] remove more unused tslint directives --- extensions/typescript-language-features/src/extension.ts | 1 - src/vs/editor/contrib/find/findWidget.ts | 1 - src/vs/platform/contextkey/test/common/contextkey.test.ts | 2 -- .../contrib/codeActions/common/codeActions.contribution.ts | 1 - .../contrib/codeEditor/browser/find/simpleFindWidget.ts | 1 - src/vs/workbench/contrib/search/browser/searchWidget.ts | 1 - .../test/electron-browser/api/extHostDiagnostics.test.ts | 1 - .../electron-browser/api/mainThreadDocumentsAndEditors.test.ts | 2 -- 8 files changed, 10 deletions(-) diff --git a/extensions/typescript-language-features/src/extension.ts b/extensions/typescript-language-features/src/extension.ts index ffa61f231f1be..a7493570f1bce 100644 --- a/extensions/typescript-language-features/src/extension.ts +++ b/extensions/typescript-language-features/src/extension.ts @@ -99,7 +99,6 @@ function lazilyActivateClient( if (!hasActivated && isSupportedDocument(supportedLanguage, textDocument)) { hasActivated = true; // Force activation - // tslint:disable-next-line:no-unused-expression void lazyClientHost.value; disposables.push(new ManagedFileContextManager(resource => { diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index d2f904129a9b5..8cf2da8896c2e 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -908,7 +908,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return null; } try { - /* tslint:disable-next-line:no-unused-expression */ new RegExp(value); return null; } catch (e) { diff --git a/src/vs/platform/contextkey/test/common/contextkey.test.ts b/src/vs/platform/contextkey/test/common/contextkey.test.ts index c1748e10ea09b..72929eff4289b 100644 --- a/src/vs/platform/contextkey/test/common/contextkey.test.ts +++ b/src/vs/platform/contextkey/test/common/contextkey.test.ts @@ -57,7 +57,6 @@ suite('ContextKeyExpr', () => { }); test('evaluate', () => { - /* tslint:disable:triple-equals */ let context = createContext({ 'a': true, 'b': false, @@ -94,7 +93,6 @@ suite('ContextKeyExpr', () => { testExpression('a && b', true && false); testExpression('a && !b && c == 5', true && !false && '5' === '5'); testExpression('d =~ /e.*/', false); - /* tslint:enable:triple-equals */ // precedence test: false && true || true === true because && is evaluated first testExpression('b && a || a', true); diff --git a/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts b/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts index 94cab6e33d557..ddf83c61dc77c 100644 --- a/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts +++ b/src/vs/workbench/contrib/codeActions/common/codeActions.contribution.ts @@ -21,7 +21,6 @@ class WorkbenchContribution { constructor( @IKeybindingService keybindingsService: IKeybindingService, ) { - // tslint:disable-next-line: no-unused-expression new CodeActionWorkbenchContribution(codeActionsExtensionPoint, keybindingsService); } } diff --git a/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts b/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts index fbbf29cc24e71..5e58e2ef15563 100644 --- a/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts +++ b/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts @@ -54,7 +54,6 @@ export abstract class SimpleFindWidget extends Widget { return null; } try { - /* tslint:disable-next-line:no-unused-expression */ new RegExp(value); return null; } catch (e) { diff --git a/src/vs/workbench/contrib/search/browser/searchWidget.ts b/src/vs/workbench/contrib/search/browser/searchWidget.ts index 21c0ecebd20d2..77defd9110c5c 100644 --- a/src/vs/workbench/contrib/search/browser/searchWidget.ts +++ b/src/vs/workbench/contrib/search/browser/searchWidget.ts @@ -439,7 +439,6 @@ export class SearchWidget extends Widget { return null; } try { - // tslint:disable-next-line: no-unused-expression new RegExp(value, 'u'); } catch (e) { return { content: e.message }; diff --git a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts index 6a1852d89905f..1a3f95ea4c3da 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts @@ -33,7 +33,6 @@ suite('ExtHostDiagnostics', () => { assert.throws(() => collection.name); assert.throws(() => collection.clear()); assert.throws(() => collection.delete(URI.parse('aa:bb'))); - // tslint:disable-next-line:semicolon assert.throws(() => collection.forEach(() => { })); assert.throws(() => collection.get(URI.parse('aa:bb'))); assert.throws(() => collection.has(URI.parse('aa:bb'))); diff --git a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts index 0703fb2ac5933..78c73141ae01f 100644 --- a/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts +++ b/src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts @@ -61,7 +61,6 @@ suite('MainThreadDocumentsAndEditors', () => { onAfterOperation = Event.None; }; - /* tslint:disable */ new MainThreadDocumentsAndEditors( SingleProxyRPCProtocol(new class extends mock() { $acceptDocumentsAndEditorsDelta(delta: IDocumentsAndEditorsDelta) { deltas.push(delta); } @@ -86,7 +85,6 @@ suite('MainThreadDocumentsAndEditors', () => { }, TestEnvironmentService ); - /* tslint:enable */ }); From 37b071f4390f376198d317f1bd432a5c83fab51d Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 08:59:50 +0100 Subject: [PATCH 44/47] remove custom tslint rules --- build/lib/tslint/duplicateImportsRule.js | 32 --- build/lib/tslint/duplicateImportsRule.ts | 40 ---- build/lib/tslint/importPatternsRule.js | 70 ------ build/lib/tslint/importPatternsRule.ts | 87 ------- build/lib/tslint/layeringRule.js | 83 ------- build/lib/tslint/layeringRule.ts | 105 --------- build/lib/tslint/noNewBufferRule.js | 22 -- build/lib/tslint/noNewBufferRule.ts | 23 -- .../lib/tslint/noNlsInStandaloneEditorRule.js | 54 ----- .../lib/tslint/noNlsInStandaloneEditorRule.ts | 67 ------ build/lib/tslint/noStandaloneEditorRule.js | 55 ----- build/lib/tslint/noStandaloneEditorRule.ts | 65 ----- .../lib/tslint/noUnexternalizedStringsRule.js | 183 --------------- .../lib/tslint/noUnexternalizedStringsRule.ts | 222 ------------------ build/lib/tslint/translationRemindRule.js | 62 ----- build/lib/tslint/translationRemindRule.ts | 73 ------ 16 files changed, 1243 deletions(-) delete mode 100644 build/lib/tslint/duplicateImportsRule.js delete mode 100644 build/lib/tslint/duplicateImportsRule.ts delete mode 100644 build/lib/tslint/importPatternsRule.js delete mode 100644 build/lib/tslint/importPatternsRule.ts delete mode 100644 build/lib/tslint/layeringRule.js delete mode 100644 build/lib/tslint/layeringRule.ts delete mode 100644 build/lib/tslint/noNewBufferRule.js delete mode 100644 build/lib/tslint/noNewBufferRule.ts delete mode 100644 build/lib/tslint/noNlsInStandaloneEditorRule.js delete mode 100644 build/lib/tslint/noNlsInStandaloneEditorRule.ts delete mode 100644 build/lib/tslint/noStandaloneEditorRule.js delete mode 100644 build/lib/tslint/noStandaloneEditorRule.ts delete mode 100644 build/lib/tslint/noUnexternalizedStringsRule.js delete mode 100644 build/lib/tslint/noUnexternalizedStringsRule.ts delete mode 100644 build/lib/tslint/translationRemindRule.js delete mode 100644 build/lib/tslint/translationRemindRule.ts diff --git a/build/lib/tslint/duplicateImportsRule.js b/build/lib/tslint/duplicateImportsRule.js deleted file mode 100644 index f336095fc6a20..0000000000000 --- a/build/lib/tslint/duplicateImportsRule.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const path_1 = require("path"); -const Lint = require("tslint"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class ImportPatterns extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - this.imports = Object.create(null); - } - visitImportDeclaration(node) { - let path = node.moduleSpecifier.getText(); - // remove quotes - path = path.slice(1, -1); - if (path[0] === '.') { - path = path_1.join(path_1.dirname(node.getSourceFile().fileName), path); - } - if (this.imports[path]) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Duplicate imports for '${path}'.`)); - } - this.imports[path] = true; - } -} diff --git a/build/lib/tslint/duplicateImportsRule.ts b/build/lib/tslint/duplicateImportsRule.ts deleted file mode 100644 index c648084be1db0..0000000000000 --- a/build/lib/tslint/duplicateImportsRule.ts +++ /dev/null @@ -1,40 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import { join, dirname } from 'path'; -import * as Lint from 'tslint'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions())); - } -} - -class ImportPatterns extends Lint.RuleWalker { - - private imports: { [path: string]: boolean; } = Object.create(null); - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - let path = node.moduleSpecifier.getText(); - - // remove quotes - path = path.slice(1, -1); - - if (path[0] === '.') { - path = join(dirname(node.getSourceFile().fileName), path); - } - - if (this.imports[path]) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Duplicate imports for '${path}'.`)); - } - - this.imports[path] = true; - } -} diff --git a/build/lib/tslint/importPatternsRule.js b/build/lib/tslint/importPatternsRule.js deleted file mode 100644 index a64f5a6967877..0000000000000 --- a/build/lib/tslint/importPatternsRule.js +++ /dev/null @@ -1,70 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const minimatch = require("minimatch"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - const configs = this.getOptions().ruleArguments; - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions(), config)); - } - } - return []; - } -} -exports.Rule = Rule; -class ImportPatterns extends Lint.RuleWalker { - constructor(file, opts, _config) { - super(file, opts); - this._config = _config; - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - let restrictions; - if (typeof this._config.restrictions === 'string') { - restrictions = [this._config.restrictions]; - } - else { - restrictions = this._config.restrictions; - } - let matched = false; - for (const pattern of restrictions) { - if (minimatch(path, pattern)) { - matched = true; - break; - } - } - if (!matched) { - // None of the restrictions matched - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Imports violates '${restrictions.join(' or ')}' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/importPatternsRule.ts b/build/lib/tslint/importPatternsRule.ts deleted file mode 100644 index 6e545a6be1605..0000000000000 --- a/build/lib/tslint/importPatternsRule.ts +++ /dev/null @@ -1,87 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as minimatch from 'minimatch'; -import { join } from 'path'; - -interface ImportPatternsConfig { - target: string; - restrictions: string | string[]; -} - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - - const configs = this.getOptions().ruleArguments; - - - for (const config of configs) { - if (minimatch(sourceFile.fileName, config.target)) { - return this.applyWithWalker(new ImportPatterns(sourceFile, this.getOptions(), config)); - } - } - - return []; - } -} - -class ImportPatterns extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions, private _config: ImportPatternsConfig) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - let restrictions: string[]; - if (typeof this._config.restrictions === 'string') { - restrictions = [this._config.restrictions]; - } else { - restrictions = this._config.restrictions; - } - - let matched = false; - for (const pattern of restrictions) { - if (minimatch(path, pattern)) { - matched = true; - break; - } - } - - if (!matched) { - // None of the restrictions matched - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Imports violates '${restrictions.join(' or ')}' restrictions. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/layeringRule.js b/build/lib/tslint/layeringRule.js deleted file mode 100644 index 21a7c9a16d947..0000000000000 --- a/build/lib/tslint/layeringRule.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - const parts = path_1.dirname(sourceFile.fileName).split(/\\|\//); - const ruleArgs = this.getOptions().ruleArguments[0]; - let config; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config.allowed.has(key)) { - config.disallowed.add(key); - } - }); - break; - } - } - if (!config) { - return []; - } - return this.applyWithWalker(new LayeringRule(sourceFile, config, this.getOptions())); - } -} -exports.Rule = Rule; -class LayeringRule extends Lint.RuleWalker { - constructor(file, config, opts) { - super(file, opts); - this._config = config; - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - if (path[0] === '.') { - path = path_1.join(path_1.dirname(node.getSourceFile().fileName), path); - } - const parts = path_1.dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - if (this._config.allowed.has(part)) { - // GOOD - same layer - return; - } - if (this._config.disallowed.has(part)) { - // BAD - wrong layer - const message = `Bad layering. You are not allowed to access '${part}' from here, allowed layers are: [${LayeringRule._print(this._config.allowed)}]`; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), message)); - return; - } - } - } - static _print(set) { - const r = []; - set.forEach(e => r.push(e)); - return r.join(', '); - } -} diff --git a/build/lib/tslint/layeringRule.ts b/build/lib/tslint/layeringRule.ts deleted file mode 100644 index dc0053fe8de17..0000000000000 --- a/build/lib/tslint/layeringRule.ts +++ /dev/null @@ -1,105 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join, dirname } from 'path'; - -interface Config { - allowed: Set; - disallowed: Set; -} - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - - const parts = dirname(sourceFile.fileName).split(/\\|\//); - const ruleArgs = this.getOptions().ruleArguments[0]; - - let config: Config | undefined; - for (let i = parts.length - 1; i >= 0; i--) { - if (ruleArgs[parts[i]]) { - config = { - allowed: new Set(ruleArgs[parts[i]]).add(parts[i]), - disallowed: new Set() - }; - Object.keys(ruleArgs).forEach(key => { - if (!config!.allowed.has(key)) { - config!.disallowed.add(key); - } - }); - break; - } - } - - if (!config) { - return []; - } - - return this.applyWithWalker(new LayeringRule(sourceFile, config, this.getOptions())); - } -} - -class LayeringRule extends Lint.RuleWalker { - - private _config: Config; - - constructor(file: ts.SourceFile, config: Config, opts: Lint.IOptions) { - super(file, opts); - this._config = config; - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - if (path[0] === '.') { - path = join(dirname(node.getSourceFile().fileName), path); - } - - const parts = dirname(path).split(/\\|\//); - for (let i = parts.length - 1; i >= 0; i--) { - const part = parts[i]; - - if (this._config.allowed.has(part)) { - // GOOD - same layer - return; - } - - if (this._config.disallowed.has(part)) { - // BAD - wrong layer - const message = `Bad layering. You are not allowed to access '${part}' from here, allowed layers are: [${LayeringRule._print(this._config.allowed)}]`; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), message)); - return; - } - } - } - - static _print(set: Set): string { - const r: string[] = []; - set.forEach(e => r.push(e)); - return r.join(', '); - } -} diff --git a/build/lib/tslint/noNewBufferRule.js b/build/lib/tslint/noNewBufferRule.js deleted file mode 100644 index ae9b02d457ec4..0000000000000 --- a/build/lib/tslint/noNewBufferRule.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new NewBufferRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class NewBufferRuleWalker extends Lint.RuleWalker { - visitNewExpression(node) { - if (node.expression.kind === ts.SyntaxKind.Identifier && node.expression && node.expression.text === 'Buffer') { - this.addFailureAtNode(node, '`new Buffer` is deprecated. Consider Buffer.From or Buffer.alloc instead.'); - } - super.visitNewExpression(node); - } -} diff --git a/build/lib/tslint/noNewBufferRule.ts b/build/lib/tslint/noNewBufferRule.ts deleted file mode 100644 index 7b0dd43e5383a..0000000000000 --- a/build/lib/tslint/noNewBufferRule.ts +++ /dev/null @@ -1,23 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -export class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new NewBufferRuleWalker(sourceFile, this.getOptions())); - } -} - -class NewBufferRuleWalker extends Lint.RuleWalker { - visitNewExpression(node: ts.NewExpression) { - if (node.expression.kind === ts.SyntaxKind.Identifier && node.expression && (node.expression as ts.Identifier).text === 'Buffer') { - this.addFailureAtNode(node, '`new Buffer` is deprecated. Consider Buffer.From or Buffer.alloc instead.'); - } - - super.visitNewExpression(node); - } -} \ No newline at end of file diff --git a/build/lib/tslint/noNlsInStandaloneEditorRule.js b/build/lib/tslint/noNlsInStandaloneEditorRule.js deleted file mode 100644 index affd4cc837034..0000000000000 --- a/build/lib/tslint/noNlsInStandaloneEditorRule.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName)) { - return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } - return []; - } -} -exports.Rule = Rule; -class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - if (/vs(\/|\\)nls/.test(path)) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`)); - } - } -} diff --git a/build/lib/tslint/noNlsInStandaloneEditorRule.ts b/build/lib/tslint/noNlsInStandaloneEditorRule.ts deleted file mode 100644 index ae23d74d784d5..0000000000000 --- a/build/lib/tslint/noNlsInStandaloneEditorRule.ts +++ /dev/null @@ -1,67 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join } from 'path'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if ( - /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(sourceFile.fileName) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(sourceFile.fileName) - ) { - return this.applyWithWalker(new NoNlsInStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } - - return []; - } -} - -class NoNlsInStandaloneEditorRuleWalker extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - if ( - /vs(\/|\\)nls/.test(path) - ) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import vs/nls in standalone editor modules. Use standaloneStrings.ts`)); - } - } -} diff --git a/build/lib/tslint/noStandaloneEditorRule.js b/build/lib/tslint/noStandaloneEditorRule.js deleted file mode 100644 index 44b70a6a8d7bb..0000000000000 --- a/build/lib/tslint/noStandaloneEditorRule.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -const path_1 = require("path"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/vs(\/|\\)editor/.test(sourceFile.fileName)) { - // the vs/editor folder is allowed to use the standalone editor - return []; - } - return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class NoStandaloneEditorRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportEqualsDeclaration(node) { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - visitImportDeclaration(node) { - this._validateImport(node.moduleSpecifier.getText(), node); - } - visitCallExpression(node) { - super.visitCallExpression(node); - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - _validateImport(path, node) { - // remove quotes - path = path.slice(1, -1); - // resolve relative paths - if (path[0] === '.') { - path = path_1.join(this.getSourceFile().fileName, path); - } - if (/vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path)) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/noStandaloneEditorRule.ts b/build/lib/tslint/noStandaloneEditorRule.ts deleted file mode 100644 index 713b94097d4c0..0000000000000 --- a/build/lib/tslint/noStandaloneEditorRule.ts +++ /dev/null @@ -1,65 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import { join } from 'path'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if (/vs(\/|\\)editor/.test(sourceFile.fileName)) { - // the vs/editor folder is allowed to use the standalone editor - return []; - } - return this.applyWithWalker(new NoStandaloneEditorRuleWalker(sourceFile, this.getOptions())); - } -} - -class NoStandaloneEditorRuleWalker extends Lint.RuleWalker { - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - if (node.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) { - this._validateImport(node.moduleReference.expression.getText(), node); - } - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - this._validateImport(node.moduleSpecifier.getText(), node); - } - - protected visitCallExpression(node: ts.CallExpression): void { - super.visitCallExpression(node); - - // import('foo') statements inside the code - if (node.expression.kind === ts.SyntaxKind.ImportKeyword) { - const [path] = node.arguments; - this._validateImport(path.getText(), node); - } - } - - private _validateImport(path: string, node: ts.Node): void { - // remove quotes - path = path.slice(1, -1); - - // resolve relative paths - if (path[0] === '.') { - path = join(this.getSourceFile().fileName, path); - } - - if ( - /vs(\/|\\)editor(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)common(\/|\\)standalone(\/|\\)/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.api/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.main/.test(path) - || /vs(\/|\\)editor(\/|\\)editor.worker/.test(path) - ) { - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`)); - } - } -} diff --git a/build/lib/tslint/noUnexternalizedStringsRule.js b/build/lib/tslint/noUnexternalizedStringsRule.js deleted file mode 100644 index a1183ce68e767..0000000000000 --- a/build/lib/tslint/noUnexternalizedStringsRule.js +++ /dev/null @@ -1,183 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = require("typescript"); -const Lint = require("tslint"); -/** - * Implementation of the no-unexternalized-strings rule. - */ -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - if (/\.d.ts$/.test(sourceFile.fileName)) { - return []; - } - return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -function isStringLiteral(node) { - return node && node.kind === ts.SyntaxKind.StringLiteral; -} -function isObjectLiteral(node) { - return node && node.kind === ts.SyntaxKind.ObjectLiteralExpression; -} -function isPropertyAssignment(node) { - return node && node.kind === ts.SyntaxKind.PropertyAssignment; -} -class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - this.signatures = Object.create(null); - this.ignores = Object.create(null); - this.messageIndex = undefined; - this.keyIndex = undefined; - this.usedKeys = Object.create(null); - const options = this.getOptions(); - const first = options && options.length > 0 ? options[0] : null; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; - } - } - } - visitSourceFile(node) { - super.visitSourceFile(node); - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - let identifier = key.substr(1, key.length - 2); - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - let occurrence = this.usedKeys[key][0]; - this.addFailure(this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `The key ${occurrence.key.getText()} doesn't conform to a valid localize identifier`)); - } - const occurrences = this.usedKeys[key]; - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`))); - }); - } - }); - } - visitStringLiteral(node) { - this.checkStringLiteral(node); - super.visitStringLiteral(node); - } - checkStringLiteral(node) { - const text = node.getText(); - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this.findDescribingParent(node); - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''), - Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''), - ]; - this.addFailureAtNode(node, NoUnexternalizedStringsRuleWalker.ImportFailureMessage, fix); - return; - } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo ? callInfo.callExpression.expression.getText() : null; - if (functionName && this.ignores[functionName]) { - return; - } - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName])) { - const s = node.getText(); - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`), - ]; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix)); - return; - } - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = property.name.getText(); - if (name === 'key') { - const initializer = property.initializer; - if (isStringLiteral(initializer)) { - this.recordKey(initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - break; - } - } - } - } - } - const messageArg = callInfo.callExpression.arguments[this.messageIndex]; - if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) { - this.addFailure(this.createFailure(messageArg.getStart(), messageArg.getWidth(), `Message argument to '${callInfo.callExpression.expression.getText()}' must be a string literal.`)); - return; - } - } - recordKey(keyNode, messageNode) { - const text = keyNode.getText(); - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { - this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`); - } - else { - this.addFailureAtNode(keyNode, `Key is empty.`); - } - return; - } - let occurrences = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; - } - if (messageNode) { - if (occurrences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) { - return; - } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - findDescribingParent(node) { - let parent; - while ((parent = node.parent)) { - const kind = parent.kind; - if (kind === ts.SyntaxKind.CallExpression) { - const callExpression = parent; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - } - else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) { - return { isImport: true }; - } - else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration - || kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration - || kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.ModuleDeclaration - || kind === ts.SyntaxKind.TypeAliasDeclaration || kind === ts.SyntaxKind.SourceFile) { - return null; - } - node = parent; - } - return null; - } -} -NoUnexternalizedStringsRuleWalker.ImportFailureMessage = 'Do not use double quotes for imports.'; -NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE = '"'; -NoUnexternalizedStringsRuleWalker.IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; diff --git a/build/lib/tslint/noUnexternalizedStringsRule.ts b/build/lib/tslint/noUnexternalizedStringsRule.ts deleted file mode 100644 index d896e4fabe2ee..0000000000000 --- a/build/lib/tslint/noUnexternalizedStringsRule.ts +++ /dev/null @@ -1,222 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; - -/** - * Implementation of the no-unexternalized-strings rule. - */ -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - if (/\.d.ts$/.test(sourceFile.fileName)) { - return []; - } - return this.applyWithWalker(new NoUnexternalizedStringsRuleWalker(sourceFile, this.getOptions())); - } -} - -interface Map { - [key: string]: V; -} - -interface UnexternalizedStringsOptions { - signatures?: string[]; - messageIndex?: number; - keyIndex?: number; - ignores?: string[]; -} - -function isStringLiteral(node: ts.Node): node is ts.StringLiteral { - return node && node.kind === ts.SyntaxKind.StringLiteral; -} - -function isObjectLiteral(node: ts.Node): node is ts.ObjectLiteralExpression { - return node && node.kind === ts.SyntaxKind.ObjectLiteralExpression; -} - -function isPropertyAssignment(node: ts.Node): node is ts.PropertyAssignment { - return node && node.kind === ts.SyntaxKind.PropertyAssignment; -} - -interface KeyMessagePair { - key: ts.StringLiteral; - message: ts.Node | undefined; -} - -class NoUnexternalizedStringsRuleWalker extends Lint.RuleWalker { - - private static ImportFailureMessage = 'Do not use double quotes for imports.'; - - private static DOUBLE_QUOTE: string = '"'; - - private signatures: Map; - private messageIndex: number | undefined; - private keyIndex: number | undefined; - private ignores: Map; - - private usedKeys: Map; - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - this.signatures = Object.create(null); - this.ignores = Object.create(null); - this.messageIndex = undefined; - this.keyIndex = undefined; - this.usedKeys = Object.create(null); - const options: any[] = this.getOptions(); - const first: UnexternalizedStringsOptions = options && options.length > 0 ? options[0] : null; - if (first) { - if (Array.isArray(first.signatures)) { - first.signatures.forEach((signature: string) => this.signatures[signature] = true); - } - if (Array.isArray(first.ignores)) { - first.ignores.forEach((ignore: string) => this.ignores[ignore] = true); - } - if (typeof first.messageIndex !== 'undefined') { - this.messageIndex = first.messageIndex; - } - if (typeof first.keyIndex !== 'undefined') { - this.keyIndex = first.keyIndex; - } - } - } - - private static IDENTIFIER = /^[_a-zA-Z0-9][ .\-_a-zA-Z0-9]*$/; - protected visitSourceFile(node: ts.SourceFile): void { - super.visitSourceFile(node); - Object.keys(this.usedKeys).forEach(key => { - // Keys are quoted. - let identifier = key.substr(1, key.length - 2); - if (!NoUnexternalizedStringsRuleWalker.IDENTIFIER.test(identifier)) { - let occurrence = this.usedKeys[key][0]; - this.addFailure(this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `The key ${occurrence.key.getText()} doesn't conform to a valid localize identifier`)); - } - const occurrences = this.usedKeys[key]; - if (occurrences.length > 1) { - occurrences.forEach(occurrence => { - this.addFailure((this.createFailure(occurrence.key.getStart(), occurrence.key.getWidth(), `Duplicate key ${occurrence.key.getText()} with different message value.`))); - }); - } - }); - } - - protected visitStringLiteral(node: ts.StringLiteral): void { - this.checkStringLiteral(node); - super.visitStringLiteral(node); - } - - private checkStringLiteral(node: ts.StringLiteral): void { - const text = node.getText(); - const doubleQuoted = text.length >= 2 && text[0] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE && text[text.length - 1] === NoUnexternalizedStringsRuleWalker.DOUBLE_QUOTE; - const info = this.findDescribingParent(node); - // Ignore strings in import and export nodes. - if (info && info.isImport && doubleQuoted) { - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), 1, '\''), - Lint.Replacement.replaceFromTo(node.getStart() + text.length - 1, 1, '\''), - ]; - this.addFailureAtNode( - node, - NoUnexternalizedStringsRuleWalker.ImportFailureMessage, - fix - ); - return; - } - const callInfo = info ? info.callInfo : null; - const functionName = callInfo ? callInfo.callExpression.expression.getText() : null; - if (functionName && this.ignores[functionName]) { - return; - } - - if (doubleQuoted && (!callInfo || callInfo.argIndex === -1 || !this.signatures[functionName!])) { - const s = node.getText(); - const fix = [ - Lint.Replacement.replaceFromTo(node.getStart(), node.getWidth(), `nls.localize('KEY-${s.substring(1, s.length - 1)}', ${s})`), - ]; - this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Unexternalized string found: ${node.getText()}`, fix)); - return; - } - // We have a single quoted string outside a localize function name. - if (!doubleQuoted && !this.signatures[functionName!]) { - return; - } - // We have a string that is a direct argument into the localize call. - const keyArg: ts.Expression | null = callInfo && callInfo.argIndex === this.keyIndex - ? callInfo.callExpression.arguments[this.keyIndex] - : null; - if (keyArg) { - if (isStringLiteral(keyArg)) { - this.recordKey(keyArg, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } else if (isObjectLiteral(keyArg)) { - for (const property of keyArg.properties) { - if (isPropertyAssignment(property)) { - const name = property.name.getText(); - if (name === 'key') { - const initializer = property.initializer; - if (isStringLiteral(initializer)) { - this.recordKey(initializer, this.messageIndex && callInfo ? callInfo.callExpression.arguments[this.messageIndex] : undefined); - } - break; - } - } - } - } - } - - const messageArg = callInfo!.callExpression.arguments[this.messageIndex!]; - - if (messageArg && messageArg.kind !== ts.SyntaxKind.StringLiteral) { - this.addFailure(this.createFailure( - messageArg.getStart(), messageArg.getWidth(), - `Message argument to '${callInfo!.callExpression.expression.getText()}' must be a string literal.`)); - return; - } - } - - private recordKey(keyNode: ts.StringLiteral, messageNode: ts.Node | undefined) { - const text = keyNode.getText(); - // We have an empty key - if (text.match(/(['"]) *\1/)) { - if (messageNode) { - this.addFailureAtNode(keyNode, `Key is empty for message: ${messageNode.getText()}`); - } else { - this.addFailureAtNode(keyNode, `Key is empty.`); - } - return; - } - let occurrences: KeyMessagePair[] = this.usedKeys[text]; - if (!occurrences) { - occurrences = []; - this.usedKeys[text] = occurrences; - } - if (messageNode) { - if (occurrences.some(pair => pair.message ? pair.message.getText() === messageNode.getText() : false)) { - return; - } - } - occurrences.push({ key: keyNode, message: messageNode }); - } - - private findDescribingParent(node: ts.Node): { callInfo?: { callExpression: ts.CallExpression, argIndex: number }, isImport?: boolean; } | null { - let parent: ts.Node; - while ((parent = node.parent)) { - const kind = parent.kind; - if (kind === ts.SyntaxKind.CallExpression) { - const callExpression = parent as ts.CallExpression; - return { callInfo: { callExpression: callExpression, argIndex: callExpression.arguments.indexOf(node) } }; - } else if (kind === ts.SyntaxKind.ImportEqualsDeclaration || kind === ts.SyntaxKind.ImportDeclaration || kind === ts.SyntaxKind.ExportDeclaration) { - return { isImport: true }; - } else if (kind === ts.SyntaxKind.VariableDeclaration || kind === ts.SyntaxKind.FunctionDeclaration || kind === ts.SyntaxKind.PropertyDeclaration - || kind === ts.SyntaxKind.MethodDeclaration || kind === ts.SyntaxKind.VariableDeclarationList || kind === ts.SyntaxKind.InterfaceDeclaration - || kind === ts.SyntaxKind.ClassDeclaration || kind === ts.SyntaxKind.EnumDeclaration || kind === ts.SyntaxKind.ModuleDeclaration - || kind === ts.SyntaxKind.TypeAliasDeclaration || kind === ts.SyntaxKind.SourceFile) { - return null; - } - node = parent; - } - return null; - } -} diff --git a/build/lib/tslint/translationRemindRule.js b/build/lib/tslint/translationRemindRule.js deleted file mode 100644 index 2234094421bb9..0000000000000 --- a/build/lib/tslint/translationRemindRule.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -Object.defineProperty(exports, "__esModule", { value: true }); -const Lint = require("tslint"); -const fs = require("fs"); -class Rule extends Lint.Rules.AbstractRule { - apply(sourceFile) { - return this.applyWithWalker(new TranslationRemindRuleWalker(sourceFile, this.getOptions())); - } -} -exports.Rule = Rule; -class TranslationRemindRuleWalker extends Lint.RuleWalker { - constructor(file, opts) { - super(file, opts); - } - visitImportDeclaration(node) { - const declaration = node.moduleSpecifier.getText(); - if (declaration !== `'${TranslationRemindRuleWalker.NLS_MODULE}'`) { - return; - } - this.visitImportLikeDeclaration(node); - } - visitImportEqualsDeclaration(node) { - const reference = node.moduleReference.getText(); - if (reference !== `require('${TranslationRemindRuleWalker.NLS_MODULE}')`) { - return; - } - this.visitImportLikeDeclaration(node); - } - visitImportLikeDeclaration(node) { - const currentFile = node.getSourceFile().fileName; - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - const resource = matchService ? matchService[0] : matchPart[0]; - let resourceDefined = false; - let json; - try { - json = fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } - catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - workbenchResources.forEach((existingResource) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - if (!resourceDefined) { - this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`); - } - } -} -TranslationRemindRuleWalker.NLS_MODULE = 'vs/nls'; diff --git a/build/lib/tslint/translationRemindRule.ts b/build/lib/tslint/translationRemindRule.ts deleted file mode 100644 index e2671599d3c0a..0000000000000 --- a/build/lib/tslint/translationRemindRule.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as ts from 'typescript'; -import * as Lint from 'tslint'; -import * as fs from 'fs'; - -export class Rule extends Lint.Rules.AbstractRule { - public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] { - return this.applyWithWalker(new TranslationRemindRuleWalker(sourceFile, this.getOptions())); - } -} - -class TranslationRemindRuleWalker extends Lint.RuleWalker { - - private static NLS_MODULE: string = 'vs/nls'; - - constructor(file: ts.SourceFile, opts: Lint.IOptions) { - super(file, opts); - } - - protected visitImportDeclaration(node: ts.ImportDeclaration): void { - const declaration = node.moduleSpecifier.getText(); - if (declaration !== `'${TranslationRemindRuleWalker.NLS_MODULE}'`) { - return; - } - - this.visitImportLikeDeclaration(node); - } - - protected visitImportEqualsDeclaration(node: ts.ImportEqualsDeclaration): void { - const reference = node.moduleReference.getText(); - if (reference !== `require('${TranslationRemindRuleWalker.NLS_MODULE}')`) { - return; - } - - this.visitImportLikeDeclaration(node); - } - - private visitImportLikeDeclaration(node: ts.ImportDeclaration | ts.ImportEqualsDeclaration) { - const currentFile = node.getSourceFile().fileName; - const matchService = currentFile.match(/vs\/workbench\/services\/\w+/); - const matchPart = currentFile.match(/vs\/workbench\/contrib\/\w+/); - if (!matchService && !matchPart) { - return; - } - - const resource = matchService ? matchService[0] : matchPart![0]; - let resourceDefined = false; - - let json; - try { - json = fs.readFileSync('./build/lib/i18n.resources.json', 'utf8'); - } catch (e) { - console.error('[translation-remind rule]: File with resources to pull from Transifex was not found. Aborting translation resource check for newly defined workbench part/service.'); - return; - } - const workbenchResources = JSON.parse(json).workbench; - - workbenchResources.forEach((existingResource: any) => { - if (existingResource.name === resource) { - resourceDefined = true; - return; - } - }); - - if (!resourceDefined) { - this.addFailureAtNode(node, `Please add '${resource}' to ./build/lib/i18n.resources.json file to use translations here.`); - } - } -} From ca8a717f5e722ecf2458c82fd99a8427e3a10769 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 09:01:41 +0100 Subject: [PATCH 45/47] tslint removal --- .github/workflows/ci.yml | 12 +--- .vscode/extensions.json | 1 - .vscode/tasks.json | 8 --- .../darwin/continuous-build-darwin.yml | 5 +- .../linux/continuous-build-linux.yml | 5 +- build/azure-pipelines/product-compile.yml | 5 +- .../win32/continuous-build-win32.yml | 5 +- build/gulpfile.hygiene.js | 60 +++---------------- build/package.json | 1 - package.json | 2 - 10 files changed, 17 insertions(+), 87 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9a2a3e71bddc..9fbfa2f16b4d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,10 +35,8 @@ jobs: name: Install Dependencies - run: yarn electron x64 name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks - run: yarn valid-globals-check @@ -69,10 +67,8 @@ jobs: name: Install Dependencies - run: yarn electron name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks - run: yarn valid-globals-check @@ -100,10 +96,8 @@ jobs: name: Install Dependencies - run: yarn electron x64 name: Download Electron - - run: yarn gulp hygiene --skip-tslint + - run: yarn gulp hygiene name: Run Hygiene Checks - - run: yarn gulp tslint - name: Run TSLint Checks - run: yarn monaco-compile-check name: Run Monaco Editor Checks - run: yarn valid-globals-check diff --git a/.vscode/extensions.json b/.vscode/extensions.json index b4336e7d127d5..2cd0a32b9ce77 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,7 +2,6 @@ // See https://go.microsoft.com/fwlink/?LinkId=827846 // for the documentation about the extensions.json format "recommendations": [ - "ms-vscode.vscode-typescript-tslint-plugin", "dbaeumer.vscode-eslint", "EditorConfig.EditorConfig", "msjsdiag.debugger-for-chrome" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 598d82214ce22..ad91007c1eb35 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -45,14 +45,6 @@ "applyTo": "allDocuments" } }, - { - "type": "gulp", - "task": "tslint", - "label": "Run tslint", - "problemMatcher": [ - "$tslint5" - ] - }, { "label": "Run tests", "type": "shell", diff --git a/build/azure-pipelines/darwin/continuous-build-darwin.yml b/build/azure-pipelines/darwin/continuous-build-darwin.yml index 1609e4a0027bb..72265e035e05f 100644 --- a/build/azure-pipelines/darwin/continuous-build-darwin.yml +++ b/build/azure-pipelines/darwin/continuous-build-darwin.yml @@ -24,11 +24,8 @@ steps: yarn electron x64 displayName: Download Electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks diff --git a/build/azure-pipelines/linux/continuous-build-linux.yml b/build/azure-pipelines/linux/continuous-build-linux.yml index 649c12593dac2..dac42d4ffaddc 100644 --- a/build/azure-pipelines/linux/continuous-build-linux.yml +++ b/build/azure-pipelines/linux/continuous-build-linux.yml @@ -32,11 +32,8 @@ steps: yarn electron x64 displayName: Download Electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - script: | yarn monaco-compile-check displayName: Run Monaco Editor Checks diff --git a/build/azure-pipelines/product-compile.yml b/build/azure-pipelines/product-compile.yml index 9ec01fd5db1d3..0055d48f0e450 100644 --- a/build/azure-pipelines/product-compile.yml +++ b/build/azure-pipelines/product-compile.yml @@ -88,11 +88,10 @@ steps: - script: | set -e - yarn gulp hygiene --skip-tslint - yarn gulp tslint + yarn gulp hygiene yarn monaco-compile-check yarn valid-globals-check - displayName: Run hygiene, tslint, monaco compile & valid globals checks + displayName: Run hygiene, monaco compile & valid globals checks condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false')) - script: | diff --git a/build/azure-pipelines/win32/continuous-build-win32.yml b/build/azure-pipelines/win32/continuous-build-win32.yml index 050a967629bda..17cb23d406faa 100644 --- a/build/azure-pipelines/win32/continuous-build-win32.yml +++ b/build/azure-pipelines/win32/continuous-build-win32.yml @@ -29,11 +29,8 @@ steps: - powershell: | yarn electron - script: | - yarn gulp hygiene --skip-tslint + yarn gulp hygiene displayName: Run Hygiene Checks -- script: | - yarn gulp tslint - displayName: Run TSLint Checks - powershell: | yarn monaco-compile-check displayName: Run Monaco Editor Checks diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index d7a5ee8463782..9af81603c8ab7 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -8,10 +8,8 @@ const gulp = require('gulp'); const filter = require('gulp-filter'); const es = require('event-stream'); -const gulptslint = require('gulp-tslint'); const gulpeslint = require('gulp-eslint'); const tsfmt = require('typescript-formatter'); -const tslint = require('tslint'); const VinylFile = require('vinyl'); const vfs = require('vinyl-fs'); const path = require('path'); @@ -85,7 +83,7 @@ const indentationFilter = [ '!src/typings/**/*.d.ts', '!extensions/**/*.d.ts', '!**/*.{svg,exe,png,bmp,scpt,bat,cmd,cur,ttf,woff,eot,md,ps1,template,yaml,yml,d.ts.recipe,ico,icns}', - '!build/{lib,tslintRules,download}/**/*.js', + '!build/{lib,download}/**/*.js', '!build/**/*.sh', '!build/azure-pipelines/**/*.js', '!build/azure-pipelines/**/*.config', @@ -128,7 +126,7 @@ const copyrightFilter = [ '!scripts/code-web.js' ]; -const eslintFilter = [ +const jsHygieneFilter = [ 'src/**/*.js', 'build/gulpfile.*.js', '!src/vs/loader.js', @@ -141,7 +139,10 @@ const eslintFilter = [ '!**/test/**' ]; -const tslintBaseFilter = [ +const tsHygieneFilter = [ + 'src/**/*.ts', + 'test/**/*.ts', + 'extensions/**/*.ts', '!**/fixtures/**', '!**/typings/**', '!**/node_modules/**', @@ -152,30 +153,6 @@ const tslintBaseFilter = [ '!extensions/html-language-features/server/lib/jquery.d.ts' ]; -const tslintCoreFilter = [ - 'src/**/*.ts', - 'test/**/*.ts', - '!extensions/**/*.ts', - '!test/automation/**', - '!test/smoke/**', - ...tslintBaseFilter -]; - -const tslintExtensionsFilter = [ - 'extensions/**/*.ts', - '!src/**/*.ts', - '!test/**/*.ts', - 'test/automation/**/*.ts', - ...tslintBaseFilter -]; - -const tslintHygieneFilter = [ - 'src/**/*.ts', - 'test/**/*.ts', - 'extensions/**/*.ts', - ...tslintBaseFilter -]; - const copyrightHeaderLines = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', @@ -185,7 +162,7 @@ const copyrightHeaderLines = [ gulp.task('eslint', () => { return vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(eslintFilter.concat(tslintHygieneFilter))) + .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] @@ -198,23 +175,6 @@ gulp.task('eslint', () => { })); }); -gulp.task('tslint', () => { - return es.merge([ - - // Core: include type information (required by certain rules like no-nodejs-globals) - vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(tslintCoreFilter)) - .pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint', program: tslint.Linter.createProgram('src/tsconfig.json') })) - .pipe(gulptslint.default.report({ emitError: true })), - - // Exenstions: do not include type information - vfs.src(all, { base: '.', follow: true, allowEmpty: true }) - .pipe(filter(tslintExtensionsFilter)) - .pipe(gulptslint.default({ rulesDirectory: 'build/lib/tslint' })) - .pipe(gulptslint.default.report({ emitError: true })) - ]).pipe(es.through()); -}); - function checkPackageJSON(actualPath) { const actual = require(path.join(__dirname, '..', actualPath)); const rootPackageJSON = require('../package.json'); @@ -301,8 +261,6 @@ function hygiene(some) { replace: undefined, tsconfig: undefined, tsconfigFile: undefined, - tslint: undefined, - tslintFile: undefined, tsfmtFile: undefined, vscode: undefined, vscodeFile: undefined @@ -347,11 +305,11 @@ function hygiene(some) { .pipe(copyrights); const typescript = result - .pipe(filter(tslintHygieneFilter)) + .pipe(filter(tsHygieneFilter)) .pipe(formatting); const javascript = result - .pipe(filter(eslintFilter.concat(tslintHygieneFilter))) + .pipe(filter(jsHygieneFilter.concat(tsHygieneFilter))) .pipe(gulpeslint({ configFile: '.eslintrc.json', rulePaths: ['./build/lib/eslint'] diff --git a/build/package.json b/build/package.json index 24570a9648e64..5cd8929a5e21f 100644 --- a/build/package.json +++ b/build/package.json @@ -42,7 +42,6 @@ "minimist": "^1.2.0", "request": "^2.85.0", "terser": "4.3.8", - "tslint": "^5.9.1", "typescript": "3.7.3", "vsce": "1.48.0", "vscode-telemetry-extractor": "^1.5.4", diff --git a/package.json b/package.json index 47fa319a4e847..d29bdbe18b7ea 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,6 @@ "gulp-replace": "^0.5.4", "gulp-shell": "^0.6.5", "gulp-tsb": "4.0.5", - "gulp-tslint": "^8.1.3", "gulp-untar": "^0.0.7", "gulp-vinyl-zip": "^2.1.2", "husky": "^0.13.1", @@ -145,7 +144,6 @@ "sinon": "^1.17.2", "source-map": "^0.4.4", "ts-loader": "^4.4.2", - "tslint": "^5.16.0", "typescript": "3.7.3", "typescript-formatter": "7.1.0", "underscore": "^1.8.2", From 125ba4a8a615f9fc8c4dd280e482bd1484c211a4 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 09:32:40 +0100 Subject: [PATCH 46/47] enable custom/forked no-unused-expressions rule --- .eslintrc.json | 7 +- .../lib/eslint/code-no-unused-expressions.js | 145 ++++++++++++++++++ src/vs/platform/log/common/fileLogService.ts | 2 +- .../editors/textFileSaveErrorHandler.ts | 2 +- 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 build/lib/eslint/code-no-unused-expressions.js diff --git a/.eslintrc.json b/.eslintrc.json index 350c475103382..1a85f595bb2a8 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -25,13 +25,18 @@ "no-sparse-arrays": "warn", "no-throw-literal": "warn", "no-unsafe-finally": "warn", - "no-unused-expressions": "off", "no-unused-labels": "warn", "no-var": "warn", "jsdoc/no-types": "warn", "semi": "off", "@typescript-eslint/semi": "warn", "@typescript-eslint/class-name-casing": "warn", + "code-no-unused-expressions": [ + "warn", + { + "allowTernary": true + } + ], "code-translation-remind": "warn", "code-no-nls-in-standalone-editor": "warn", "code-no-standalone-editor": "warn", diff --git a/build/lib/eslint/code-no-unused-expressions.js b/build/lib/eslint/code-no-unused-expressions.js new file mode 100644 index 0000000000000..c7b175513117c --- /dev/null +++ b/build/lib/eslint/code-no-unused-expressions.js @@ -0,0 +1,145 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +// FORKED FROM https://github.com/eslint/eslint/blob/b23ad0d789a909baf8d7c41a35bc53df932eaf30/lib/rules/no-unused-expressions.js +// and added support for `OptionalCallExpression`, see https://github.com/facebook/create-react-app/issues/8107 and https://github.com/eslint/eslint/issues/12642 + +/** + * @fileoverview Flag expressions in statement position that do not side effect + * @author Michael Ficarra + */ + +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: 'suggestion', + + docs: { + description: 'disallow unused expressions', + category: 'Best Practices', + recommended: false, + url: 'https://eslint.org/docs/rules/no-unused-expressions' + }, + + schema: [ + { + type: 'object', + properties: { + allowShortCircuit: { + type: 'boolean', + default: false + }, + allowTernary: { + type: 'boolean', + default: false + }, + allowTaggedTemplates: { + type: 'boolean', + default: false + } + }, + additionalProperties: false + } + ] + }, + + create(context) { + const config = context.options[0] || {}, + allowShortCircuit = config.allowShortCircuit || false, + allowTernary = config.allowTernary || false, + allowTaggedTemplates = config.allowTaggedTemplates || false; + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node any node + * @returns {boolean} whether the given node structurally represents a directive + */ + function looksLikeDirective(node) { + return node.type === 'ExpressionStatement' && + node.expression.type === 'Literal' && typeof node.expression.value === 'string'; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {Function} predicate ([a] -> Boolean) the function used to make the determination + * @param {a[]} list the input list + * @returns {a[]} the leading sequence of members in the given list that pass the given predicate + */ + function takeWhile(predicate, list) { + for (let i = 0; i < list.length; ++i) { + if (!predicate(list[i])) { + return list.slice(0, i); + } + } + return list.slice(); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node a Program or BlockStatement node + * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body + */ + function directives(node) { + return takeWhile(looksLikeDirective, node.body); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {ASTNode} node any node + * @param {ASTNode[]} ancestors the given node's ancestors + * @returns {boolean} whether the given node is considered a directive in its current position + */ + function isDirective(node, ancestors) { + const parent = ancestors[ancestors.length - 1], + grandparent = ancestors[ancestors.length - 2]; + + return (parent.type === 'Program' || parent.type === 'BlockStatement' && + (/Function/u.test(grandparent.type))) && + directives(parent).indexOf(node) >= 0; + } + + /** + * Determines whether or not a given node is a valid expression. Recurses on short circuit eval and ternary nodes if enabled by flags. + * @param {ASTNode} node any node + * @returns {boolean} whether the given node is a valid expression + */ + function isValidExpression(node) { + if (allowTernary) { + + // Recursive check for ternary and logical expressions + if (node.type === 'ConditionalExpression') { + return isValidExpression(node.consequent) && isValidExpression(node.alternate); + } + } + + if (allowShortCircuit) { + if (node.type === 'LogicalExpression') { + return isValidExpression(node.right); + } + } + + if (allowTaggedTemplates && node.type === 'TaggedTemplateExpression') { + return true; + } + + return /^(?:Assignment|OptionalCall|Call|New|Update|Yield|Await)Expression$/u.test(node.type) || + (node.type === 'UnaryExpression' && ['delete', 'void'].indexOf(node.operator) >= 0); + } + + return { + ExpressionStatement(node) { + if (!isValidExpression(node.expression) && !isDirective(node, context.getAncestors())) { + context.report({ node, message: 'Expected an assignment or function call and instead saw an expression.' }); + } + } + }; + + } +}; diff --git a/src/vs/platform/log/common/fileLogService.ts b/src/vs/platform/log/common/fileLogService.ts index 32493332bc1a7..20716554d0477 100644 --- a/src/vs/platform/log/common/fileLogService.ts +++ b/src/vs/platform/log/common/fileLogService.ts @@ -173,7 +173,7 @@ export class FileLoggerService extends Disposable implements ILoggerService { getLogger(resource: URI): ILogger { let logger = this.loggers.get(resource.toString()); if (!logger) { - logger = new BufferLogService, this.logService.getLevel(); + logger = new BufferLogService(this.logService.getLevel()); this.loggers.set(resource.toString(), logger); whenProviderRegistered(resource, this.fileService).then(() => (logger).logger = this.instantiationService.createInstance(FileLogService, basename(resource), resource, this.logService.getLevel())); } diff --git a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts index 7de229cf5837f..cebc296f37790 100644 --- a/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts +++ b/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.ts @@ -180,7 +180,7 @@ export class TextFileSaveErrorHandler extends Disposable implements ISaveErrorHa // Show message and keep function to hide in case the file gets saved/reverted const actions: INotificationActions = { primary: primaryActions, secondary: secondaryActions }; const handle = this.notificationService.notify({ severity: Severity.Error, message, actions }); - Event.once(handle.onDidClose)(() => { dispose(primaryActions), dispose(secondaryActions); }); + Event.once(handle.onDidClose)(() => { dispose(primaryActions); dispose(secondaryActions); }); this.messages.set(model.resource, handle); } From 186491566a70854080ddd19d8cc59e3e8bab2e39 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 3 Jan 2020 10:34:42 +0100 Subject: [PATCH 47/47] add eslint task definition --- .vscode/tasks.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ad91007c1eb35..aa94be6112649 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -82,7 +82,6 @@ "command": "yarn web -- --no-launch", "label": "Run web", "isBackground": true, - // This section to make error go away when launching the debug config "problemMatcher": { "pattern": { "regexp": "" @@ -96,5 +95,13 @@ "reveal": "never" } }, + { + "type": "npm", + "script": "eslint", + "problemMatcher": { + "source": "eslint", + "base": "$eslint-stylish" + } + } ] }