Skip to content

Commit b2073bd

Browse files
Merge pull request #43 from w3c/eslint-indent
Enable the ESLint indent rule
2 parents 82b56b1 + 79310e1 commit b2073bd

5 files changed

+87
-86
lines changed

graphql.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const GH_HEADERS = {
1818

1919
async function graphql(query, variables) {
2020
let options = { method: 'POST', headers: GH_HEADERS },
21-
postObj = { query: query };
21+
postObj = { query: query };
2222
if (variables) {
2323
postObj.variables = variables;
2424
}

list-unconnected-contributors.js

+22-24
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,31 @@ w3c.apiKey = config.w3capikey;
1111
const octo = new Octokat({ token: config.ghToken });
1212

1313
if (!process.argv[2] || process.argv[2].indexOf('/') === -1) {
14-
console.error("Required: name of repo to check, e.g. w3c/webrtc-pc");
15-
process.exit(2);
14+
console.error("Required: name of repo to check, e.g. w3c/webrtc-pc");
15+
process.exit(2);
1616
}
1717

1818
const selectedrepo = process.argv[2];
1919

2020
octo.repos(selectedrepo).contributors.fetch().then(contributors => {
21-
Promise.all(contributors.items.map(contributor =>
22-
{
23-
return new Promise(function(res, rej) {
24-
w3c.user({type: 'github', id: contributor.id}).fetch(function(err, /* w3cuser */) {
25-
if (err) {
26-
if (err.status === 404) {
27-
// is the user known in ahsnazg local db?
28-
if (ashnazgusers.indexOf(contributor.id) !== -1)
29-
return res(null);
30-
else
31-
return res({login: contributor.login, contributions: contributor.contributions});
32-
} else {
33-
return rej(err);
34-
}
35-
}
36-
return res(null);
37-
});
38-
});
39-
}))
40-
.then(results => {
41-
console.log(JSON.stringify(results.filter(x => x), null, 2));
42-
});
21+
Promise.all(contributors.items.map(contributor => {
22+
return new Promise(function(res, rej) {
23+
w3c.user({type: 'github', id: contributor.id}).fetch(function(err, /* w3cuser */) {
24+
if (err) {
25+
if (err.status === 404) {
26+
// is the user known in ahsnazg local db?
27+
if (ashnazgusers.indexOf(contributor.id) !== -1)
28+
return res(null);
29+
else
30+
return res({login: contributor.login, contributions: contributor.contributions});
31+
} else {
32+
return rej(err);
33+
}
34+
}
35+
return res(null);
36+
});
37+
});
38+
})).then(results => {
39+
console.log(JSON.stringify(results.filter(x => x), null, 2));
40+
});
4341
});

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"extends": [
2424
"eslint:recommended"
2525
],
26+
"rules": {
27+
"indent": ["error", 2]
28+
},
2629
"parserOptions": {
2730
"ecmaVersion": 2019
2831
}

report.js

+60-60
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ const defaultReport = ["now3cjson", "inconsistengroups", "invalidw3cjson", "inco
2222

2323
// from https://stackoverflow.com/questions/10970078/modifying-a-query-string-without-reloading-the-page
2424
function insertUrlParam(key, value) {
25-
if (history.pushState) {
26-
let searchParams = new URLSearchParams(window.location.search);
27-
searchParams.set(key, value);
28-
let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + searchParams.toString();
29-
window.history.pushState({path: newurl}, '', newurl);
30-
}
25+
if (history.pushState) {
26+
let searchParams = new URLSearchParams(window.location.search);
27+
searchParams.set(key, value);
28+
let newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + '?' + searchParams.toString();
29+
window.history.pushState({path: newurl}, '', newurl);
30+
}
3131
}
3232

3333
// from https://stackoverflow.com/a/5158301
@@ -96,59 +96,59 @@ function writeReport() {
9696
const stats = document.createElement('p');
9797
stats.textContent = `${data.repos.filter(r => r.owner.login === 'w3c' && !r.isArchived).length} active repos in the w3c github organization; overall, ${Object.values(data.groups).filter(g => g.type === 'working group').reduce((acc, g) => acc + g.repos.length, 0)} known repos associated with Working Groups, ${Object.values(data.groups).filter(g => g.type === 'community group').reduce((acc, g) => acc + g.repos.length, 0)} associated with Community Groups`;
9898
report.appendChild(stats);
99-
const groups = data.groups;
100-
Object.keys(groups).sort((a,b) => groups[a].name.localeCompare(groups[b].name))
101-
.forEach(groupId => {
102-
const section = document.createElement('section');
103-
const title = document.createElement('h2');
104-
title.appendChild(document.createTextNode(groups[groupId].name));
105-
if (groupFilter(groupId))
106-
section.appendChild(title);
107-
if (groups[groupId].type === "working group" && !groups[groupId].repos.some(r => r.hasRecTrack)) {
108-
const p = document.createElement('p');
109-
p.appendChild(document.createTextNode('No identified repo for rec-track spec.'));
110-
section.appendChild(p);
111-
}
112-
if (groups[groupId].repos.length) {
113-
Object.keys(errortypes).filter(t => errorFilter.size === 0 || errorFilter.has(t))
114-
.forEach(err => {
115-
const repos = data.errors[err].filter(r => groups[groupId].repos.find(x => x.fullName === r || x.fullName === r.repo));
116-
if (repos.length) {
117-
const errsection = document.createElement('section');
118-
const errtitle = document.createElement('h3');
119-
errtitle.appendChild(document.createTextNode(errortypes[err]));
120-
errsection.appendChild(errtitle);
121-
122-
const list = document.createElement('ul');
123-
repos.forEach(repo => {
124-
const repoName = typeof repo === "string" ? repo : repo.repo;
125-
mentionedRepos.add(repoName);
126-
writeErrorEntry(repoName, list, repo.error);
127-
128-
});
129-
errsection.appendChild(list);
130-
if (groupFilter(groupId))
131-
section.appendChild(errsection);
132-
}
133-
});
134-
}
135-
report.appendChild(section);
136-
});
137-
const section = document.createElement('section');
138-
const title = document.createElement('h2');
139-
title.appendChild(document.createTextNode("No w3c.json"));
140-
section.appendChild(title);
141-
const ul = document.createElement('ul');
142-
data.errors.incompletew3cjson
143-
.filter(x => x.error === "group")
144-
.forEach(x => writeErrorEntry(x.repo, ul, "missing group in w3c.json"));
145-
data.errors.illformedw3cjson
146-
.forEach(x => writeErrorEntry(x, ul, "ill-formed JSON"));
147-
data.errors.now3cjson
148-
.filter(x => x.startsWith('w3c/') || x.startsWith('WICG') || x.startsWith('WebAudio'))
149-
.filter(x => !mentionedRepos.has(x))
150-
.forEach(x => writeErrorEntry(x, ul, "no w3c.json"));
151-
section.appendChild(ul);
152-
report.appendChild(section);
99+
const groups = data.groups;
100+
Object.keys(groups).sort((a,b) => groups[a].name.localeCompare(groups[b].name))
101+
.forEach(groupId => {
102+
const section = document.createElement('section');
103+
const title = document.createElement('h2');
104+
title.appendChild(document.createTextNode(groups[groupId].name));
105+
if (groupFilter(groupId))
106+
section.appendChild(title);
107+
if (groups[groupId].type === "working group" && !groups[groupId].repos.some(r => r.hasRecTrack)) {
108+
const p = document.createElement('p');
109+
p.appendChild(document.createTextNode('No identified repo for rec-track spec.'));
110+
section.appendChild(p);
111+
}
112+
if (groups[groupId].repos.length) {
113+
Object.keys(errortypes).filter(t => errorFilter.size === 0 || errorFilter.has(t))
114+
.forEach(err => {
115+
const repos = data.errors[err].filter(r => groups[groupId].repos.find(x => x.fullName === r || x.fullName === r.repo));
116+
if (repos.length) {
117+
const errsection = document.createElement('section');
118+
const errtitle = document.createElement('h3');
119+
errtitle.appendChild(document.createTextNode(errortypes[err]));
120+
errsection.appendChild(errtitle);
121+
122+
const list = document.createElement('ul');
123+
repos.forEach(repo => {
124+
const repoName = typeof repo === "string" ? repo : repo.repo;
125+
mentionedRepos.add(repoName);
126+
writeErrorEntry(repoName, list, repo.error);
127+
128+
});
129+
errsection.appendChild(list);
130+
if (groupFilter(groupId))
131+
section.appendChild(errsection);
132+
}
133+
});
134+
}
135+
report.appendChild(section);
136+
});
137+
const section = document.createElement('section');
138+
const title = document.createElement('h2');
139+
title.appendChild(document.createTextNode("No w3c.json"));
140+
section.appendChild(title);
141+
const ul = document.createElement('ul');
142+
data.errors.incompletew3cjson
143+
.filter(x => x.error === "group")
144+
.forEach(x => writeErrorEntry(x.repo, ul, "missing group in w3c.json"));
145+
data.errors.illformedw3cjson
146+
.forEach(x => writeErrorEntry(x, ul, "ill-formed JSON"));
147+
data.errors.now3cjson
148+
.filter(x => x.startsWith('w3c/') || x.startsWith('WICG') || x.startsWith('WebAudio'))
149+
.filter(x => !mentionedRepos.has(x))
150+
.forEach(x => writeErrorEntry(x, ul, "no w3c.json"));
151+
section.appendChild(ul);
152+
report.appendChild(section);
153153
}
154154

validate.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async function fetchRepoPage(org, acc = [], cursor = null) {
189189
if (res.organization.repositories.pageInfo.hasNextPage) {
190190
return fetchRepoPage(org, data, res.organization.repositories.pageInfo.endCursor);
191191
} else {
192-
return data;
192+
return data;
193193
}
194194
});
195195
} else {

0 commit comments

Comments
 (0)