Skip to content

Commit 4e33c38

Browse files
authored
Merge pull request #41018 from github/repo-sync
Repo sync
2 parents 4dbbb32 + 232a0f8 commit 4e33c38

File tree

73 files changed

+246
-182
lines changed

Some content is hidden

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

73 files changed

+246
-182
lines changed

eslint.config.ts

Lines changed: 18 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -67,63 +67,33 @@ export default [
6767
// JSX A11y recommended rules
6868
...jsxA11y.configs.recommended.rules,
6969

70-
// TypeScript-specific overrides
70+
// Overrides
7171
'import/no-extraneous-dependencies': [
7272
'error',
7373
{
7474
packageDir: '.',
7575
},
7676
],
77-
'import/extensions': 'off',
78-
'no-console': 'off',
79-
camelcase: 'off',
80-
'no-shadow': 'off',
81-
'prefer-template': 'off',
82-
'no-constant-condition': 'off',
83-
'no-unused-vars': 'off',
84-
'no-undef': 'off',
85-
'no-use-before-define': 'off',
86-
'no-redeclare': 'off', // Allow function overloads in TypeScript
87-
'import/no-named-as-default-member': 'off',
88-
'one-var': 'off',
89-
'import/no-namespace': 'off',
90-
'import/no-anonymous-default-export': 'off',
91-
'object-shorthand': 'off',
92-
'no-empty': 'off',
93-
'prefer-const': 'off',
94-
'import/no-named-as-default': 'off',
95-
'no-useless-concat': 'off',
96-
'func-style': 'off',
97-
98-
// TypeScript ESLint specific rules
77+
'import/extensions': ['error', { json: 'always' }],
78+
'no-empty': ['error', { allowEmptyCatch: true }],
9979
'@typescript-eslint/no-unused-vars': 'error',
80+
'prefer-const': ['error', { destructuring: 'all' }],
10081

101-
// Disable GitHub plugin rules that were disabled in original config
102-
'github/array-foreach': 'off',
103-
'github/no-then': 'off',
104-
105-
// Disable rules that might not exist or cause issues initially
106-
'i18n-text/no-en': 'off',
107-
'filenames/match-regex': 'off',
108-
'eslint-comments/no-use': 'off',
109-
'eslint-comments/no-unused-disable': 'off',
110-
'eslint-comments/no-unlimited-disable': 'off',
111-
112-
// Disable new ESLint 9 rules that are causing issues
113-
'no-constant-binary-expression': 'off',
114-
115-
// Disable stricter TypeScript rules initially
116-
'@typescript-eslint/no-explicit-any': 'off',
117-
'@typescript-eslint/no-unused-expressions': 'off',
118-
'@typescript-eslint/ban-ts-comment': 'off',
119-
'@typescript-eslint/no-wrapper-object-types': 'off',
120-
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
121-
'@typescript-eslint/no-unsafe-function-type': 'off',
122-
'@typescript-eslint/no-empty-object-type': 'off',
123-
'@typescript-eslint/prefer-as-const': 'off',
82+
// Rules that must be disabled
83+
'no-redeclare': 'off', // Allow function overloads in TypeScript
84+
'i18n-text/no-en': 'off', // This rule causes eslint to not run at all
85+
'filenames/match-regex': 'off', // This rule causes eslint to not run at all
12486

125-
// React/JSX specific rules
126-
'jsx-a11y/no-onchange': 'off',
87+
// Disabled rules to review
88+
'github/no-then': 'off', // 30+
89+
'@typescript-eslint/ban-ts-comment': 'off', // 50+
90+
'no-undef': 'off', // 50+
91+
'no-shadow': 'off', // 150+
92+
'prefer-template': 'off', // 150+
93+
'github/array-foreach': 'off', // 250+
94+
camelcase: 'off', // 600+
95+
'no-console': 'off', // 800+
96+
'@typescript-eslint/no-explicit-any': 'off', // 1000+
12797
},
12898
},
12999

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"index-general-search": "tsx src/search/scripts/index/index-cli general-search",
5454
"index-test-fixtures": "./src/search/scripts/index-test-fixtures.sh",
5555
"labeler": "tsx .github/actions/labeler/labeler.ts",
56-
"lint": "eslint '**/*.{js,mjs,ts,tsx}'",
56+
"lint": "eslint '**/*.{ts,tsx}'",
5757
"lint-content": "tsx src/content-linter/scripts/lint-content.ts",
5858
"lint-translation": "vitest src/content-linter/tests/lint-files.ts",
5959
"liquid-markdown-tables": "tsx src/tools/scripts/liquid-markdown-tables/index.ts",
@@ -67,8 +67,8 @@
6767
"postinstall": "cp package-lock.json .installed.package-lock.json && echo \"Updated .installed.package-lock.json\" # see husky/post-checkout and husky/post-merge",
6868
"precompute-pageinfo": "tsx src/article-api/scripts/precompute-pageinfo.ts",
6969
"prepare": "husky src/workflows/husky",
70-
"prettier": "prettier -w \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
71-
"prettier-check": "prettier -c \"**/*.{ts,tsx,js,mjs,scss,yml,yaml}\"",
70+
"prettier": "prettier -w \"**/*.{ts,tsx,scss,yml,yaml}\"",
71+
"prettier-check": "prettier -c \"**/*.{ts,tsx,scss,yml,yaml}\"",
7272
"prevent-pushes-to-main": "tsx src/workflows/prevent-pushes-to-main.ts",
7373
"purge-fastly-edge-cache": "tsx src/workflows/purge-fastly-edge-cache.ts",
7474
"purge-fastly-edge-cache-per-language": "tsx src/languages/scripts/purge-fastly-edge-cache-per-language.ts",
@@ -105,12 +105,12 @@
105105
"what-docs-early-access-branch": "tsx src/early-access/scripts/what-docs-early-access-branch.ts"
106106
},
107107
"lint-staged": {
108-
"*.{js,mjs,ts,tsx}": "eslint --cache --fix",
109-
"*.{js,mjs,scss,ts,tsx,yml,yaml}": "prettier --write",
108+
"*.{ts,tsx}": "eslint --cache --fix",
109+
"*.{scss,ts,tsx,yml,yaml}": "prettier --write",
110110
"{content,data}/**/*.md": "npm run lint-content -- --precommit --paths"
111111
},
112112
"nodemonConfig": {
113-
"ext": "ts,js,json,yml,md,html,scss",
113+
"ext": "ts,json,yml,md,html,scss",
114114
"exec": "tsx",
115115
"ignore": [
116116
"assets",
@@ -139,7 +139,7 @@
139139
},
140140
{
141141
"files": [
142-
"**/*.{ts,tsx,js,mjs}"
142+
"**/*.{ts,tsx}"
143143
],
144144
"options": {
145145
"printWidth": 100,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export default async function archivedEnterpriseVersions(
235235
// `x-host` is a custom header set by Fastly.
236236
// GLB automatically deletes the `x-forwarded-host` header.
237237
const host = req.get('x-host') || req.get('x-forwarded-host') || req.get('host')
238-
let modifiedBody = body
238+
const modifiedBody = body
239239
.replaceAll(
240240
`${OLD_AZURE_BLOB_ENTERPRISE_DIR}/${requestedVersion}/assets/cb-`,
241241
`${ENTERPRISE_GH_PAGES_URL_PREFIX}${requestedVersion}/assets/cb-`,

src/assets/scripts/deleted-assets-pr-comment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as github from '@actions/github'
1+
import github from '@actions/github'
22
import core from '@actions/core'
33

44
const { GITHUB_TOKEN } = process.env

src/assets/scripts/find-orphaned-assets.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ async function main(opts: MainOptions) {
145145
// Add exceptions
146146
sourceFiles.push('.github/CONTRIBUTING.md')
147147
sourceFiles.push('README.md')
148-
verbose && console.log(`${sourceFiles.length.toLocaleString()} source files found in total.`)
148+
if (verbose) {
149+
console.log(`${sourceFiles.length.toLocaleString()} source files found in total.`)
150+
}
149151

150152
const allImages = new Set(
151153
walk(
@@ -159,7 +161,9 @@ async function main(opts: MainOptions) {
159161
).filter((filePath) => !filePath.endsWith('.md')),
160162
)
161163

162-
verbose && console.log(`${allImages.size.toLocaleString()} images found in total.`)
164+
if (verbose) {
165+
console.log(`${allImages.size.toLocaleString()} images found in total.`)
166+
}
163167

164168
for (const sourceFile of sourceFiles) {
165169
const content = fs.readFileSync(sourceFile, 'utf-8')

src/assets/tests/static-assets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type MockResponse = {
4343
_json?: string
4444
_send?: string
4545
headers: Record<string, string>
46-
set?: (key: string | Object, value: string) => void
46+
set?: (key: string | object, value: string) => void
4747
removeHeader?: (key: string) => void
4848
hasHeader?: (key: string) => boolean
4949
}

src/audit-logs/lib/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async function resolveReferenceLinksToTitles(
9696
// docs_reference_links: 'event reference links'
9797
// },
9898
// ]
99-
export function getAuditLogEvents(page: string, version: string) {
99+
export function getAuditLogEvents(page: string, version: string): AuditLogEventT[] {
100100
const openApiVersion = getOpenApiVersion(version)
101101
const auditLogFileName = path.join(AUDIT_LOG_DATA_DIR, openApiVersion, `${page}.json`)
102102

@@ -115,14 +115,14 @@ export function getAuditLogEvents(page: string, version: string) {
115115
?.set(page, readCompressedJsonFileFallback(auditLogFileName))
116116
}
117117

118-
const auditLogEvents = auditLogEventsCache.get(openApiVersion)?.get(page)!
118+
const auditLogEvents = auditLogEventsCache.get(openApiVersion)?.get(page)
119119
// If an event doesn't yet have a description (value will be empty string or
120120
// "N/A"), then we don't show the event.
121-
const filteredAuditLogEvents = auditLogEvents.filter(
121+
const filteredAuditLogEvents = auditLogEvents?.filter(
122122
(event) => event.description !== 'N/A' && event.description !== '',
123123
)
124124

125-
return filteredAuditLogEvents
125+
return filteredAuditLogEvents || []
126126
}
127127

128128
// get categorized audit log event data for the requested page and version
@@ -137,7 +137,7 @@ export function getAuditLogEvents(page: string, version: string) {
137137
// repo: [ [Object] ],
138138
// user: [ [Object], [Object] ]
139139
// }
140-
export function getCategorizedAuditLogEvents(page: string, version: string) {
140+
export function getCategorizedAuditLogEvents(page: string, version: string): CategorizedEvents {
141141
const events = getAuditLogEvents(page, version)
142142
const openApiVersion = getOpenApiVersion(version)
143143

@@ -148,7 +148,7 @@ export function getCategorizedAuditLogEvents(page: string, version: string) {
148148
categorizedAuditLogEventsCache.get(openApiVersion)?.set(page, categorizeEvents(events))
149149
}
150150

151-
return categorizedAuditLogEventsCache.get(openApiVersion)?.get(page)!
151+
return categorizedAuditLogEventsCache.get(openApiVersion)?.get(page) || {}
152152
}
153153

154154
// Filters audit log events based on allowlist values.

src/audit-logs/pages/audit-log-events.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ export const getServerSideProps: GetServerSideProps<Props> = async (context) =>
8686
Object.keys(auditLogEvents).map((category) => category),
8787
context,
8888
)
89-
auditLogEventsMiniTocs && miniTocItems.push(...auditLogEventsMiniTocs)
89+
if (auditLogEventsMiniTocs) {
90+
miniTocItems.push(...auditLogEventsMiniTocs)
91+
}
9092

9193
return {
9294
props: {

src/content-linter/lib/helpers/should-include-result.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as nodePath from 'path'
1+
import nodePath from 'path'
22
import { reportingConfig } from '@/content-linter/style/github-docs'
33

44
interface LintFlaw {

src/content-linter/lib/linting-rules/liquid-ifversion-versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const liquidIfversionVersions = {
3030
// The versions frontmatter object or all versions if the file
3131
// being processed is a data file.
3232
const fm = getFrontmatter(params.lines)
33-
let content = fm ? getFrontmatterLines(params.lines).join('\n') : params.lines.join('\n')
33+
const content = fm ? getFrontmatterLines(params.lines).join('\n') : params.lines.join('\n')
3434

3535
const fileVersionsFm = params.name.startsWith('data')
3636
? { ghec: '*', ghes: '*', fpt: '*' }

0 commit comments

Comments
 (0)