From 45cb94c97a978cd223bfd7f9367de0e39636bc11 Mon Sep 17 00:00:00 2001 From: Victor Date: Tue, 7 Nov 2023 11:34:46 +0100 Subject: [PATCH] Fix S6790: Use method definition in code snippets (#3420) --- rules/S6790/javascript/rule.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/S6790/javascript/rule.adoc b/rules/S6790/javascript/rule.adoc index 2d665b995c8..826c292c931 100644 --- a/rules/S6790/javascript/rule.adoc +++ b/rules/S6790/javascript/rule.adoc @@ -11,11 +11,11 @@ Older React versions allowed the ref attribute to be a string, like `"textInput" [source,javascript,diff-id=1,diff-type=noncompliant] ---- const Hello = createReactClass({ - componentDidMount: function() { + componentDidMount() { const component = this.refs.hello; // Noncompliant // ... }, - render: function() { + render() { return
Hello, world.
; } }); @@ -26,7 +26,7 @@ Instead, reference callbacks should be used. These do not have the limitations m [source,javascript,diff-id=1,diff-type=compliant] ---- const Hello = createReactClass({ - componentDidMount: function() { + componentDidMount() { const component = this.hello; // ... },