Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
type Props = {
// correct names
onFoo(): void;
onBar: () => void;
// incorrect names
handleFoo(): void;
handleBar: () => void;
};
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "typeMethod",
"prefix": [
"on"
],
"format": ["StrictPascalCase"]
}
]
},
};
tsconfig
Expected Result
Both handleFoo
and handleBar
should be marked as errors.
Actual Result
Only handleFoo
is marked as an error.
Additional Info
The typeMethod
selector should pick up every possible method syntax similarly to the objectLiteralMethod
selector. Right now only TSMethodSignature
nodes are picked up by the typeMethod
selector, whereas it should also pickup TSPropertySignature
nodes with typeAnnotation
of TSFunctionType
.
If you confirm this is a bug, I would be more than happy to create a PR with the fix 😄
References in code:
- place where every non-computed
TSPropertySignature
is mapped astypeProperty
selector: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/naming-convention.ts#L397 - place where every non-computed
typeMethod
selector is mapped: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/src/rules/naming-convention.ts#L463
Metadata
Metadata
Assignees
Labels
Go ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueSomething isn't workingSomething isn't workingIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin