Skip to content

Commit 4401b76

Browse files
authored
Version 1.0 prep (#73)
* shellscape eslint config, refactoring * fix for comments between selectors and braces, postcss 5.2 * updating tokenzing for latest postcss tests * updating dependencies * removing shrinkwrap
1 parent 05f3ba6 commit 4401b76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1543
-4530
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ root = true
22

33
[*]
44
indent_style = space
5-
indent_size = 4
5+
indent_size = 2
66
end_of_line = lf
77
charset = utf-8
88
trim_trailing_whitespace = true

.eslintrc

+3-66
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,10 @@
11
{
2+
"extends": "shellscape",
3+
"parser": "babel-eslint",
24
"parserOptions": {
3-
"ecmaVersion": 6,
45
"sourceType": "module"
56
},
6-
"extends": [
7-
"strict",
8-
"strict/es6",
9-
"strict/mocha"
10-
],
117
"rules": {
12-
// JUSTIFICATION: code cleanliness
13-
// separation of variable declarations and logic makes source code more readable
14-
"newline-after-var": [
15-
"error",
16-
"always"
17-
],
18-
"semi": [
19-
"error",
20-
"always"
21-
],
22-
"space-before-function-paren": [
23-
"error",
24-
"always"
25-
],
26-
"comma-dangle": [
27-
"error",
28-
"never"
29-
],
30-
"array-bracket-spacing": [
31-
"error",
32-
"never"
33-
],
34-
"object-curly-spacing": [
35-
"error",
36-
"never"
37-
],
38-
"no-trailing-spaces": [
39-
"error",
40-
{
41-
"skipBlankLines": true
42-
}
43-
],
44-
"indent": [
45-
"error",
46-
4,
47-
{
48-
"SwitchCase": 1
49-
}
50-
],
51-
"eol-last": [
52-
"off"
53-
],
54-
"no-extra-semi": [
55-
"off"
56-
],
57-
"no-return-assign": [
58-
"off"
59-
],
60-
"semi-spacing": [
61-
"error",
62-
{
63-
"before": false,
64-
"after": true
65-
}
66-
],
67-
"quotes": [
68-
"error",
69-
"single",
70-
"avoid-escape"
71-
]
8+
"object-curly-spacing": ["error", "always", { "arraysInObjects": true }]
729
}
7310
}

LICENSE

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ The MIT License (MIT)
33
Copyright (c) 2013 Andrey Sitnik <andrey@sitnik.ru>
44
Copyright (c) 2016 Denys Kniazevych <webschik@gmail.com>
55
Copyright (c) 2016 Pat Sissons <patricksissons@gmail.com>
6+
Copyright (c) 2017 Andrew Powell <andrew@shellscape.org>
67

78
Permission is hereby granted, free of charge, to any person obtaining a copy
89
of this software and associated documentation files (the "Software"), to deal
@@ -20,4 +21,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2021
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2122
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2223
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23-
SOFTWARE.
24+
SOFTWARE.

gulpfile.babel.js

+70-69
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ import uglify from 'gulp-uglify';
1818
import util from 'gulp-util';
1919

2020
const config = {
21-
dirs: {
22-
lib: path.join(__dirname, 'lib'),
23-
test: path.join(__dirname, 'test'),
24-
build: path.join(__dirname, 'build'),
25-
dist: path.join(__dirname, 'dist')
26-
},
27-
builds: {
28-
lib: 'lib',
29-
test: 'test'
30-
},
31-
test: {
32-
reporter: 'spec'
33-
}
21+
dirs: {
22+
lib: path.join(__dirname, 'lib'),
23+
test: path.join(__dirname, 'test'),
24+
build: path.join(__dirname, 'build'),
25+
dist: path.join(__dirname, 'dist')
26+
},
27+
builds: {
28+
lib: 'lib',
29+
test: 'test'
30+
},
31+
test: {
32+
reporter: 'spec'
33+
}
3434
};
3535

3636
function lint (srcPath) {
37-
return gulp
37+
return gulp
3838
.src(srcPath)
3939
.pipe(eslint())
4040
.pipe(eslint.format())
@@ -44,7 +44,7 @@ function lint (srcPath) {
4444
gulp.task('default', ['test']);
4545

4646
gulp.task('config', () => {
47-
util.log(JSON.stringify(config, null, 2));
47+
util.log(JSON.stringify(config, null, 2));
4848
});
4949

5050
// Clean
@@ -54,26 +54,26 @@ gulp.task('clean', ['clean:all']);
5454
gulp.task('clean:all', ['clean:build', 'clean:dist']);
5555

5656
gulp.task('clean:lib', () => {
57-
return gulp
58-
.src(path.join(config.dirs.build, config.builds.lib), {read: false})
57+
return gulp
58+
.src(path.join(config.dirs.build, config.builds.lib), { read: false })
5959
.pipe(clean());
6060
});
6161

6262
gulp.task('clean:test', () => {
63-
return gulp
64-
.src(path.join(config.dirs.build, config.builds.test), {read: false})
63+
return gulp
64+
.src(path.join(config.dirs.build, config.builds.test), { read: false })
6565
.pipe(clean());
6666
});
6767

6868
gulp.task('clean:build', () => {
69-
return gulp
70-
.src(config.dirs.build, {read: false})
69+
return gulp
70+
.src(config.dirs.build, { read: false })
7171
.pipe(clean());
7272
});
7373

7474
gulp.task('clean:dist', () => {
75-
return gulp
76-
.src(path.join(config.dirs.dist), {read: false})
75+
return gulp
76+
.src(path.join(config.dirs.dist), { read: false })
7777
.pipe(clean());
7878
});
7979

@@ -83,14 +83,14 @@ gulp.task('build', ['build:all']);
8383
gulp.task('build:all', ['build:lib', 'build:test']);
8484

8585
gulp.task('build:lib', ['clean:lib'], () => {
86-
return gulp
86+
return gulp
8787
.src(path.join(config.dirs.lib, '**', '*.js'))
8888
.pipe(babel())
8989
.pipe(gulp.dest(path.join(config.dirs.build, config.builds.lib)));
9090
});
9191

9292
gulp.task('build:test', ['clean:test', 'build:lib'], () => {
93-
return gulp
93+
return gulp
9494
.src(path.join(config.dirs.test, '**', '*.js'))
9595
.pipe(babel())
9696
.pipe(gulp.dest(path.join(config.dirs.build, config.builds.test)));
@@ -103,84 +103,85 @@ gulp.task('lint', ['lint:all']);
103103
gulp.task('lint:all', ['lint:lib', 'lint:test', 'lint:root']);
104104

105105
gulp.task('lint:lib', () => {
106-
return lint(path.join(config.dirs.lib, '**', '*.js'));
106+
return lint(path.join(config.dirs.lib, '**', '*.js'));
107107
});
108108

109109
gulp.task('lint:test', () => {
110-
return lint(path.join(config.dirs.test, '**', '*.js'));
110+
return lint(path.join(config.dirs.test, '**', '*.js'));
111111
});
112112

113113
gulp.task('lint:root', () => {
114-
return lint(path.join(__dirname, '*.js'));
114+
return lint(path.join(__dirname, '*.js'));
115115
});
116116

117117
// Test
118118

119119
gulp.task('test', ['lint', 'test:run']);
120120

121121
gulp.task('test:all', (done) => {
122-
runSequence('lint', 'test:run', 'test:integration', done);
122+
runSequence('lint', 'test:run', 'test:integration', done);
123123
});
124124

125125
gulp.task('test:run', ['build:test'], () => {
126-
let mochaError = {};
126+
let mochaError = {};
127127

128-
return gulp
129-
.src(path.join(config.dirs.build, config.builds.test, '**', '*.spec.js'), {read: false})
128+
return gulp
129+
.src(path.join(config.dirs.build, config.builds.test, '**', '*.spec.js'), { read: false })
130130
.pipe(mocha({
131-
reporter: config.test.reporter
131+
reporter: config.test.reporter
132132
}))
133133
.on('error', function (error) {
134-
mochaError = error;
134+
mochaError = error;
135135
// eslint-disable-next-line no-invalid-this
136-
this.emit('end');
136+
this.emit('end');
137137
})
138138
.on('end', () => {
139-
if (mochaError.message) {
140-
throw new util.PluginError({
141-
plugin: 'gulp-mocha',
142-
message: mochaError.message
143-
});
144-
}
139+
if (mochaError.message) {
140+
throw new util.PluginError({
141+
plugin: 'gulp-mocha',
142+
message: mochaError.message
143+
});
144+
}
145145
});
146146
});
147147

148148
gulp.task('test:integration', ['build:lib'], (done) => {
149149
// this require is only available after running the build:lib task
150150
// eslint-disable-next-line global-require
151-
const lessSyntax = require('./build/lib/less-syntax').default;
151+
const lessSyntax = require('./build/lib/less-syntax').default;
152152

153-
real(done, (css) => {
154-
return postcss()
153+
real(done, (css) => {
154+
return postcss()
155155
.process(css, {
156-
parser: lessSyntax,
157-
map: {annotation: false}
156+
parser: lessSyntax,
157+
map: { annotation: false }
158158
});
159-
});
159+
});
160160
});
161161

162162
gulp.task('test:integration:local', ['build:lib'], () => {
163163
// create file in root source directory called integration.css to process
164164

165165
// this require is only available after running the build:lib task
166166
// eslint-disable-next-line global-require
167-
const lessSyntax = require('./build/lib/less-syntax').default;
167+
const lessSyntax = require('./build/lib/less-syntax').default;
168168

169-
return gulp
169+
return gulp
170170
.src(path.join(__dirname, 'integration.css'))
171171
.pipe(through((file) => {
172-
try {
172+
try {
173173
// we need to access .css as it is a lazy property
174174
// eslint-disable-next-line no-unused-vars
175-
const css = postcss().process(file.contents.toString(), {
176-
parser: lessSyntax,
177-
map: {annotation: false}
178-
}).css;
179-
180-
util.log(util.colors.green('VALID'));
181-
} catch (err) {
182-
util.log(util.colors.red('ERROR'), err.message, err.stack);
183-
}
175+
const css = postcss().process(file.contents.toString(), {
176+
parser: lessSyntax,
177+
map: { annotation: false }
178+
}).css;
179+
180+
util.log(util.colors.green('VALID'));
181+
}
182+
catch (err) {
183+
util.log(util.colors.red('ERROR'), err.message, err.stack);
184+
}
184185
}));
185186
});
186187

@@ -189,32 +190,32 @@ gulp.task('test:integration:local', ['build:lib'], () => {
189190
gulp.task('watch', ['watch:test']);
190191

191192
gulp.task('watch:lint', ['lint'], () => {
192-
return gulp
193+
return gulp
193194
.watch([
194-
path.join(config.dirs.lib, '**', '*.js'),
195-
path.join(config.dirs.test, '**', '*.js'),
196-
path.join(__dirname, '*.js')
195+
path.join(config.dirs.lib, '**', '*.js'),
196+
path.join(config.dirs.test, '**', '*.js'),
197+
path.join(__dirname, '*.js')
197198
], ['lint']);
198199
});
199200

200201
gulp.task('watch:test', ['test:run'], () => {
201-
return gulp
202+
return gulp
202203
.watch([
203-
path.join(config.dirs.lib, '**', '*.js'),
204-
path.join(config.dirs.test, '**', '*.js')
204+
path.join(config.dirs.lib, '**', '*.js'),
205+
path.join(config.dirs.test, '**', '*.js')
205206
], ['test:run']);
206207
});
207208

208209
// Dist
209210

210211
gulp.task('dist', ['build:lib'], () => {
211-
gulp
212+
gulp
212213
.src(path.join(config.dirs.build, config.builds.lib, '**', '*.js'))
213214
.pipe(gulp.dest(config.dirs.dist));
214215

215-
gulp
216+
gulp
216217
.src(path.join(config.dirs.build, config.builds.lib, '**', '*.js'))
217218
.pipe(uglify())
218-
.pipe(rename({suffix: '.min'}))
219+
.pipe(rename({ suffix: '.min' }))
219220
.pipe(gulp.dest(config.dirs.dist));
220221
});

0 commit comments

Comments
 (0)