Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
30ce2998
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
30ce2998
编写于
7月 14, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
teach lint rules new dynamic import statements
上级
cebe4943
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
84 addition
and
41 deletion
+84
-41
.vscode/tasks.json
.vscode/tasks.json
+9
-2
build/lib/i18n.js
build/lib/i18n.js
+37
-37
build/lib/tslint/importPatternsRule.js
build/lib/tslint/importPatternsRule.js
+8
-0
build/lib/tslint/importPatternsRule.ts
build/lib/tslint/importPatternsRule.ts
+10
-0
build/lib/tslint/layeringRule.js
build/lib/tslint/layeringRule.js
+8
-0
build/lib/tslint/layeringRule.ts
build/lib/tslint/layeringRule.ts
+10
-0
build/lib/tslint/noUnexternalizedStringsRule.js
build/lib/tslint/noUnexternalizedStringsRule.js
+1
-1
build/lib/tslint/translationRemindRule.js
build/lib/tslint/translationRemindRule.js
+1
-1
未找到文件。
.vscode/tasks.json
浏览文件 @
30ce2998
...
...
@@ -32,7 +32,9 @@
"type"
:
"gulp"
,
"task"
:
"tslint"
,
"label"
:
"Run tslint"
,
"problemMatcher"
:
[
"$tslint4"
]
"problemMatcher"
:
[
"$tslint4"
]
},
{
"taskName"
:
"Run tests"
,
...
...
@@ -59,6 +61,11 @@
"type"
:
"gulp"
,
"task"
:
"electron"
,
"label"
:
"Download electron"
},
{
"type"
:
"gulp"
,
"task"
:
"hygiene"
,
"problemMatcher"
:
[]
}
]
}
\ No newline at end of file
}
build/lib/i18n.js
浏览文件 @
30ce2998
...
...
@@ -162,50 +162,50 @@ var XLF = (function () {
line
.
append
(
content
);
this
.
buffer
.
push
(
line
.
toString
());
};
return
XLF
;
}());
XLF
.
parse
=
function
(
xlfString
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
parser
=
new
xml2js
.
Parser
();
var
files
=
[];
parser
.
parseString
(
xlfString
,
function
(
err
,
result
)
{
if
(
err
)
{
reject
(
"
Failed to parse XLIFF string.
"
+
err
);
}
var
fileNodes
=
result
[
'
xliff
'
][
'
file
'
];
if
(
!
fileNodes
)
{
reject
(
'
XLIFF file does not contain "xliff" or "file" node(s) required for parsing.
'
);
}
fileNodes
.
forEach
(
function
(
file
)
{
var
originalFilePath
=
file
.
$
.
original
;
if
(
!
originalFilePath
)
{
reject
(
'
XLIFF file node does not contain original attribute to determine the original location of the resource file.
'
);
XLF
.
parse
=
function
(
xlfString
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
var
parser
=
new
xml2js
.
Parser
();
var
files
=
[];
parser
.
parseString
(
xlfString
,
function
(
err
,
result
)
{
if
(
err
)
{
reject
(
"
Failed to parse XLIFF string.
"
+
err
);
}
var
language
=
file
.
$
[
'
target-language
'
].
toLowerCase
()
;
if
(
!
language
)
{
reject
(
'
XLIFF file
node does not contain target-language attribute to determine translated language
.
'
);
var
fileNodes
=
result
[
'
xliff
'
][
'
file
'
]
;
if
(
!
fileNodes
)
{
reject
(
'
XLIFF file
does not contain "xliff" or "file" node(s) required for parsing
.
'
);
}
var
messages
=
{};
var
transUnits
=
file
.
body
[
0
][
'
trans-unit
'
];
transUnits
.
forEach
(
function
(
unit
)
{
var
key
=
unit
.
$
.
id
;
if
(
!
unit
.
target
)
{
return
;
// No translation available
}
var
val
=
unit
.
target
.
toString
();
if
(
key
&&
val
)
{
messages
[
key
]
=
decodeEntities
(
val
);
fileNodes
.
forEach
(
function
(
file
)
{
var
originalFilePath
=
file
.
$
.
original
;
if
(
!
originalFilePath
)
{
reject
(
'
XLIFF file node does not contain original attribute to determine the original location of the resource file.
'
);
}
else
{
reject
(
'
XLIFF file does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.
'
);
var
language
=
file
.
$
[
'
target-language
'
].
toLowerCase
();
if
(
!
language
)
{
reject
(
'
XLIFF file node does not contain target-language attribute to determine translated language.
'
);
}
var
messages
=
{};
var
transUnits
=
file
.
body
[
0
][
'
trans-unit
'
];
transUnits
.
forEach
(
function
(
unit
)
{
var
key
=
unit
.
$
.
id
;
if
(
!
unit
.
target
)
{
return
;
// No translation available
}
var
val
=
unit
.
target
.
toString
();
if
(
key
&&
val
)
{
messages
[
key
]
=
decodeEntities
(
val
);
}
else
{
reject
(
'
XLIFF file does not contain full localization data. ID or target translation for one of the trans-unit nodes is not present.
'
);
}
});
files
.
push
({
messages
:
messages
,
originalFilePath
:
originalFilePath
,
language
:
language
});
});
files
.
push
({
messages
:
messages
,
originalFilePath
:
originalFilePath
,
language
:
language
}
);
resolve
(
files
);
});
resolve
(
files
);
});
});
};
};
return
XLF
;
}());
exports
.
XLF
=
XLF
;
var
iso639_3_to_2
=
{
'
chs
'
:
'
zh-cn
'
,
...
...
build/lib/tslint/importPatternsRule.js
浏览文件 @
30ce2998
...
...
@@ -51,6 +51,14 @@ var ImportPatterns = (function (_super) {
ImportPatterns
.
prototype
.
visitImportDeclaration
=
function
(
node
)
{
this
.
_validateImport
(
node
.
moduleSpecifier
.
getText
(),
node
);
};
ImportPatterns
.
prototype
.
visitCallExpression
=
function
(
node
)
{
_super
.
prototype
.
visitCallExpression
.
call
(
this
,
node
);
// import('foo') statements inside the code
if
(
node
.
expression
.
kind
===
ts
.
SyntaxKind
.
ImportKeyword
)
{
var
path
=
node
.
arguments
[
0
];
this
.
_validateImport
(
path
.
getText
(),
node
);
}
};
ImportPatterns
.
prototype
.
_validateImport
=
function
(
path
,
node
)
{
// remove quotes
path
=
path
.
slice
(
1
,
-
1
);
...
...
build/lib/tslint/importPatternsRule.ts
浏览文件 @
30ce2998
...
...
@@ -45,6 +45,16 @@ class ImportPatterns extends Lint.RuleWalker {
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
);
...
...
build/lib/tslint/layeringRule.js
浏览文件 @
30ce2998
...
...
@@ -63,6 +63,14 @@ var LayeringRule = (function (_super) {
LayeringRule
.
prototype
.
visitImportDeclaration
=
function
(
node
)
{
this
.
_validateImport
(
node
.
moduleSpecifier
.
getText
(),
node
);
};
LayeringRule
.
prototype
.
visitCallExpression
=
function
(
node
)
{
_super
.
prototype
.
visitCallExpression
.
call
(
this
,
node
);
// import('foo') statements inside the code
if
(
node
.
expression
.
kind
===
ts
.
SyntaxKind
.
ImportKeyword
)
{
var
path
=
node
.
arguments
[
0
];
this
.
_validateImport
(
path
.
getText
(),
node
);
}
};
LayeringRule
.
prototype
.
_validateImport
=
function
(
path
,
node
)
{
// remove quotes
path
=
path
.
slice
(
1
,
-
1
);
...
...
build/lib/tslint/layeringRule.ts
浏览文件 @
30ce2998
...
...
@@ -61,6 +61,16 @@ class LayeringRule extends Lint.RuleWalker {
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
);
...
...
build/lib/tslint/noUnexternalizedStringsRule.js
浏览文件 @
30ce2998
...
...
@@ -172,6 +172,6 @@ var NoUnexternalizedStringsRuleWalker = (function (_super) {
node
=
parent
;
}
};
NoUnexternalizedStringsRuleWalker
.
DOUBLE_QUOTE
=
'
"
'
;
return
NoUnexternalizedStringsRuleWalker
;
}(
Lint
.
RuleWalker
));
NoUnexternalizedStringsRuleWalker
.
DOUBLE_QUOTE
=
'
"
'
;
build/lib/tslint/translationRemindRule.js
浏览文件 @
30ce2998
...
...
@@ -74,6 +74,6 @@ var TranslationRemindRuleWalker = (function (_super) {
this
.
addFailureAtNode
(
node
,
"
Please add '
"
+
resource
+
"
' to ./builds/lib/i18n.resources.json file to use translations here.
"
);
}
};
TranslationRemindRuleWalker
.
NLS_MODULE
=
'
vs/nls
'
;
return
TranslationRemindRuleWalker
;
}(
Lint
.
RuleWalker
));
TranslationRemindRuleWalker
.
NLS_MODULE
=
'
vs/nls
'
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录