forked from oxc-project/oxc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tasks/lint_rules): Remove usage of deprecated function
`Linter.getRules` oxc-project#2932
- Loading branch information
Showing
3 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** @typedef {import("eslint/lib/shared/types").RuleMeta} RuleMeta */ | ||
|
||
const ESLINT_RULES_META_URL = 'https://raw.githubusercontent.com/eslint/eslint/main/docs/src/_data/rules_meta.json'; | ||
|
||
/** | ||
* A record of ESLint rules meta data. | ||
* @typedef {Record<string, RuleMeta>} RuleMetaRecord | ||
*/ | ||
|
||
/** | ||
* Fetches the ESLint rules meta data from the ESLint repository. | ||
* @returns {Promise<RuleMetaRecord>} The ESLint rules meta data. | ||
*/ | ||
async function fetchEslintRulesMeta() { | ||
const response = await fetch(ESLINT_RULES_META_URL); | ||
if (!response.ok) { | ||
throw new Error(`Failed to fetch ESLint rules meta: ${response.statusText}\n${await response.text()}`); | ||
} | ||
|
||
// @ts-expect-error Json returns unknown type | ||
return await response.json(); | ||
} | ||
|
||
exports.fetchEslintRulesMeta = fetchEslintRulesMeta; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters