Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
feat: export plugin metadata#8331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
14 changes: 13 additions & 1 deletionpackages/eslint-plugin-internal/src/index.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,17 @@ | ||
| import type { Linter } from '@typescript-eslint/utils/ts-eslint'; | ||
| import rules from './rules'; | ||
| // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder | ||
| const { name, version } = require('../package.json') as { | ||
| name: string; | ||
| version: string; | ||
| }; | ||
| export = { | ||
| rules, | ||
| meta: { | ||
| name, | ||
| version, | ||
| }, | ||
| } satisfies Linter.Plugin; |
4 changes: 3 additions & 1 deletionpackages/eslint-plugin-internal/src/rules/index.ts
This file contains hidden or 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
15 changes: 14 additions & 1 deletionpackages/eslint-plugin-tslint/src/index.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| import type { Linter } from '@typescript-eslint/utils/ts-eslint'; | ||
| import configRule from './rules/config'; | ||
| // note - cannot migrate this to an import statement because it will make TSC copy the package.json to the dist folder | ||
| const { name, version } = require('../package.json') as { | ||
| name: string; | ||
| version: string; | ||
| }; | ||
| export const meta: Linter.PluginMeta = { | ||
| name, | ||
| version, | ||
| }; | ||
| /** | ||
| * Expose a single rule called "config", which will be accessed in the user's eslint config files | ||
| * via "tslint/config" | ||
| */ | ||
| export const rules: Linter.PluginRules = { | ||
| config: configRule, | ||
| }; |
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/all.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/base.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/disable-type-checked.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/eslint-recommended.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/recommended-type-checked.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/recommended.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/strict-type-checked.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/strict.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/stylistic-type-checked.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/configs/stylistic.ts
This file contains hidden or 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
14 changes: 13 additions & 1 deletionpackages/eslint-plugin/src/index.ts
This file contains hidden or 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
4 changes: 3 additions & 1 deletionpackages/eslint-plugin/src/rules/index.ts
This file contains hidden or 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
6 changes: 5 additions & 1 deletionpackages/repo-tools/src/generate-configs.mts
This file contains hidden or 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
22 changes: 12 additions & 10 deletionspackages/utils/src/ts-eslint/Config.ts
This file contains hidden or 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
22 changes: 20 additions & 2 deletionspackages/utils/src/ts-eslint/Linter.ts
This file contains hidden or 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 |
|---|---|---|
| @@ -5,7 +5,13 @@ import { Linter as ESLintLinter } from 'eslint'; | ||
| import type { ClassicConfig, FlatConfig, SharedConfig } from './Config'; | ||
| import type { Parser } from './Parser'; | ||
| import type { Processor as ProcessorType } from './Processor'; | ||
| import type { | ||
| AnyRuleCreateFunction, | ||
| AnyRuleModule, | ||
| RuleCreateFunction, | ||
| RuleFix, | ||
| RuleModule, | ||
| } from './Rule'; | ||
| import type { SourceCode } from './SourceCode'; | ||
| export type MinimalRuleModule< | ||
| @@ -118,6 +124,7 @@ namespace Linter { | ||
| export type GlobalVariableOption = SharedConfig.GlobalVariableOption; | ||
| export type GlobalVariableOptionBase = SharedConfig.GlobalVariableOptionBase; | ||
| export type ParserOptions = SharedConfig.ParserOptions; | ||
| export type PluginMeta = SharedConfig.PluginMeta; | ||
| export type RuleEntry = SharedConfig.RuleEntry; | ||
| export type RuleLevel = SharedConfig.RuleLevel; | ||
| export type RuleLevelAndOptions = SharedConfig.RuleLevelAndOptions; | ||
| @@ -262,6 +269,13 @@ namespace Linter { | ||
| parserOptions?: ParserOptions; | ||
| } | ||
| // TODO - RuleCreateFunction is no longer supported in ESLint v9 | ||
bradzacher marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| export type LegacyPluginRules = Record< | ||
| string, | ||
| AnyRuleCreateFunction | AnyRuleModule | ||
| >; | ||
| export type PluginRules = Record<string, AnyRuleModule>; | ||
| export interface Plugin { | ||
| /** | ||
| * The definition of plugin configs. | ||
| @@ -271,14 +285,18 @@ namespace Linter { | ||
| * The definition of plugin environments. | ||
| */ | ||
| environments?: Record<string, Environment>; | ||
| /** | ||
| * Metadata about your plugin for easier debugging and more effective caching of plugins. | ||
| */ | ||
| meta?: PluginMeta; | ||
| /** | ||
| * The definition of plugin processors. | ||
| */ | ||
| processors?: Record<string, ProcessorType.ProcessorModule>; | ||
| /** | ||
| * The definition of plugin rules. | ||
| */ | ||
| rules?:LegacyPluginRules; | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.