diff --git a/package.json b/package.json index 203b2a4c..57757f84 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "eslint": "~8.31.0", "eslint-config-prettier": "~8.5.0", "eslint-gitignore": "~0.1.0", + "eslint-plugin-deprecation": "~1.3.3", "eslint-plugin-import": "~2.26.0", "eslint-plugin-inclusive-language": "~2.2.0", "eslint-plugin-jsdoc": "~39.6.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e18a8a93..7ab93095 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,6 +13,7 @@ specifiers: eslint: ~8.31.0 eslint-config-prettier: ~8.5.0 eslint-gitignore: ~0.1.0 + eslint-plugin-deprecation: ~1.3.3 eslint-plugin-import: ~2.26.0 eslint-plugin-inclusive-language: ~2.2.0 eslint-plugin-jsdoc: ~39.6.4 @@ -49,6 +50,7 @@ devDependencies: eslint: 8.31.0 eslint-config-prettier: 8.5.0_eslint@8.31.0 eslint-gitignore: 0.1.0_eslint@8.31.0 + eslint-plugin-deprecation: 1.3.3_iukboom6ndih5an6iafl45j2fe eslint-plugin-import: 2.26.0_ejk3zt536nc2nr7uicalblhboi eslint-plugin-inclusive-language: 2.2.0 eslint-plugin-jsdoc: 39.6.4_eslint@8.31.0 @@ -660,6 +662,19 @@ packages: - supports-color dev: true + /@typescript-eslint/experimental-utils/5.47.1_iukboom6ndih5an6iafl45j2fe: + resolution: {integrity: sha512-zWHo/VbqAiRvhXP5byQqW7rGQtdanajHnItGqtmv8JaIi58zMPnmGZ1bW/drXIjU1fuOyfTVoDkNS7aEWGDSLg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + dependencies: + '@typescript-eslint/utils': 5.47.1_iukboom6ndih5an6iafl45j2fe + eslint: 8.31.0 + transitivePeerDependencies: + - supports-color + - typescript + dev: true + /@typescript-eslint/parser/5.47.1_iukboom6ndih5an6iafl45j2fe: resolution: {integrity: sha512-9Vb+KIv29r6GPu4EboWOnQM7T+UjpjXvjCPhNORlgm40a9Ia9bvaPJswvtae1gip2QEeVeGh6YquqAzEgoRAlw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -1695,6 +1710,21 @@ packages: - supports-color dev: true + /eslint-plugin-deprecation/1.3.3_iukboom6ndih5an6iafl45j2fe: + resolution: {integrity: sha512-Bbkv6ZN2cCthVXz/oZKPwsSY5S/CbgTLRG4Q2s2gpPpgNsT0uJ0dB5oLNiWzFYY8AgKX4ULxXFG1l/rDav9QFA==} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + typescript: ^3.7.5 || ^4.0.0 + dependencies: + '@typescript-eslint/experimental-utils': 5.47.1_iukboom6ndih5an6iafl45j2fe + eslint: 8.31.0 + tslib: 2.4.1 + tsutils: 3.21.0_typescript@4.9.4 + typescript: 4.9.4 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-es/3.0.1_eslint@8.31.0: resolution: {integrity: sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==} engines: {node: '>=8.10.0'} diff --git a/scripts/generate-rule-files/src/plugins-map.ts b/scripts/generate-rule-files/src/plugins-map.ts index 8100a49c..8182f124 100644 --- a/scripts/generate-rule-files/src/plugins-map.ts +++ b/scripts/generate-rule-files/src/plugins-map.ts @@ -1,4 +1,5 @@ import * as eslint from 'eslint'; +import * as eslintPluginDeprecation from 'eslint-plugin-deprecation'; // @ts-expect-error import * as eslintPluginImport from 'eslint-plugin-import'; // @ts-expect-error @@ -26,6 +27,12 @@ import type { Plugin } from '../contracts'; * Map of plugins for which the script will generate rule files. */ export const PLUGIN_REGISTRY: Readonly> = { + deprecation: { + name: 'Deprecation', + rules: + // @ts-expect-error: throw error when plugin successfully updated their type defs + eslintPluginDeprecation.rules as Plugin['rules'], + }, eslint: { name: 'Eslint', rules: Object.fromEntries(new eslint.Linter().getRules().entries()), diff --git a/src/config/plugin.d.ts b/src/config/plugin.d.ts index 5cfa1926..e4920c20 100644 --- a/src/config/plugin.d.ts +++ b/src/config/plugin.d.ts @@ -3,6 +3,7 @@ import type { LiteralUnion } from '../utility-types'; /** Plugin. */ export type Plugin = LiteralUnion< | '@typescript-eslint' + | 'deprecation' | 'import' | 'inclusive-language' | 'jsdoc' diff --git a/src/rules/deprecation/deprecation.d.ts b/src/rules/deprecation/deprecation.d.ts new file mode 100644 index 00000000..2eb3c67f --- /dev/null +++ b/src/rules/deprecation/deprecation.d.ts @@ -0,0 +1,22 @@ +import type { RuleConfig } from '../rule-config'; + +/** + * Do not use deprecated APIs. + * + * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) + */ +export type DeprecationRuleConfig = RuleConfig<[]>; + +/** + * Do not use deprecated APIs. + * + * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) + */ +export interface DeprecationRule { + /** + * Do not use deprecated APIs. + * + * @see [deprecation](https://github.com/gund/eslint-plugin-deprecation) + */ + 'deprecation/deprecation': DeprecationRuleConfig; +} diff --git a/src/rules/deprecation/index.d.ts b/src/rules/deprecation/index.d.ts new file mode 100644 index 00000000..f1088f15 --- /dev/null +++ b/src/rules/deprecation/index.d.ts @@ -0,0 +1,6 @@ +import type { DeprecationRule } from './deprecation'; + +/** + * All Deprecation rules. + */ +export type DeprecationRules = DeprecationRule; diff --git a/src/rules/index.d.ts b/src/rules/index.d.ts index ebe0312c..2471f92c 100644 --- a/src/rules/index.d.ts +++ b/src/rules/index.d.ts @@ -1,3 +1,4 @@ +import type { DeprecationRules } from './deprecation'; import type { EslintRules } from './eslint'; import type { ImportRules } from './import'; import type { JSDocRules } from './jsdoc'; @@ -17,7 +18,8 @@ import type { VuePugRules } from './vue-pug'; * @see [Rules](https://eslint.org/docs/user-guide/configuring/rules) */ export type Rules = Partial< - EslintRules & + DeprecationRules & + EslintRules & ImportRules & JSDocRules & NodeRules &