mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 (#8911)
* Merge from vscode a234f13c45b40a0929777cb440ee011b7549eed2 * update distro * fix layering * update distro * fix tests
This commit is contained in:
16
.eslintignore
Normal file
16
.eslintignore
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
**/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/**
|
||||||
|
**/vscode-api-tests/testWorkspace2/**
|
||||||
|
**/extensions/**/out/**
|
||||||
|
**/extensions/**/build/**
|
||||||
|
**/extensions/markdown-language-features/media/**
|
||||||
|
**/extensions/typescript-basics/test/colorize-fixtures/**
|
||||||
281
.eslintrc.json
281
.eslintrc.json
@@ -1,20 +1,273 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"env": {
|
"parser": "@typescript-eslint/parser",
|
||||||
"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": {
|
"parserOptions": {
|
||||||
"ecmaFeatures": {
|
"ecmaVersion": 6,
|
||||||
"experimentalObjectRestSpread": true
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint",
|
||||||
|
"jsdoc"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"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": "warn",
|
||||||
|
"no-new-wrappers": "warn",
|
||||||
|
"no-redeclare": "off",
|
||||||
|
"no-sparse-arrays": "warn",
|
||||||
|
"no-throw-literal": "warn",
|
||||||
|
"no-unsafe-finally": "warn",
|
||||||
|
"no-unused-labels": "warn",
|
||||||
|
"no-restricted-globals": ["warn", "name", "length", "event", "closed", "external", "status", "origin", "orientation"], // non-complete list of globals that are easy to access unintentionally
|
||||||
|
"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",
|
||||||
|
"code-no-unexternalized-strings": "warn",
|
||||||
|
"code-layering": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"common": ["browser"], // {{SQL CARBON EDIT}} @anthonydresser not ideal, but for our purposes its fine for now,
|
||||||
|
"node": [
|
||||||
|
"common"
|
||||||
|
],
|
||||||
|
"browser": [
|
||||||
|
"common"
|
||||||
|
],
|
||||||
|
"electron-main": [
|
||||||
|
"common",
|
||||||
|
"node"
|
||||||
|
],
|
||||||
|
"electron-browser": [
|
||||||
|
"common",
|
||||||
|
"browser",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"code-import-patterns": [
|
||||||
|
"warn",
|
||||||
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
// !!! Do not relax these rules !!!
|
||||||
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/common/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/common/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/test/common/**",
|
||||||
|
"restrictions": [
|
||||||
|
"assert",
|
||||||
|
"sinon",
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/common/**",
|
||||||
|
"**/{vs,sql}/base/test/common/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"vs/css!./**/*",
|
||||||
|
"**/{vs,sql}/base/{common,browser}/**",
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/node/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node}/**",
|
||||||
|
"!path" // node modules (except path where we have our own impl)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// vs/base/test/browser contains tests for vs/base/browser
|
||||||
|
"target": "**/{vs,sql}/base/test/browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"assert",
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/base/test/{common,browser}/**",
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/parts/*/common/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/common/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/common/**"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/parts/*/browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"vs/css!./**/*",
|
||||||
|
"**/{vs,sql}/base/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser}/**",
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/parts/*/node/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node}/**",
|
||||||
|
"!path" // node modules (except path where we have our own impl)
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/parts/*/electron-browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"vs/css!./**/*",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node,electron-browser}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node,electron-browser}/**",
|
||||||
|
"!path", // node modules (except path where we have our own impl)
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/base/parts/*/electron-main/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node,electron-main}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node,electron-main}/**",
|
||||||
|
"!path", // node modules (except path where we have our own impl)
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/common/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/common/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/common/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/common/**",
|
||||||
|
"**/vs/editor/common/**",
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/test/common/**",
|
||||||
|
"restrictions": [
|
||||||
|
"assert",
|
||||||
|
"sinon",
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/common/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/common/**",
|
||||||
|
"**/{vs,sql}/{base,platform,workbench}/**/test/common/**",
|
||||||
|
"typemoq",
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"vs/css!./**/*",
|
||||||
|
"**/{vs,sql}/base/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/{common,browser}/**",
|
||||||
|
"**/vs/editor/{common,browser}/**",
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*",
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/node/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node}/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/{common,browser,node}/**",
|
||||||
|
"**/vs/editor/{common,browser,node}/**",
|
||||||
|
"!path", // node modules (except path where we have our own impl)
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/electron-browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"vs/css!./**/*",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node,electron-browser}/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/{common,browser,node,electron-browser}/**",
|
||||||
|
"**/vs/editor/{common,browser,node,electron-browser}/**",
|
||||||
|
"!path", // node modules (except path where we have our own impl)
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*",
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/electron-main/**",
|
||||||
|
"restrictions": [
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser,node}/**",
|
||||||
|
"**/{vs,sql}/base/parts/*/{common,browser,node,electron-browser}/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/{common,browser,node,electron-main}/**",
|
||||||
|
"**/vs/editor/{common,browser,node,electron-main}/**",
|
||||||
|
"!path", // node modules (except path where we have our own impl)
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"target": "**/{vs,sql}/platform/*/test/browser/**",
|
||||||
|
"restrictions": [
|
||||||
|
"assert",
|
||||||
|
"sinon",
|
||||||
|
"vs/nls",
|
||||||
|
"**/{vs,sql}/base/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/{platform,workbench}/**/{common,browser}/**",
|
||||||
|
"**/{vs,sql}/{base,platform,workbench}/**/test/{common,browser}/**",
|
||||||
|
"typemoq",
|
||||||
|
"@angular/*",
|
||||||
|
"rxjs/*",
|
||||||
|
"azdata" // TODO remove
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"*.js"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"jsdoc/no-types": "off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
7
.eslintrc.sql.json
Normal file
7
.eslintrc.sql.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"extends": ".eslintrc.json",
|
||||||
|
"rules": {
|
||||||
|
"no-sync": "warn",
|
||||||
|
"strict": ["warn", "never"]
|
||||||
|
}
|
||||||
|
}
|
||||||
34
.github/feature-requests.yml
vendored
Normal file
34
.github/feature-requests.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
typeLabel: {
|
||||||
|
name: 'feature-request'
|
||||||
|
},
|
||||||
|
candidateMilestone: {
|
||||||
|
number: 107,
|
||||||
|
name: 'Backlog Candidates'
|
||||||
|
},
|
||||||
|
approvedMilestone: {
|
||||||
|
number: 8,
|
||||||
|
name: 'Backlog'
|
||||||
|
},
|
||||||
|
onLabeled: {
|
||||||
|
delay: 60,
|
||||||
|
perform: true
|
||||||
|
},
|
||||||
|
onCandidateMilestoned: {
|
||||||
|
candidatesComment: "This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!",
|
||||||
|
perform: true
|
||||||
|
},
|
||||||
|
onMonitorUpvotes: {
|
||||||
|
upvoteThreshold: 20,
|
||||||
|
acceptanceComment: ":slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!",
|
||||||
|
perform: true
|
||||||
|
},
|
||||||
|
onMonitorDaysOnCandidateMilestone: {
|
||||||
|
daysOnMilestone: 60,
|
||||||
|
warningPeriod: 10,
|
||||||
|
numberOfCommentsToPreventAutomaticRejection: 20,
|
||||||
|
rejectionComment: ":slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding!",
|
||||||
|
warningComment: "This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our [documentation](https://aka.ms/vscode-issue-lifecycle).\n\nHappy Coding",
|
||||||
|
perform: true
|
||||||
|
}
|
||||||
|
}
|
||||||
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -35,14 +35,14 @@ jobs:
|
|||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
- run: yarn electron x64
|
- run: yarn electron x64
|
||||||
name: Download Electron
|
name: Download Electron
|
||||||
- run: yarn gulp hygiene --skip-tslint
|
- run: yarn gulp hygiene
|
||||||
name: Run Hygiene Checks
|
name: Run Hygiene Checks
|
||||||
- run: yarn gulp tslint
|
|
||||||
name: Run TSLint Checks
|
|
||||||
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
||||||
name: Run Strict Null Check
|
name: Run Strict Null Check
|
||||||
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# name: Run Monaco Editor Checks
|
# name: Run Monaco Editor Checks
|
||||||
|
- run: yarn valid-layers-check
|
||||||
|
name: Run Valid Layers Checks
|
||||||
- run: yarn compile
|
- run: yarn compile
|
||||||
name: Compile Sources
|
name: Compile Sources
|
||||||
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
||||||
@@ -69,14 +69,14 @@ jobs:
|
|||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
- run: yarn electron
|
- run: yarn electron
|
||||||
name: Download Electron
|
name: Download Electron
|
||||||
- run: yarn gulp hygiene --skip-tslint
|
- run: yarn gulp hygiene
|
||||||
name: Run Hygiene Checks
|
name: Run Hygiene Checks
|
||||||
- run: yarn gulp tslint
|
|
||||||
name: Run TSLint Checks
|
|
||||||
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
||||||
name: Run Strict Null Check
|
name: Run Strict Null Check
|
||||||
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# name: Run Monaco Editor Checks
|
# name: Run Monaco Editor Checks
|
||||||
|
- run: yarn valid-layers-check
|
||||||
|
name: Run Valid Layers Checks
|
||||||
- run: yarn compile
|
- run: yarn compile
|
||||||
name: Compile Sources
|
name: Compile Sources
|
||||||
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
||||||
@@ -100,14 +100,14 @@ jobs:
|
|||||||
name: Install Dependencies
|
name: Install Dependencies
|
||||||
- run: yarn electron x64
|
- run: yarn electron x64
|
||||||
name: Download Electron
|
name: Download Electron
|
||||||
- run: yarn gulp hygiene --skip-tslint
|
- run: yarn gulp hygiene
|
||||||
name: Run Hygiene Checks
|
name: Run Hygiene Checks
|
||||||
- run: yarn gulp tslint
|
|
||||||
name: Run TSLint Checks
|
|
||||||
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
- run: yarn strict-null-check # {{SQL CARBON EDIT}} add step
|
||||||
name: Run Strict Null Check
|
name: Run Strict Null Check
|
||||||
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
# - run: yarn monaco-compile-check {{SQL CARBON EDIT}} remove step
|
||||||
# name: Run Monaco Editor Checks
|
# name: Run Monaco Editor Checks
|
||||||
|
- run: yarn valid-layers-check
|
||||||
|
name: Run Valid Layers Checks
|
||||||
- run: yarn compile
|
- run: yarn compile
|
||||||
name: Compile Sources
|
name: Compile Sources
|
||||||
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
# - run: yarn download-builtin-extensions {{SQL CARBON EDIT}} remove step
|
||||||
|
|||||||
13
.github/workflows/tslint.yml
vendored
13
.github/workflows/tslint.yml
vendored
@@ -1,13 +0,0 @@
|
|||||||
name: TSLint Enforcement
|
|
||||||
on: [pull_request]
|
|
||||||
jobs:
|
|
||||||
job:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 5
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v1
|
|
||||||
- name: TSLint
|
|
||||||
uses: aaomidi/gh-action-tslint@master
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
tslint_config: 'tslint-sql.json'
|
|
||||||
1
.vscode/extensions.json
vendored
1
.vscode/extensions.json
vendored
@@ -2,7 +2,6 @@
|
|||||||
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
// See https://go.microsoft.com/fwlink/?LinkId=827846
|
||||||
// for the documentation about the extensions.json format
|
// for the documentation about the extensions.json format
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"ms-vscode.vscode-typescript-tslint-plugin",
|
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"EditorConfig.EditorConfig",
|
"EditorConfig.EditorConfig",
|
||||||
"msjsdiag.debugger-for-chrome"
|
"msjsdiag.debugger-for-chrome"
|
||||||
|
|||||||
18
.vscode/launch.json
vendored
18
.vscode/launch.json
vendored
@@ -20,10 +20,7 @@
|
|||||||
"restart": true,
|
"restart": true,
|
||||||
"outFiles": [
|
"outFiles": [
|
||||||
"${workspaceFolder}/out/**/*.js"
|
"${workspaceFolder}/out/**/*.js"
|
||||||
],
|
]
|
||||||
"presentation": {
|
|
||||||
"hidden": true,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
@@ -69,10 +66,7 @@
|
|||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
"request": "attach",
|
"request": "attach",
|
||||||
"name": "Attach to azuredatastudio",
|
"name": "Attach to azuredatastudio",
|
||||||
"port": 9222,
|
"port": 9222
|
||||||
"presentation": {
|
|
||||||
"hidden": true
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "chrome",
|
"type": "chrome",
|
||||||
@@ -96,12 +90,12 @@
|
|||||||
"urlFilter": "*workbench.html*",
|
"urlFilter": "*workbench.html*",
|
||||||
"runtimeArgs": [
|
"runtimeArgs": [
|
||||||
"--inspect=5875",
|
"--inspect=5875",
|
||||||
"--no-cached-data"
|
"--no-cached-data",
|
||||||
],
|
],
|
||||||
"webRoot": "${workspaceFolder}",
|
"webRoot": "${workspaceFolder}",
|
||||||
"presentation": {
|
// Settings for js-debug:
|
||||||
"hidden": true
|
"pauseForSourceMap": false,
|
||||||
}
|
"outFiles": ["${workspaceFolder}/out/**/*.js"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "node",
|
"type": "node",
|
||||||
|
|||||||
10
.vscode/searches/ts36031.code-search
vendored
Normal file
10
.vscode/searches/ts36031.code-search
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Query: \\w+\\?\\..+![(.[]
|
||||||
|
# Flags: RegExp
|
||||||
|
# ContextLines: 2
|
||||||
|
|
||||||
|
src/vs/base/browser/ui/tree/asyncDataTree.ts:
|
||||||
|
270 } : undefined,
|
||||||
|
271 isChecked: options.ariaProvider!.isChecked ? (e) => {
|
||||||
|
272: return options.ariaProvider?.isChecked!(e.element as T);
|
||||||
|
273 } : undefined
|
||||||
|
274 },
|
||||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -37,6 +37,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"eslint.options": {
|
||||||
|
"rulePaths": [
|
||||||
|
"./build/lib/eslint"
|
||||||
|
]
|
||||||
|
},
|
||||||
"typescript.tsdk": "node_modules/typescript/lib",
|
"typescript.tsdk": "node_modules/typescript/lib",
|
||||||
"npm.exclude": "**/extensions/**",
|
"npm.exclude": "**/extensions/**",
|
||||||
"npm.packageManager": "yarn",
|
"npm.packageManager": "yarn",
|
||||||
|
|||||||
17
.vscode/tasks.json
vendored
17
.vscode/tasks.json
vendored
@@ -59,14 +59,6 @@
|
|||||||
"applyTo": "allDocuments"
|
"applyTo": "allDocuments"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "gulp",
|
|
||||||
"task": "tslint",
|
|
||||||
"label": "Run tslint",
|
|
||||||
"problemMatcher": [
|
|
||||||
"$tslint5"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Run tests",
|
"label": "Run tests",
|
||||||
"type": "shell",
|
"type": "shell",
|
||||||
@@ -104,7 +96,6 @@
|
|||||||
"command": "yarn web -- --no-launch",
|
"command": "yarn web -- --no-launch",
|
||||||
"label": "Run web",
|
"label": "Run web",
|
||||||
"isBackground": true,
|
"isBackground": true,
|
||||||
// This section to make error go away when launching the debug config
|
|
||||||
"problemMatcher": {
|
"problemMatcher": {
|
||||||
"pattern": {
|
"pattern": {
|
||||||
"regexp": ""
|
"regexp": ""
|
||||||
@@ -118,5 +109,13 @@
|
|||||||
"reveal": "never"
|
"reveal": "never"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "npm",
|
||||||
|
"script": "eslint",
|
||||||
|
"problemMatcher": {
|
||||||
|
"source": "eslint",
|
||||||
|
"base": "$eslint-stylish"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
.yarnrc
2
.yarnrc
@@ -1,3 +1,3 @@
|
|||||||
disturl "https://atom.io/download/electron"
|
disturl "https://atom.io/download/electron"
|
||||||
target "6.1.6"
|
target "7.1.7"
|
||||||
runtime "electron"
|
runtime "electron"
|
||||||
|
|||||||
@@ -24,20 +24,17 @@ steps:
|
|||||||
yarn electron x64
|
yarn electron x64
|
||||||
displayName: Download Electron
|
displayName: Download Electron
|
||||||
- script: |
|
- script: |
|
||||||
yarn gulp hygiene --skip-tslint
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: |
|
|
||||||
yarn gulp tslint
|
|
||||||
displayName: Run TSLint Checks
|
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
- script: | # {{SQL CARBON EDIT}} add step
|
||||||
yarn strict-null-check
|
yarn strict-null-check
|
||||||
displayName: Run Strict Null Check.
|
displayName: Run Strict Null Check.
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
|
||||||
yarn tslint
|
|
||||||
displayName: Run TSLint (gci)
|
|
||||||
# - script: | {{SQL CARBON EDIT}} remove step
|
# - script: | {{SQL CARBON EDIT}} remove step
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
# displayName: Run Monaco Editor Checks
|
# displayName: Run Monaco Editor Checks
|
||||||
|
- script: |
|
||||||
|
yarn valid-layers-check
|
||||||
|
displayName: Run Valid Layers Checks
|
||||||
- script: |
|
- script: |
|
||||||
yarn compile
|
yarn compile
|
||||||
displayName: Compile Sources
|
displayName: Compile Sources
|
||||||
|
|||||||
@@ -32,20 +32,17 @@ steps:
|
|||||||
yarn electron x64
|
yarn electron x64
|
||||||
displayName: Download Electron
|
displayName: Download Electron
|
||||||
- script: |
|
- script: |
|
||||||
yarn gulp hygiene --skip-tslint
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: |
|
|
||||||
yarn gulp tslint
|
|
||||||
displayName: Run TSLint Checks
|
|
||||||
- script: | # {{SQL CARBON EDIT}} add gci checks
|
|
||||||
yarn tslint
|
|
||||||
displayName: Run TSLint (gci)
|
|
||||||
- script: | # {{SQL CARBON EDIT}} add strict null check
|
- script: | # {{SQL CARBON EDIT}} add strict null check
|
||||||
yarn strict-null-check
|
yarn strict-null-check
|
||||||
displayName: Run Strict Null Check
|
displayName: Run Strict Null Check
|
||||||
# - script: | {{SQL CARBON EDIT}} remove monaco editor checks
|
# - script: | {{SQL CARBON EDIT}} remove monaco editor checks
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
# displayName: Run Monaco Editor Checks
|
# displayName: Run Monaco Editor Checks
|
||||||
|
- script: |
|
||||||
|
yarn valid-layers-check
|
||||||
|
displayName: Run Valid Layers Checks
|
||||||
- script: |
|
- script: |
|
||||||
yarn compile
|
yarn compile
|
||||||
displayName: Compile Sources
|
displayName: Compile Sources
|
||||||
|
|||||||
@@ -88,10 +88,10 @@ steps:
|
|||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
set -e
|
||||||
yarn gulp hygiene --skip-tslint
|
yarn gulp hygiene
|
||||||
yarn gulp tslint
|
|
||||||
yarn monaco-compile-check
|
yarn monaco-compile-check
|
||||||
displayName: Run hygiene, tslint and monaco compile checks
|
yarn valid-layers-check
|
||||||
|
displayName: Run hygiene, monaco compile & valid layers checks
|
||||||
condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
|
|||||||
@@ -87,8 +87,9 @@ steps:
|
|||||||
|
|
||||||
- script: |
|
- script: |
|
||||||
set -e
|
set -e
|
||||||
yarn gulp hygiene --skip-tslint
|
yarn gulp hygiene
|
||||||
yarn gulp tslint
|
yarn strict-null-check
|
||||||
|
yarn valid-layers-check
|
||||||
displayName: Run hygiene, tslint
|
displayName: Run hygiene, tslint
|
||||||
condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
condition: and(succeeded(), ne(variables['CacheRestored-Compilation'], 'true'), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
|
||||||
|
|
||||||
|
|||||||
@@ -29,20 +29,17 @@ steps:
|
|||||||
- powershell: |
|
- powershell: |
|
||||||
yarn electron
|
yarn electron
|
||||||
- script: |
|
- script: |
|
||||||
yarn gulp hygiene --skip-tslint
|
yarn gulp hygiene
|
||||||
displayName: Run Hygiene Checks
|
displayName: Run Hygiene Checks
|
||||||
- script: |
|
|
||||||
yarn gulp tslint
|
|
||||||
displayName: Run TSLint Checks
|
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
|
||||||
yarn tslint
|
|
||||||
displayName: Run TSLint (gci)
|
|
||||||
- script: | # {{SQL CARBON EDIT}} add step
|
- script: | # {{SQL CARBON EDIT}} add step
|
||||||
yarn strict-null-check
|
yarn strict-null-check
|
||||||
displayName: Run Strict Null Check
|
displayName: Run Strict Null Check
|
||||||
# - powershell: | {{SQL CARBON EDIT}} remove step
|
# - powershell: | {{SQL CARBON EDIT}} remove step
|
||||||
# yarn monaco-compile-check
|
# yarn monaco-compile-check
|
||||||
# displayName: Run Monaco Editor Checks
|
# displayName: Run Monaco Editor Checks
|
||||||
|
- script: |
|
||||||
|
yarn valid-layers-check
|
||||||
|
displayName: Run Valid Layers Checks
|
||||||
- powershell: |
|
- powershell: |
|
||||||
yarn compile
|
yarn compile
|
||||||
displayName: Compile Sources
|
displayName: Compile Sources
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ const compilation = require('./lib/compilation');
|
|||||||
const monacoapi = require('./monaco/api');
|
const monacoapi = require('./monaco/api');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
|
||||||
var root = path.dirname(__dirname);
|
let root = path.dirname(__dirname);
|
||||||
var sha1 = util.getVersion(root);
|
let sha1 = util.getVersion(root);
|
||||||
var semver = require('./monaco/package.json').version;
|
let semver = require('./monaco/package.json').version;
|
||||||
var headerVersion = semver + '(' + sha1 + ')';
|
let headerVersion = semver + '(' + sha1 + ')';
|
||||||
|
|
||||||
// Build
|
// Build
|
||||||
|
|
||||||
var editorEntryPoints = [
|
let editorEntryPoints = [
|
||||||
{
|
{
|
||||||
name: 'vs/editor/editor.main',
|
name: 'vs/editor/editor.main',
|
||||||
include: [],
|
include: [],
|
||||||
@@ -40,11 +40,11 @@ var editorEntryPoints = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
var editorResources = [
|
let editorResources = [
|
||||||
'out-editor-build/vs/base/browser/ui/codiconLabel/**/*.ttf'
|
'out-editor-build/vs/base/browser/ui/codiconLabel/**/*.ttf'
|
||||||
];
|
];
|
||||||
|
|
||||||
var BUNDLED_FILE_HEADER = [
|
let BUNDLED_FILE_HEADER = [
|
||||||
'/*!-----------------------------------------------------------',
|
'/*!-----------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
' * Version: ' + headerVersion,
|
' * Version: ' + headerVersion,
|
||||||
@@ -197,7 +197,7 @@ const compileEditorESMTask = task.define('compile-editor-esm', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function toExternalDTS(contents) {
|
function toExternalDTS(contents) {
|
||||||
let lines = contents.split('\n');
|
let lines = contents.split(/\r\n|\r|\n/);
|
||||||
let killNextCloseCurlyBrace = false;
|
let killNextCloseCurlyBrace = false;
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
let line = lines[i];
|
let line = lines[i];
|
||||||
@@ -263,7 +263,7 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
|
|||||||
// package.json
|
// package.json
|
||||||
gulp.src('build/monaco/package.json')
|
gulp.src('build/monaco/package.json')
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
var json = JSON.parse(data.contents.toString());
|
let json = JSON.parse(data.contents.toString());
|
||||||
json.private = false;
|
json.private = false;
|
||||||
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
|
data.contents = Buffer.from(JSON.stringify(json, null, ' '));
|
||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
@@ -307,10 +307,10 @@ const finalEditorResourcesTask = task.define('final-editor-resources', () => {
|
|||||||
return;
|
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();
|
let strContents = data.contents.toString();
|
||||||
var newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
let newStr = '//# sourceMappingURL=' + relativePathToMap.replace(/\\/g, '/');
|
||||||
strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr);
|
strContents = strContents.replace(/\/\/# sourceMappingURL=[^ ]+$/, newStr);
|
||||||
|
|
||||||
data.contents = Buffer.from(strContents);
|
data.contents = Buffer.from(strContents);
|
||||||
@@ -353,6 +353,13 @@ gulp.task('editor-distro',
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
gulp.task('monacodts', task.define('monacodts', () => {
|
||||||
|
const result = monacoapi.execute();
|
||||||
|
fs.writeFileSync(result.filePath, result.content);
|
||||||
|
fs.writeFileSync(path.join(root, 'src/vs/editor/common/standalone/standaloneEnums.ts'), result.enums);
|
||||||
|
return Promise.resolve(true);
|
||||||
|
}));
|
||||||
|
|
||||||
//#region monaco type checking
|
//#region monaco type checking
|
||||||
|
|
||||||
function createTscCompileTask(watch) {
|
function createTscCompileTask(watch) {
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
const filter = require('gulp-filter');
|
const filter = require('gulp-filter');
|
||||||
const es = require('event-stream');
|
const es = require('event-stream');
|
||||||
const gulptslint = require('gulp-tslint');
|
|
||||||
const gulpeslint = require('gulp-eslint');
|
const gulpeslint = require('gulp-eslint');
|
||||||
const tsfmt = require('typescript-formatter');
|
const tsfmt = require('typescript-formatter');
|
||||||
const tslint = require('tslint');
|
|
||||||
const VinylFile = require('vinyl');
|
const VinylFile = require('vinyl');
|
||||||
const vfs = require('vinyl-fs');
|
const vfs = require('vinyl-fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
@@ -87,7 +85,7 @@ const indentationFilter = [
|
|||||||
'!src/typings/**/*.d.ts',
|
'!src/typings/**/*.d.ts',
|
||||||
'!extensions/**/*.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}',
|
'!**/*.{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/**/*.sh',
|
||||||
'!build/azure-pipelines/**/*.js',
|
'!build/azure-pipelines/**/*.js',
|
||||||
'!build/azure-pipelines/**/*.config',
|
'!build/azure-pipelines/**/*.config',
|
||||||
@@ -173,7 +171,7 @@ const copyrightFilter = [
|
|||||||
'!**/*.bacpac'
|
'!**/*.bacpac'
|
||||||
];
|
];
|
||||||
|
|
||||||
const eslintFilter = [
|
const jsHygieneFilter = [
|
||||||
'src/**/*.js',
|
'src/**/*.js',
|
||||||
'build/gulpfile.*.js',
|
'build/gulpfile.*.js',
|
||||||
'!src/vs/loader.js',
|
'!src/vs/loader.js',
|
||||||
@@ -186,7 +184,10 @@ const eslintFilter = [
|
|||||||
'!**/test/**'
|
'!**/test/**'
|
||||||
];
|
];
|
||||||
|
|
||||||
const tslintBaseFilter = [
|
const tsHygieneFilter = [
|
||||||
|
'src/**/*.ts',
|
||||||
|
'test/**/*.ts',
|
||||||
|
'extensions/**/*.ts',
|
||||||
'!**/fixtures/**',
|
'!**/fixtures/**',
|
||||||
'!**/typings/**',
|
'!**/typings/**',
|
||||||
'!**/node_modules/**',
|
'!**/node_modules/**',
|
||||||
@@ -197,68 +198,17 @@ const tslintBaseFilter = [
|
|||||||
'!extensions/html-language-features/server/lib/jquery.d.ts',
|
'!extensions/html-language-features/server/lib/jquery.d.ts',
|
||||||
'!extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts', // {{SQL CARBON EDIT}},
|
'!extensions/big-data-cluster/src/bigDataCluster/controller/apiGenerated.ts', // {{SQL CARBON EDIT}},
|
||||||
'!extensions/big-data-cluster/src/bigDataCluster/controller/tokenApiGenerated.ts', // {{SQL CARBON EDIT}},
|
'!extensions/big-data-cluster/src/bigDataCluster/controller/tokenApiGenerated.ts', // {{SQL CARBON EDIT}},
|
||||||
'!src/vs/workbench/services/themes/common/textMateScopeMatcher.ts' // {{SQL CARBON EDIT}} skip this because we have no plans on touching this and its not ours
|
'!src/vs/workbench/services/themes/common/textMateScopeMatcher.ts', // {{SQL CARBON EDIT}} skip this because we have no plans on touching this and its not ours
|
||||||
|
'!src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts' // {{SQL CARBON EDIT}} skip this because known issue
|
||||||
];
|
];
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}}
|
const sqlHygieneFilter = [ // for rules we want to only apply to our code
|
||||||
const sqlFilter = [
|
'src/sql/**/*.ts',
|
||||||
'src/sql/**',
|
'!**/node_modules/**',
|
||||||
'extensions/**',
|
|
||||||
// Ignore VS Code extensions
|
|
||||||
'!extensions/bat/**',
|
|
||||||
'!extensions/configuration-editing/**',
|
|
||||||
'!extensions/docker/**',
|
|
||||||
'!extensions/extension-editing/**',
|
|
||||||
'!extensions/git/**',
|
|
||||||
'!extensions/git-ui/**',
|
|
||||||
'!extensions/image-preview/**',
|
|
||||||
'!extensions/insights-default/**',
|
|
||||||
'!extensions/json/**',
|
|
||||||
'!extensions/json-language-features/**',
|
|
||||||
'!extensions/markdown-basics/**',
|
|
||||||
'!extensions/markdown-language-features/**',
|
|
||||||
'!extensions/merge-conflict/**',
|
|
||||||
'!extensions/powershell/**',
|
|
||||||
'!extensions/python/**',
|
|
||||||
'!extensions/r/**',
|
|
||||||
'!extensions/theme-*/**',
|
|
||||||
'!extensions/vscode-*/**',
|
|
||||||
'!extensions/xml/**',
|
|
||||||
'!extensions/xml-language-features/**',
|
|
||||||
'!extensions/yarml/**',
|
|
||||||
];
|
|
||||||
|
|
||||||
const tslintCoreFilter = [
|
|
||||||
'src/**/*.ts',
|
|
||||||
'test/**/*.ts',
|
|
||||||
'!extensions/**/*.ts',
|
|
||||||
'!test/automation/**',
|
|
||||||
'!test/smoke/**',
|
|
||||||
...tslintBaseFilter
|
|
||||||
];
|
|
||||||
|
|
||||||
const tslintExtensionsFilter = [
|
|
||||||
'extensions/**/*.ts',
|
'extensions/**/*.ts',
|
||||||
'!src/**/*.ts',
|
'!extensions/{git,search-result,vscode-test-resolver,extension-editing,json-language-features,vscode-colorize-tests}/**/*.ts',
|
||||||
'!test/**/*.ts',
|
|
||||||
'test/automation/**/*.ts',
|
|
||||||
...tslintBaseFilter
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const tslintHygieneFilter = [
|
|
||||||
'src/**/*.ts',
|
|
||||||
'test/**/*.ts',
|
|
||||||
'extensions/**/*.ts',
|
|
||||||
'!src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts', // {{SQL CARBON EDIT}} known formatting issue do to commenting out code
|
|
||||||
...tslintBaseFilter
|
|
||||||
];
|
|
||||||
|
|
||||||
const fileLengthFilter = filter([
|
|
||||||
'**',
|
|
||||||
'!extensions/import/*.docx',
|
|
||||||
'!extensions/admin-tool-ext-win/license/**'
|
|
||||||
], {restore: true});
|
|
||||||
|
|
||||||
const copyrightHeaderLines = [
|
const copyrightHeaderLines = [
|
||||||
'/*---------------------------------------------------------------------------------------------',
|
'/*---------------------------------------------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
@@ -268,27 +218,17 @@ const copyrightHeaderLines = [
|
|||||||
|
|
||||||
gulp.task('eslint', () => {
|
gulp.task('eslint', () => {
|
||||||
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
return vfs.src(all, { base: '.', follow: true, allowEmpty: true })
|
||||||
.pipe(filter(eslintFilter))
|
.pipe(filter(jsHygieneFilter.concat(tsHygieneFilter)))
|
||||||
.pipe(gulpeslint('src/.eslintrc'))
|
.pipe(gulpeslint({
|
||||||
|
configFile: '.eslintrc.json',
|
||||||
|
rulePaths: ['./build/lib/eslint']
|
||||||
|
}))
|
||||||
.pipe(gulpeslint.formatEach('compact'))
|
.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', () => {
|
}
|
||||||
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) {
|
function checkPackageJSON(actualPath) {
|
||||||
@@ -377,8 +317,6 @@ function hygiene(some) {
|
|||||||
replace: undefined,
|
replace: undefined,
|
||||||
tsconfig: undefined,
|
tsconfig: undefined,
|
||||||
tsconfigFile: undefined,
|
tsconfigFile: undefined,
|
||||||
tslint: undefined,
|
|
||||||
tslintFile: undefined,
|
|
||||||
tsfmtFile: undefined,
|
tsfmtFile: undefined,
|
||||||
vscode: undefined,
|
vscode: undefined,
|
||||||
vscodeFile: undefined
|
vscodeFile: undefined
|
||||||
@@ -387,7 +325,7 @@ function hygiene(some) {
|
|||||||
let formatted = result.dest.replace(/\r\n/gm, '\n');
|
let formatted = result.dest.replace(/\r\n/gm, '\n');
|
||||||
|
|
||||||
if (original !== formatted) {
|
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++;
|
errorCount++;
|
||||||
}
|
}
|
||||||
cb(null, file);
|
cb(null, file);
|
||||||
@@ -397,33 +335,6 @@ function hygiene(some) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const filelength = es.through(function (file) {
|
|
||||||
|
|
||||||
const fileName = path.basename(file.relative);
|
|
||||||
const fileDir = path.dirname(file.relative);
|
|
||||||
//check the filename is < 50 characters (basename gets the filename with extension).
|
|
||||||
if (fileName.length > 50) {
|
|
||||||
console.error(`File name '${fileName}' under ${fileDir} is too long. Rename file to have less than 50 characters.`);
|
|
||||||
errorCount++;
|
|
||||||
}
|
|
||||||
if (file.relative.length > 150) {
|
|
||||||
console.error(`File path ${file.relative} exceeds acceptable file-length. Rename the path to have less than 150 characters.`);
|
|
||||||
errorCount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emit('data', file);
|
|
||||||
});
|
|
||||||
|
|
||||||
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;
|
let input;
|
||||||
|
|
||||||
if (Array.isArray(some) || typeof some === 'string' || !some) {
|
if (Array.isArray(some) || typeof some === 'string' || !some) {
|
||||||
@@ -437,22 +348,9 @@ function hygiene(some) {
|
|||||||
input = some;
|
input = some;
|
||||||
}
|
}
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} Linting for SQL
|
|
||||||
const tslintSqlConfiguration = tslint.Configuration.findConfiguration('tslint-sql.json', '.');
|
|
||||||
const tslintSqlOptions = { fix: false, formatter: 'json' };
|
|
||||||
const sqlTsLinter = new tslint.Linter(tslintSqlOptions);
|
|
||||||
|
|
||||||
const sqlTsl = es.through(function (file) { //TODO restore
|
|
||||||
const contents = file.contents.toString('utf8');
|
|
||||||
sqlTsLinter.lint(file.relative, contents, tslintSqlConfiguration.results);
|
|
||||||
});
|
|
||||||
|
|
||||||
const productJsonFilter = filter('product.json', { restore: true });
|
const productJsonFilter = filter('product.json', { restore: true });
|
||||||
|
|
||||||
const result = input
|
const result = input
|
||||||
.pipe(fileLengthFilter)
|
|
||||||
.pipe(filelength)
|
|
||||||
.pipe(fileLengthFilter.restore)
|
|
||||||
.pipe(filter(f => !f.stat.isDirectory()))
|
.pipe(filter(f => !f.stat.isDirectory()))
|
||||||
.pipe(productJsonFilter)
|
.pipe(productJsonFilter)
|
||||||
.pipe(process.env['BUILD_SOURCEVERSION'] ? es.through() : productJson)
|
.pipe(process.env['BUILD_SOURCEVERSION'] ? es.through() : productJson)
|
||||||
@@ -462,25 +360,36 @@ function hygiene(some) {
|
|||||||
.pipe(filter(copyrightFilter))
|
.pipe(filter(copyrightFilter))
|
||||||
.pipe(copyrights);
|
.pipe(copyrights);
|
||||||
|
|
||||||
let typescript = result
|
const typescript = result
|
||||||
.pipe(filter(tslintHygieneFilter))
|
.pipe(filter(tsHygieneFilter))
|
||||||
.pipe(formatting);
|
.pipe(formatting);
|
||||||
|
|
||||||
if (!process.argv.some(arg => arg === '--skip-tslint')) {
|
|
||||||
typescript = typescript.pipe(tsl);
|
|
||||||
typescript = typescript
|
|
||||||
.pipe(filter(sqlFilter)) // {{SQL CARBON EDIT}}
|
|
||||||
.pipe(sqlTsl);
|
|
||||||
}
|
|
||||||
|
|
||||||
const javascript = result
|
const javascript = result
|
||||||
.pipe(filter(eslintFilter))
|
.pipe(filter(jsHygieneFilter.concat(tsHygieneFilter)))
|
||||||
.pipe(gulpeslint('src/.eslintrc'))
|
.pipe(gulpeslint({
|
||||||
|
configFile: '.eslintrc.json',
|
||||||
|
rulePaths: ['./build/lib/eslint']
|
||||||
|
}))
|
||||||
.pipe(gulpeslint.formatEach('compact'))
|
.pipe(gulpeslint.formatEach('compact'))
|
||||||
.pipe(gulpeslint.failAfterError());
|
.pipe(gulpeslint.results(results => {
|
||||||
|
errorCount += results.warningCount;
|
||||||
|
errorCount += results.errorCount;
|
||||||
|
}));
|
||||||
|
|
||||||
|
const sqlJavascript = result
|
||||||
|
.pipe(filter(sqlHygieneFilter))
|
||||||
|
.pipe(gulpeslint({
|
||||||
|
configFile: '.eslintrc.sql.json',
|
||||||
|
rulePaths: ['./build/lib/eslint']
|
||||||
|
}))
|
||||||
|
.pipe(gulpeslint.formatEach('compact'))
|
||||||
|
.pipe(gulpeslint.results(results => {
|
||||||
|
errorCount += results.warningCount;
|
||||||
|
errorCount += results.errorCount;
|
||||||
|
}));
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
return es.merge(typescript, javascript)
|
return es.merge(typescript, javascript, sqlJavascript)
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
count++;
|
count++;
|
||||||
if (process.env['TRAVIS'] && count % 10 === 0) {
|
if (process.env['TRAVIS'] && count % 10 === 0) {
|
||||||
@@ -489,33 +398,6 @@ function hygiene(some) {
|
|||||||
this.emit('data', data);
|
this.emit('data', data);
|
||||||
}, function () {
|
}, function () {
|
||||||
process.stdout.write('\n');
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sqlTslintResult = sqlTsLinter.getResult();
|
|
||||||
if (sqlTslintResult.failures.length > 0) {
|
|
||||||
for (const failure of sqlTslintResult.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 += sqlTslintResult.failures.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorCount > 0) {
|
if (errorCount > 0) {
|
||||||
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
this.emit('error', 'Hygiene failed with ' + errorCount + ' errors. Check \'build/gulpfile.hygiene.js\'.');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function mixinServer(watch) {
|
|||||||
const packageJSONPath = path.join(path.dirname(__dirname), 'package.json');
|
const packageJSONPath = path.join(path.dirname(__dirname), 'package.json');
|
||||||
function exec(cmdLine) {
|
function exec(cmdLine) {
|
||||||
console.log(cmdLine);
|
console.log(cmdLine);
|
||||||
cp.execSync(cmdLine, { stdio: "inherit" });
|
cp.execSync(cmdLine, { stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
function checkout() {
|
function checkout() {
|
||||||
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString());
|
const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath).toString());
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ function installService() {
|
|||||||
let runtime = p.runtimeId;
|
let runtime = p.runtimeId;
|
||||||
// fix path since it won't be correct
|
// fix path since it won't be correct
|
||||||
config.installDirectory = path.join(__dirname, '../extensions/mssql/src', config.installDirectory);
|
config.installDirectory = path.join(__dirname, '../extensions/mssql/src', config.installDirectory);
|
||||||
var installer = new serviceDownloader(config);
|
let installer = new serviceDownloader(config);
|
||||||
let serviceInstallFolder = installer.getInstallDirectory(runtime);
|
let serviceInstallFolder = installer.getInstallDirectory(runtime);
|
||||||
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
console.log('Cleaning up the install folder: ' + serviceInstallFolder);
|
||||||
return del(serviceInstallFolder + '/*').then(() => {
|
return del(serviceInstallFolder + '/*').then(() => {
|
||||||
@@ -123,7 +123,7 @@ gulp.task('install-ssmsmin', () => {
|
|||||||
const runtime = 'Windows_64'; // admin-tool-ext is a windows only extension, and we only ship a 64 bit version, so locking the binaries as such
|
const runtime = 'Windows_64'; // admin-tool-ext is a windows only extension, and we only ship a 64 bit version, so locking the binaries as such
|
||||||
// fix path since it won't be correct
|
// fix path since it won't be correct
|
||||||
config.installDirectory = path.join(__dirname, '..', 'extensions', 'admin-tool-ext-win', config.installDirectory);
|
config.installDirectory = path.join(__dirname, '..', 'extensions', 'admin-tool-ext-win', config.installDirectory);
|
||||||
var installer = new serviceDownloader(config);
|
let installer = new serviceDownloader(config);
|
||||||
const serviceInstallFolder = installer.getInstallDirectory(runtime);
|
const serviceInstallFolder = installer.getInstallDirectory(runtime);
|
||||||
const serviceCleanupFolder = path.join(serviceInstallFolder, '..');
|
const serviceCleanupFolder = path.join(serviceInstallFolder, '..');
|
||||||
console.log('Cleaning up the install folder: ' + serviceCleanupFolder);
|
console.log('Cleaning up the install folder: ' + serviceCleanupFolder);
|
||||||
|
|||||||
@@ -150,9 +150,9 @@ gulp.task(minifyVSCodeTask);
|
|||||||
* @return {Object} A map of paths to checksums.
|
* @return {Object} A map of paths to checksums.
|
||||||
*/
|
*/
|
||||||
function computeChecksums(out, filenames) {
|
function computeChecksums(out, filenames) {
|
||||||
var result = {};
|
let result = {};
|
||||||
filenames.forEach(function (filename) {
|
filenames.forEach(function (filename) {
|
||||||
var fullPath = path.join(process.cwd(), out, filename);
|
let fullPath = path.join(process.cwd(), out, filename);
|
||||||
result[filename] = computeChecksum(fullPath);
|
result[filename] = computeChecksum(fullPath);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
@@ -165,9 +165,9 @@ function computeChecksums(out, filenames) {
|
|||||||
* @return {string} The checksum for `filename`.
|
* @return {string} The checksum for `filename`.
|
||||||
*/
|
*/
|
||||||
function computeChecksum(filename) {
|
function computeChecksum(filename) {
|
||||||
var contents = fs.readFileSync(filename);
|
let contents = fs.readFileSync(filename);
|
||||||
|
|
||||||
var hash = crypto
|
let hash = crypto
|
||||||
.createHash('md5')
|
.createHash('md5')
|
||||||
.update(contents)
|
.update(contents)
|
||||||
.digest('base64')
|
.digest('base64')
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const commit = util.getVersion(root);
|
|||||||
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
const linuxPackageRevision = Math.floor(new Date().getTime() / 1000);
|
||||||
|
|
||||||
function getDebPackageArch(arch) {
|
function getDebPackageArch(arch) {
|
||||||
return { x64: 'amd64', arm: 'armhf', arm64: "arm64" }[arch];
|
return { x64: 'amd64', arm: 'armhf', arm64: 'arm64' }[arch];
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareDebPackage(arch) {
|
function prepareDebPackage(arch) {
|
||||||
@@ -118,7 +118,7 @@ function getRpmBuildPath(rpmArch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getRpmPackageArch(arch) {
|
function getRpmPackageArch(arch) {
|
||||||
return { x64: 'x86_64', arm: 'armhf', arm64: "arm64" }[arch];
|
return { x64: 'x86_64', arm: 'armhf', arm64: 'arm64' }[arch];
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareRpmPackage(arch) {
|
function prepareRpmPackage(arch) {
|
||||||
|
|||||||
59
build/lib/eslint/code-import-patterns.js
Normal file
59
build/lib/eslint/code-import-patterns.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
const path_1 = require("path");
|
||||||
|
const minimatch = require("minimatch");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
module.exports = new class {
|
||||||
|
constructor() {
|
||||||
|
this.meta = {
|
||||||
|
messages: {
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
create(context) {
|
||||||
|
const configs = context.options;
|
||||||
|
for (const config of configs) {
|
||||||
|
if (minimatch(context.getFilename(), config.target)) {
|
||||||
|
return utils_1.createImportRuleListener((node, value) => this._checkImport(context, config, node, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
_checkImport(context, config, node, path) {
|
||||||
|
// 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'badImport',
|
||||||
|
data: {
|
||||||
|
restrictions: restrictions.join(' or ')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
75
build/lib/eslint/code-import-patterns.ts
Normal file
75
build/lib/eslint/code-import-patterns.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||||
|
import { join } from 'path';
|
||||||
|
import * as minimatch from 'minimatch';
|
||||||
|
import { createImportRuleListener } from './utils';
|
||||||
|
|
||||||
|
interface ImportPatternsConfig {
|
||||||
|
target: string;
|
||||||
|
restrictions: string | string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export = new class implements eslint.Rule.RuleModule {
|
||||||
|
|
||||||
|
readonly meta: eslint.Rule.RuleMetaData = {
|
||||||
|
messages: {
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
|
||||||
|
|
||||||
|
const configs = <ImportPatternsConfig[]>context.options;
|
||||||
|
|
||||||
|
for (const config of configs) {
|
||||||
|
if (minimatch(context.getFilename(), config.target)) {
|
||||||
|
return createImportRuleListener((node, value) => this._checkImport(context, config, node, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
private _checkImport(context: eslint.Rule.RuleContext, config: ImportPatternsConfig, node: TSESTree.Node, path: string) {
|
||||||
|
|
||||||
|
// 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'badImport',
|
||||||
|
data: {
|
||||||
|
restrictions: restrictions.join(' or ')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
68
build/lib/eslint/code-layering.js
Normal file
68
build/lib/eslint/code-layering.js
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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 = {
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
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 utils_1.createImportRuleListener((node, path) => {
|
||||||
|
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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'layerbreaker',
|
||||||
|
data: {
|
||||||
|
from: part,
|
||||||
|
allowed: [...config.allowed.keys()].join(', ')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
83
build/lib/eslint/code-layering.ts
Normal file
83
build/lib/eslint/code-layering.ts
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { join, dirname } from 'path';
|
||||||
|
import { createImportRuleListener } from './utils';
|
||||||
|
|
||||||
|
type Config = {
|
||||||
|
allowed: Set<string>;
|
||||||
|
disallowed: Set<string>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export = new class implements eslint.Rule.RuleModule {
|
||||||
|
|
||||||
|
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'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
create(context: eslint.Rule.RuleContext): eslint.Rule.RuleListener {
|
||||||
|
|
||||||
|
const fileDirname = dirname(context.getFilename());
|
||||||
|
const parts = fileDirname.split(/\\|\//);
|
||||||
|
const ruleArgs = <Record<string, string[]>>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 createImportRuleListener((node, path) => {
|
||||||
|
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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'layerbreaker',
|
||||||
|
data: {
|
||||||
|
from: part,
|
||||||
|
allowed: [...config!.allowed.keys()].join(', ')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
38
build/lib/eslint/code-no-nls-in-standalone-editor.js
Normal file
38
build/lib/eslint/code-no-nls-in-standalone-editor.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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 = {
|
||||||
|
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 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'noNls'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
48
build/lib/eslint/code-no-nls-in-standalone-editor.ts
Normal file
48
build/lib/eslint/code-no-nls-in-standalone-editor.ts
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { createImportRuleListener } from './utils';
|
||||||
|
|
||||||
|
export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule {
|
||||||
|
|
||||||
|
readonly meta: eslint.Rule.RuleMetaData = {
|
||||||
|
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 createImportRuleListener((node, path) => {
|
||||||
|
// resolve relative paths
|
||||||
|
if (path[0] === '.') {
|
||||||
|
path = join(context.getFilename(), path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
/vs(\/|\\)nls/.test(path)
|
||||||
|
) {
|
||||||
|
context.report({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'noNls'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
41
build/lib/eslint/code-no-standalone-editor.js
Normal file
41
build/lib/eslint/code-no-standalone-editor.js
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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 = {
|
||||||
|
messages: {
|
||||||
|
badImport: 'Not allowed to import standalone editor modules.'
|
||||||
|
},
|
||||||
|
docs: {
|
||||||
|
url: 'https://github.com/microsoft/vscode/wiki/Source-Code-Organization'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
create(context) {
|
||||||
|
if (/vs(\/|\\)editor/.test(context.getFilename())) {
|
||||||
|
// the vs/editor folder is allowed to use the standalone editor
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return utils_1.createImportRuleListener((node, path) => {
|
||||||
|
// 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'badImport'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
50
build/lib/eslint/code-no-standalone-editor.ts
Normal file
50
build/lib/eslint/code-no-standalone-editor.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { createImportRuleListener } from './utils';
|
||||||
|
|
||||||
|
export = new class NoNlsInStandaloneEditorRule implements eslint.Rule.RuleModule {
|
||||||
|
|
||||||
|
readonly meta: eslint.Rule.RuleMetaData = {
|
||||||
|
messages: {
|
||||||
|
badImport: 'Not allowed to import standalone editor modules.'
|
||||||
|
},
|
||||||
|
docs: {
|
||||||
|
url: 'https://github.com/microsoft/vscode/wiki/Source-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 createImportRuleListener((node, 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'badImport'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
111
build/lib/eslint/code-no-unexternalized-strings.js
Normal file
111
build/lib/eslint/code-no-unexternalized-strings.js
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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 = {
|
||||||
|
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),
|
||||||
|
['ExpressionStatement[directive] Literal:exit']: (node) => doubleQuotedStringLiterals.delete(node),
|
||||||
|
['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][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);
|
||||||
126
build/lib/eslint/code-no-unexternalized-strings.ts
Normal file
126
build/lib/eslint/code-no-unexternalized-strings.ts
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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: 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.',
|
||||||
|
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<string, { call: TSESTree.CallExpression, message: TSESTree.Node }[]>();
|
||||||
|
const doubleQuotedStringLiterals = new Set<TSESTree.Node>();
|
||||||
|
|
||||||
|
function collectDoubleQuotedStrings(node: TSESTree.Literal) {
|
||||||
|
if (isStringLiteral(node) && isDoubleQuoted(node)) {
|
||||||
|
doubleQuotedStringLiterals.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function visitLocalizeCall(node: TSESTree.CallExpression) {
|
||||||
|
|
||||||
|
// localize(key, message)
|
||||||
|
const [keyNode, messageNode] = (<TSESTree.CallExpression>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(<any>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(<any>values[i - 1].message) !== context.getSourceCode().getText(<any>values[i].message)) {
|
||||||
|
context.report({ loc: values[i].call.loc, messageId: 'duplicateKey', data: { key } });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
['Literal']: (node: any) => collectDoubleQuotedStrings(node),
|
||||||
|
['ExpressionStatement[directive] Literal:exit']: (node: any) => doubleQuotedStringLiterals.delete(node),
|
||||||
|
['CallExpression[callee.type="MemberExpression"][callee.object.name="nls"][callee.property.name="localize"]:exit']: (node: any) => visitLocalizeCall(node),
|
||||||
|
['CallExpression[callee.name="localize"][arguments.length>=2]:exit']: (node: any) => visitLocalizeCall(node),
|
||||||
|
['Program:exit']: reportBadStringsAndBadKeys,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
145
build/lib/eslint/code-no-unused-expressions.js
Normal file
145
build/lib/eslint/code-no-unused-expressions.js
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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.' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
57
build/lib/eslint/code-translation-remind.js
Normal file
57
build/lib/eslint/code-translation-remind.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
var _a;
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const utils_1 = require("./utils");
|
||||||
|
module.exports = new (_a = class TranslationRemind {
|
||||||
|
constructor() {
|
||||||
|
this.meta = {
|
||||||
|
messages: {
|
||||||
|
missing: 'Please add \'{{resource}}\' to ./build/lib/i18n.resources.json file to use translations here.'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
create(context) {
|
||||||
|
return utils_1.createImportRuleListener((node, path) => this._checkImport(context, node, path));
|
||||||
|
}
|
||||||
|
_checkImport(context, node, path) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (!resourceDefined) {
|
||||||
|
context.report({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'missing',
|
||||||
|
data: { resource }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_a.NLS_MODULE = 'vs/nls',
|
||||||
|
_a);
|
||||||
67
build/lib/eslint/code-translation-remind.ts
Normal file
67
build/lib/eslint/code-translation-remind.ts
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import { createImportRuleListener } from './utils';
|
||||||
|
|
||||||
|
|
||||||
|
export = new class TranslationRemind implements eslint.Rule.RuleModule {
|
||||||
|
|
||||||
|
private static NLS_MODULE = 'vs/nls';
|
||||||
|
|
||||||
|
readonly meta: eslint.Rule.RuleMetaData = {
|
||||||
|
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 createImportRuleListener((node, path) => this._checkImport(context, node, path));
|
||||||
|
}
|
||||||
|
|
||||||
|
private _checkImport(context: eslint.Rule.RuleContext, node: TSESTree.Node, path: string) {
|
||||||
|
|
||||||
|
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 = 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({
|
||||||
|
loc: node.loc,
|
||||||
|
messageId: 'missing',
|
||||||
|
data: { resource }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
36
build/lib/eslint/utils.js
Normal file
36
build/lib/eslint/utils.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. 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(...) OR await import('module')
|
||||||
|
['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node) => {
|
||||||
|
_checkImport(node);
|
||||||
|
},
|
||||||
|
// import foo = ...
|
||||||
|
['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node) => {
|
||||||
|
_checkImport(node);
|
||||||
|
},
|
||||||
|
// export ?? from 'module'
|
||||||
|
ExportAllDeclaration: (node) => {
|
||||||
|
_checkImport(node.source);
|
||||||
|
},
|
||||||
|
// export {foo} from 'module'
|
||||||
|
ExportNamedDeclaration: (node) => {
|
||||||
|
_checkImport(node.source);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.createImportRuleListener = createImportRuleListener;
|
||||||
40
build/lib/eslint/utils.ts
Normal file
40
build/lib/eslint/utils.ts
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as eslint from 'eslint';
|
||||||
|
import { TSESTree } from '@typescript-eslint/experimental-utils';
|
||||||
|
|
||||||
|
export function createImportRuleListener(validateImport: (node: TSESTree.Literal, value: string) => any): eslint.Rule.RuleListener {
|
||||||
|
|
||||||
|
function _checkImport(node: TSESTree.Node | null) {
|
||||||
|
if (node && node.type === 'Literal' && typeof node.value === 'string') {
|
||||||
|
validateImport(node, node.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
// import ??? from 'module'
|
||||||
|
ImportDeclaration: (node: any) => {
|
||||||
|
_checkImport((<TSESTree.ImportDeclaration>node).source);
|
||||||
|
},
|
||||||
|
// import('module').then(...) OR await import('module')
|
||||||
|
['CallExpression[callee.type="Import"][arguments.length=1] > Literal']: (node: any) => {
|
||||||
|
_checkImport(node);
|
||||||
|
},
|
||||||
|
// import foo = ...
|
||||||
|
['TSImportEqualsDeclaration > TSExternalModuleReference > Literal']: (node: any) => {
|
||||||
|
_checkImport(node);
|
||||||
|
},
|
||||||
|
// export ?? from 'module'
|
||||||
|
ExportAllDeclaration: (node: any) => {
|
||||||
|
_checkImport((<TSESTree.ExportAllDeclaration>node).source);
|
||||||
|
},
|
||||||
|
// export {foo} from 'module'
|
||||||
|
ExportNamedDeclaration: (node: any) => {
|
||||||
|
_checkImport((<TSESTree.ExportNamedDeclaration>node).source);
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -30,6 +30,14 @@
|
|||||||
"name": "vs/workbench/api/common",
|
"name": "vs/workbench/api/common",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/contrib/backup",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/contrib/bulkEdit",
|
||||||
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "vs/workbench/contrib/cli",
|
"name": "vs/workbench/contrib/cli",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
@@ -309,6 +317,10 @@
|
|||||||
{
|
{
|
||||||
"name": "vs/workbench/services/userData",
|
"name": "vs/workbench/services/userData",
|
||||||
"project": "vscode-workbench"
|
"project": "vscode-workbench"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vs/workbench/services/userDataSync",
|
||||||
|
"project": "vscode-workbench"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
209
build/lib/layersChecker.js
Normal file
209
build/lib/layersChecker.js
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
"use strict";
|
||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const ts = require("typescript");
|
||||||
|
const fs_1 = require("fs");
|
||||||
|
const path_1 = require("path");
|
||||||
|
const minimatch_1 = require("minimatch");
|
||||||
|
//
|
||||||
|
// #############################################################################################
|
||||||
|
//
|
||||||
|
// A custom typescript checker for the specific task of detecting the use of certain types in a
|
||||||
|
// layer that does not allow such use. For example:
|
||||||
|
// - using DOM globals in common/node/electron-main layer (e.g. HTMLElement)
|
||||||
|
// - using node.js globals in common/browser layer (e.g. process)
|
||||||
|
//
|
||||||
|
// Make changes to below RULES to lift certain files from these checks only if absolutely needed
|
||||||
|
//
|
||||||
|
// #############################################################################################
|
||||||
|
//
|
||||||
|
// Types we assume are present in all implementations of JS VMs (node.js, browsers)
|
||||||
|
// Feel free to add more core types as you see needed if present in node.js and browsers
|
||||||
|
const CORE_TYPES = [
|
||||||
|
'require',
|
||||||
|
'atob',
|
||||||
|
'btoa',
|
||||||
|
'setTimeout',
|
||||||
|
'clearTimeout',
|
||||||
|
'setInterval',
|
||||||
|
'clearInterval',
|
||||||
|
'console',
|
||||||
|
'log',
|
||||||
|
'info',
|
||||||
|
'warn',
|
||||||
|
'error',
|
||||||
|
'group',
|
||||||
|
'groupEnd',
|
||||||
|
'table',
|
||||||
|
'Error',
|
||||||
|
'String',
|
||||||
|
'throws',
|
||||||
|
'stack',
|
||||||
|
'captureStackTrace',
|
||||||
|
'stackTraceLimit',
|
||||||
|
'TextDecoder',
|
||||||
|
'TextEncoder',
|
||||||
|
'encode',
|
||||||
|
'decode',
|
||||||
|
'self',
|
||||||
|
'trimLeft',
|
||||||
|
'trimRight'
|
||||||
|
];
|
||||||
|
const RULES = [
|
||||||
|
// Tests: skip
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/test/**',
|
||||||
|
skip: true // -> skip all test files
|
||||||
|
},
|
||||||
|
// Common: vs/base/common/platform.ts
|
||||||
|
{
|
||||||
|
target: '**/vs/base/common/platform.ts',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
// Safe access to postMessage() and friends
|
||||||
|
'MessageEvent',
|
||||||
|
'data'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts',
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Common: vs/workbench/api/common/extHostExtensionService.ts
|
||||||
|
{
|
||||||
|
target: '**/vs/workbench/api/common/extHostExtensionService.ts',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
// Safe access to global
|
||||||
|
'global'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts',
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Common
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/common/**',
|
||||||
|
allowedTypes: CORE_TYPES,
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts',
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Browser
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/browser/**',
|
||||||
|
allowedTypes: CORE_TYPES,
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// node.js
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/node/**',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
// --> types from node.d.ts that duplicate from lib.dom.d.ts
|
||||||
|
'URL',
|
||||||
|
'protocol',
|
||||||
|
'hostname',
|
||||||
|
'port',
|
||||||
|
'pathname',
|
||||||
|
'search',
|
||||||
|
'username',
|
||||||
|
'password'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts' // no DOM
|
||||||
|
]
|
||||||
|
},
|
||||||
|
// Electron (renderer): skip
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/electron-browser/**',
|
||||||
|
skip: true // -> supports all types
|
||||||
|
},
|
||||||
|
// Electron (main)
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/electron-main/**',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
// --> types from electron.d.ts that duplicate from lib.dom.d.ts
|
||||||
|
'Event',
|
||||||
|
'Request'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts' // no DOM
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
const TS_CONFIG_PATH = path_1.join(__dirname, '../../', 'src', 'tsconfig.json');
|
||||||
|
let hasErrors = false;
|
||||||
|
function checkFile(program, sourceFile, rule) {
|
||||||
|
checkNode(sourceFile);
|
||||||
|
function checkNode(node) {
|
||||||
|
var _a;
|
||||||
|
if (node.kind !== ts.SyntaxKind.Identifier) {
|
||||||
|
return ts.forEachChild(node, checkNode); // recurse down
|
||||||
|
}
|
||||||
|
const text = node.getText(sourceFile);
|
||||||
|
if ((_a = rule.allowedTypes) === null || _a === void 0 ? void 0 : _a.some(allowed => allowed === text)) {
|
||||||
|
return; // override
|
||||||
|
}
|
||||||
|
const checker = program.getTypeChecker();
|
||||||
|
const symbol = checker.getSymbolAtLocation(node);
|
||||||
|
if (symbol) {
|
||||||
|
const declarations = symbol.declarations;
|
||||||
|
if (Array.isArray(declarations)) {
|
||||||
|
for (const declaration of declarations) {
|
||||||
|
if (declaration) {
|
||||||
|
const parent = declaration.parent;
|
||||||
|
if (parent) {
|
||||||
|
const parentSourceFile = parent.getSourceFile();
|
||||||
|
if (parentSourceFile) {
|
||||||
|
const definitionFileName = parentSourceFile.fileName;
|
||||||
|
if (rule.disallowedDefinitions) {
|
||||||
|
for (const disallowedDefinition of rule.disallowedDefinitions) {
|
||||||
|
if (definitionFileName.indexOf(disallowedDefinition) >= 0) {
|
||||||
|
const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||||
|
console.log(`[build/lib/layersChecker.ts]: Reference to '${text}' from '${disallowedDefinition}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1})`);
|
||||||
|
hasErrors = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function createProgram(tsconfigPath) {
|
||||||
|
const tsConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
||||||
|
const configHostParser = { fileExists: fs_1.existsSync, readDirectory: ts.sys.readDirectory, readFile: file => fs_1.readFileSync(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' };
|
||||||
|
const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, path_1.resolve(path_1.dirname(tsconfigPath)), { noEmit: true });
|
||||||
|
const compilerHost = ts.createCompilerHost(tsConfigParsed.options, true);
|
||||||
|
return ts.createProgram(tsConfigParsed.fileNames, tsConfigParsed.options, compilerHost);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Create program and start checking
|
||||||
|
//
|
||||||
|
const program = createProgram(TS_CONFIG_PATH);
|
||||||
|
for (const sourceFile of program.getSourceFiles()) {
|
||||||
|
for (const rule of RULES) {
|
||||||
|
if (minimatch_1.match([sourceFile.fileName], rule.target).length > 0) {
|
||||||
|
if (!rule.skip) {
|
||||||
|
checkFile(program, sourceFile, rule);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasErrors) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
245
build/lib/layersChecker.ts
Normal file
245
build/lib/layersChecker.ts
Normal file
@@ -0,0 +1,245 @@
|
|||||||
|
/*---------------------------------------------------------------------------------------------
|
||||||
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as ts from 'typescript';
|
||||||
|
import { readFileSync, existsSync } from 'fs';
|
||||||
|
import { resolve, dirname, join } from 'path';
|
||||||
|
import { match } from 'minimatch';
|
||||||
|
|
||||||
|
//
|
||||||
|
// #############################################################################################
|
||||||
|
//
|
||||||
|
// A custom typescript checker for the specific task of detecting the use of certain types in a
|
||||||
|
// layer that does not allow such use. For example:
|
||||||
|
// - using DOM globals in common/node/electron-main layer (e.g. HTMLElement)
|
||||||
|
// - using node.js globals in common/browser layer (e.g. process)
|
||||||
|
//
|
||||||
|
// Make changes to below RULES to lift certain files from these checks only if absolutely needed
|
||||||
|
//
|
||||||
|
// #############################################################################################
|
||||||
|
//
|
||||||
|
|
||||||
|
// Types we assume are present in all implementations of JS VMs (node.js, browsers)
|
||||||
|
// Feel free to add more core types as you see needed if present in node.js and browsers
|
||||||
|
const CORE_TYPES = [
|
||||||
|
'require', // from our AMD loader
|
||||||
|
'atob',
|
||||||
|
'btoa',
|
||||||
|
'setTimeout',
|
||||||
|
'clearTimeout',
|
||||||
|
'setInterval',
|
||||||
|
'clearInterval',
|
||||||
|
'console',
|
||||||
|
'log',
|
||||||
|
'info',
|
||||||
|
'warn',
|
||||||
|
'error',
|
||||||
|
'group',
|
||||||
|
'groupEnd',
|
||||||
|
'table',
|
||||||
|
'Error',
|
||||||
|
'String',
|
||||||
|
'throws',
|
||||||
|
'stack',
|
||||||
|
'captureStackTrace',
|
||||||
|
'stackTraceLimit',
|
||||||
|
'TextDecoder',
|
||||||
|
'TextEncoder',
|
||||||
|
'encode',
|
||||||
|
'decode',
|
||||||
|
'self',
|
||||||
|
'trimLeft',
|
||||||
|
'trimRight'
|
||||||
|
];
|
||||||
|
|
||||||
|
const RULES = [
|
||||||
|
|
||||||
|
// Tests: skip
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/test/**',
|
||||||
|
skip: true // -> skip all test files
|
||||||
|
},
|
||||||
|
|
||||||
|
// Common: vs/base/common/platform.ts
|
||||||
|
{
|
||||||
|
target: '**/vs/base/common/platform.ts',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
|
||||||
|
// Safe access to postMessage() and friends
|
||||||
|
'MessageEvent',
|
||||||
|
'data'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts', // no DOM
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Common: vs/workbench/api/common/extHostExtensionService.ts
|
||||||
|
{
|
||||||
|
target: '**/vs/workbench/api/common/extHostExtensionService.ts',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
|
||||||
|
// Safe access to global
|
||||||
|
'global'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts', // no DOM
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Common
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/common/**',
|
||||||
|
allowedTypes: CORE_TYPES,
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts', // no DOM
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Browser
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/browser/**',
|
||||||
|
allowedTypes: CORE_TYPES,
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'@types/node' // no node.js
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// node.js
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/node/**',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
|
||||||
|
// --> types from node.d.ts that duplicate from lib.dom.d.ts
|
||||||
|
'URL',
|
||||||
|
'protocol',
|
||||||
|
'hostname',
|
||||||
|
'port',
|
||||||
|
'pathname',
|
||||||
|
'search',
|
||||||
|
'username',
|
||||||
|
'password'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts' // no DOM
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Electron (renderer): skip
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/electron-browser/**',
|
||||||
|
skip: true // -> supports all types
|
||||||
|
},
|
||||||
|
|
||||||
|
// Electron (main)
|
||||||
|
{
|
||||||
|
target: '**/{vs,sql}/**/electron-main/**',
|
||||||
|
allowedTypes: [
|
||||||
|
...CORE_TYPES,
|
||||||
|
|
||||||
|
// --> types from electron.d.ts that duplicate from lib.dom.d.ts
|
||||||
|
'Event',
|
||||||
|
'Request'
|
||||||
|
],
|
||||||
|
disallowedDefinitions: [
|
||||||
|
'lib.dom.d.ts' // no DOM
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const TS_CONFIG_PATH = join(__dirname, '../../', 'src', 'tsconfig.json');
|
||||||
|
|
||||||
|
interface IRule {
|
||||||
|
target: string;
|
||||||
|
skip?: boolean;
|
||||||
|
allowedTypes?: string[];
|
||||||
|
disallowedDefinitions?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
let hasErrors = false;
|
||||||
|
|
||||||
|
function checkFile(program: ts.Program, sourceFile: ts.SourceFile, rule: IRule) {
|
||||||
|
checkNode(sourceFile);
|
||||||
|
|
||||||
|
function checkNode(node: ts.Node): void {
|
||||||
|
if (node.kind !== ts.SyntaxKind.Identifier) {
|
||||||
|
return ts.forEachChild(node, checkNode); // recurse down
|
||||||
|
}
|
||||||
|
|
||||||
|
const text = node.getText(sourceFile);
|
||||||
|
|
||||||
|
if (rule.allowedTypes?.some(allowed => allowed === text)) {
|
||||||
|
return; // override
|
||||||
|
}
|
||||||
|
|
||||||
|
const checker = program.getTypeChecker();
|
||||||
|
const symbol = checker.getSymbolAtLocation(node);
|
||||||
|
if (symbol) {
|
||||||
|
const declarations = symbol.declarations;
|
||||||
|
if (Array.isArray(declarations)) {
|
||||||
|
for (const declaration of declarations) {
|
||||||
|
if (declaration) {
|
||||||
|
const parent = declaration.parent;
|
||||||
|
if (parent) {
|
||||||
|
const parentSourceFile = parent.getSourceFile();
|
||||||
|
if (parentSourceFile) {
|
||||||
|
const definitionFileName = parentSourceFile.fileName;
|
||||||
|
if (rule.disallowedDefinitions) {
|
||||||
|
for (const disallowedDefinition of rule.disallowedDefinitions) {
|
||||||
|
if (definitionFileName.indexOf(disallowedDefinition) >= 0) {
|
||||||
|
const { line, character } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
|
||||||
|
console.log(`[build/lib/layersChecker.ts]: Reference to '${text}' from '${disallowedDefinition}' violates layer '${rule.target}' (${sourceFile.fileName} (${line + 1},${character + 1})`);
|
||||||
|
|
||||||
|
hasErrors = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createProgram(tsconfigPath: string): ts.Program {
|
||||||
|
const tsConfig = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
||||||
|
|
||||||
|
const configHostParser: ts.ParseConfigHost = { fileExists: existsSync, readDirectory: ts.sys.readDirectory, readFile: file => readFileSync(file, 'utf8'), useCaseSensitiveFileNames: process.platform === 'linux' };
|
||||||
|
const tsConfigParsed = ts.parseJsonConfigFileContent(tsConfig.config, configHostParser, resolve(dirname(tsconfigPath)), { noEmit: true });
|
||||||
|
|
||||||
|
const compilerHost = ts.createCompilerHost(tsConfigParsed.options, true);
|
||||||
|
|
||||||
|
return ts.createProgram(tsConfigParsed.fileNames, tsConfigParsed.options, compilerHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create program and start checking
|
||||||
|
//
|
||||||
|
const program = createProgram(TS_CONFIG_PATH);
|
||||||
|
|
||||||
|
for (const sourceFile of program.getSourceFiles()) {
|
||||||
|
for (const rule of RULES) {
|
||||||
|
if (match([sourceFile.fileName], rule.target).length > 0) {
|
||||||
|
if (!rule.skip) {
|
||||||
|
checkFile(program, sourceFile, rule);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasErrors) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const Lint = require("tslint");
|
|
||||||
class AbstractGlobalsRuleWalker extends Lint.RuleWalker {
|
|
||||||
constructor(file, program, opts, _config) {
|
|
||||||
super(file, opts);
|
|
||||||
this.program = program;
|
|
||||||
this._config = _config;
|
|
||||||
}
|
|
||||||
visitIdentifier(node) {
|
|
||||||
if (this.getDisallowedGlobals().some(disallowedGlobal => disallowedGlobal === node.text)) {
|
|
||||||
if (this._config.allowed && this._config.allowed.some(allowed => allowed === node.text)) {
|
|
||||||
return; // override
|
|
||||||
}
|
|
||||||
const checker = this.program.getTypeChecker();
|
|
||||||
const symbol = checker.getSymbolAtLocation(node);
|
|
||||||
if (symbol) {
|
|
||||||
const declarations = symbol.declarations;
|
|
||||||
if (Array.isArray(declarations) && symbol.declarations.some(declaration => {
|
|
||||||
if (declaration) {
|
|
||||||
const parent = declaration.parent;
|
|
||||||
if (parent) {
|
|
||||||
const sourceFile = parent.getSourceFile();
|
|
||||||
if (sourceFile) {
|
|
||||||
const fileName = sourceFile.fileName;
|
|
||||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})) {
|
|
||||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.visitIdentifier(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.AbstractGlobalsRuleWalker = AbstractGlobalsRuleWalker;
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import * as ts from 'typescript';
|
|
||||||
import * as Lint from 'tslint';
|
|
||||||
|
|
||||||
interface AbstractGlobalsRuleConfig {
|
|
||||||
target: string;
|
|
||||||
allowed: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class AbstractGlobalsRuleWalker extends Lint.RuleWalker {
|
|
||||||
|
|
||||||
constructor(file: ts.SourceFile, private program: ts.Program, opts: Lint.IOptions, private _config: AbstractGlobalsRuleConfig) {
|
|
||||||
super(file, opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract getDisallowedGlobals(): string[];
|
|
||||||
|
|
||||||
protected abstract getDefinitionPattern(): string;
|
|
||||||
|
|
||||||
visitIdentifier(node: ts.Identifier) {
|
|
||||||
if (this.getDisallowedGlobals().some(disallowedGlobal => disallowedGlobal === node.text)) {
|
|
||||||
if (this._config.allowed && this._config.allowed.some(allowed => allowed === node.text)) {
|
|
||||||
return; // override
|
|
||||||
}
|
|
||||||
|
|
||||||
const checker = this.program.getTypeChecker();
|
|
||||||
const symbol = checker.getSymbolAtLocation(node);
|
|
||||||
if (symbol) {
|
|
||||||
const declarations = symbol.declarations;
|
|
||||||
if (Array.isArray(declarations) && symbol.declarations.some(declaration => {
|
|
||||||
if (declaration) {
|
|
||||||
const parent = declaration.parent;
|
|
||||||
if (parent) {
|
|
||||||
const sourceFile = parent.getSourceFile();
|
|
||||||
if (sourceFile) {
|
|
||||||
const fileName = sourceFile.fileName;
|
|
||||||
if (fileName && fileName.indexOf(this.getDefinitionPattern()) >= 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})) {
|
|
||||||
this.addFailureAtNode(node, `Cannot use global '${node.text}' in '${this._config.target}'`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.visitIdentifier(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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 double-quoted-string-arg rule which verifies that the specified index of calls matching
|
|
||||||
* the specified signatures is quoted with double-quotes only.
|
|
||||||
*/
|
|
||||||
class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
apply(sourceFile) {
|
|
||||||
return this.applyWithWalker(new DoubleQuotedStringArgRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
class DoubleQuotedStringArgRuleWalker extends Lint.RuleWalker {
|
|
||||||
constructor(file, opts) {
|
|
||||||
super(file, opts);
|
|
||||||
this.signatures = Object.create(null);
|
|
||||||
this.argIndex = undefined;
|
|
||||||
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 (typeof first.argIndex !== 'undefined') {
|
|
||||||
this.argIndex = first.argIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
visitCallExpression(node) {
|
|
||||||
this.checkCallExpression(node);
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
checkCallExpression(node) {
|
|
||||||
// Not one of the functions we're looking for, continue on
|
|
||||||
const functionName = node.expression.getText();
|
|
||||||
if (functionName && !this.signatures[functionName]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const arg = node.arguments[this.argIndex];
|
|
||||||
// Ignore if the arg isn't a string - we expect the compiler to warn if that's an issue
|
|
||||||
if (arg && ts.isStringLiteral(arg)) {
|
|
||||||
const argText = arg.getText();
|
|
||||||
const doubleQuotedArg = argText.length >= 2 && argText[0] === DoubleQuotedStringArgRuleWalker.DOUBLE_QUOTE && argText[argText.length - 1] === DoubleQuotedStringArgRuleWalker.DOUBLE_QUOTE;
|
|
||||||
if (!doubleQuotedArg) {
|
|
||||||
const fix = Lint.Replacement.replaceFromTo(arg.getStart(), arg.getEnd(), `"${arg.getText().slice(1, arg.getWidth() - 1)}"`);
|
|
||||||
this.addFailure(this.createFailure(arg.getStart(), arg.getWidth(), `Argument ${this.argIndex + 1} to '${functionName}' must be double quoted.`, fix));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DoubleQuotedStringArgRuleWalker.DOUBLE_QUOTE = '"';
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import * as ts from 'typescript';
|
|
||||||
import * as Lint from 'tslint';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of the double-quoted-string-arg rule which verifies that the specified index of calls matching
|
|
||||||
* the specified signatures is quoted with double-quotes only.
|
|
||||||
*/
|
|
||||||
export class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
|
||||||
return this.applyWithWalker(new DoubleQuotedStringArgRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Map<V> {
|
|
||||||
[key: string]: V;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DoubleQuotedStringArgOptions {
|
|
||||||
signatures?: string[];
|
|
||||||
argIndex?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DoubleQuotedStringArgRuleWalker extends Lint.RuleWalker {
|
|
||||||
|
|
||||||
private static DOUBLE_QUOTE: string = '"';
|
|
||||||
|
|
||||||
private signatures: Map<boolean>;
|
|
||||||
private argIndex: number | undefined;
|
|
||||||
|
|
||||||
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
|
|
||||||
super(file, opts);
|
|
||||||
this.signatures = Object.create(null);
|
|
||||||
this.argIndex = undefined;
|
|
||||||
const options: any[] = this.getOptions();
|
|
||||||
const first: DoubleQuotedStringArgOptions = options && options.length > 0 ? options[0] : null;
|
|
||||||
if (first) {
|
|
||||||
if (Array.isArray(first.signatures)) {
|
|
||||||
first.signatures.forEach((signature: string) => this.signatures[signature] = true);
|
|
||||||
}
|
|
||||||
if (typeof first.argIndex !== 'undefined') {
|
|
||||||
this.argIndex = first.argIndex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected visitCallExpression(node: ts.CallExpression): void {
|
|
||||||
this.checkCallExpression(node);
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
private checkCallExpression(node: ts.CallExpression): void {
|
|
||||||
// Not one of the functions we're looking for, continue on
|
|
||||||
const functionName = node.expression.getText();
|
|
||||||
if (functionName && !this.signatures[functionName]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const arg = node.arguments[this.argIndex!];
|
|
||||||
|
|
||||||
// Ignore if the arg isn't a string - we expect the compiler to warn if that's an issue
|
|
||||||
if(arg && ts.isStringLiteral(arg)) {
|
|
||||||
const argText = arg.getText();
|
|
||||||
const doubleQuotedArg = argText.length >= 2 && argText[0] === DoubleQuotedStringArgRuleWalker.DOUBLE_QUOTE && argText[argText.length - 1] === DoubleQuotedStringArgRuleWalker.DOUBLE_QUOTE;
|
|
||||||
|
|
||||||
if (!doubleQuotedArg) {
|
|
||||||
const fix = Lint.Replacement.replaceFromTo(arg.getStart(), arg.getEnd(), `"${arg.getText().slice(1, arg.getWidth() - 1)}"`);
|
|
||||||
this.addFailure(this.createFailure(
|
|
||||||
arg.getStart(), arg.getWidth(),
|
|
||||||
`Argument ${this.argIndex! + 1} to '${functionName}' must be double quoted.`, fix));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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 = <ImportPatternsConfig[]>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`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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(', ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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<string>;
|
|
||||||
disallowed: Set<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
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<string>(<string[]>ruleArgs[parts[i]]).add(parts[i]),
|
|
||||||
disallowed: new Set<string>()
|
|
||||||
};
|
|
||||||
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>): string {
|
|
||||||
const r: string[] = [];
|
|
||||||
set.forEach(e => r.push(e));
|
|
||||||
return r.join(', ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const Lint = require("tslint");
|
|
||||||
const minimatch = require("minimatch");
|
|
||||||
const abstractGlobalsRule_1 = require("./abstractGlobalsRule");
|
|
||||||
class Rule extends Lint.Rules.TypedRule {
|
|
||||||
applyWithProgram(sourceFile, program) {
|
|
||||||
const configs = this.getOptions().ruleArguments;
|
|
||||||
for (const config of configs) {
|
|
||||||
if (minimatch(sourceFile.fileName, config.target)) {
|
|
||||||
return this.applyWithWalker(new NoDOMGlobalsRuleWalker(sourceFile, program, this.getOptions(), config));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
class NoDOMGlobalsRuleWalker extends abstractGlobalsRule_1.AbstractGlobalsRuleWalker {
|
|
||||||
getDefinitionPattern() {
|
|
||||||
return 'lib.dom.d.ts';
|
|
||||||
}
|
|
||||||
getDisallowedGlobals() {
|
|
||||||
// intentionally not complete
|
|
||||||
return [
|
|
||||||
"window",
|
|
||||||
"document",
|
|
||||||
"HTMLElement"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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 { AbstractGlobalsRuleWalker } from './abstractGlobalsRule';
|
|
||||||
|
|
||||||
interface NoDOMGlobalsRuleConfig {
|
|
||||||
target: string;
|
|
||||||
allowed: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Rule extends Lint.Rules.TypedRule {
|
|
||||||
|
|
||||||
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {
|
|
||||||
const configs = <NoDOMGlobalsRuleConfig[]>this.getOptions().ruleArguments;
|
|
||||||
|
|
||||||
for (const config of configs) {
|
|
||||||
if (minimatch(sourceFile.fileName, config.target)) {
|
|
||||||
return this.applyWithWalker(new NoDOMGlobalsRuleWalker(sourceFile, program, this.getOptions(), config));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NoDOMGlobalsRuleWalker extends AbstractGlobalsRuleWalker {
|
|
||||||
|
|
||||||
getDefinitionPattern(): string {
|
|
||||||
return 'lib.dom.d.ts';
|
|
||||||
}
|
|
||||||
|
|
||||||
getDisallowedGlobals(): string[] {
|
|
||||||
// intentionally not complete
|
|
||||||
return [
|
|
||||||
"window",
|
|
||||||
"document",
|
|
||||||
"HTMLElement"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const Lint = require("tslint");
|
|
||||||
const minimatch = require("minimatch");
|
|
||||||
const abstractGlobalsRule_1 = require("./abstractGlobalsRule");
|
|
||||||
class Rule extends Lint.Rules.TypedRule {
|
|
||||||
applyWithProgram(sourceFile, program) {
|
|
||||||
const configs = this.getOptions().ruleArguments;
|
|
||||||
for (const config of configs) {
|
|
||||||
if (minimatch(sourceFile.fileName, config.target)) {
|
|
||||||
return this.applyWithWalker(new NoNodejsGlobalsRuleWalker(sourceFile, program, this.getOptions(), config));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
class NoNodejsGlobalsRuleWalker extends abstractGlobalsRule_1.AbstractGlobalsRuleWalker {
|
|
||||||
getDefinitionPattern() {
|
|
||||||
return '@types/node';
|
|
||||||
}
|
|
||||||
getDisallowedGlobals() {
|
|
||||||
// https://nodejs.org/api/globals.html#globals_global_objects
|
|
||||||
return [
|
|
||||||
"NodeJS",
|
|
||||||
"Buffer",
|
|
||||||
"__dirname",
|
|
||||||
"__filename",
|
|
||||||
"clearImmediate",
|
|
||||||
"exports",
|
|
||||||
"global",
|
|
||||||
"module",
|
|
||||||
"process",
|
|
||||||
"setImmediate"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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 { AbstractGlobalsRuleWalker } from './abstractGlobalsRule';
|
|
||||||
|
|
||||||
interface NoNodejsGlobalsConfig {
|
|
||||||
target: string;
|
|
||||||
allowed: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Rule extends Lint.Rules.TypedRule {
|
|
||||||
|
|
||||||
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {
|
|
||||||
const configs = <NoNodejsGlobalsConfig[]>this.getOptions().ruleArguments;
|
|
||||||
|
|
||||||
for (const config of configs) {
|
|
||||||
if (minimatch(sourceFile.fileName, config.target)) {
|
|
||||||
return this.applyWithWalker(new NoNodejsGlobalsRuleWalker(sourceFile, program, this.getOptions(), config));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NoNodejsGlobalsRuleWalker extends AbstractGlobalsRuleWalker {
|
|
||||||
|
|
||||||
getDefinitionPattern(): string {
|
|
||||||
return '@types/node';
|
|
||||||
}
|
|
||||||
|
|
||||||
getDisallowedGlobals(): string[] {
|
|
||||||
// https://nodejs.org/api/globals.html#globals_global_objects
|
|
||||||
return [
|
|
||||||
"NodeJS",
|
|
||||||
"Buffer",
|
|
||||||
"__dirname",
|
|
||||||
"__filename",
|
|
||||||
"clearImmediate",
|
|
||||||
"exports",
|
|
||||||
"global",
|
|
||||||
"module",
|
|
||||||
"process",
|
|
||||||
"setImmediate"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// {{SQL CARBON EDIT}} - Rename node argument to _node to prevent errors since it is not used
|
|
||||||
_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)) {
|
|
||||||
// {{SQL CARBON EDIT}}
|
|
||||||
//this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// {{SQL CARBON EDIT}} - Rename node argument to _node to prevent errors since it is not used
|
|
||||||
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)
|
|
||||||
) {
|
|
||||||
// {{SQL CARBON EDIT}}
|
|
||||||
//this.addFailure(this.createFailure(node.getStart(), node.getWidth(), `Not allowed to import standalone editor modules. See https://github.com/Microsoft/vscode/wiki/Code-Organization`));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const Lint = require("tslint");
|
|
||||||
const minimatch = require("minimatch");
|
|
||||||
class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
apply(sourceFile) {
|
|
||||||
const args = this.getOptions().ruleArguments[0];
|
|
||||||
if (args.exclude.every(x => !minimatch(sourceFile.fileName, x))) {
|
|
||||||
return this.applyWithWalker(new NoSyncRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
class NoSyncRuleWalker extends Lint.RuleWalker {
|
|
||||||
constructor(file, opts) {
|
|
||||||
super(file, opts);
|
|
||||||
}
|
|
||||||
visitCallExpression(node) {
|
|
||||||
if (node.expression && NoSyncRuleWalker.operations.some(x => node.expression.getText().indexOf(x) >= 0)) {
|
|
||||||
this.addFailureAtNode(node, `Do not use Sync operations`);
|
|
||||||
}
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NoSyncRuleWalker.operations = ['readFileSync', 'writeFileSync', 'existsSync', 'fchmodSync', 'lchmodSync',
|
|
||||||
'statSync', 'fstatSync', 'lstatSync', 'linkSync', 'symlinkSync', 'readlinkSync', 'realpathSync', 'unlinkSync', 'rmdirSync',
|
|
||||||
'mkdirSync', 'mkdtempSync', 'readdirSync', 'openSync', 'utimesSync', 'futimesSync', 'fsyncSync', 'writeSync', 'readSync',
|
|
||||||
'appendFileSync', 'accessSync', 'fdatasyncSync', 'copyFileSync'];
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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';
|
|
||||||
|
|
||||||
interface NoSyncRuleConfig {
|
|
||||||
exclude: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
|
|
||||||
apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
|
||||||
const args = <NoSyncRuleConfig>this.getOptions().ruleArguments[0];
|
|
||||||
|
|
||||||
if (args.exclude.every(x => !minimatch(sourceFile.fileName, x))) {
|
|
||||||
return this.applyWithWalker(new NoSyncRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NoSyncRuleWalker extends Lint.RuleWalker {
|
|
||||||
|
|
||||||
private static readonly operations = ['readFileSync', 'writeFileSync', 'existsSync', 'fchmodSync', 'lchmodSync',
|
|
||||||
'statSync', 'fstatSync', 'lstatSync', 'linkSync', 'symlinkSync', 'readlinkSync', 'realpathSync', 'unlinkSync', 'rmdirSync',
|
|
||||||
'mkdirSync', 'mkdtempSync', 'readdirSync', 'openSync', 'utimesSync', 'futimesSync', 'fsyncSync', 'writeSync', 'readSync',
|
|
||||||
'appendFileSync', 'accessSync', 'fdatasyncSync', 'copyFileSync'];
|
|
||||||
|
|
||||||
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
|
|
||||||
super(file, opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
visitCallExpression(node: ts.CallExpression) {
|
|
||||||
if (node.expression && NoSyncRuleWalker.operations.some(x => node.expression.getText().indexOf(x) >= 0)) {
|
|
||||||
this.addFailureAtNode(node, `Do not use Sync operations`);
|
|
||||||
}
|
|
||||||
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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-localize-keys-with-underscore rule which verifies that keys to the localize
|
|
||||||
* calls don't contain underscores (_) since those break the localization process.
|
|
||||||
*/
|
|
||||||
class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
apply(sourceFile) {
|
|
||||||
return this.applyWithWalker(new NoLocalizeKeysWithUnderscore(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
const signatures = [
|
|
||||||
"localize",
|
|
||||||
"nls.localize"
|
|
||||||
];
|
|
||||||
class NoLocalizeKeysWithUnderscore extends Lint.RuleWalker {
|
|
||||||
constructor(file, opts) {
|
|
||||||
super(file, opts);
|
|
||||||
}
|
|
||||||
visitCallExpression(node) {
|
|
||||||
this.checkCallExpression(node);
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
checkCallExpression(node) {
|
|
||||||
// If this isn't one of the localize functions then continue on
|
|
||||||
const functionName = node.expression.getText();
|
|
||||||
if (functionName && !signatures.some(s => s === functionName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const arg = node && node.arguments && node.arguments.length > 0 ? node.arguments[0] : undefined; // The key is the first element
|
|
||||||
// Ignore if the arg isn't a string - we expect the compiler to warn if that's an issue
|
|
||||||
if (arg && ts.isStringLiteral(arg)) {
|
|
||||||
if (arg.getText().indexOf('_') >= 0) {
|
|
||||||
const fix = [
|
|
||||||
Lint.Replacement.replaceFromTo(arg.getStart(), arg.getEnd(), `${arg.getText().replace(/_/g, '.')}`),
|
|
||||||
];
|
|
||||||
this.addFailure(this.createFailure(arg.getStart(), arg.getWidth(), `Keys for localize calls must not contain underscores. Use periods (.) instead.`, fix));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import * as ts from 'typescript';
|
|
||||||
import * as Lint from 'tslint';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of the no-localize-keys-with-underscore rule which verifies that keys to the localize
|
|
||||||
* calls don't contain underscores (_) since those break the localization process.
|
|
||||||
*/
|
|
||||||
export class Rule extends Lint.Rules.AbstractRule {
|
|
||||||
public apply(sourceFile: ts.SourceFile): Lint.RuleFailure[] {
|
|
||||||
return this.applyWithWalker(new NoLocalizeKeysWithUnderscore(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const signatures = [
|
|
||||||
"localize",
|
|
||||||
"nls.localize"
|
|
||||||
];
|
|
||||||
|
|
||||||
class NoLocalizeKeysWithUnderscore extends Lint.RuleWalker {
|
|
||||||
|
|
||||||
constructor(file: ts.SourceFile, opts: Lint.IOptions) {
|
|
||||||
super(file, opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected visitCallExpression(node: ts.CallExpression): void {
|
|
||||||
this.checkCallExpression(node);
|
|
||||||
super.visitCallExpression(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
private checkCallExpression(node: ts.CallExpression): void {
|
|
||||||
// If this isn't one of the localize functions then continue on
|
|
||||||
const functionName = node.expression.getText();
|
|
||||||
if (functionName && !signatures.some(s => s === functionName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const arg = node && node.arguments && node.arguments.length > 0 ? node.arguments[0] : undefined; // The key is the first element
|
|
||||||
// Ignore if the arg isn't a string - we expect the compiler to warn if that's an issue
|
|
||||||
if(arg && ts.isStringLiteral(arg)) {
|
|
||||||
if (arg.getText().indexOf('_') >= 0) {
|
|
||||||
const fix = [
|
|
||||||
Lint.Replacement.replaceFromTo(arg.getStart(), arg.getEnd(), `${arg.getText().replace(/_/g, '.')}`),
|
|
||||||
];
|
|
||||||
this.addFailure(this.createFailure(
|
|
||||||
arg.getStart(), arg.getWidth(),
|
|
||||||
`Keys for localize calls must not contain underscores. Use periods (.) instead.`, fix));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,183 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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]*$/;
|
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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<V> {
|
|
||||||
[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<boolean>;
|
|
||||||
private messageIndex: number | undefined;
|
|
||||||
private keyIndex: number | undefined;
|
|
||||||
private ignores: Map<boolean>;
|
|
||||||
|
|
||||||
private usedKeys: Map<KeyMessagePair[]>;
|
|
||||||
|
|
||||||
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(<any>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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const Lint = require("tslint");
|
|
||||||
class Rule extends Lint.Rules.TypedRule {
|
|
||||||
applyWithProgram(sourceFile, program) {
|
|
||||||
if (program.getCompilerOptions().alwaysStrict) {
|
|
||||||
return this.applyWithWalker(new NoUselessStrictRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.Rule = Rule;
|
|
||||||
class NoUselessStrictRuleWalker extends Lint.RuleWalker {
|
|
||||||
visitStringLiteral(node) {
|
|
||||||
this.checkStringLiteral(node);
|
|
||||||
super.visitStringLiteral(node);
|
|
||||||
}
|
|
||||||
checkStringLiteral(node) {
|
|
||||||
const text = node.getText();
|
|
||||||
if (text === '\'use strict\'' || text === '"use strict"') {
|
|
||||||
this.addFailureAtNode(node, 'use strict directive is unnecessary');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import * as Lint from 'tslint';
|
|
||||||
import * as ts from 'typescript';
|
|
||||||
|
|
||||||
export class Rule extends Lint.Rules.TypedRule {
|
|
||||||
public applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): Lint.RuleFailure[] {
|
|
||||||
if (program.getCompilerOptions().alwaysStrict) {
|
|
||||||
return this.applyWithWalker(new NoUselessStrictRuleWalker(sourceFile, this.getOptions()));
|
|
||||||
}
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NoUselessStrictRuleWalker extends Lint.RuleWalker {
|
|
||||||
protected visitStringLiteral(node: ts.StringLiteral): void {
|
|
||||||
this.checkStringLiteral(node);
|
|
||||||
super.visitStringLiteral(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
private checkStringLiteral(node: ts.StringLiteral): void {
|
|
||||||
const text = node.getText();
|
|
||||||
if (text === '\'use strict\'' || text === '"use strict"') {
|
|
||||||
this.addFailureAtNode(node, 'use strict directive is unnecessary');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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';
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. 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.`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,7 +9,7 @@ const ts = require("typescript");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const fancyLog = require("fancy-log");
|
const fancyLog = require("fancy-log");
|
||||||
const ansiColors = require("ansi-colors");
|
const ansiColors = require("ansi-colors");
|
||||||
const dtsv = '2';
|
const dtsv = '3';
|
||||||
const tsfmt = require('../../tsfmt.json');
|
const tsfmt = require('../../tsfmt.json');
|
||||||
const SRC = path.join(__dirname, '../../src');
|
const SRC = path.join(__dirname, '../../src');
|
||||||
exports.RECIPE_PATH = path.join(__dirname, './monaco.d.ts.recipe');
|
exports.RECIPE_PATH = path.join(__dirname, './monaco.d.ts.recipe');
|
||||||
@@ -148,12 +148,44 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration, importName,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else if (declaration.kind === ts.SyntaxKind.VariableStatement) {
|
||||||
|
const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile));
|
||||||
|
if (jsDoc.indexOf('@monacodtsreplace') >= 0) {
|
||||||
|
const jsDocLines = jsDoc.split(/\r\n|\r|\n/);
|
||||||
|
let directives = [];
|
||||||
|
for (const jsDocLine of jsDocLines) {
|
||||||
|
const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/);
|
||||||
|
if (m) {
|
||||||
|
directives.push([new RegExp(m[1], 'g'), m[2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove the jsdoc
|
||||||
|
result = result.substr(jsDoc.length);
|
||||||
|
if (directives.length > 0) {
|
||||||
|
// apply replace directives
|
||||||
|
const replacer = createReplacerFromDirectives(directives);
|
||||||
|
result = replacer(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
result = result.replace(/export default /g, 'export ');
|
result = result.replace(/export default /g, 'export ');
|
||||||
result = result.replace(/export declare /g, 'export ');
|
result = result.replace(/export declare /g, 'export ');
|
||||||
result = result.replace(/declare /g, '');
|
result = result.replace(/declare /g, '');
|
||||||
|
let lines = result.split(/\r\n|\r|\n/);
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
if (/\s*\*/.test(lines[i])) {
|
||||||
|
// very likely a comment
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = lines[i].replace(/"/g, '\'');
|
||||||
|
}
|
||||||
|
result = lines.join('\n');
|
||||||
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
||||||
result = result.replace(/const enum/, 'enum');
|
result = result.replace(/const enum/, 'enum');
|
||||||
enums.push(result);
|
enums.push({
|
||||||
|
enumName: declaration.name.getText(sourceFile),
|
||||||
|
text: result
|
||||||
|
});
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -277,6 +309,14 @@ function format(text, endl) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function createReplacerFromDirectives(directives) {
|
||||||
|
return (str) => {
|
||||||
|
for (let i = 0; i < directives.length; i++) {
|
||||||
|
str = str.replace(directives[i][0], directives[i][1]);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
}
|
||||||
function createReplacer(data) {
|
function createReplacer(data) {
|
||||||
data = data || '';
|
data = data || '';
|
||||||
let rawDirectives = data.split(';');
|
let rawDirectives = data.split(';');
|
||||||
@@ -292,12 +332,7 @@ function createReplacer(data) {
|
|||||||
findStr = '\\b' + findStr + '\\b';
|
findStr = '\\b' + findStr + '\\b';
|
||||||
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
||||||
});
|
});
|
||||||
return (str) => {
|
return createReplacerFromDirectives(directives);
|
||||||
for (let i = 0; i < directives.length; i++) {
|
|
||||||
str = str.replace(directives[i][0], directives[i][1]);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
function generateDeclarationFile(recipe, sourceFileGetter) {
|
function generateDeclarationFile(recipe, sourceFileGetter) {
|
||||||
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||||
@@ -415,6 +450,15 @@ function generateDeclarationFile(recipe, sourceFileGetter) {
|
|||||||
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
||||||
resultTxt = format(resultTxt, endl);
|
resultTxt = format(resultTxt, endl);
|
||||||
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
||||||
|
enums.sort((e1, e2) => {
|
||||||
|
if (e1.enumName < e2.enumName) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (e1.enumName > e2.enumName) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
let resultEnums = [
|
let resultEnums = [
|
||||||
'/*---------------------------------------------------------------------------------------------',
|
'/*---------------------------------------------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
@@ -423,7 +467,7 @@ function generateDeclarationFile(recipe, sourceFileGetter) {
|
|||||||
'',
|
'',
|
||||||
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
||||||
''
|
''
|
||||||
].concat(enums).join(endl);
|
].concat(enums.map(e => e.text)).join(endl);
|
||||||
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
||||||
resultEnums = format(resultEnums, endl);
|
resultEnums = format(resultEnums, endl);
|
||||||
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import * as path from 'path';
|
|||||||
import * as fancyLog from 'fancy-log';
|
import * as fancyLog from 'fancy-log';
|
||||||
import * as ansiColors from 'ansi-colors';
|
import * as ansiColors from 'ansi-colors';
|
||||||
|
|
||||||
const dtsv = '2';
|
const dtsv = '3';
|
||||||
|
|
||||||
const tsfmt = require('../../tsfmt.json');
|
const tsfmt = require('../../tsfmt.json');
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ function isDefaultExport(declaration: ts.InterfaceDeclaration | ts.ClassDeclarat
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: string[]): string {
|
function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declaration: TSTopLevelDeclare, importName: string, usage: string[], enums: IEnumEntry[]): string {
|
||||||
let result = getNodeText(sourceFile, declaration);
|
let result = getNodeText(sourceFile, declaration);
|
||||||
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
if (declaration.kind === ts.SyntaxKind.InterfaceDeclaration || declaration.kind === ts.SyntaxKind.ClassDeclaration) {
|
||||||
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
let interfaceDeclaration = <ts.InterfaceDeclaration | ts.ClassDeclaration>declaration;
|
||||||
@@ -177,14 +177,45 @@ function getMassagedTopLevelDeclarationText(sourceFile: ts.SourceFile, declarati
|
|||||||
// life..
|
// life..
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (declaration.kind === ts.SyntaxKind.VariableStatement) {
|
||||||
|
const jsDoc = result.substr(0, declaration.getLeadingTriviaWidth(sourceFile));
|
||||||
|
if (jsDoc.indexOf('@monacodtsreplace') >= 0) {
|
||||||
|
const jsDocLines = jsDoc.split(/\r\n|\r|\n/);
|
||||||
|
let directives: [RegExp, string][] = [];
|
||||||
|
for (const jsDocLine of jsDocLines) {
|
||||||
|
const m = jsDocLine.match(/^\s*\* \/([^/]+)\/([^/]+)\/$/);
|
||||||
|
if (m) {
|
||||||
|
directives.push([new RegExp(m[1], 'g'), m[2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// remove the jsdoc
|
||||||
|
result = result.substr(jsDoc.length);
|
||||||
|
if (directives.length > 0) {
|
||||||
|
// apply replace directives
|
||||||
|
const replacer = createReplacerFromDirectives(directives);
|
||||||
|
result = replacer(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result = result.replace(/export default /g, 'export ');
|
result = result.replace(/export default /g, 'export ');
|
||||||
result = result.replace(/export declare /g, 'export ');
|
result = result.replace(/export declare /g, 'export ');
|
||||||
result = result.replace(/declare /g, '');
|
result = result.replace(/declare /g, '');
|
||||||
|
let lines = result.split(/\r\n|\r|\n/);
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
if (/\s*\*/.test(lines[i])) {
|
||||||
|
// very likely a comment
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lines[i] = lines[i].replace(/"/g, '\'');
|
||||||
|
}
|
||||||
|
result = lines.join('\n');
|
||||||
|
|
||||||
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
if (declaration.kind === ts.SyntaxKind.EnumDeclaration) {
|
||||||
result = result.replace(/const enum/, 'enum');
|
result = result.replace(/const enum/, 'enum');
|
||||||
enums.push(result);
|
enums.push({
|
||||||
|
enumName: declaration.name.getText(sourceFile),
|
||||||
|
text: result
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@@ -324,6 +355,15 @@ function format(text: string, endl: string): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function createReplacerFromDirectives(directives: [RegExp, string][]): (str: string) => string {
|
||||||
|
return (str: string) => {
|
||||||
|
for (let i = 0; i < directives.length; i++) {
|
||||||
|
str = str.replace(directives[i][0], directives[i][1]);
|
||||||
|
}
|
||||||
|
return str;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function createReplacer(data: string): (str: string) => string {
|
function createReplacer(data: string): (str: string) => string {
|
||||||
data = data || '';
|
data = data || '';
|
||||||
let rawDirectives = data.split(';');
|
let rawDirectives = data.split(';');
|
||||||
@@ -341,12 +381,7 @@ function createReplacer(data: string): (str: string) => string {
|
|||||||
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
directives.push([new RegExp(findStr, 'g'), replaceStr]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (str: string) => {
|
return createReplacerFromDirectives(directives);
|
||||||
for (let i = 0; i < directives.length; i++) {
|
|
||||||
str = str.replace(directives[i][0], directives[i][1]);
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ITempResult {
|
interface ITempResult {
|
||||||
@@ -355,6 +390,11 @@ interface ITempResult {
|
|||||||
enums: string;
|
enums: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface IEnumEntry {
|
||||||
|
enumName: string;
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGetter): ITempResult | null {
|
function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGetter): ITempResult | null {
|
||||||
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
const endl = /\r\n/.test(recipe) ? '\r\n' : '\n';
|
||||||
|
|
||||||
@@ -376,7 +416,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet
|
|||||||
return importName;
|
return importName;
|
||||||
};
|
};
|
||||||
|
|
||||||
let enums: string[] = [];
|
let enums: IEnumEntry[] = [];
|
||||||
let version: string | null = null;
|
let version: string | null = null;
|
||||||
|
|
||||||
lines.forEach(line => {
|
lines.forEach(line => {
|
||||||
@@ -492,6 +532,16 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet
|
|||||||
resultTxt = format(resultTxt, endl);
|
resultTxt = format(resultTxt, endl);
|
||||||
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
resultTxt = resultTxt.split(/\r\n|\n|\r/).join(endl);
|
||||||
|
|
||||||
|
enums.sort((e1, e2) => {
|
||||||
|
if (e1.enumName < e2.enumName) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (e1.enumName > e2.enumName) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
let resultEnums = [
|
let resultEnums = [
|
||||||
'/*---------------------------------------------------------------------------------------------',
|
'/*---------------------------------------------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
@@ -500,7 +550,7 @@ function generateDeclarationFile(recipe: string, sourceFileGetter: SourceFileGet
|
|||||||
'',
|
'',
|
||||||
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
'// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.',
|
||||||
''
|
''
|
||||||
].concat(enums).join(endl);
|
].concat(enums.map(e => e.text)).join(endl);
|
||||||
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
||||||
resultEnums = format(resultEnums, endl);
|
resultEnums = format(resultEnums, endl);
|
||||||
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
resultEnums = resultEnums.split(/\r\n|\n|\r/).join(endl);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ declare namespace monaco.editor {
|
|||||||
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
#include(vs/editor/standalone/common/standaloneThemeService): BuiltinTheme, IStandaloneThemeData, IColors
|
||||||
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
#include(vs/editor/common/modes/supports/tokenization): ITokenThemeRule
|
||||||
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
#include(vs/editor/common/services/webWorker): MonacoWebWorker, IWebWorkerOptions
|
||||||
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
#include(vs/editor/standalone/browser/standaloneCodeEditor): IActionDescriptor, IGlobalEditorOptions, IStandaloneEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
|
||||||
export interface ICommandHandler {
|
export interface ICommandHandler {
|
||||||
(...args: any[]): void;
|
(...args: any[]): void;
|
||||||
}
|
}
|
||||||
@@ -62,6 +62,7 @@ export interface ICommandHandler {
|
|||||||
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
|
#includeAll(vs/editor/common/editorCommon;editorOptions.=>): IScrollEvent
|
||||||
#includeAll(vs/editor/common/model/textModelEvents):
|
#includeAll(vs/editor/common/model/textModelEvents):
|
||||||
#includeAll(vs/editor/common/controller/cursorEvents):
|
#includeAll(vs/editor/common/controller/cursorEvents):
|
||||||
|
#include(vs/platform/accessibility/common/accessibility): AccessibilitySupport
|
||||||
#includeAll(vs/editor/common/config/editorOptions):
|
#includeAll(vs/editor/common/config/editorOptions):
|
||||||
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
#includeAll(vs/editor/browser/editorBrowser;editorCommon.=>;editorOptions.=>):
|
||||||
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
#include(vs/editor/common/config/fontInfo): FontInfo, BareFontInfo
|
||||||
@@ -87,4 +88,4 @@ declare namespace monaco.worker {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//dtsv=2
|
//dtsv=3
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "monaco-editor-core",
|
"name": "monaco-editor-core",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.18.0",
|
"version": "0.19.2",
|
||||||
"description": "A browser based code editor",
|
"description": "A browser based code editor",
|
||||||
"author": "Microsoft Corporation",
|
"author": "Microsoft Corporation",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
"@types/azure": "0.9.19",
|
"@types/azure": "0.9.19",
|
||||||
"@types/debounce": "^1.0.0",
|
"@types/debounce": "^1.0.0",
|
||||||
"@types/documentdb": "^1.10.5",
|
"@types/documentdb": "^1.10.5",
|
||||||
|
"@types/eslint": "4.16.1",
|
||||||
"@types/fancy-log": "^1.3.0",
|
"@types/fancy-log": "^1.3.0",
|
||||||
"@types/glob": "^7.1.1",
|
"@types/glob": "^7.1.1",
|
||||||
"@types/gulp": "^4.0.5",
|
"@types/gulp": "^4.0.5",
|
||||||
@@ -29,6 +30,8 @@
|
|||||||
"@types/through2": "^2.0.34",
|
"@types/through2": "^2.0.34",
|
||||||
"@types/underscore": "^1.8.9",
|
"@types/underscore": "^1.8.9",
|
||||||
"@types/xml2js": "0.0.33",
|
"@types/xml2js": "0.0.33",
|
||||||
|
"@typescript-eslint/experimental-utils": "~2.13.0",
|
||||||
|
"@typescript-eslint/parser": "^2.12.0",
|
||||||
"applicationinsights": "1.0.8",
|
"applicationinsights": "1.0.8",
|
||||||
"azure-storage": "^2.1.0",
|
"azure-storage": "^2.1.0",
|
||||||
"del": "^3.0.0",
|
"del": "^3.0.0",
|
||||||
@@ -39,6 +42,7 @@
|
|||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.0",
|
||||||
"iconv-lite": "0.4.23",
|
"iconv-lite": "0.4.23",
|
||||||
"mime": "^1.3.4",
|
"mime": "^1.3.4",
|
||||||
|
"minimatch": "3.0.4",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"request": "^2.85.0",
|
"request": "^2.85.0",
|
||||||
"rollup": "^1.20.3",
|
"rollup": "^1.20.3",
|
||||||
@@ -46,8 +50,7 @@
|
|||||||
"rollup-plugin-node-resolve": "^5.2.0",
|
"rollup-plugin-node-resolve": "^5.2.0",
|
||||||
"service-downloader": "github:anthonydresser/service-downloader#0.1.7",
|
"service-downloader": "github:anthonydresser/service-downloader#0.1.7",
|
||||||
"terser": "4.3.8",
|
"terser": "4.3.8",
|
||||||
"tslint": "^5.9.1",
|
"typescript": " 3.8.0-beta",
|
||||||
"typescript": "3.7.3",
|
|
||||||
"vsce": "1.48.0",
|
"vsce": "1.48.0",
|
||||||
"vscode-telemetry-extractor": "^1.5.4",
|
"vscode-telemetry-extractor": "^1.5.4",
|
||||||
"xml2js": "^0.4.17"
|
"xml2js": "^0.4.17"
|
||||||
|
|||||||
@@ -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": "warning"
|
|
||||||
}
|
|
||||||
@@ -6,4 +6,4 @@ AddToPath=Add to PATH (requires shell restart)
|
|||||||
RunAfter=Run %1 after installation
|
RunAfter=Run %1 after installation
|
||||||
Other=Other:
|
Other=Other:
|
||||||
SourceFile=%1 Source File
|
SourceFile=%1 Source File
|
||||||
OpenWithCodeContextMenu=Open with %1
|
OpenWithCodeContextMenu=Open w&ith %1
|
||||||
|
|||||||
265
build/yarn.lock
265
build/yarn.lock
@@ -89,6 +89,24 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@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/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/estree@0.0.39":
|
"@types/estree@0.0.39":
|
||||||
version "0.0.39"
|
version "0.0.39"
|
||||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
|
||||||
@@ -188,6 +206,11 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c"
|
resolved "https://registry.yarnpkg.com/@types/js-beautify/-/js-beautify-1.8.0.tgz#0369d3d0e1f35a6aec07cb4da2ee2bcda111367c"
|
||||||
integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA==
|
integrity sha512-/siF86XrwDKLuHe8l7h6NhrAWgLdgqbxmjZv9NvGWmgYRZoTipkjKiWb0SQHy/jcR+ee0GvbG6uGd+LEBMGNvA==
|
||||||
|
|
||||||
|
"@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==
|
||||||
|
|
||||||
"@types/mime@0.0.29":
|
"@types/mime@0.0.29":
|
||||||
version "0.0.29"
|
version "0.0.29"
|
||||||
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b"
|
resolved "https://registry.yarnpkg.com/@types/mime/-/mime-0.0.29.tgz#fbcfd330573b912ef59eeee14602bface630754b"
|
||||||
@@ -328,6 +351,60 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.33.tgz#20c5dd6460245284d64a55690015b95e409fb7de"
|
resolved "https://registry.yarnpkg.com/@types/xml2js/-/xml2js-0.0.33.tgz#20c5dd6460245284d64a55690015b95e409fb7de"
|
||||||
integrity sha1-IMXdZGAkUoTWSlVpABW5XkCft94=
|
integrity sha1-IMXdZGAkUoTWSlVpABW5XkCft94=
|
||||||
|
|
||||||
|
"@typescript-eslint/experimental-utils@2.14.0":
|
||||||
|
version "2.14.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.14.0.tgz#e9179fa3c44e00b3106b85d7b69342901fb43e3b"
|
||||||
|
integrity sha512-KcyKS7G6IWnIgl3ZpyxyBCxhkBPV+0a5Jjy2g5HxlrbG2ZLQNFeneIBVXdaBCYOVjvGmGGFKom1kgiAY75SDeQ==
|
||||||
|
dependencies:
|
||||||
|
"@types/json-schema" "^7.0.3"
|
||||||
|
"@typescript-eslint/typescript-estree" "2.14.0"
|
||||||
|
eslint-scope "^5.0.0"
|
||||||
|
|
||||||
|
"@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.14.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.14.0.tgz#30fa0523d86d74172a5e32274558404ba4262cd6"
|
||||||
|
integrity sha512-haS+8D35fUydIs+zdSf4BxpOartb/DjrZ2IxQ5sR8zyGfd77uT9ZJZYF8+I0WPhzqHmfafUBx8MYpcp8pfaoSA==
|
||||||
|
dependencies:
|
||||||
|
"@types/eslint-visitor-keys" "^1.0.0"
|
||||||
|
"@typescript-eslint/experimental-utils" "2.14.0"
|
||||||
|
"@typescript-eslint/typescript-estree" "2.14.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"
|
||||||
|
|
||||||
|
"@typescript-eslint/typescript-estree@2.14.0":
|
||||||
|
version "2.14.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.14.0.tgz#c67698acdc14547f095eeefe908958d93e1a648d"
|
||||||
|
integrity sha512-pnLpUcMNG7GfFFfNQbEX6f1aPa5fMnH2G9By+A1yovYI4VIOK2DzkaRuUlIkbagpAcrxQHLqovI1YWqEcXyRnA==
|
||||||
|
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"
|
||||||
|
|
||||||
abbrev@1:
|
abbrev@1:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
|
||||||
@@ -397,13 +474,6 @@ ansi-styles@^2.2.1:
|
|||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
||||||
integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
|
integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=
|
||||||
|
|
||||||
ansi-styles@^3.2.1:
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
|
|
||||||
integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==
|
|
||||||
dependencies:
|
|
||||||
color-convert "^1.9.0"
|
|
||||||
|
|
||||||
ansi-wrap@0.1.0:
|
ansi-wrap@0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
|
resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf"
|
||||||
@@ -587,15 +657,6 @@ azure-storage@^2.1.0:
|
|||||||
xml2js "0.2.7"
|
xml2js "0.2.7"
|
||||||
xmlbuilder "0.4.3"
|
xmlbuilder "0.4.3"
|
||||||
|
|
||||||
babel-code-frame@^6.22.0:
|
|
||||||
version "6.26.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
|
||||||
integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=
|
|
||||||
dependencies:
|
|
||||||
chalk "^1.1.3"
|
|
||||||
esutils "^2.0.2"
|
|
||||||
js-tokens "^3.0.2"
|
|
||||||
|
|
||||||
balanced-match@^1.0.0:
|
balanced-match@^1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
|
||||||
@@ -747,11 +808,6 @@ buffer@^5.2.1:
|
|||||||
base64-js "^1.0.2"
|
base64-js "^1.0.2"
|
||||||
ieee754 "^1.1.4"
|
ieee754 "^1.1.4"
|
||||||
|
|
||||||
builtin-modules@^1.1.1:
|
|
||||||
version "1.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
|
|
||||||
integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=
|
|
||||||
|
|
||||||
builtin-modules@^3.1.0:
|
builtin-modules@^3.1.0:
|
||||||
version "3.1.0"
|
version "3.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
|
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484"
|
||||||
@@ -777,7 +833,7 @@ caseless@~0.12.0:
|
|||||||
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
|
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
|
||||||
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
|
integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=
|
||||||
|
|
||||||
chalk@^1.0.0, chalk@^1.1.3:
|
chalk@^1.0.0:
|
||||||
version "1.1.3"
|
version "1.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
||||||
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
|
integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=
|
||||||
@@ -788,15 +844,6 @@ chalk@^1.0.0, chalk@^1.1.3:
|
|||||||
strip-ansi "^3.0.0"
|
strip-ansi "^3.0.0"
|
||||||
supports-color "^2.0.0"
|
supports-color "^2.0.0"
|
||||||
|
|
||||||
chalk@^2.3.0:
|
|
||||||
version "2.4.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
|
|
||||||
integrity sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^3.2.1"
|
|
||||||
escape-string-regexp "^1.0.5"
|
|
||||||
supports-color "^5.3.0"
|
|
||||||
|
|
||||||
cheerio@^1.0.0-rc.1:
|
cheerio@^1.0.0-rc.1:
|
||||||
version "1.0.0-rc.2"
|
version "1.0.0-rc.2"
|
||||||
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db"
|
resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.2.tgz#4b9f53a81b27e4d5dac31c0ffd0cfa03cc6830db"
|
||||||
@@ -876,18 +923,6 @@ collection-visit@^1.0.0:
|
|||||||
map-visit "^1.0.0"
|
map-visit "^1.0.0"
|
||||||
object-visit "^1.0.0"
|
object-visit "^1.0.0"
|
||||||
|
|
||||||
color-convert@^1.9.0:
|
|
||||||
version "1.9.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
|
|
||||||
integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
|
|
||||||
dependencies:
|
|
||||||
color-name "1.1.3"
|
|
||||||
|
|
||||||
color-name@1.1.3:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
|
|
||||||
integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
|
|
||||||
|
|
||||||
color-support@^1.1.3:
|
color-support@^1.1.3:
|
||||||
version "1.1.3"
|
version "1.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
|
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
|
||||||
@@ -922,16 +957,16 @@ command-line-args@^5.1.1:
|
|||||||
lodash.camelcase "^4.3.0"
|
lodash.camelcase "^4.3.0"
|
||||||
typical "^4.0.0"
|
typical "^4.0.0"
|
||||||
|
|
||||||
commander@^2.12.1, commander@^2.8.1:
|
|
||||||
version "2.19.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
|
||||||
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
|
||||||
|
|
||||||
commander@^2.20.0, commander@~2.20.0:
|
commander@^2.20.0, commander@~2.20.0:
|
||||||
version "2.20.0"
|
version "2.20.0"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
|
||||||
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
|
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
|
||||||
|
|
||||||
|
commander@^2.8.1:
|
||||||
|
version "2.19.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||||
|
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
||||||
|
|
||||||
commander@~2.8.1:
|
commander@~2.8.1:
|
||||||
version "2.8.1"
|
version "2.8.1"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.8.1.tgz#06be367febfda0c330aa1e2a072d3dc9762425d4"
|
||||||
@@ -1204,11 +1239,6 @@ diagnostic-channel@0.2.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
semver "^5.3.0"
|
semver "^5.3.0"
|
||||||
|
|
||||||
diff@^3.2.0:
|
|
||||||
version "3.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
|
|
||||||
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==
|
|
||||||
|
|
||||||
dir-glob@^3.0.1:
|
dir-glob@^3.0.1:
|
||||||
version "3.0.1"
|
version "3.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
|
resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
|
||||||
@@ -1317,26 +1347,41 @@ es6-promisify@^5.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
es6-promise "^4.0.3"
|
es6-promise "^4.0.3"
|
||||||
|
|
||||||
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
|
escape-string-regexp@^1.0.2:
|
||||||
version "1.0.5"
|
version "1.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
||||||
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
|
||||||
|
|
||||||
esprima@^4.0.0:
|
eslint-scope@^5.0.0:
|
||||||
version "4.0.1"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
|
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9"
|
||||||
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
|
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==
|
||||||
|
|
||||||
|
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==
|
||||||
|
|
||||||
estree-walker@^0.6.1:
|
estree-walker@^0.6.1:
|
||||||
version "0.6.1"
|
version "0.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
|
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
|
||||||
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
|
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
|
||||||
|
|
||||||
esutils@^2.0.2:
|
|
||||||
version "2.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
|
|
||||||
integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=
|
|
||||||
|
|
||||||
eventemitter2@^5.0.1:
|
eventemitter2@^5.0.1:
|
||||||
version "5.0.1"
|
version "5.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-5.0.1.tgz#6197a095d5fb6b57e8942f6fd7eaad63a09c9452"
|
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-5.0.1.tgz#6197a095d5fb6b57e8942f6fd7eaad63a09c9452"
|
||||||
@@ -1631,7 +1676,7 @@ glob-parent@^5.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
is-glob "^4.0.1"
|
is-glob "^4.0.1"
|
||||||
|
|
||||||
glob@^7.0.3, glob@^7.0.6, glob@^7.1.1:
|
glob@^7.0.3, glob@^7.0.6:
|
||||||
version "7.1.3"
|
version "7.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
|
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.3.tgz#3960832d3f1574108342dafd3a67b332c0969df1"
|
||||||
integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==
|
integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==
|
||||||
@@ -1655,6 +1700,18 @@ glob@^7.1.3:
|
|||||||
once "^1.3.0"
|
once "^1.3.0"
|
||||||
path-is-absolute "^1.0.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:
|
globby@^10.0.1:
|
||||||
version "10.0.1"
|
version "10.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22"
|
resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22"
|
||||||
@@ -1812,11 +1869,6 @@ has-ansi@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
ansi-regex "^2.0.0"
|
ansi-regex "^2.0.0"
|
||||||
|
|
||||||
has-flag@^3.0.0:
|
|
||||||
version "3.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
|
||||||
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
|
|
||||||
|
|
||||||
has-gulplog@^0.1.0:
|
has-gulplog@^0.1.0:
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce"
|
resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce"
|
||||||
@@ -2240,19 +2292,6 @@ isstream@~0.1.2:
|
|||||||
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
|
||||||
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
|
integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=
|
||||||
|
|
||||||
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.7.0:
|
|
||||||
version "3.12.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
|
|
||||||
integrity sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==
|
|
||||||
dependencies:
|
|
||||||
argparse "^1.0.7"
|
|
||||||
esprima "^4.0.0"
|
|
||||||
|
|
||||||
jsbn@~0.1.0:
|
jsbn@~0.1.0:
|
||||||
version "0.1.1"
|
version "0.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
|
||||||
@@ -2454,6 +2493,11 @@ lodash.templatesettings@^3.0.0:
|
|||||||
lodash._reinterpolate "^3.0.0"
|
lodash._reinterpolate "^3.0.0"
|
||||||
lodash.escape "^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:
|
lodash@^4.15.0, lodash@^4.17.10:
|
||||||
version "4.17.15"
|
version "4.17.15"
|
||||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
|
||||||
@@ -2929,7 +2973,7 @@ path-key@^2.0.0, path-key@^2.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
|
resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40"
|
||||||
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
|
integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=
|
||||||
|
|
||||||
path-parse@^1.0.5, path-parse@^1.0.6:
|
path-parse@^1.0.6:
|
||||||
version "1.0.6"
|
version "1.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
|
||||||
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
|
||||||
@@ -3203,13 +3247,6 @@ resolve@^1.11.0, resolve@^1.11.1:
|
|||||||
dependencies:
|
dependencies:
|
||||||
path-parse "^1.0.6"
|
path-parse "^1.0.6"
|
||||||
|
|
||||||
resolve@^1.3.2:
|
|
||||||
version "1.8.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.8.1.tgz#82f1ec19a423ac1fbd080b0bab06ba36e84a7a26"
|
|
||||||
integrity sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==
|
|
||||||
dependencies:
|
|
||||||
path-parse "^1.0.5"
|
|
||||||
|
|
||||||
ret@~0.1.10:
|
ret@~0.1.10:
|
||||||
version "0.1.15"
|
version "0.1.15"
|
||||||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc"
|
||||||
@@ -3339,6 +3376,11 @@ semver@^5.5.0:
|
|||||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
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==
|
||||||
|
|
||||||
"service-downloader@github:anthonydresser/service-downloader#0.1.7":
|
"service-downloader@github:anthonydresser/service-downloader#0.1.7":
|
||||||
version "0.1.7"
|
version "0.1.7"
|
||||||
resolved "https://codeload.github.com/anthonydresser/service-downloader/tar.gz/c08de456c9f1af6258061fdc524275b21c6db667"
|
resolved "https://codeload.github.com/anthonydresser/service-downloader/tar.gz/c08de456c9f1af6258061fdc524275b21c6db667"
|
||||||
@@ -3598,13 +3640,6 @@ supports-color@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
||||||
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
|
integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=
|
||||||
|
|
||||||
supports-color@^5.3.0:
|
|
||||||
version "5.5.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
|
|
||||||
integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==
|
|
||||||
dependencies:
|
|
||||||
has-flag "^3.0.0"
|
|
||||||
|
|
||||||
tar-stream@^1.5.2:
|
tar-stream@^1.5.2:
|
||||||
version "1.6.2"
|
version "1.6.2"
|
||||||
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555"
|
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555"
|
||||||
@@ -3746,7 +3781,7 @@ ts-morph@^3.1.3:
|
|||||||
multimatch "^4.0.0"
|
multimatch "^4.0.0"
|
||||||
typescript "^3.0.1"
|
typescript "^3.0.1"
|
||||||
|
|
||||||
tslib@^1.8.0, tslib@^1.8.1:
|
tslib@^1.8.1:
|
||||||
version "1.9.3"
|
version "1.9.3"
|
||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
|
||||||
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
|
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
|
||||||
@@ -3756,28 +3791,10 @@ tslib@^1.9.3:
|
|||||||
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||||
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==
|
||||||
|
|
||||||
tslint@^5.9.1:
|
tsutils@^3.17.1:
|
||||||
version "5.11.0"
|
version "3.17.1"
|
||||||
resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.11.0.tgz#98f30c02eae3cde7006201e4c33cb08b48581eed"
|
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"
|
||||||
integrity sha1-mPMMAurjzecAYgHkwzywi0hYHu0=
|
integrity sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==
|
||||||
dependencies:
|
|
||||||
babel-code-frame "^6.22.0"
|
|
||||||
builtin-modules "^1.1.1"
|
|
||||||
chalk "^2.3.0"
|
|
||||||
commander "^2.12.1"
|
|
||||||
diff "^3.2.0"
|
|
||||||
glob "^7.1.1"
|
|
||||||
js-yaml "^3.7.0"
|
|
||||||
minimatch "^3.0.4"
|
|
||||||
resolve "^1.3.2"
|
|
||||||
semver "^5.3.0"
|
|
||||||
tslib "^1.8.0"
|
|
||||||
tsutils "^2.27.2"
|
|
||||||
|
|
||||||
tsutils@^2.27.2:
|
|
||||||
version "2.29.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99"
|
|
||||||
integrity sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==
|
|
||||||
dependencies:
|
dependencies:
|
||||||
tslib "^1.8.1"
|
tslib "^1.8.1"
|
||||||
|
|
||||||
@@ -3806,10 +3823,10 @@ typed-rest-client@^0.9.0:
|
|||||||
tunnel "0.0.4"
|
tunnel "0.0.4"
|
||||||
underscore "1.8.3"
|
underscore "1.8.3"
|
||||||
|
|
||||||
typescript@3.7.3:
|
"typescript@ 3.8.0-beta":
|
||||||
version "3.7.3"
|
version "3.8.0-beta"
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.3.tgz#b36840668a16458a7025b9eabfad11b66ab85c69"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.0-beta.tgz#acdcaf9f24c7e20b1ff0a6329d1e8d63691e2e13"
|
||||||
integrity sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==
|
integrity sha512-mQEmQUJg0CQBhf/GSVnGscKv/jrKsrLxE01AhdjYmBNoXX2Iah3i38ufxXByXacK6Fc5Nr9oMz7MjpjgddiknA==
|
||||||
|
|
||||||
typescript@^3.0.1:
|
typescript@^3.0.1:
|
||||||
version "3.5.3"
|
version "3.5.3"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"git": {
|
"git": {
|
||||||
"name": "chromium",
|
"name": "chromium",
|
||||||
"repositoryUrl": "https://chromium.googlesource.com/chromium/src",
|
"repositoryUrl": "https://chromium.googlesource.com/chromium/src",
|
||||||
"commitHash": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa"
|
"commitHash": "e4745133a1d3745f066e068b8033c6a269b59caf"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"licenseDetail": [
|
"licenseDetail": [
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||||
],
|
],
|
||||||
"isOnlyProductionDependency": true,
|
"isOnlyProductionDependency": true,
|
||||||
"version": "76.0.3809.146"
|
"version": "78.0.3904.130"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"component": {
|
"component": {
|
||||||
@@ -48,11 +48,11 @@
|
|||||||
"git": {
|
"git": {
|
||||||
"name": "nodejs",
|
"name": "nodejs",
|
||||||
"repositoryUrl": "https://github.com/nodejs/node",
|
"repositoryUrl": "https://github.com/nodejs/node",
|
||||||
"commitHash": "64219741218aa87e259cf8257596073b8e747f0a"
|
"commitHash": "787378879acfb212ed4ff824bf9f767a24a5cb43a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"isOnlyProductionDependency": true,
|
"isOnlyProductionDependency": true,
|
||||||
"version": "12.4.0"
|
"version": "12.8.1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"component": {
|
"component": {
|
||||||
@@ -60,12 +60,12 @@
|
|||||||
"git": {
|
"git": {
|
||||||
"name": "electron",
|
"name": "electron",
|
||||||
"repositoryUrl": "https://github.com/electron/electron",
|
"repositoryUrl": "https://github.com/electron/electron",
|
||||||
"commitHash": "19c705ab80cd6fdccca3d65803ec2c4addb9540a"
|
"commitHash": "bef0dd868b7d6d32716c319664ed480f2ae17396"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"isOnlyProductionDependency": true,
|
"isOnlyProductionDependency": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "6.1.6"
|
"version": "7.1.7"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"component": {
|
"component": {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
import AdsTelemetryReporter from 'ads-extension-telemetry';
|
import AdsTelemetryReporter from 'ads-extension-telemetry';
|
||||||
|
|
||||||
import * as Utils from './utils';
|
import * as Utils from './utils';
|
||||||
@@ -19,8 +18,3 @@ export enum TelemetryViews {
|
|||||||
SsmsMinGsw = 'SsmsMinGsw',
|
SsmsMinGsw = 'SsmsMinGsw',
|
||||||
SsmsMinDialog = 'SsmsMinDialog'
|
SsmsMinDialog = 'SsmsMinDialog'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export enum AgentDialogMode {
|
export enum AgentDialogMode {
|
||||||
CREATE = 1,
|
CREATE = 1,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
export class AzureResourceCredentialError extends Error {
|
export class AzureResourceCredentialError extends Error {
|
||||||
constructor(
|
constructor(
|
||||||
message: string,
|
message: string,
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { NodeInfo } from 'azdata';
|
import { NodeInfo } from 'azdata';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { extensions, TreeItem } from 'vscode';
|
import { extensions, TreeItem } from 'vscode';
|
||||||
import { Account } from 'azdata';
|
import { Account } from 'azdata';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { NodeInfo } from 'azdata';
|
import { NodeInfo } from 'azdata';
|
||||||
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { Event } from 'vscode';
|
import { Event } from 'vscode';
|
||||||
import { Account, DidChangeAccountsParams } from 'azdata';
|
import { Account, DidChangeAccountsParams } from 'azdata';
|
||||||
import { ApiWrapper } from '../../apiWrapper';
|
import { ApiWrapper } from '../../apiWrapper';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { ExtensionContext } from 'vscode';
|
import { ExtensionContext } from 'vscode';
|
||||||
|
|
||||||
import { IAzureResourceCacheService } from '../interfaces';
|
import { IAzureResourceCacheService } from '../interfaces';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { WorkspaceConfiguration, ConfigurationTarget } from 'vscode';
|
import { WorkspaceConfiguration, ConfigurationTarget } from 'vscode';
|
||||||
import { Account } from 'azdata';
|
import { Account } from 'azdata';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as request from 'request';
|
import * as request from 'request';
|
||||||
|
|
||||||
import { azureResource } from '../azure-resource';
|
import { azureResource } from '../azure-resource';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
import { TreeItem, TreeItemCollapsibleState } from 'vscode';
|
||||||
import { NodeInfo } from 'azdata';
|
import { NodeInfo } from 'azdata';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { TreeNode } from '../treeNode';
|
import { TreeNode } from '../treeNode';
|
||||||
|
|
||||||
export interface IAzureResourceTreeChangeHandler {
|
export interface IAzureResourceTreeChangeHandler {
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import { TreeDataProvider, EventEmitter, Event, TreeItem } from 'vscode';
|
import { TreeDataProvider, EventEmitter, Event, TreeItem } from 'vscode';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { AppContext } from '../../appContext';
|
import { AppContext } from '../../appContext';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import 'mocha';
|
import 'mocha';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
import * as TypeMoq from 'typemoq';
|
import * as TypeMoq from 'typemoq';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as should from 'should';
|
import * as should from 'should';
|
||||||
import * as TypeMoq from 'typemoq';
|
import * as TypeMoq from 'typemoq';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
["{", "}"],
|
["{", "}"],
|
||||||
["[", "]"],
|
["[", "]"],
|
||||||
["(", ")"],
|
["(", ")"],
|
||||||
["\"", "\""]
|
{ "open": "\"", "close": "\"", "notIn": ["string"] }
|
||||||
],
|
],
|
||||||
"surroundingPairs": [
|
"surroundingPairs": [
|
||||||
["{", "}"],
|
["{", "}"],
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { ApiWrapper } from './apiWrapper';
|
import { ApiWrapper } from './apiWrapper';
|
||||||
import { CmsUtils } from './cmsUtils';
|
import { CmsUtils } from './cmsUtils';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user