forked from OmniSharp/csharp-language-server-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.lintstagedrc.js
26 lines (24 loc) · 1.05 KB
/
.lintstagedrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function forEachChunk(chunks, callback, chunkSize = 50) {
var mappedFiles = [];
var files = chunks.concat();
while (files.length > 0) {
var chunk = files.splice(0, chunkSize);
mappedFiles = mappedFiles.concat(callback(chunk));
}
return mappedFiles;
}
function cleanupcode(filenames) {
var sln = require('./.nuke/parameters.json').Solution;
return forEachChunk(filenames, chunk => [
`dotnet jb cleanupcode ${sln} "--profile=Full Cleanup" "--disable-settings-layers=GlobalAll;GlobalPerProduct;SolutionPersonal;ProjectPersonal" "--include=${chunk.join(
';'
)}"`,
]);
}
module.exports = {
'*.cs': filenames => {
return [`echo "'${filenames.join(`' '`)}'" | dotnet format --include -`]; //.concat(cleanupcode(filenames));
},
'*.{csproj,targets,props,xml}': filenames => forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
'*.{js,ts,jsx,tsx,json,yml,yaml}': filenames => forEachChunk(filenames, chunk => [`prettier --write '${chunk.join(`' '`)}'`]),
};