Merge pull request #34724 from github/repo-sync

Repo sync
This commit is contained in:
docs-bot 2024-09-24 17:30:44 -04:00 коммит произвёл GitHub
Родитель e3d1d107c4 1a1afc40cd
Коммит a58090da0c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -14,3 +14,7 @@ shortTitle: Sponsors GraphQL API
To get started with the GraphQL API, see "[AUTOTITLE](/graphql/guides/introduction-to-graphql)."
You can find the details about the Sponsors GraphQL API in the reference docs. For more information, see "[AUTOTITLE](/graphql/reference)." We recommend using the GraphQL explorer to build your GraphQL calls. For more information, see "[AUTOTITLE](/graphql/guides/using-the-explorer)."
## Known Issues
The `createSponsorship` mutation currently does not work for one-time payments. [Reproduction steps and discussion here](https://github.com/orgs/community/discussions/138161)

Просмотреть файл

@ -67,6 +67,8 @@ const ALL_CONTENT_DIR = ['content', 'data']
main()
async function main() {
if (!isOptionsValid()) return
// If paths has not been specified, lint all files
const files = getFilesToLint((summaryByRule && ALL_CONTENT_DIR) || paths || getChangedFiles())
@ -651,3 +653,41 @@ function getSearchReplaceRuleSeverity(ruleName, object, isPrecommit) {
const rule = allConfig[ruleName].rules.find((rule) => rule.name === pluginRuleName)
return isPrecommit ? rule.precommitSeverity || rule.severity : rule.severity
}
function isOptionsValid() {
// paths should only contain existing files and directories
const paths = program.opts().paths || []
for (const path of paths) {
try {
fs.statSync(path)
} catch (err) {
if ('paths'.includes(path)) {
console.log('error: did you mean --paths')
} else {
console.log(
`error: invalid --paths (-p) option. The value '${path}' is not a valid file or directory`,
)
}
return false
}
}
// rules should only contain existing, correctly spelled rules
const allRulesList = Object.values(allRules)
.map((rule) => rule.names)
.flat()
const rules = program.opts().rules || []
for (const rule of rules) {
if (!allRulesList.includes(rule)) {
if ('rules'.includes(rule)) {
console.log('error: did you mean --rules')
} else {
console.log(
`error: invalid --rules (-r) option. The value '${rule}' is not a valid rule name.`,
)
}
return false
}
}
return true
}