fix(generic-spacing): improve cases
This commit is contained in:
parent
54b234f4ef
commit
95e28e4a4a
@ -20,6 +20,9 @@ type Foo<
|
||||
`interface Log {
|
||||
<T>(name: T): void
|
||||
}`,
|
||||
`interface Foo {
|
||||
foo?: <T>(name: T) => void
|
||||
}`,
|
||||
]
|
||||
const invalids = [
|
||||
['type Foo<T=true> = T', 'type Foo<T = true> = T'],
|
||||
|
@ -23,7 +23,7 @@ export default createEslintRule<Options, MessageIds>({
|
||||
const sourceCode = context.getSourceCode()
|
||||
return {
|
||||
TSTypeParameterDeclaration: (node) => {
|
||||
if (!['TSCallSignatureDeclaration', 'ArrowFunctionExpression'].includes(node.parent.type)) {
|
||||
if (!['TSCallSignatureDeclaration', 'ArrowFunctionExpression', 'TSFunctionType'].includes(node.parent.type)) {
|
||||
const pre = sourceCode.text.slice(0, node.range[0])
|
||||
const preSpace = pre.match(/(\s+)$/)?.[0]
|
||||
// strip space before <T>
|
||||
|
Loading…
Reference in New Issue
Block a user