Skip to content

Commit abf09ec

Browse files
authored
Re-enable Biome lint rules disabled during migration (#1503)
1 parent 5dcc5a3 commit abf09ec

File tree

94 files changed

+390
-387
lines changed

Some content is hidden

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

94 files changed

+390
-387
lines changed

app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ function createApp(config) {
243243
} else {
244244
// Don't log Azure robot liveness checks
245245
// https://feedback.azure.com/forums/169385-web-apps/suggestions/32120617-document-healthcheck-url-requirement-for-custom-co
246-
if (!(request && request.url && request.url.includes('robots933456.txt')))
247-
logger.error('SvcRequestFailure: ' + request.url, error)
246+
if (!request?.url?.includes('robots933456.txt')) logger.error(`SvcRequestFailure: ${request.url}`, error)
248247

249248
// set locals, only providing error in development
250249
response.locals.message = error.message

bin/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function loadFactory(spec, namespace) {
3434
*/
3535
function loadOne(spec, namespace) {
3636
const [requirePath, objectPath] = spec.split('|')
37-
const getPath = (namespace ? namespace + '.' : '') + requirePath
37+
const getPath = (namespace ? `${namespace}.` : '') + requirePath
3838
let target = get(providers, getPath)
3939
try {
4040
if (!target) target = require(requirePath)

biome.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,8 @@
3030
"recommended": true,
3131
"suspicious": {
3232
"noAssignInExpressions": "off",
33-
"noDoubleEquals": "off",
34-
"noGlobalIsNan": "off",
3533
"noExplicitAny": "off",
3634
"noDuplicateTestHooks": "off",
37-
"noConfusingVoidType": "off",
38-
"noMisleadingInstantiator": "off",
3935
"noConsole": { "level": "off", "options": { "allow": ["log"] } },
4036
"noVar": "off",
4137
"useIterableCallbackReturn": "off"
@@ -47,23 +43,13 @@
4743
},
4844
"style": {
4945
"noParameterAssign": "off",
50-
"noUselessElse": "off",
51-
"useNodejsImportProtocol": "off",
52-
"useTemplate": "off",
53-
"useDefaultParameterLast": "off",
54-
"useSingleVarDeclarator": "off"
46+
"useDefaultParameterLast": "off"
5547
},
5648
"complexity": {
57-
"noForEach": "off",
5849
"noStaticOnlyClass": "off",
59-
"noThisInStatic": "off",
60-
"noUselessConstructor": "off",
61-
"noUselessTernary": "off",
62-
"useOptionalChain": "off",
6350
"useLiteralKeys": "off"
6451
},
6552
"performance": {
66-
"noAccumulatingSpread": "off",
6753
"noDelete": "off"
6854
}
6955
}

business/aggregator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ class AggregationService {
7373
const order = this.workingPrecedence || []
7474
/** @type {string[]} */
7575
const tools = []
76-
order.forEach(tool => {
76+
for (const tool of order) {
7777
const data = this._findData(tool, summarized)
7878
if (data) {
7979
tools.push(data.toolSpec)
8080
mergeDefinitions(result, data.summary)
8181
}
82-
})
82+
}
8383
if (!tools.length) return null
8484
set(result, 'described.tools', tools.reverse())
8585
const cdSummarized = this._findData('clearlydefined', summarized)

business/definitionService.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export declare class DefinitionService {
385385
*
386386
* @param coordinates - Individual or array of coordinates to invalidate
387387
*/
388-
invalidate(coordinates: EntityCoordinates | EntityCoordinates[]): Promise<void[]>
388+
invalidate(coordinates: EntityCoordinates | EntityCoordinates[]): Promise<undefined[]>
389389

390390
/**
391391
* Compute and store a definition, then trigger auto-curation
@@ -440,7 +440,7 @@ export declare class DefinitionService {
440440
* @param mode - 'definitions' to recompute, 'index' to just re-index
441441
* @param coordinatesList - Optional list of coordinates to reload
442442
*/
443-
reload(mode: 'definitions' | 'index', coordinatesList?: string[] | null): Promise<(void | null)[]>
443+
reload(mode: 'definitions' | 'index', coordinatesList?: string[] | null): Promise<(undefined | null)[]>
444444

445445
/**
446446
* Check if a file is in the core facet

business/definitionService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,10 @@ class DefinitionService {
528528
* @private
529529
*/
530530
_ensureNoNulls(object) {
531-
Object.keys(object).forEach(key => {
531+
for (const key of Object.keys(object)) {
532532
if (object[key] && typeof object[key] === 'object') this._ensureNoNulls(object[key])
533533
else if (object[key] == null) delete object[key]
534-
})
534+
}
535535
}
536536

537537
/**
@@ -713,7 +713,7 @@ class DefinitionService {
713713
if (declared) referencedExpressions.add(declared)
714714
/** @type {Set<string>} */
715715
const result = new Set()
716-
referencedExpressions.forEach(expression => this._extractLicensesFromExpression(expression, result))
716+
for (const expression of referencedExpressions) this._extractLicensesFromExpression(expression, result)
717717
return Array.from(result)
718718
}
719719

@@ -726,9 +726,9 @@ class DefinitionService {
726726
_collectLicenseTexts(definition) {
727727
/** @type {Set<string>} */
728728
const result = new Set()
729-
definition.files
730-
.filter(DefinitionService._isLicenseFile)
731-
.forEach(file => this._extractLicensesFromExpression(file.license, result))
729+
for (const file of definition.files.filter(DefinitionService._isLicenseFile)) {
730+
this._extractLicensesFromExpression(file.license, result)
731+
}
732732
return Array.from(result)
733733
}
734734

lib/condaRepoAccess.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ class CondaRepoAccess {
121121
const subdirs = subdir === '-' ? channelData.packages[name].subdirs : [subdir]
122122
for (const subdir of subdirs) {
123123
const repoData = await this.fetchRepoData(channel, subdir)
124-
;['packages', 'packages.conda'].forEach(key => {
124+
for (const key of ['packages', 'packages.conda']) {
125125
if (repoData[key]) {
126126
const matchingVersions = Object.entries(repoData[key])
127127
.filter(([, packageData]) => packageData.name === name)
128128
.map(([, packageData]) => `${subdir}:${packageData.version}-${packageData.build}`)
129129
revisions.push(...matchingVersions)
130130
}
131-
})
131+
}
132132
}
133133
return uniq(revisions)
134134
}

lib/curation.js

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,38 +106,32 @@ class Curation {
106106
/** @type {string[]} */
107107
const errors = []
108108

109-
Object.keys(revisions)
110-
.filter(revision => revisions[revision].licensed)
111-
.forEach(revision =>
112-
sourceLicenseList.push({
113-
source: `${revision} licensed.declared`,
114-
license: revisions[revision].licensed.declared
115-
})
116-
)
117-
118-
Object.keys(revisions)
119-
.filter(revision => revisions[revision].files)
120-
.forEach(revision => {
121-
revisions[revision].files.forEach(
122-
/** @param {import('./curation').CurationFileEntry} file */ file => {
123-
if (file.license) {
124-
sourceLicenseList.push({
125-
source: `${file.path} in ${revision} files`,
126-
license: file.license
127-
})
128-
}
129-
}
130-
)
109+
for (const revision of Object.keys(revisions).filter(revision => revisions[revision].licensed)) {
110+
sourceLicenseList.push({
111+
source: `${revision} licensed.declared`,
112+
license: revisions[revision].licensed.declared
131113
})
114+
}
115+
116+
for (const revision of Object.keys(revisions).filter(revision => revisions[revision].files)) {
117+
for (const /** @type {import('./curation').CurationFileEntry} */ file of revisions[revision].files) {
118+
if (file.license) {
119+
sourceLicenseList.push({
120+
source: `${file.path} in ${revision} files`,
121+
license: file.license
122+
})
123+
}
124+
}
125+
}
132126

133-
sourceLicenseList.forEach(({ source, license }) => {
127+
for (const { source, license } of sourceLicenseList) {
134128
const parsed = SPDX.normalize(license)
135129
if (!parsed || parsed.includes('NOASSERTION')) {
136130
errors.push(`${source} with value "${license}" is not SPDX compliant`)
137131
} else if (parsed !== license) {
138132
errors.push(`${source} with value "${license}" is not normalized. Suggest using "${parsed}"`)
139133
}
140-
})
134+
}
141135

142136
return {
143137
isCompliant: errors.length === 0,

lib/entityCoordinates.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ class EntityCoordinates {
8686
*/
8787
constructor(type, provider, namespace, name, revision) {
8888
/** @type {string | undefined} The Type of the entity */
89-
this.type = type && type.toLowerCase()
89+
this.type = type?.toLowerCase()
9090
/** @type {string | undefined} The Provider of the entity */
91-
this.provider = provider && provider.toLowerCase()
91+
this.provider = provider?.toLowerCase()
9292
/** @type {string | undefined} The Namespace of the entity */
9393
if (namespace && namespace !== '-') this.namespace = normalize(namespace, this.provider, NAMESPACE)
9494
/** @type {string | undefined} The Name of the entity */

lib/github.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
getClient: options => {
2727
const config = {
2828
headers: defaultHeaders,
29-
...(options && options.token ? { auth: options.token } : {})
29+
...(options?.token ? { auth: options.token } : {})
3030
}
3131

3232
const github = new Octokit(config)

0 commit comments

Comments
 (0)