Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
ccbikai
9 years ago
Commit
e331f61b180e71771a60a7f606b9ff533652f09c
1 parent
b10de60e
add vue code check
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
lint.js
public/vue/channel/home.vue
lint.js
View file @
e331f61
...
...
@@ -3,8 +3,10 @@ const path = require('path');
const
changeFiles
=
{
js
:
shelljs
.
exec
(
'git diff --cached --name-only --diff-filter=ACM | grep .js$'
,
{
silent
:
true
}).
stdout
,
css
:
shelljs
.
exec
(
'git diff --cached --name-only --diff-filter=ACM | grep .css$'
,
{
silent
:
true
}).
stdout
css
:
shelljs
.
exec
(
'git diff --cached --name-only --diff-filter=ACM | grep .css$'
,
{
silent
:
true
}).
stdout
,
vue
:
shelljs
.
exec
(
'git diff --cached --name-only --diff-filter=ACM | grep .vue$'
,
{
silent
:
true
}).
stdout
,
};
const
lintPath
=
{
js
:
path
.
resolve
(
'./node_modules/.bin/eslint'
),
css
:
path
.
resolve
(
'./node_modules/.bin/stylelint'
)
...
...
@@ -31,6 +33,14 @@ if (changeFiles.css) {
lintResult
.
css
=
shelljs
.
exec
(
`
$
{
lintPath
.
css
}
$
{
ext
}
--
config
.
stylelintrc
$
{
changeFiles
.
css
}
`
);
}
if
(
lintResult
.
js
.
code
||
lintResult
.
css
.
code
)
{
process
.
exit
(
lintResult
.
js
.
code
||
lintResult
.
css
.
code
);
// eslint-disable-line
if
(
changeFiles
.
vue
)
{
changeFiles
.
vue
=
changeFiles
.
vue
.
replace
(
/
\n
/g
,
' '
);
lintResult
.
vueScript
=
shelljs
.
exec
(
`
$
{
lintPath
.
js
}
$
{
ext
}
-
c
.
eslintrc
--
cache
--
fix
$
{
changeFiles
.
vue
}
`
);
lintResult
.
vueStyle
=
shelljs
.
exec
(
`
$
{
lintPath
.
css
}
$
{
ext
}
--
extract
--
config
.
stylelintrc
$
{
changeFiles
.
vue
}
`
);
}
const
errorCode
=
lintResult
.
js
.
code
||
lintResult
.
css
.
code
||
lintResult
.
vueScript
.
code
||
lintResult
.
vueStyle
.
code
;
if
(
errorCode
)
{
process
.
exit
(
errorCode
);
// eslint-disable-line
}
...
...
public/vue/channel/home.vue
View file @
e331f61
...
...
@@ -8,24 +8,33 @@
</template>
<script>
var s = 1; // 测试代码检查
module.exports = {
data: function() {
return {
message: 'test',
message2: 'test2'
}
}
;
}
}
};
</script>
<style>
/* 雪碧图测试 */
.test {
color: green;
background: url("/channel/boys.png");
}
/* 图片测试 */
.test2 {
color: blue;
background: resolve("channel/boys.png");
}
.testError {
background: white;
}
</style>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment