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-misused-promises] don't report onstaticaccessor properties#10814

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
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
3 changes: 2 additions & 1 deletionpackages/eslint-plugin/src/rules/no-misused-promises.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -987,7 +987,8 @@ function getMemberIfExists(
function isStaticMember(node: TSESTree.Node): boolean {
return (
(node.type === AST_NODE_TYPES.MethodDefinition ||
node.type === AST_NODE_TYPES.PropertyDefinition) &&
node.type === AST_NODE_TYPES.PropertyDefinition ||
node.type === AST_NODE_TYPES.AccessorProperty) &&
node.static
);
}
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -467,6 +467,36 @@ class Bar extends Foo {
}
`,
`
class Foo {
public doThing = (): void => {};
}

class Bar extends Foo {
public static accessor doThing = async (): Promise<void> => {};
}
`,
`
class Foo {
public accessor doThing = (): void => {};
}

class Bar extends Foo {
public static accessor doThing = (): void => {};
}
`,
{
code: `
class Foo {
[key: string]: void;
}

class Bar extends Foo {
[key: string]: Promise<void>;
}
`,
options: [{ checksVoidReturn: { inheritedMethods: true } }],
},
`
function restTuple(...args: []): void;
function restTuple(...args: [string]): void;
function restTuple(..._args: string[]): void {}
Expand DownExpand Up@@ -2031,6 +2061,46 @@ abstract class MyAbstractClassImplementsMyInterface implements MyInterface {
},
{
code: `
class MyClass {
accessor setThing = (): void => {
return;
};
}

class MySubclassExtendsMyClass extends MyClass {
accessor setThing = async (): Promise<void> => {
await Promise.resolve();
};
}
`,
errors: [
{
data: { heritageTypeName: 'MyClass' },
line: 9,
messageId: 'voidReturnInheritedMethod',
},
],
},
{
code: `
abstract class MyClass {
abstract accessor setThing: () => void;
}

abstract class MySubclassExtendsMyClass extends MyClass {
abstract accessor setThing: () => Promise<void>;
}
`,
errors: [
{
data: { heritageTypeName: 'MyClass' },
line: 7,
messageId: 'voidReturnInheritedMethod',
},
],
},
{
code: `
interface MyInterface {
setThing(): void;
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp