mirror of
https://github.com/openharmony/third_party_typescript_eslint.git
synced 2026-07-01 21:24:00 -04:00
fix(eslint-plugin): [naming-convention] check bodyless function parameters (#2675)
This commit is contained in:
committed by
GitHub
parent
db1fc7c7c1
commit
3f20973e54
@@ -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',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user