Skip to content

Commit

Permalink
fix(eslint-plugin): [naming-convention] check bodyless function param…
Browse files Browse the repository at this point in the history
…eters (#2675)
  • Loading branch information
thomasmichaelwallace committed Oct 18, 2020
1 parent d690c8d commit c505863
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/eslint-plugin/src/rules/naming-convention.ts
Expand Up @@ -529,10 +529,11 @@ export default util.createRule<Options, MessageIds>({
// #endregion function

// #region parameter

'FunctionDeclaration, TSDeclareFunction, FunctionExpression, ArrowFunctionExpression'(
'FunctionDeclaration, TSDeclareFunction, TSEmptyBodyFunctionExpression, FunctionExpression, ArrowFunctionExpression'(
node:
| TSESTree.FunctionDeclaration
| TSESTree.TSDeclareFunction
| TSESTree.TSEmptyBodyFunctionExpression
| TSESTree.FunctionExpression
| TSESTree.ArrowFunctionExpression,
): void {
Expand Down
15 changes: 15 additions & 0 deletions packages/eslint-plugin/tests/rules/naming-convention.test.ts
Expand Up @@ -1316,5 +1316,20 @@ ruleTester.run('naming-convention', rule, {
},
],
},
{
code: `
declare class Foo {
Bar(Baz: string): void;
}
`,
parserOptions,
options: [{ selector: 'parameter', format: ['camelCase'] }],
errors: [
{
line: 3,
messageId: 'doesNotMatchFormat',
},
],
},
],
});

0 comments on commit c505863

Please sign in to comment.