feat: create recommended eslint configuration#468
feat: create recommended eslint configuration#468zendy199x wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Create a new configuration file that defines the `recommended` settings for `eslint-plugin-tsdoc`. This configuration will enable the `tsdoc/syntax` rule with a `warn` severity, allowing users to easily adopt TSDoc validation by extending `plugin:tsdoc/recommended` in their ESLint setup. Signed-off-by: Zendy <50132805+zendy199x@users.noreply.github.com>
Create a new configuration file that defines the `recommended` settings for `eslint-plugin-tsdoc`. This configuration will enable the `tsdoc/syntax` rule with a `warn` severity, allowing users to easily adopt TSDoc validation by extending `plugin:tsdoc/recommended` in their ESLint setup. Signed-off-by: Zendy <50132805+zendy199x@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a recommended shareable config for eslint-plugin-tsdoc so users can enable TSDoc syntax validation via extends: ['plugin:tsdoc/recommended'].
Changes:
- Added
eslint-plugin/src/configs/recommended.tsdefiningtsdoc/syntaxaswarn - Updated
eslint-plugin/src/index.tsto wire the newrecommendedconfig into the plugin export surface
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| eslint-plugin/src/index.ts | Adds a recommended config import / plugin configs typing to expose plugin:tsdoc/recommended |
| eslint-plugin/src/configs/recommended.ts | New recommended config enabling tsdoc/syntax with warn severity |
Comments suppressed due to low confidence (1)
eslint-plugin/src/index.ts:73
eslint-plugin/src/index.tsis truncated: thepluginobject andsyntax.createfunction are not closed, and there is no export. This will fail TypeScript compilation and prevents the plugin from being consumable. Restore the removed implementation and ensure the module exports the plugin object (and closes all braces).
create: (context: eslint.Rule.RuleContext) => {
const sourceFilePath: string = context.filename;
// If eslint is configured with @typescript-eslint/parser, there is a parser option
// to explicitly specify where the tsconfig file is. Use that if available.
const tsConfigDir: string | undefined = getRootDirectoryFromContext(
context as unknown as TSESLint.RuleContext<string, unknown[]>
);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| interface IPlugin { | ||
| rules: { [x: string]: eslint.Rule.RuleModule }; | ||
| configs: { [x: string]: eslint.Linter.Config }; | ||
| } |
There was a problem hiding this comment.
configs was added to IPlugin and recommended is imported, but this file currently doesn't define/export plugin.configs anywhere. To actually expose plugin:tsdoc/recommended, ensure the exported plugin object includes configs: { recommended } (and that the module exports plugin).
| const config: Linter.Config = { | ||
| rules: { | ||
| 'tsdoc/syntax': 'warn' | ||
| } | ||
| }; | ||
|
|
||
| export default config; |
There was a problem hiding this comment.
This repo appears to consistently use named exports (no other export default usages were found). Consider exporting this as a named export (e.g., export const recommended = ...) to match existing module patterns and avoid any TS interop edge cases with default imports.
| const config: Linter.Config = { | |
| rules: { | |
| 'tsdoc/syntax': 'warn' | |
| } | |
| }; | |
| export default config; | |
| export const recommended: Linter.Config = { | |
| rules: { | |
| 'tsdoc/syntax': 'warn' | |
| } | |
| }; |
| const config: Linter.Config = { | ||
| rules: { | ||
| 'tsdoc/syntax': 'warn' | ||
| } |
There was a problem hiding this comment.
The new recommended config is a public entrypoint (plugin:tsdoc/recommended) but there’s no test covering that it is exported and contains the expected rule settings. Consider adding a small unit test asserting plugin.configs.recommended.rules['tsdoc/syntax'] === 'warn' so this contract doesn’t regress.
Summary
Create a new configuration file that defines the
recommendedsettings foreslint-plugin-tsdoc. This configuration will enable thetsdoc/syntaxrule with awarnseverity, allowing users to easily adopt TSDoc validation by extendingplugin:tsdoc/recommendedin their ESLint setup.Changes
eslint-plugin/src/configs/recommended.tseslint-plugin/src/index.tsCreate a new configuration file that defines the
recommendedsettings foreslint-plugin-tsdoc. This configuration will enable thetsdoc/syntaxrule with awarnseverity, allowing users to easily adopt TSDoc validation by extendingplugin:tsdoc/recommendedin their ESLint setup.Testing
Closes #321