Skip to content
This repository was archived by the owner on Jun 27, 2019. It is now read-only.

Commit 22829a3

Browse files
committed
Tidy-up logs. Split out eslint rules into separate file. Fixes #39
1 parent 73f1b21 commit 22829a3

11 files changed

+426
-406
lines changed

.eslintrc

Lines changed: 319 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,319 @@
1+
{
2+
"rules": {
3+
"no-var": "error",
4+
"prefer-const": "error",
5+
"accessor-pairs": 2,
6+
"arrow-spacing": [
7+
2,
8+
{
9+
"before": true,
10+
"after": true
11+
}
12+
],
13+
"block-spacing": [
14+
2,
15+
"always"
16+
],
17+
"brace-style": [
18+
2,
19+
"1tbs",
20+
{
21+
"allowSingleLine": true
22+
}
23+
],
24+
"camelcase": [
25+
2,
26+
{
27+
"properties": "never"
28+
}
29+
],
30+
"comma-dangle": [
31+
2,
32+
"never"
33+
],
34+
"comma-spacing": [
35+
2,
36+
{
37+
"before": false,
38+
"after": true
39+
}
40+
],
41+
"comma-style": [
42+
2,
43+
"last"
44+
],
45+
"constructor-super": 2,
46+
"curly": [
47+
2,
48+
"multi-line"
49+
],
50+
"dot-location": [
51+
2,
52+
"property"
53+
],
54+
"eol-last": 2,
55+
"eqeqeq": [
56+
2,
57+
"allow-null"
58+
],
59+
"func-call-spacing": [
60+
2,
61+
"never"
62+
],
63+
"handle-callback-err": [
64+
2,
65+
"^(err|error)$"
66+
],
67+
"key-spacing": [
68+
2,
69+
{
70+
"beforeColon": false,
71+
"afterColon": true
72+
}
73+
],
74+
"keyword-spacing": [
75+
2,
76+
{
77+
"before": true,
78+
"after": true
79+
}
80+
],
81+
"new-cap": [
82+
2,
83+
{
84+
"newIsCap": true,
85+
"capIsNew": false
86+
}
87+
],
88+
"new-parens": 2,
89+
"no-array-constructor": 2,
90+
"no-caller": 2,
91+
"no-class-assign": 2,
92+
"no-cond-assign": 2,
93+
"no-const-assign": 2,
94+
"no-constant-condition": [
95+
2,
96+
{
97+
"checkLoops": false
98+
}
99+
],
100+
"no-control-regex": 2,
101+
"no-debugger": 2,
102+
"no-delete-var": 2,
103+
"no-dupe-args": 2,
104+
"no-dupe-class-members": 2,
105+
"no-dupe-keys": 2,
106+
"no-duplicate-case": 2,
107+
"no-duplicate-imports": 2,
108+
"no-empty-character-class": 2,
109+
"no-empty-pattern": 2,
110+
"no-eval": 2,
111+
"no-ex-assign": 2,
112+
"no-extend-native": 2,
113+
"no-extra-bind": 2,
114+
"no-extra-boolean-cast": 2,
115+
"no-extra-parens": [
116+
2,
117+
"functions"
118+
],
119+
"no-fallthrough": 2,
120+
"no-floating-decimal": 2,
121+
"no-func-assign": 2,
122+
"no-global-assign": 2,
123+
"no-implied-eval": 2,
124+
"no-inner-declarations": [
125+
2,
126+
"functions"
127+
],
128+
"no-invalid-regexp": 2,
129+
"no-irregular-whitespace": 2,
130+
"no-iterator": 2,
131+
"no-label-var": 2,
132+
"no-labels": [
133+
2,
134+
{
135+
"allowLoop": false,
136+
"allowSwitch": false
137+
}
138+
],
139+
"no-lone-blocks": 2,
140+
"no-mixed-spaces-and-tabs": 2,
141+
"no-multi-spaces": 2,
142+
"no-multi-str": 2,
143+
"no-multiple-empty-lines": [
144+
2,
145+
{
146+
"max": 1
147+
}
148+
],
149+
"no-native-reassign": 2,
150+
"no-negated-in-lhs": 2,
151+
"no-new": 2,
152+
"no-new-func": 2,
153+
"no-new-object": 2,
154+
"no-new-require": 2,
155+
"no-new-symbol": 2,
156+
"no-new-wrappers": 2,
157+
"no-obj-calls": 2,
158+
"no-octal": 2,
159+
"no-octal-escape": 2,
160+
"no-path-concat": 2,
161+
"no-proto": 2,
162+
"no-redeclare": 2,
163+
"no-regex-spaces": 2,
164+
"no-return-assign": [
165+
2,
166+
"except-parens"
167+
],
168+
"no-self-assign": 2,
169+
"no-self-compare": 2,
170+
"no-sequences": 2,
171+
"no-shadow-restricted-names": 2,
172+
"no-sparse-arrays": 2,
173+
"no-template-curly-in-string": 2,
174+
"no-this-before-super": 2,
175+
"no-throw-literal": 2,
176+
"no-undef": 2,
177+
"no-undef-init": 2,
178+
"no-unexpected-multiline": 2,
179+
"no-unmodified-loop-condition": 2,
180+
"no-unneeded-ternary": [
181+
2,
182+
{
183+
"defaultAssignment": false
184+
}
185+
],
186+
"no-unreachable": 2,
187+
"no-unsafe-finally": 2,
188+
"no-unsafe-negation": 2,
189+
"no-unused-vars": [
190+
2,
191+
{
192+
"vars": "all",
193+
"args": "none"
194+
}
195+
],
196+
"no-useless-call": 2,
197+
"no-useless-computed-key": 2,
198+
"no-useless-constructor": 2,
199+
"no-useless-escape": 2,
200+
"no-useless-rename": 2,
201+
"no-whitespace-before-property": 2,
202+
"no-with": 2,
203+
"object-property-newline": [
204+
2,
205+
{
206+
"allowMultiplePropertiesPerLine": true
207+
}
208+
],
209+
"one-var": [
210+
2,
211+
{
212+
"initialized": "never"
213+
}
214+
],
215+
"operator-linebreak": [
216+
2,
217+
"after",
218+
{
219+
"overrides": {
220+
"?": "before",
221+
":": "before"
222+
}
223+
}
224+
],
225+
"padded-blocks": [
226+
2,
227+
"never"
228+
],
229+
"quotes": [
230+
2,
231+
"single",
232+
{
233+
"avoidEscape": true,
234+
"allowTemplateLiterals": true
235+
}
236+
],
237+
"rest-spread-spacing": [
238+
2,
239+
"never"
240+
],
241+
"semi-spacing": [
242+
2,
243+
{
244+
"before": false,
245+
"after": true
246+
}
247+
],
248+
"space-before-blocks": [
249+
2,
250+
"always"
251+
],
252+
"space-in-parens": [
253+
2,
254+
"never"
255+
],
256+
"space-infix-ops": 2,
257+
"space-unary-ops": [
258+
2,
259+
{
260+
"words": true,
261+
"nonwords": false
262+
}
263+
],
264+
"spaced-comment": [
265+
2,
266+
"always",
267+
{
268+
"line": {
269+
"markers": [
270+
"*package",
271+
"!",
272+
","
273+
]
274+
},
275+
"block": {
276+
"balanced": true,
277+
"markers": [
278+
"*package",
279+
"!",
280+
","
281+
],
282+
"exceptions": [
283+
"*"
284+
]
285+
}
286+
}
287+
],
288+
"template-curly-spacing": [
289+
2,
290+
"never"
291+
],
292+
"unicode-bom": [
293+
2,
294+
"never"
295+
],
296+
"use-isnan": 2,
297+
"valid-typeof": 2,
298+
"wrap-iife": [
299+
2,
300+
"any"
301+
],
302+
"yield-star-spacing": [
303+
2,
304+
"both"
305+
],
306+
"yoda": [
307+
2,
308+
"never"
309+
]
310+
},
311+
"env": {
312+
"es6": true,
313+
"node": true
314+
},
315+
"parserOptions": {
316+
"ecmaVersion": 7
317+
},
318+
"extends": "eslint:recommended"
319+
}

bin/archive.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@ const debug = require('./utils').debug;
1111
* @param {object} config - The passed PatternLab config.
1212
*/
1313
function exportPatterns(config) {
14-
if (!isValidConfig) throw new TypeError('exportExpects config not to be empty OR of type object if not empty.');
14+
if (!isValidConfig) throw new TypeError('export: Expects config not to be empty OR of type object if not empty.');
1515

1616
const archive = new Archiver('zip', {});
1717
const exportsPath = path.resolve('./', config.patternExportDirectory, 'patterns.zip');
1818
const output = fs.createWriteStream(exportsPath);
1919

20-
output.on('close', function () {
21-
debug('patternlab→export: Exported patterns in ' + exportsPath + ' - ' + archive.pointer() + ' total bytes.');
20+
output.on('close', () => {
21+
debug(`export: Exported patterns in ${exportsPath} - ${archive.pointer()} total bytes.`);
2222
});
2323

2424
archive.on('error', function (err) {
25-
throw new TypeError(`exportAn error occured during zipping the patterns: ${err}`);
25+
throw new TypeError(`export: An error occured during zipping the patterns: ${err}`);
2626
});
2727

2828
archive.pipe(output);

bin/build.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const isValidConfig = require('./validate-config');
1010
* @param {object} options - Additional opts to specify build mode.
1111
*/
1212
function build(config, options) {
13-
if (!isValidConfig) throw new TypeError('buildExpects config not to be empty and of type object.');
13+
if (!isValidConfig) throw new TypeError('build: Expects config not to be empty and of type object.');
1414

1515
// Initiate PatternLab core with the config
1616
const patternLab = pl(config);
@@ -21,14 +21,14 @@ function build(config, options) {
2121
* 2. Normal build
2222
*/
2323
if (options && options.patternsOnly) { // 1
24-
debug(`patternlab→build: Building only patterns now into ${config.paths.public.root}`);
24+
debug(`build: Building only patterns now into ${config.paths.public.root}`);
2525
return patternLab.patternsonly(function () {
26-
console.log(`patternlab→build: Yay, your patterns were successfully built ☺`); // eslint-disable-line
26+
debug(`build: Yay, your patterns were successfully built ☺`);
2727
}, config.cleanPublic);
2828
} else { // 2
29-
debug(`patternlab→build: Building your project now into ${config.paths.public.root}`);
29+
debug(`build: Building your project now into ${config.paths.public.root}`);
3030
return patternLab.build(function () {
31-
console.log(`patternlab→build: Yay, your PatternLab project was successfully built ☺`); // eslint-disable-line
31+
debug(`build: Yay, your PatternLab project was successfully built ☺`);
3232
}, config.cleanPublic);
3333
}
3434
}

bin/copy-source-files.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const copyFilesFromSourceToPublic = paths => wrapAsync(function*() {
1919
copy(paths.source.fonts, '*', paths.public.fonts),
2020
copy(paths.source.root, 'favicon.ico', paths.public.root)
2121
];
22-
debug('patternlab→build: Your files were copied over to ' + paths.public.root);
22+
debug(`build: Your files were copied over to ${paths.public.root}`);
2323
return yield Promise.all(copiedFiles);
2424
});
2525

0 commit comments

Comments
 (0)