JS-776 Remove in-rule React detection and rely on requiredDependency#6635
JS-776 Remove in-rule React detection and rely on requiredDependency#6635
Conversation
Ruling ReportNew issues flagged (9 issues)S6440eigen/src/app/Components/ArtworkGrids/LotCloseInfo.tsx:30 28 | return null
29 | }
> 30 | const { hasEnded: lotHasClosed } = useTimer(lotEndAt, sale.startAt ?? "")
31 |
32 | const { hasEnded: lotsAreClosing, hasStarted: saleHasStarted } = useTimer(eigen/src/app/Components/ArtworkGrids/LotCloseInfo.tsx:32 30 | const { hasEnded: lotHasClosed } = useTimer(lotEndAt, sale.startAt ?? "")
31 |
> 32 | const { hasEnded: lotsAreClosing, hasStarted: saleHasStarted } = useTimer(
33 | sale.endAt!,
34 | sale.startAt!eigen/src/app/Scenes/Inbox/Components/Conversations/OpenInquiryModalButton.tests.tsx:14 12 | import { OpenInquiryModalButtonFragmentContainer } from "./OpenInquiryModalButton"
13 |
> 14 | const trackEvent = useTracking().trackEvent
15 |
16 | jest.unmock("react-relay")eigen/src/app/utils/platformUtil.ts:10 8 | return 0
9 | } else {
> 10 | return 13 + useSafeAreaInsets().top
11 | }
12 | }moose/renderer/utils/animations.ts:29 27 |
28 | const translateY = `${reverse ? -5 : 5}px`;
> 29 | return useTransition(item, keys, {
30 | from: {
31 | opacity: 0,moose/renderer/utils/animations.ts:48 46 |
47 | export function fadeIn(item, keys) {
> 48 | return useTransition(item, keys, {
49 | from: {
50 | opacity: 0,moose/renderer/utils/animations.ts:65 63 |
64 | export function scale(item) {
> 65 | return useTransition(item, null, {
66 | from: { transform: "scale(0.5)", opacity: 0 },
67 | enter: { transform: "scale(1)", opacity: 1 },sonar-web/src/main/js/helpers/measures.js:12 10 | export function formatMeasure (value, type) {
11 | let formatter = getFormatter(type);
> 12 | return useFormatter(value, formatter);
13 | }
14 | sonar-web/src/main/js/helpers/measures.js:23 21 | export function formatMeasureVariation (value, type) {
22 | let formatter = getVariationFormatter(type);
> 23 | return useFormatter(value, formatter);
24 | }
25 | |
|
Generating a summary... |
| 'Remove this property or method or refactor this component, as "{{name}}" is not used inside component body', | ||
| unusedWithClass: | ||
| 'Remove this property or method or refactor "{{className}}", as "{{name}}" is not used inside component body', |
There was a problem hiding this comment.
Here we override the builtin messages from eslint
|
|
Both of those rule can't immediately benefit from simplification.
I did update rspec with required dependencies for a few of these rules - https://github.com/SonarSource/rspec/pull/6379 |




Summary
detectReactRule) from S6440 and S6441reactdependency guards from S6477 and S6747rule-detect-reacthelperrequiredDependencyfiltering for a React rule (disabled withoutreact, enabled withreact)Validation
npx tsx --tsconfig packages/tsconfig.test.json --test packages/jsts/src/rules/S6440/cb.test.ts packages/jsts/src/rules/S6441/cb.test.ts packages/jsts/tests/linter/index.test.ts