Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8ede0519
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,发现更多精彩内容 >>
提交
8ede0519
编写于
2月 18, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'hygiene-tslint'
上级
7bcd1612
9707fdf6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
42 addition
and
17 deletion
+42
-17
build/gulpfile.hygiene.js
build/gulpfile.hygiene.js
+42
-17
未找到文件。
build/gulpfile.hygiene.js
浏览文件 @
8ede0519
...
...
@@ -7,7 +7,8 @@ var gulp = require('gulp');
var
filter
=
require
(
'
gulp-filter
'
);
var
es
=
require
(
'
event-stream
'
);
var
path
=
require
(
'
path
'
);
var
tslint
=
require
(
'
gulp-tslint
'
);
var
gulptslint
=
require
(
'
gulp-tslint
'
);
var
tslint
=
require
(
'
tslint
'
);
var
all
=
[
'
*
'
,
...
...
@@ -91,26 +92,31 @@ var copyrightHeader = [
'
*--------------------------------------------------------------------------------------------*/
'
].
join
(
'
\n
'
);
/**
* Reports tslint erros in the format:
* src/helloWorld.c:5:3: warning: implicit declaration of function ‘prinft’
*/
var
lintReporter
=
function
(
output
,
file
,
options
)
{
var
relativeBase
=
file
.
base
.
substring
(
file
.
cwd
.
length
+
1
).
replace
(
'
\\
'
,
'
/
'
);
output
.
forEach
(
function
(
e
)
{
var
message
=
relativeBase
+
e
.
name
+
'
:
'
+
(
e
.
startPosition
.
line
+
1
)
+
'
:
'
+
(
e
.
startPosition
.
character
+
1
)
+
'
:
'
+
e
.
failure
;
console
.
log
(
'
[tslint]
'
+
message
);
});
};
function
failureReporter
(
failure
)
{
var
name
=
failure
.
name
||
failure
.
fileName
;
var
position
=
failure
.
startPosition
;
var
line
=
position
.
lineAndCharacter
?
position
.
lineAndCharacter
.
line
:
position
.
line
;
var
character
=
position
.
lineAndCharacter
?
position
.
lineAndCharacter
.
character
:
position
.
character
;
console
.
error
(
name
+
'
:
'
+
(
line
+
1
)
+
'
:
'
+
(
character
+
1
)
+
'
:
'
+
failure
.
failure
);
}
gulp
.
task
(
'
tslint
'
,
function
()
{
var
options
=
{
summarizeFailureOutput
:
true
};
function
reporter
(
failures
)
{
failures
.
forEach
(
failureReporter
);
}
return
gulp
.
src
(
all
,
{
base
:
'
.
'
})
.
pipe
(
filter
(
tslintFilter
))
.
pipe
(
tslint
({
rulesDirectory
:
'
build/tslintRules
'
}))
.
pipe
(
tslint
.
report
(
lintReporter
,
{
summarizeFailureOutput
:
false
,
emitError
:
false
}));
.
pipe
(
gulptslint
({
rulesDirectory
:
'
build/tslintRules
'
}))
.
pipe
(
gulptslint
.
report
(
reporter
,
options
));
});
var
hygiene
=
exports
.
hygiene
=
function
(
some
)
{
...
...
@@ -154,6 +160,23 @@ var hygiene = exports.hygiene = function (some) {
this
.
emit
(
'
data
'
,
file
);
});
var
tslint
=
es
.
through
(
function
(
file
)
{
configuration
=
tslint
.
findConfiguration
(
null
,
'
.
'
);
var
options
=
{
formatter
:
'
json
'
,
configuration
:
configuration
,
rulesDirectory
:
'
build/tslintRules
'
,
}
var
contents
=
file
.
contents
.
toString
(
'
utf8
'
);
var
linter
=
new
tslint
(
file
.
relative
,
contents
,
options
);
var
result
=
linter
.
lint
();
if
(
result
.
failureCount
>
0
)
{
result
.
failures
.
forEach
(
failureReporter
);
errorCount
+=
result
.
failureCount
;
}
this
.
emit
(
'
data
'
,
file
);
});
return
gulp
.
src
(
some
||
all
,
{
base
:
'
.
'
})
.
pipe
(
filter
(
function
(
f
)
{
return
!
f
.
stat
.
isDirectory
();
}))
.
pipe
(
filter
(
eolFilter
))
...
...
@@ -162,6 +185,8 @@ var hygiene = exports.hygiene = function (some) {
.
pipe
(
indentation
)
.
pipe
(
filter
(
copyrightFilter
))
.
pipe
(
copyrights
)
.
pipe
(
filter
(
tslintFilter
))
.
pipe
(
tslint
)
.
pipe
(
es
.
through
(
null
,
function
()
{
if
(
errorCount
>
0
)
{
this
.
emit
(
'
error
'
,
'
Hygiene failed with
'
+
errorCount
+
'
errors. Check
\'
build/gulpfile.hygiene.js
\'
.
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录