Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 8ca5721

Browse files
author
Quadflieg , Christopher
committed
Add support for deprecation
1 parent 6dddb48 commit 8ca5721

File tree

7 files changed

+70
-1
lines changed

7 files changed

+70
-1
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"eslint": "~8.31.0",
6464
"eslint-config-prettier": "~8.5.0",
6565
"eslint-gitignore": "~0.1.0",
66+
"eslint-plugin-deprecation": "~1.3.3",
6667
"eslint-plugin-import": "~2.26.0",
6768
"eslint-plugin-inclusive-language": "~2.2.0",
6869
"eslint-plugin-jsdoc": "~39.6.4",

pnpm-lock.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generate-rule-files/src/plugins-map.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as eslint from 'eslint';
2+
import * as eslintPluginDeprecation from 'eslint-plugin-deprecation';
23
// @ts-expect-error
34
import * as eslintPluginImport from 'eslint-plugin-import';
45
// @ts-expect-error
@@ -26,6 +27,12 @@ import type { Plugin } from '../contracts';
2627
* Map of plugins for which the script will generate rule files.
2728
*/
2829
export const PLUGIN_REGISTRY: Readonly<Record<string, Plugin>> = {
30+
deprecation: {
31+
name: 'Deprecation',
32+
rules:
33+
// @ts-expect-error: throw error when plugin successfully updated their type defs
34+
eslintPluginDeprecation.rules as Plugin['rules'],
35+
},
2936
eslint: {
3037
name: 'Eslint',
3138
rules: Object.fromEntries(new eslint.Linter().getRules().entries()),

src/config/plugin.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { LiteralUnion } from '../utility-types';
33
/** Plugin. */
44
export type Plugin = LiteralUnion<
55
| '@typescript-eslint'
6+
| 'deprecation'
67
| 'import'
78
| 'inclusive-language'
89
| 'jsdoc'
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Do not use deprecated APIs.
5+
*
6+
* @see [deprecation](https://github.com/gund/eslint-plugin-deprecation)
7+
*/
8+
export type DeprecationRuleConfig = RuleConfig<[]>;
9+
10+
/**
11+
* Do not use deprecated APIs.
12+
*
13+
* @see [deprecation](https://github.com/gund/eslint-plugin-deprecation)
14+
*/
15+
export interface DeprecationRule {
16+
/**
17+
* Do not use deprecated APIs.
18+
*
19+
* @see [deprecation](https://github.com/gund/eslint-plugin-deprecation)
20+
*/
21+
'deprecation/deprecation': DeprecationRuleConfig;
22+
}

src/rules/deprecation/index.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type { DeprecationRule } from './deprecation';
2+
3+
/**
4+
* All Deprecation rules.
5+
*/
6+
export type DeprecationRules = DeprecationRule;

src/rules/index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { DeprecationRules } from './deprecation';
12
import type { EslintRules } from './eslint';
23
import type { ImportRules } from './import';
34
import type { JSDocRules } from './jsdoc';
@@ -17,7 +18,8 @@ import type { VuePugRules } from './vue-pug';
1718
* @see [Rules](https://eslint.org/docs/user-guide/configuring/rules)
1819
*/
1920
export type Rules = Partial<
20-
EslintRules &
21+
DeprecationRules &
22+
EslintRules &
2123
ImportRules &
2224
JSDocRules &
2325
NodeRules &

0 commit comments

Comments
 (0)