Skip to content

Commit c505863

Browse files
fix(eslint-plugin): [naming-convention] check bodyless function parameters (typescript-eslint#2675)
1 parent d690c8d commit c505863

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/eslint-plugin/src/rules/naming-convention.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,11 @@ export default util.createRule<Options, MessageIds>({
529529
// #endregion function
530530

531531
// #region parameter
532-
533-
'FunctionDeclaration, TSDeclareFunction, FunctionExpression, ArrowFunctionExpression'(
532+
'FunctionDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, FunctionExpression, ArrowFunctionExpression'(
534533
node:
535534
| TSESTree.FunctionDeclaration
535+
| TSESTree.TSDeclareFunction
536+
| TSESTree.TSEmptyBodyFunctionExpression
536537
| TSESTree.FunctionExpression
537538
| TSESTree.ArrowFunctionExpression,
538539
): void {

packages/eslint-plugin/tests/rules/naming-convention.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,5 +1316,20 @@ ruleTester.run('naming-convention', rule, {
13161316
},
13171317
],
13181318
},
1319+
{
1320+
code: `
1321+
declare class Foo {
1322+
Bar(Baz: string): void;
1323+
}
1324+
`,
1325+
parserOptions,
1326+
options: [{ selector: 'parameter', format: ['camelCase'] }],
1327+
errors: [
1328+
{
1329+
line: 3,
1330+
messageId: 'doesNotMatchFormat',
1331+
},
1332+
],
1333+
},
13191334
],
13201335
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy