3// // expect(element).toHaveTextContent(/react/i)
4// // learn more: https://github.com/testing-library/jest-dom
5// import '@testing-library/jest-dom/extend-expect';
6import React from 'react'; 7import Enzyme from 'enzyme';
8import Adapter from 'enzyme-adapter-react-16';
9import {createSerializer} from 'enzyme-to-json';
3import SideBarHeader from '../SideBarHeader/SideBarHeader';
4import Subscription from './Subscription/Subscription';
5
6const Subscriptions = props => ( 7 <Fragment>
8 <SideBarHeader title="subscriptions" />
9 <Subscription label="MusicChannel" broadcasting />
3import { Button, Image } from 'semantic-ui-react';
4import Rating from '../../../components/Rating/Rating';
5
6const Comment = props => ( 7 <div className="comment">
8 <Image className="user-image" src="https://via.placeholder.com/48x48" circular />
9 <div>
3import { VideoPreview } from '../VideoPreview/VideoPreview';
4import NextUpVideo from './NextUpVideo/NextUpVideo';
5
6const RelatedVideos = props => ( 7 <div className="related-videos">
8 <NextUpVideo />
9 <VideoPreview horizontal />
3import { Checkbox, Divider } from 'semantic-ui-react';
4import { VideoPreview } from '../../VideoPreview/VideoPreview';
5
6const NextUpVideo = props => ( 7 <Fragment>
8 <div className="nextup-container">
9 <h4>Up next</h4>
Found variables that are declared but not used anywhere.
Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.
NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _
to prevent them from being flagged by DeepSource.
// Write-only variables are not considered as used.
var y = 10;
y = 5;
// A variable that modifies only itself isn't considered used.
var z = 0;
z = z + 1;
// Unused argument
(function(x) {
return 5;
})();
// Unused recursive functions also raise this issue.
function fact(n) {
if (n < 2) return 1;
return n * fact(n - 1);
}
// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
return y;
}
var x = 10;
alert(x);
((arg1) => {
return arg1;
})();
let myFunc;
myFunc = (n) => {
// this is legal
if (n < 0) myFunc();
};
// this is also considered legal
console.log(declaredLater);
var declaredLater;
// Only the second argument from the descructured array is used.
function getY([, y]) {
return y;
}