Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
845a4d42
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
845a4d42
编写于
1月 20, 2021
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add new rule to enforce Thenable over Promise, adopt in vscode.d.ts and vscode.proposed.d.ts
上级
dfc8f5ab
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
132 addition
and
24 deletion
+132
-24
.eslintrc.json
.eslintrc.json
+69
-15
build/lib/eslint/vscode-dts-use-thenable.js
build/lib/eslint/vscode-dts-use-thenable.js
+24
-0
build/lib/eslint/vscode-dts-use-thenable.ts
build/lib/eslint/vscode-dts-use-thenable.ts
+30
-0
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+1
-1
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+8
-8
未找到文件。
.eslintrc.json
浏览文件 @
845a4d42
...
...
@@ -5,7 +5,10 @@
"ecmaVersion"
:
6
,
"sourceType"
:
"module"
},
"plugins"
:
[
"@typescript-eslint"
,
"jsdoc"
],
"plugins"
:
[
"@typescript-eslint"
,
"jsdoc"
],
"rules"
:
{
"constructor-super"
:
"warn"
,
"curly"
:
"warn"
,
...
...
@@ -43,7 +46,9 @@
"warn"
,
{
"selector"
:
"class"
,
"format"
:
[
"PascalCase"
]
"format"
:
[
"PascalCase"
]
}
],
"code-no-unused-expressions"
:
[
...
...
@@ -60,11 +65,26 @@
"warn"
,
{
"common"
:
[],
"node"
:
[
"common"
],
"browser"
:
[
"common"
],
"electron-sandbox"
:
[
"common"
,
"browser"
],
"electron-browser"
:
[
"common"
,
"browser"
,
"node"
,
"electron-sandbox"
],
"electron-main"
:
[
"common"
,
"node"
]
"node"
:
[
"common"
],
"browser"
:
[
"common"
],
"electron-sandbox"
:
[
"common"
,
"browser"
],
"electron-browser"
:
[
"common"
,
"browser"
,
"node"
,
"electron-sandbox"
],
"electron-main"
:
[
"common"
,
"node"
]
}
],
"code-import-patterns"
:
[
...
...
@@ -74,7 +94,10 @@
//
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
{
"target"
:
"**/vs/base/common/**"
,
"restrictions"
:
[
"vs/nls"
,
"**/vs/base/common/**"
]
"restrictions"
:
[
"vs/nls"
,
"**/vs/base/common/**"
]
},
{
"target"
:
"**/vs/base/test/common/**"
,
...
...
@@ -432,7 +455,11 @@
},
{
"target"
:
"**/vs/workbench/api/worker/**"
,
"restrictions"
:
[
"vscode"
,
"vs/nls"
,
"**/vs/**/{common,worker}/**"
]
"restrictions"
:
[
"vscode"
,
"vs/nls"
,
"**/vs/**/{common,worker}/**"
]
},
{
"target"
:
"**/vs/workbench/electron-sandbox/**"
,
...
...
@@ -878,7 +905,13 @@
},
{
"target"
:
"**/api/**.test.ts"
,
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"vscode"
]
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"vscode"
]
},
{
"target"
:
"**/{node,electron-browser,electron-main}/**/*.test.ts"
,
...
...
@@ -903,28 +936,46 @@
},
{
"target"
:
"**/**.test.ts"
,
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"xterm*"
]
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"xterm*"
]
},
{
"target"
:
"**/test/**"
,
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"xterm*"
]
"restrictions"
:
[
"**/vs/**"
,
"assert"
,
"sinon"
,
"crypto"
,
"xterm*"
]
}
]
},
"overrides"
:
[
{
"files"
:
[
"*.js"
],
"files"
:
[
"*.js"
],
"rules"
:
{
"jsdoc/no-types"
:
"off"
}
},
{
"files"
:
[
"**/vscode.d.ts"
,
"**/vscode.proposed.d.ts"
],
"files"
:
[
"**/vscode.d.ts"
,
"**/vscode.proposed.d.ts"
],
"rules"
:
{
"vscode-dts-create-func"
:
"warn"
,
"vscode-dts-literal-or-types"
:
"warn"
,
"vscode-dts-interface-naming"
:
"warn"
,
"vscode-dts-cancellation"
:
"warn"
,
"vscode-dts-use-thenable"
:
"warn"
,
"vscode-dts-provider-naming"
:
[
"warn"
,
{
...
...
@@ -940,7 +991,10 @@
"vscode-dts-event-naming"
:
[
"warn"
,
{
"allowed"
:
[
"onCancellationRequested"
,
"event"
],
"allowed"
:
[
"onCancellationRequested"
,
"event"
],
"verbs"
:
[
"accept"
,
"change"
,
...
...
build/lib/eslint/vscode-dts-use-thenable.js
0 → 100644
浏览文件 @
845a4d42
"
use strict
"
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
module
.
exports
=
new
class
ApiEventNaming
{
constructor
()
{
this
.
meta
=
{
messages
:
{
usage
:
'
Use the Thenable-type instead of the Promise type
'
,
}
};
}
create
(
context
)
{
return
{
[
'
TSTypeAnnotation TSTypeReference Identifier[name="Promise"]
'
]:
(
node
)
=>
{
context
.
report
({
node
,
messageId
:
'
usage
'
,
});
}
};
}
};
build/lib/eslint/vscode-dts-use-thenable.ts
0 → 100644
浏览文件 @
845a4d42
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
eslint
from
'
eslint
'
;
export
=
new
class
ApiEventNaming
implements
eslint
.
Rule
.
RuleModule
{
readonly
meta
:
eslint
.
Rule
.
RuleMetaData
=
{
messages
:
{
usage
:
'
Use the Thenable-type instead of the Promise type
'
,
}
};
create
(
context
:
eslint
.
Rule
.
RuleContext
):
eslint
.
Rule
.
RuleListener
{
return
{
[
'
TSTypeAnnotation TSTypeReference Identifier[name="Promise"]
'
]:
(
node
:
any
)
=>
{
context
.
report
({
node
,
messageId
:
'
usage
'
,
});
}
};
}
};
src/vs/vscode.d.ts
浏览文件 @
845a4d42
...
...
@@ -12161,7 +12161,7 @@ declare module 'vscode' {
/**
* Optional reaction handler for creating and deleting reactions on a [comment](#Comment).
*/
reactionHandler
?:
(
comment
:
Comment
,
reaction
:
CommentReaction
)
=>
Promis
e
<
void
>
;
reactionHandler
?:
(
comment
:
Comment
,
reaction
:
CommentReaction
)
=>
Thenabl
e
<
void
>
;
/**
* Dispose this comment controller.
...
...
src/vs/vscode.proposed.d.ts
浏览文件 @
845a4d42
...
...
@@ -1577,16 +1577,16 @@ declare module 'vscode' {
* resolve the raw content for `uri` as the resouce is not necessarily a file on disk.
*/
// eslint-disable-next-line vscode-dts-provider-naming
openNotebook
(
uri
:
Uri
,
openContext
:
NotebookDocumentOpenContext
):
NotebookData
|
Promis
e
<
NotebookData
>
;
openNotebook
(
uri
:
Uri
,
openContext
:
NotebookDocumentOpenContext
):
NotebookData
|
Thenabl
e
<
NotebookData
>
;
// eslint-disable-next-line vscode-dts-provider-naming
// eslint-disable-next-line vscode-dts-cancellation
resolveNotebook
(
document
:
NotebookDocument
,
webview
:
NotebookCommunication
):
Promis
e
<
void
>
;
resolveNotebook
(
document
:
NotebookDocument
,
webview
:
NotebookCommunication
):
Thenabl
e
<
void
>
;
// eslint-disable-next-line vscode-dts-provider-naming
saveNotebook
(
document
:
NotebookDocument
,
cancellation
:
CancellationToken
):
Promis
e
<
void
>
;
saveNotebook
(
document
:
NotebookDocument
,
cancellation
:
CancellationToken
):
Thenabl
e
<
void
>
;
// eslint-disable-next-line vscode-dts-provider-naming
saveNotebookAs
(
targetResource
:
Uri
,
document
:
NotebookDocument
,
cancellation
:
CancellationToken
):
Promis
e
<
void
>
;
saveNotebookAs
(
targetResource
:
Uri
,
document
:
NotebookDocument
,
cancellation
:
CancellationToken
):
Thenabl
e
<
void
>
;
// eslint-disable-next-line vscode-dts-provider-naming
backupNotebook
(
document
:
NotebookDocument
,
context
:
NotebookDocumentBackupContext
,
cancellation
:
CancellationToken
):
Promis
e
<
NotebookDocumentBackup
>
;
backupNotebook
(
document
:
NotebookDocument
,
context
:
NotebookDocumentBackupContext
,
cancellation
:
CancellationToken
):
Thenabl
e
<
NotebookDocumentBackup
>
;
}
export
interface
NotebookKernel
{
...
...
@@ -1685,7 +1685,7 @@ declare module 'vscode' {
):
Disposable
;
export
function
createNotebookEditorDecorationType
(
options
:
NotebookDecorationRenderOptions
):
NotebookEditorDecorationType
;
export
function
openNotebookDocument
(
uri
:
Uri
,
viewType
?:
string
):
Promis
e
<
NotebookDocument
>
;
export
function
openNotebookDocument
(
uri
:
Uri
,
viewType
?:
string
):
Thenabl
e
<
NotebookDocument
>
;
export
const
onDidOpenNotebookDocument
:
Event
<
NotebookDocument
>
;
export
const
onDidCloseNotebookDocument
:
Event
<
NotebookDocument
>
;
export
const
onDidSaveNotebookDocument
:
Event
<
NotebookDocument
>
;
...
...
@@ -1729,7 +1729,7 @@ declare module 'vscode' {
export
const
onDidChangeActiveNotebookEditor
:
Event
<
NotebookEditor
|
undefined
>
;
export
const
onDidChangeNotebookEditorSelection
:
Event
<
NotebookEditorSelectionChangeEvent
>
;
export
const
onDidChangeNotebookEditorVisibleRanges
:
Event
<
NotebookEditorVisibleRangesChangeEvent
>
;
export
function
showNotebookDocument
(
document
:
NotebookDocument
,
options
?:
NotebookDocumentShowOptions
):
Promis
e
<
NotebookEditor
>
;
export
function
showNotebookDocument
(
document
:
NotebookDocument
,
options
?:
NotebookDocumentShowOptions
):
Thenabl
e
<
NotebookEditor
>
;
}
//#endregion
...
...
@@ -1940,7 +1940,7 @@ declare module 'vscode' {
}
export
namespace
languages
{
export
function
getTokenInformationAtPosition
(
document
:
TextDocument
,
position
:
Position
):
Promis
e
<
TokenInformation
>
;
export
function
getTokenInformationAtPosition
(
document
:
TextDocument
,
position
:
Position
):
Thenabl
e
<
TokenInformation
>
;
}
//#endregion
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录