Skip to content

Commit 7d1a209

Browse files
authored
Remove disabling of prefer-template eslint rule (#58230)
1 parent 4f46d28 commit 7d1a209

File tree

72 files changed

+234
-250
lines changed

Some content is hidden

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

72 files changed

+234
-250
lines changed

eslint.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,13 @@ export default [
9393
'no-redeclare': 'off', // Allow function overloads in TypeScript
9494
'i18n-text/no-en': 'off', // This rule causes eslint to not run at all
9595
'filenames/match-regex': 'off', // This rule causes eslint to not run at all
96+
camelcase: 'off', // Many gh apis use underscores, 600+ uses
9697

9798
// Disabled rules to review
9899
'github/no-then': 'off', // 30+
99100
'@typescript-eslint/ban-ts-comment': 'off', // 50+
100101
'no-shadow': 'off', // 150+
101-
'prefer-template': 'off', // 150+
102102
'github/array-foreach': 'off', // 250+
103-
camelcase: 'off', // 600+
104103
'no-console': 'off', // 800+
105104
'@typescript-eslint/no-explicit-any': 'off', // 1000+
106105
},

src/app/lib/language-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export function hasLanguagePrefix(path: string): boolean {
3434
export function stripLanguagePrefix(path: string): string {
3535
if (hasLanguagePrefix(path)) {
3636
const pathSegments = path.split('/')
37-
return '/' + pathSegments.slice(2).join('/')
37+
return `/${pathSegments.slice(2).join('/')}`
3838
}
3939
return path
4040
}

src/archives/middleware/archived-enterprise-versions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,14 @@ function getProxyPath(reqPath: string, requestedVersion: string) {
353353

354354
// Releases 2.18 and higher
355355
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutArchivedRedirectsFile}`)) {
356-
const newReqPath = reqPath.includes('redirects.json') ? `/${reqPath}` : reqPath + '/index.html'
356+
const newReqPath = reqPath.includes('redirects.json') ? `/${reqPath}` : `${reqPath}/index.html`
357357
return ENTERPRISE_GH_PAGES_URL_PREFIX + requestedVersion + newReqPath
358358
}
359359

360360
// Releases 2.13 - 2.17
361361
// redirect.json files don't exist for these versions
362362
if (versionSatisfiesRange(requestedVersion, `>=2.13`)) {
363-
return ENTERPRISE_GH_PAGES_URL_PREFIX + requestedVersion + reqPath + '/index.html'
363+
return `${ENTERPRISE_GH_PAGES_URL_PREFIX + requestedVersion + reqPath}/index.html`
364364
}
365365

366366
// Releases 2.12 and lower

src/article-api/middleware/article.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ function incrementArticleLookup(
167167
const source =
168168
req.get('X-Request-Source') ||
169169
(req.get('Referer')
170-
? 'external-' + (new URL(req.get('Referer') || '').hostname || 'unknown')
170+
? `external-${new URL(req.get('Referer') || '').hostname || 'unknown'}`
171171
: 'external')
172172

173173
const tags = [

src/article-api/scripts/generate-api-docs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ function updateReadme(readmePath: string, markdown: string): void {
156156

157157
// Replace API documentation section, or append to end
158158
if (readme.includes(placeholderComment)) {
159-
const pattern = new RegExp(placeholderComment + '[\\s\\S]*', 'g')
160-
readme = readme.replace(pattern, placeholderComment + '\n' + markdown)
159+
const pattern = new RegExp(`${placeholderComment}[\\s\\S]*`, 'g')
160+
readme = readme.replace(pattern, `${placeholderComment}\n${markdown}`)
161161
} else {
162-
readme += '\n' + markdown
162+
readme += `\n${markdown}`
163163
}
164164

165165
writeFileSync(readmePath, readme)

src/assets/tests/dynamic-assets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ describe('dynamic assets', () => {
103103
})
104104

105105
test.each(['key', 'key=value'])('any query string (%p) triggers a redirect', async (qs) => {
106-
const res = await get('/assets/images/_fixtures/screenshot.webp?' + qs)
106+
const res = await get(`/assets/images/_fixtures/screenshot.webp?${qs}`)
107107
expect(res.statusCode).toBe(302)
108108
expect(res.headers.location).toBe('/assets/images/_fixtures/screenshot.webp')
109109
expect(res.headers['cache-control']).toContain('public')

src/assets/tests/static-assets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ describe('static assets', () => {
113113
// This picks the first one found. We just need it to be anything
114114
// that actually resolves.
115115
const filePath = getNextStaticAsset('css')
116-
const asURL = '/' + filePath.replace('.next', '_next').split(path.sep).join('/')
116+
const asURL = `/${filePath.replace('.next', '_next').split(path.sep).join('/')}`
117117
const res = await get(asURL)
118118
expect(res.statusCode).toBe(200)
119119
checkCachingHeaders(res)

src/codeql-cli/scripts/sync.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function main() {
4141
const matchHeading = '## Options\n'
4242
const primaryHeadingSourceContent = sourceContent.replace(
4343
matchHeading,
44-
matchHeading + '\n### Primary Options\n',
44+
`${matchHeading}\n### Primary Options\n`,
4545
)
4646
const currentFileName = path.basename(file)
4747
const { data, content } = await convertContentToDocs(

src/codeql-cli/tests/test-circular-links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async function testCircularLinkFix(): Promise<boolean> {
5656
}
5757

5858
console.log('\n--- Generated content preview ---')
59-
console.log(result1.content.substring(0, 800) + '...')
59+
console.log(`${result1.content.substring(0, 800)}...`)
6060

6161
return !hasCircularLink && hasValidLink
6262
} catch (error) {

src/content-linter/lib/linting-rules/code-annotation-comment-spacing.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export const codeAnnotationCommentSpacing = {
8181
// No space after comment character - this is an error
8282
const lineNumber: number = token.lineNumber + index + 1
8383
const leadingWhitespace: string = line.match(/^\s*/)![0]
84-
const fixedLine: string = leadingWhitespace + commentChar + ' ' + restOfLine
84+
const fixedLine: string = `${leadingWhitespace + commentChar} ${restOfLine}`
8585

8686
addError(
8787
onError,

0 commit comments

Comments
 (0)