Content-Length: 298336 | pFad | http://github.com/jsx-eslint/eslint-plugin-react/commit/07f2c978e925b0659cd1d414a010ee0e1b4f5e34

D0 [Fix] `no-is-mounted`: fix logic in method name check · jsx-eslint/eslint-plugin-react@07f2c97 · GitHub
Skip to content

Commit 07f2c97

Browse files
committed
[Fix] no-is-mounted: fix logic in method name check
The last change to `no-is-mounted` caused the rule to error with any method name, not just with "isMounted".
1 parent 1df23d2 commit 07f2c97

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

lib/rules/no-is-mounted.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module.exports = {
4141
}
4242
if (
4343
callee.object.type !== 'ThisExpression'
44-
&& (!('name' in callee.property) || callee.property.name !== 'isMounted')
44+
|| !('name' in callee.property)
45+
|| callee.property.name !== 'isMounted'
4546
) {
4647
return;
4748
}

tests/lib/rules/no-is-mounted.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ ruleTester.run('no-is-mounted', rule, {
5757
});
5858
`,
5959
},
60+
{
61+
code: `
62+
class Hello extends React.Component {
63+
notIsMounted() {}
64+
render() {
65+
this.notIsMounted();
66+
return <div>Hello</div>;
67+
}
68+
};
69+
`,
70+
},
6071
]),
6172

6273
invalid: parsers.all([

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jsx-eslint/eslint-plugin-react/commit/07f2c978e925b0659cd1d414a010ee0e1b4f5e34

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy