Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(eslint-plugin): [no-extraneous-class] handle accessor keyword#10678

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionspackages/eslint-plugin/src/rules/no-extraneous-class.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -123,10 +123,12 @@ export default createRule<Options, MessageIds>({
onlyConstructor = false;
if (
((prop.type === AST_NODE_TYPES.PropertyDefinition ||
prop.type === AST_NODE_TYPES.MethodDefinition) &&
prop.type === AST_NODE_TYPES.MethodDefinition ||
prop.type === AST_NODE_TYPES.AccessorProperty) &&
!prop.static) ||
prop.type === AST_NODE_TYPES.TSAbstractPropertyDefinition ||
prop.type === AST_NODE_TYPES.TSAbstractMethodDefinition // `static abstract` methods and properties are currently not supported. See: https://github.com/microsoft/TypeScript/issues/34516
prop.type === AST_NODE_TYPES.TSAbstractMethodDefinition || // `static abstract` methods and properties are currently not supported. See: https://github.com/microsoft/TypeScript/issues/34516
prop.type === AST_NODE_TYPES.TSAbstractAccessorProperty
) {
onlyStatic = false;
}
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -96,6 +96,29 @@ abstract class Foo {
`
abstract class Foo {
abstract method(): string;
}
`,
`
class Foo {
accessor prop: string;
}
`,
`
class Foo {
accessor prop = 'bar';
static bar() {
return false;
}
}
`,
`
abstract class Foo {
accessor prop: string;
}
`,
`
abstract class Foo {
abstract accessor prop: string;
}
`,
],
Expand DownExpand Up@@ -212,5 +235,21 @@ abstract class Foo {
`,
errors: [onlyConstructor],
},
{
code: `
class Foo {
static accessor prop: string;
}
`,
errors: [onlyStatic],
},
{
code: `
abstract class Foo {
static accessor prop: string;
}
`,
errors: [onlyStatic],
},
],
});
Loading

[8]ページ先頭

©2009-2025 Movatter.jp