Skip to content
This repository was archived by the owner on Feb 12, 2020. It is now read-only.

Commit 39c4fef

Browse files
committed
eslint
1 parent 5bdd05f commit 39c4fef

File tree

3 files changed

+151
-12
lines changed

3 files changed

+151
-12
lines changed

.eslintrc.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": "eslint:recommended",
7+
"rules": {
8+
"capitalized-comments": [
9+
"error",
10+
"always",
11+
{
12+
"ignoreConsecutiveComments": true
13+
}
14+
],
15+
"comma-dangle": [
16+
"error", {
17+
"arrays": "always-multiline",
18+
"objects": "always-multiline",
19+
"imports": "never",
20+
"exports": "never",
21+
"functions": "never"
22+
}
23+
],
24+
"comma-spacing": "error",
25+
"curly": [
26+
"error",
27+
"multi-line"
28+
],
29+
"eol-last": "error",
30+
"eqeqeq": "error",
31+
"indent": [
32+
"error",
33+
"tab"
34+
],
35+
"keyword-spacing": "error",
36+
"linebreak-style": [
37+
"error",
38+
"unix"
39+
],
40+
"no-console": [
41+
"error",
42+
{
43+
"allow": ["warn", "error"]
44+
}
45+
],
46+
"no-eval": [
47+
"error",
48+
{
49+
"allowIndirect": true
50+
}
51+
],
52+
"no-redeclare": "error",
53+
"no-unused-vars": "warn",
54+
"no-useless-concat": "error",
55+
"quote-props": [
56+
"error",
57+
"as-needed"
58+
],
59+
"quotes": [
60+
"error",
61+
"single"
62+
],
63+
"require-jsdoc": [
64+
"error", {
65+
"require": {
66+
"FunctionDeclaration": true,
67+
"MethodDefinition": true,
68+
"ClassDeclaration": false,
69+
"ArrowFunctionExpression": false,
70+
"FunctionExpression": true
71+
}
72+
}
73+
],
74+
"semi": [
75+
"error",
76+
"always"
77+
],
78+
"space-before-blocks": [
79+
"error",
80+
"always"
81+
],
82+
"space-before-function-paren": [
83+
"error",
84+
"never"
85+
],
86+
"spaced-comment": [
87+
"error",
88+
"always",
89+
{
90+
"line": {
91+
"markers": ["/"],
92+
"exceptions": ["-", "+"]
93+
},
94+
"block": {
95+
"markers": ["!"],
96+
"exceptions": ["*"],
97+
"balanced": true
98+
}
99+
}
100+
],
101+
"space-in-parens": [
102+
"error",
103+
"never"
104+
],
105+
"space-infix-ops": [
106+
"error",
107+
{
108+
"int32Hint": false
109+
}
110+
],
111+
"space-unary-ops": [
112+
"error",
113+
{
114+
"words": true,
115+
"nonwords": false,
116+
"overrides": {
117+
"new": false,
118+
"++": false
119+
}
120+
}
121+
],
122+
"valid-jsdoc": "error",
123+
"yoda": [
124+
"error",
125+
"always"
126+
]
127+
}
128+
}

Gruntfile.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ module.exports = function(grunt) {
1010
sass: {
1111
dist: {
1212
options: {
13-
style: 'compressed'
13+
outputStyle: 'compressed',
14+
sourceMap: true,
15+
outFile: 'demo/assets/demo.css.map',
1416
},
1517
files: {
1618
'demo/assets/demo.css': 'src/scss/demo.scss'
@@ -39,8 +41,16 @@ module.exports = function(grunt) {
3941
},
4042

4143
// Javascript processing.
42-
jshint: {
43-
all: ['src/js/vue-blob-forms.js']
44+
eslint: {
45+
check: {
46+
src: ['src/js/vue-blob-forms.js'],
47+
},
48+
fix: {
49+
options: {
50+
fix: true,
51+
},
52+
src: ['src/js/vue-blob-forms.js'],
53+
}
4454
},
4555

4656
uglify: {
@@ -94,19 +104,19 @@ module.exports = function(grunt) {
94104
});
95105

96106
// These plugins provide necessary tasks.
97-
grunt.loadNpmTasks('grunt-contrib-uglify');
107+
grunt.loadNpmTasks('grunt-contrib-uglify-es');
98108
grunt.loadNpmTasks('grunt-contrib-watch');
99-
grunt.loadNpmTasks('grunt-contrib-sass');
100-
grunt.loadNpmTasks('grunt-postcss');
101-
grunt.loadNpmTasks('grunt-contrib-jshint');
109+
grunt.loadNpmTasks('grunt-eslint');
102110
grunt.loadNpmTasks('grunt-notify');
111+
grunt.loadNpmTasks('grunt-postcss');
112+
grunt.loadNpmTasks('grunt-sass');
103113

104114
// Tasks.
105115
grunt.registerTask('default', ['css', 'javascript']);
106116
grunt.registerTask('css', ['sass', 'postcss']);
107-
grunt.registerTask('javascript', ['jshint', 'uglify']);
117+
grunt.registerTask('javascript', ['eslint:check', 'uglify']);
108118

109119
grunt.event.on('watch', function(action, filepath, target) {
110120
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
111121
});
112-
};
122+
};

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
"devDependencies": {
44
"cssnano": "*",
55
"grunt": "*",
6-
"grunt-contrib-jshint": "*",
7-
"grunt-contrib-sass": "*",
8-
"grunt-contrib-uglify": "*",
6+
"grunt-eslint": "*",
97
"grunt-contrib-watch": "*",
108
"grunt-notify": "*",
119
"grunt-postcss": "*",
1210
"grunt-sass": "*",
1311
"postcss-fixes": "*"
12+
},
13+
"dependencies": {
14+
"grunt-contrib-uglify-es": "git://github.com/gruntjs/grunt-contrib-uglify.git#harmony"
1415
}
1516
}

0 commit comments

Comments
 (0)