Skip to content

Commit 639801a

Browse files
refactor: updated depencencies regarding prettier (#1307)
* refactor: updated husky and pretty-quick dependencies and updated to the new config storage model and removed husky and pretty-quick from packages/core, as this should be possible to get triggered from root * refactor: updated prettier dependency and removed rules "trailingComma": "es5" as this is the new default * fix: added missing comma * refactor: regenerated yarn.lock file * refactor(husky): made additional necessary changes for the installation as well as moved husky to the devDependencies, as defined by the software doc itself * refactor(pinst): remove that solution again see typicode/husky#884 * refactor(code): integrated prettier feedback that was enforced like this by eslint * refactor(husky): updated husky and added pinst Yarn 2 doesn't support prepare lifecycle script, so husky needs to be installed differently (this doesn't apply to Yarn 1 though) * Revert "refactor(husky): updated husky and added pinst" This reverts commit e834b42. * refactor(husky): updated husky Co-authored-by: Josef Bredreck <slime.games@outlook.de>
1 parent 7ecca69 commit 639801a

Some content is hidden

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

59 files changed

+352
-354
lines changed

.husky/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx --no-install pretty-quick --staged

.prettierrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
22
"singleQuote": true,
3-
"trailingComma": "es5",
43
"endOfLine": "auto"
54
}

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
"eslint-config-prettier": "^6.0.0",
1919
"eslint-plugin-import": "^2.18.2",
2020
"eslint-plugin-prettier": "^3.1.0",
21-
"prettier": "^1.14.3",
2221
"lerna": "3.17.0",
23-
"pretty-quick": "^1.11.1",
2422
"auto": "^9.40.5",
25-
"@auto-it/released": "^9.40.5"
23+
"@auto-it/released": "^9.40.5",
24+
"prettier": "^2.2.1",
25+
"pretty-quick": "^3.1.0"
2626
},
2727
"repository": {
2828
"type": "git",
@@ -41,7 +41,8 @@
4141
"publish": "npx lerna publish -m \"[skip travis] chore(release): publish %s\"",
4242
"postpublish": "auto release",
4343
"preview:docs": "cd packages/docs && yarn production",
44-
"preview:hbs": "cd packages/development-edition-engine-handlebars && yarn pl:starterkit && yarn pl:build"
44+
"preview:hbs": "cd packages/development-edition-engine-handlebars && yarn pl:starterkit && yarn pl:build",
45+
"prepare": "husky install"
4546
},
4647
"nyc": {
4748
"exclude": [
@@ -50,5 +51,8 @@
5051
"packages/core/test",
5152
"packages/live-server"
5253
]
54+
},
55+
"devDependencies": {
56+
"husky": "^6.0.0"
5357
}
5458
}

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"eslint": "4.18.2",
3535
"eslint-config-prettier": "2.9.0",
3636
"eslint-plugin-prettier": "2.6.0",
37-
"prettier": "1.11.1",
37+
"prettier": "2.2.1",
3838
"proxyquire": "2.1.3",
3939
"tap": "14.11.0"
4040
},

packages/core/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@
3030
"eslint-config-prettier": "^6.0.0",
3131
"eslint-plugin-import": "^2.18.2",
3232
"eslint-plugin-prettier": "^3.1.0",
33-
"husky": "0.14.3",
3433
"jsdoc-to-markdown": "5.0.1",
35-
"prettier": "^1.14.3",
36-
"pretty-quick": "^1.11.1",
34+
"prettier": "^2.2.1",
3735
"rewire": "2.5.2",
3836
"standard-version": "9.1.1",
3937
"tap": "14.11.0"

packages/core/src/lib/addPattern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const logger = require('./log');
44

5-
module.exports = function(pattern, patternlab) {
5+
module.exports = function (pattern, patternlab) {
66
//add the link to the global object
77
if (!patternlab.data.link) {
88
patternlab.data.link = {};

packages/core/src/lib/annotation_exporter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const _ = require('lodash');
66
const mp = require('./markdown_parser');
77
const logger = require('./log');
88

9-
const annotations_exporter = function(pl) {
9+
const annotations_exporter = function (pl) {
1010
const paths = pl.config.paths;
1111
let oldAnnotations;
1212

@@ -68,7 +68,7 @@ const annotations_exporter = function(pl) {
6868
//let annotations = annotations;
6969
const markdown_parser = parser;
7070

71-
return function(filePath) {
71+
return function (filePath) {
7272
const annotationsMD = fs.readFileSync(path.resolve(filePath), 'utf8');
7373

7474
//take the annotation snippets and split them on our custom delimiter
@@ -110,13 +110,13 @@ const annotations_exporter = function(pl) {
110110
}
111111

112112
return {
113-
gather: function() {
113+
gather: function () {
114114
return gatherAnnotations();
115115
},
116-
gatherJS: function() {
116+
gatherJS: function () {
117117
return parseAnnotationsJS();
118118
},
119-
gatherMD: function() {
119+
gatherMD: function () {
120120
return parseAnnotationsMD();
121121
},
122122
};

packages/core/src/lib/buildFooter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ let render = require('./render'); //eslint-disable-line prefer-const
1313
* @param patternPartial - the partial key to build this for, either viewall-patternPartial or a viewall-patternGroup-all
1414
* @returns A promise which resolves with the HTML
1515
*/
16-
module.exports = function(patternlab, patternPartial, uikit) {
16+
module.exports = function (patternlab, patternPartial, uikit) {
1717
//first render the general footer
1818
return render(Pattern.createEmpty({ extendedTemplate: uikit.footer }), {
1919
patternData: JSON.stringify({
2020
patternPartial: patternPartial,
2121
}),
2222
cacheBuster: patternlab.cacheBuster,
2323
})
24-
.then(footerPartial => {
24+
.then((footerPartial) => {
2525
let allFooterData;
2626
try {
2727
allFooterData = jsonCopy(
@@ -36,7 +36,7 @@ module.exports = function(patternlab, patternPartial, uikit) {
3636

3737
return render(patternlab.userFoot, allFooterData);
3838
})
39-
.catch(reason => {
39+
.catch((reason) => {
4040
console.log(reason);
4141
logger.error('Error building buildFooterHTML');
4242
});

packages/core/src/lib/buildListItems.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const items = [
2626
'twenty',
2727
];
2828

29-
module.exports = function(container) {
29+
module.exports = function (container) {
3030
//combine all list items into one structure
3131
const list = [];
3232
for (const item in container.listitems) {

packages/core/src/lib/buildPatterns.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
119119
cacheBuster: patternlab.cacheBuster,
120120
}
121121
)
122-
.then(results => {
122+
.then((results) => {
123123
patternlab.data.patternLabHead = results;
124124

125125
// If deletePatternDir == true or graph needs to be updated
@@ -133,7 +133,7 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
133133
if (patternlab.incrementalBuildsEnabled) {
134134
// When the graph was loaded from file, some patterns might have been moved/deleted between runs
135135
// so the graph data become out of sync
136-
patternlab.graph.sync().forEach(n => {
136+
patternlab.graph.sync().forEach((n) => {
137137
logger.info('[Deleted/Moved] ' + n);
138138
});
139139

@@ -150,18 +150,18 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
150150
}
151151
//render all patterns last, so lineageR works
152152
const allPatternsPromise = patternsToBuild.map(
153-
async pattern => await compose(pattern, patternlab)
153+
async (pattern) => await compose(pattern, patternlab)
154154
);
155155
//copy non-pattern files like JavaScript
156-
const allJS = patternsToBuild.map(pattern => {
156+
const allJS = patternsToBuild.map((pattern) => {
157157
const { name, patternPartial, subdir } = pattern;
158158
const {
159159
source: { patterns: sourceDir },
160160
public: { patterns: publicDir },
161161
} = patternlab.config.paths;
162162
const src = path.join(sourceDir, subdir);
163163
const dest = path.join(publicDir, name);
164-
return map(patternlab.uikits, uikit => {
164+
return map(patternlab.uikits, (uikit) => {
165165
return copy(
166166
src,
167167
path.resolve(process.cwd(), uikit.outputDir, dest),
@@ -199,27 +199,27 @@ module.exports = async (deletePatternDir, patternlab, additionalData) => {
199199
//export patterns if necessary
200200
pattern_exporter.export_patterns(patternlab);
201201
})
202-
.catch(reason => {
202+
.catch((reason) => {
203203
console.log(reason);
204204
logger.error('Error rendering patterns');
205205
});
206206
})
207-
.catch(reason => {
207+
.catch((reason) => {
208208
console.log(reason);
209209
logger.error('Error rendering pattern lab header');
210210
});
211211
})
212-
.catch(reason => {
212+
.catch((reason) => {
213213
console.log(reason);
214214
logger.error('Error processing meta patterns');
215215
});
216216
})
217-
.catch(reason => {
217+
.catch((reason) => {
218218
console.log(reason);
219219
logger.error('Error processing patterns recursively');
220220
});
221221
})
222-
.catch(reason => {
222+
.catch((reason) => {
223223
console.log(reason);
224224
logger.error('Error in buildPatterns()');
225225
});

packages/core/src/lib/changes_hunter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let fs = require('fs-extra'); //eslint-disable-line prefer-const
1212
* For detecting changed patterns.
1313
* @constructor
1414
*/
15-
const ChangesHunter = function() {};
15+
const ChangesHunter = function () {};
1616

1717
ChangesHunter.prototype = {
1818
/**
@@ -25,7 +25,7 @@ ChangesHunter.prototype = {
2525
*
2626
* @see {@link CompileState}
2727
*/
28-
checkBuildState: function(pattern, patternlab) {
28+
checkBuildState: function (pattern, patternlab) {
2929
//write the compiled template to the public patterns directory
3030
const renderedTemplatePath =
3131
patternlab.config.paths.public.patterns +
@@ -40,12 +40,12 @@ ChangesHunter.prototype = {
4040
pattern.compileState = CompileState.NEEDS_REBUILD;
4141
}
4242

43-
_.each(patternlab.uikits, uikit => {
43+
_.each(patternlab.uikits, (uikit) => {
4444
try {
4545
// renderedTemplatePath required to display a single element
4646
// Markup only is required for "View All" pages. It will get loaded later on.
4747
// If any of these is missing, mark pattern for recompile
48-
[renderedTemplatePath, markupOnlyPath].forEach(renderedFile => {
48+
[renderedTemplatePath, markupOnlyPath].forEach((renderedFile) => {
4949
// Prevent error message if file does not exist
5050
fs.accessSync(
5151
path.join(process.cwd(), uikit.outputDir, renderedFile),
@@ -94,7 +94,7 @@ ChangesHunter.prototype = {
9494
* @param {Pattern} currentPattern
9595
* @param {string} file
9696
*/
97-
checkLastModified: function(currentPattern, file) {
97+
checkLastModified: function (currentPattern, file) {
9898
if (file && fs.pathExistsSync(file)) {
9999
try {
100100
const stat = fs.statSync(file);
@@ -110,7 +110,7 @@ ChangesHunter.prototype = {
110110
}
111111
},
112112

113-
needsRebuild: function(lastModified, p) {
113+
needsRebuild: function (lastModified, p) {
114114
if (p.compileState !== CompileState.CLEAN || !p.lastModified) {
115115
return true;
116116
}

packages/core/src/lib/cleanBuildDirectory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ module.exports = (incrementalBuildsEnabled, patternlab) => {
1515
return Promise.resolve();
1616
} else {
1717
return Promise.all(
18-
_.map(patternlab.uikits, uikit => {
18+
_.map(patternlab.uikits, (uikit) => {
1919
return fs.emptyDir(
2020
path.join(process.cwd(), uikit.outputDir, paths.public.patterns)
2121
);
2222
})
23-
).catch(reason => {
23+
).catch((reason) => {
2424
logger.error(reason);
2525
});
2626
}

packages/core/src/lib/compose.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const pluginManager = new pm();
1515
const Pattern = require('./object_factory').Pattern;
1616
const CompileState = require('./object_factory').CompileState;
1717

18-
module.exports = async function(pattern, patternlab) {
18+
module.exports = async function (pattern, patternlab) {
1919
// Pattern does not need to be built and recompiled more than once
2020
if (!pattern.isPattern || pattern.compileState === CompileState.CLEAN) {
2121
return Promise.resolve(false);
@@ -41,7 +41,7 @@ module.exports = async function(pattern, patternlab) {
4141
);
4242

4343
return Promise.all(
44-
_.map(patternlab.uikits, uikit => {
44+
_.map(patternlab.uikits, (uikit) => {
4545
// exclude pattern from uikit rendering
4646
if (uikitExcludePattern(pattern, uikit)) {
4747
return Promise.resolve();
@@ -154,7 +154,7 @@ module.exports = async function(pattern, patternlab) {
154154
patternPartialPromise,
155155
footerPartialPromise,
156156
])
157-
.then(intermediateResults => {
157+
.then((intermediateResults) => {
158158
// retrieve results of promises
159159
const headHTML = intermediateResults[0]; //headPromise
160160
pattern.patternPartialCode = intermediateResults[1]; //patternPartialPromise
@@ -178,7 +178,7 @@ module.exports = async function(pattern, patternlab) {
178178
allFooterData.patternLabFoot = footerPartial;
179179

180180
return render(patternlab.userFoot, allFooterData).then(
181-
async footerHTML => {
181+
async (footerHTML) => {
182182
///////////////
183183
// WRITE FILES
184184
///////////////
@@ -212,7 +212,7 @@ module.exports = async function(pattern, patternlab) {
212212
}
213213
);
214214
})
215-
.catch(reason => {
215+
.catch((reason) => {
216216
console.log(reason);
217217
});
218218
})

packages/core/src/lib/copier.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const watchAssets = require('./watchAssets');
88
const watchPatternLabFiles = require('./watchPatternLabFiles');
99

1010
const copier = () => {
11-
const transform_paths = directories => {
11+
const transform_paths = (directories) => {
1212
//create array with all source keys minus our blacklist
1313
const dirs = {};
1414
const blackList = [
@@ -66,7 +66,7 @@ const copier = () => {
6666
} else {
6767
//just copy
6868
copyPromises.push(
69-
_.map(patternlab.uikits, uikit => {
69+
_.map(patternlab.uikits, (uikit) => {
7070
copyFile(
7171
dir.source,
7272
path.join(basePath, uikit.outputDir, dir.public),
@@ -79,7 +79,7 @@ const copier = () => {
7979

8080
// copy the styleguide
8181
copyPromises.push(
82-
_.map(patternlab.uikits, uikit => {
82+
_.map(patternlab.uikits, (uikit) => {
8383
copyFile(
8484
path.join(uikit.modulePath, assetDirectories.source.styleguide),
8585
path.join(basePath, uikit.outputDir, assetDirectories.public.root),
@@ -90,7 +90,7 @@ const copier = () => {
9090

9191
// copy the favicon
9292
copyPromises.push(
93-
_.map(patternlab.uikits, uikit => {
93+
_.map(patternlab.uikits, (uikit) => {
9494
copyFile(
9595
`${assetDirectories.source.root}/favicon.ico`,
9696
path.join(
@@ -116,7 +116,7 @@ const copier = () => {
116116
copyAndWatch: (assetDirectories, patternlab, options) => {
117117
return copyAndWatch(assetDirectories, patternlab, options);
118118
},
119-
transformConfigPaths: paths => {
119+
transformConfigPaths: (paths) => {
120120
return transform_paths(paths);
121121
},
122122
};

packages/core/src/lib/copyFile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ let copy = require('recursive-copy'); // eslint-disable-line prefer-const
77

88
const copyFile = (p, dest, options) => {
99
return copy(p, dest, options)
10-
.on(copy.events.ERROR, function(error, copyOperation) {
10+
.on(copy.events.ERROR, function (error, copyOperation) {
1111
logger.error('Unable to copy ' + copyOperation.dest);
1212
})
13-
.on(copy.events.COPY_FILE_ERROR, error => {
13+
.on(copy.events.COPY_FILE_ERROR, (error) => {
1414
logger.error(error);
1515
})
1616
.on(copy.events.COPY_FILE_COMPLETE, () => {

0 commit comments

Comments
 (0)