Skip to content

Commit

Permalink
Add support for deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Quadflieg , Christopher committed Jan 2, 2023
1 parent 6dddb48 commit 8ca5721
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -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",
Expand Down
30 changes: 30 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions 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
Expand Down Expand Up @@ -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<Record<string, Plugin>> = {
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()),
Expand Down
1 change: 1 addition & 0 deletions src/config/plugin.d.ts
Expand Up @@ -3,6 +3,7 @@ import type { LiteralUnion } from '../utility-types';
/** Plugin. */
export type Plugin = LiteralUnion<
| '@typescript-eslint'
| 'deprecation'
| 'import'
| 'inclusive-language'
| 'jsdoc'
Expand Down
22 changes: 22 additions & 0 deletions 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;
}
6 changes: 6 additions & 0 deletions src/rules/deprecation/index.d.ts
@@ -0,0 +1,6 @@
import type { DeprecationRule } from './deprecation';

/**
* All Deprecation rules.
*/
export type DeprecationRules = DeprecationRule;
4 changes: 3 additions & 1 deletion 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';
Expand All @@ -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 &
Expand Down

0 comments on commit 8ca5721

Please sign in to comment.