fix(eslint-plugin): [naming-convention] check bodyless function parameters (#2675)

This commit is contained in:
thomas michael wallace
2020-10-18 19:50:06 +01:00
committed by GitHub
parent db1fc7c7c1
commit 3f20973e54
2 changed files with 18 additions and 2 deletions
@@ -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 {
@@ -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',
},
],
},
],
});