Skip to content

Commit d2e67c9

Browse files
committed
chore: fmt
1 parent c5abe5c commit d2e67c9

File tree

9 files changed

+9
-29
lines changed

9 files changed

+9
-29
lines changed

source/.eslintrc.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ rules:
8181
no-multiple-empty-lines: error
8282
no-multi-str: error
8383
no-multi-assign: error
84-
no-inline-comments: error
8584
yoda: error
8685
max-classes-per-file: [error, 1]
8786
grouped-accessor-pairs: error
@@ -116,9 +115,6 @@ rules:
116115
quotes: [error, double, {avoidEscape: true}]
117116
template-curly-spacing: error
118117

119-
# Coding style (comments rules)
120-
line-comment-position: error
121-
122118
# Coding style (spacing rules)
123119
block-spacing: [error, always]
124120
comma-spacing: error

source/app/metrics/metadata.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ metadata.plugin = async function({__plugins, __templates, name, logger}) {
233233
comment: "",
234234
descriptor: yaml.dump({
235235
[key]: Object.fromEntries(
236-
Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)).map(([k, v]) =>
237-
k === "description" ? [k, v.split("\n")[0]] : k === "default" ? [k, ((/^\$\{\{[\s\S]+\}\}$/.test(v)) || (["config_presets", "config_timezone", "use_prebuilt_image"].includes(key))) ? v : "<default-value>"] : [k, v]
238-
),
236+
Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)).map(([k, v]) => k === "description" ? [k, v.split("\n")[0]] : k === "default" ? [k, ((/^\$\{\{[\s\S]+\}\}$/.test(v)) || (["config_presets", "config_timezone", "use_prebuilt_image"].includes(key))) ? v : "<default-value>"] : [k, v]),
239237
),
240238
}, {quotingType: '"', noCompatMode: true}),
241239
},

source/app/web/statics/app.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,9 @@
238238
` template: ${this.templates.selected}`,
239239
` base: ${Object.entries(this.plugins.enabled.base).filter(([key, value]) => value).map(([key]) => key).join(", ") || '""'}`,
240240
...[
241-
...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web) && (value !== metadata.base.web[key]?.defaulted)).map(([key, value]) =>
242-
` ${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`
243-
),
241+
...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web) && (value !== metadata.base.web[key]?.defaulted)).map(([key, value]) => ` ${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
244242
...Object.entries(this.plugins.enabled).filter(([key, value]) => (key !== "base") && (value)).map(([key]) => ` plugin_${key}: yes`),
245-
...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) =>
246-
` plugin_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`
247-
),
243+
...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) => ` plugin_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
248244
...Object.entries(this.config).filter(([key, value]) => (value) && (value !== metadata.core.web[key]?.defaulted)).map(([key, value]) => ` config_${key.replace(/[.]/g, "_")}: ${typeof value === "boolean" ? {true: "yes", false: "no"}[value] : value}`),
249245
].sort(),
250246
].join("\n")

source/app/web/statics/app.placeholder.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@
402402
status: "modified",
403403
additions: faker.datatype.number(50),
404404
deletions: faker.datatype.number(50),
405-
patch:
406-
`<span class="token coord">@@ -0,0 +1,5 @@</span><br> //Imports<br><span class="token inserted">+ import app from "./src/app.mjs"</span><br><span class="token deleted">- import app from "./src/app.js"</span><br> //Start app<br> await app()<br>\\ No newline at end of file`,
405+
patch: `<span class="token coord">@@ -0,0 +1,5 @@</span><br> //Imports<br><span class="token inserted">+ import app from "./src/app.mjs"</span><br><span class="token deleted">- import app from "./src/app.js"</span><br> //Start app<br> await app()<br>\\ No newline at end of file`,
407406
repo: `${faker.random.word()}/${faker.random.word()}`,
408407
},
409408
},

source/plugins/languages/index.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ export default async function({login, data, imports, q, rest, account}, {enabled
128128
//Compute languages stats
129129
for (const {section, stats = {}, lines = {}, missed = {bytes: 0}, total = 0} of [{section: "favorites", stats: languages.stats, lines: languages.lines, total: languages.total, missed: languages.missed}, {section: "recent", ...languages["stats.recent"]}]) {
130130
console.debug(`metrics/compute/${login}/plugins > languages > computing stats ${section}`)
131-
languages[section] = Object.entries(stats).filter(([name]) => !ignored.includes(name.toLocaleLowerCase())).sort(([_an, a], [_bn, b]) => b - a).slice(0, limit).map(([name, value]) => ({name, value, size: value, color: languages.colors[name], x: 0})).filter(({value}) =>
132-
value / total > threshold
133-
)
131+
languages[section] = Object.entries(stats).filter(([name]) => !ignored.includes(name.toLocaleLowerCase())).sort(([_an, a], [_bn, b]) => b - a).slice(0, limit).map(([name, value]) => ({name, value, size: value, color: languages.colors[name], x: 0})).filter(({value}) => value / total > threshold)
134132
if (other) {
135133
let value = indepth ? missed.bytes : Object.entries(stats).filter(([name]) => !Object.values(languages[section]).map(({name}) => name).includes(name)).reduce((a, [_, b]) => a + b, 0)
136134
if (value) {

source/plugins/lines/index.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export default async function({login, data, imports, rest, q, account}, {enabled
2323
//Get contributors stats from repositories
2424
console.debug(`metrics/compute/${login}/plugins > lines > querying api`)
2525
const lines = {added: 0, deleted: 0, changed: 0}
26-
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getContributorsStats({owner, repo})))].filter(({status}) =>
27-
status === "fulfilled"
28-
).map(({value}) => value)
26+
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getContributorsStats({owner, repo})))].filter(({status}) => status === "fulfilled").map(({value}) => value)
2927

3028
//Compute changed lines
3129
console.debug(`metrics/compute/${login}/plugins > lines > computing total diff`)

source/plugins/notable/index.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ export default async function({login, q, imports, rest, graphql, data, account,
2929
}
3030

3131
//Set contributions
32-
contributions = (await Promise.all(contributions.map(async ({handle, stars, issues, pulls, avatarUrl, organization}) => ({name: handle.split("/").shift(), handle, stars, issues, pulls, avatar: await imports.imgb64(avatarUrl), organization})))).sort((a, b) =>
33-
a.name.localeCompare(b.name)
34-
)
32+
contributions = (await Promise.all(contributions.map(async ({handle, stars, issues, pulls, avatarUrl, organization}) => ({name: handle.split("/").shift(), handle, stars, issues, pulls, avatar: await imports.imgb64(avatarUrl), organization})))).sort((a, b) => a.name.localeCompare(b.name))
3533
console.debug(`metrics/compute/${login}/plugins > notable > found ${contributions.length} notable contributions`)
3634

3735
//Extras features

source/plugins/traffic/index.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ export default async function({login, imports, data, rest, q, account}, {enabled
1616
//Get views stats from repositories
1717
console.debug(`metrics/compute/${login}/plugins > traffic > querying api`)
1818
const views = {count: 0, uniques: 0}
19-
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getViews({owner, repo})))].filter(({status}) =>
20-
status === "fulfilled"
21-
).map(({value}) => value)
19+
const response = [...await Promise.allSettled(repositories.map(({repo, owner}) => (skipped.includes(repo.toLocaleLowerCase())) || (skipped.includes(`${owner}/${repo}`.toLocaleLowerCase())) ? {} : rest.repos.getViews({owner, repo})))].filter(({status}) => status === "fulfilled").map(({value}) => value)
2220

2321
//Compute views
2422
console.debug(`metrics/compute/${login}/plugins > traffic > computing stats`)

tests/ci.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,5 @@ describe("Check files editions (checkout your files if needed)", () => {
4444

4545
//Templates editions
4646
describe("Check templates editions", () => {
47-
test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () =>
48-
void expect((await diff()).filter(edited => /^sources[/]templates[/]/.test(edited) && /^source[/]templates[/](?:classic|terminal|markdown|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0))
47+
test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () => void expect((await diff()).filter(edited => /^sources[/]templates[/]/.test(edited) && /^source[/]templates[/](?:classic|terminal|markdown|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0))
4948
})

0 commit comments

Comments
 (0)