diff --git a/README.md b/README.md index 62e7160..f2279b1 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # test test repository -[![DeepScan grade](https://stage.deepscan.io/api/teams/6494/projects/23671/branches/721392/badge/grade.svg)](https://stage.deepscan.io/dashboard#view=project&tid=6494&pid=23671&bid=721392) +[![DeepScan grade](https://deepscan.io/api/teams/20255/projects/25078/branches/777497/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=20255&pid=25078&bid=777497) diff --git a/src/js/code-quality.js b/src/js/code-quality.js index faa0b88..87fa9f1 100644 --- a/src/js/code-quality.js +++ b/src/js/code-quality.js @@ -193,17 +193,3 @@ function foo(url) { var target = url + "user" + user; // UNUSED_VAR_ASSIGN alarm target = url.replace(/\.|\?|\&|\/|\=|\:|\-|\s/gi, ""); } - -import React from 'react'; -import PropTypes from 'prop-types'; - -class Hello extends React.Component { - render() { - return
Hello, {this.props.name}
; - } -} - -Hello.propTypes = { - name: PropTypes.string, - age: PropTypes.number // USELESS_PROP_TYPES alarm because this property 'age' is not used. -}; diff --git a/src/js/react-rules.js b/src/js/react-rules.js index c25ecb9..bdb25dd 100644 --- a/src/js/react-rules.js +++ b/src/js/react-rules.js @@ -214,3 +214,14 @@ Hello.propTypes = { name: PropTypes.string, age: PropTypes.number // USELESS_PROP_TYPES alarm because this property 'age' is not used. }; + +export class Hello extends React.Component { + render() { + return ( +
+ /* This is a comment */ {/* JSX_BAD_COMMENT alarm because this text is recognized as a JSX child instead of a comment. */} +
// is a double slash.
{/* JSX_BAD_COMMENT alarm because this text in div element is recognized as a JSX child instead of a comment. */} +
+ ); + } +} diff --git a/src/js/test.js b/src/js/test.js new file mode 100644 index 0000000..4e878a8 --- /dev/null +++ b/src/js/test.js @@ -0,0 +1,15 @@ + +class Test { + data = 'data'; + foo() { + console.log(this.data); + } + bar() { + this.foo.call(this); // USELESS_CALL alarm + } +} +function a() { return 1; } // DUPLICATE_DECL alarm. This function declaration is ignored. +function a(b) { return b; } + +var foo; +var foo; // DUPLICATE_DECL alarm