Skip to content

Commit d7d57e8

Browse files
authored
RI-7861: Fix ESLint issues (#5343)
* fix(config): include stories in tsconfig for ESLint type-aware linting The stories/playground/*.tsx files were not included in any tsconfig, causing ESLint parsing errors during type-aware linting. - Fix import order in Gallery.tsx and PlaygroundPage.tsx - Fix variable shadowing in Colors.tsx by reusing outer scope regex - Fix no-use-before-define in Theme.tsx by moving component definitions before the main Theme component that uses them
1 parent 1a200ac commit d7d57e8

File tree

7 files changed

+210
-217
lines changed

7 files changed

+210
-217
lines changed

redisinsight/api/src/modules/rdi/exceptions/rdi-pipeline.error.handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
RdiPipelineValidationException,
88
} from 'src/modules/rdi/exceptions';
99
import { RdiPipelineForbiddenException } from './rdi-pipeline.forbidden.exception';
10-
import { RdiPipelineBadRequestException } from "src/modules/rdi/exceptions/rdi-pipeline.bad-request.exception";
10+
import { RdiPipelineBadRequestException } from 'src/modules/rdi/exceptions/rdi-pipeline.bad-request.exception';
1111

1212
export const parseErrorMessage = (error: AxiosError<any>): string => {
1313
const data = error.response?.data;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import type { Meta, StoryObj } from '@storybook/react-vite';
1+
import type { Meta, StoryObj } from '@storybook/react-vite'
22

3-
import BottomGroupMinimized from './BottomGroupMinimized';
3+
import BottomGroupMinimized from './BottomGroupMinimized'
44

55
const meta = {
66
component: BottomGroupMinimized,
7-
} satisfies Meta<typeof BottomGroupMinimized>;
7+
} satisfies Meta<typeof BottomGroupMinimized>
88

9-
export default meta;
9+
export default meta
1010

11-
type Story = StoryObj<typeof meta>;
11+
type Story = StoryObj<typeof meta>
1212

13-
export const Default: Story = {};
13+
export const Default: Story = {}

stories/playground/Colors.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ export const Colors = () => {
109109

110110
const filteredSemanticColors = Object.keys(semanticColors).reduce(
111111
(acc, colorSection) => {
112-
const tempColors = semanticColors[colorSection as keyof typeof semanticColors]
112+
const tempColors =
113+
semanticColors[colorSection as keyof typeof semanticColors]
113114
Object.entries(tempColors).forEach(([colorName, color]) => {
114115
if (!search || regex.test(colorName)) {
115116
semanticCount++
@@ -123,18 +124,8 @@ export const Colors = () => {
123124
},
124125
{} as Record<string, Record<string, string>>,
125126
)
126-
const filteredRootColors = Object.entries(rootColors).filter(
127-
([colorName]) => {
128-
if (!search) {
129-
return true
130-
}
131-
// Create regex pattern: each character from search with .* in between
132-
// Escape special regex characters
133-
const escapedSearch = search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
134-
const pattern = escapedSearch.split('').join('.*')
135-
const regex = new RegExp(pattern, 'i')
136-
return regex.test(colorName)
137-
},
127+
const filteredRootColors = Object.entries(rootColors).filter(([colorName]) =>
128+
!search ? true : regex.test(colorName),
138129
)
139130

140131
return (

stories/playground/Gallery.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import React, { useState } from 'react'
2-
import { FlexItem, Grid } from 'uiSrc/components/base/layout/flex'
2+
import styled from 'styled-components'
3+
import { Col, FlexItem, Grid, Row } from 'uiSrc/components/base/layout/flex'
34
import { AllIconsType, RiIcon } from 'uiSrc/components/base/icons/RiIcon'
45
import * as Icons from 'uiSrc/components/base/icons/iconRegistry'
5-
import styled from 'styled-components'
6-
import { Text } from 'uiSrc/components/base/text'
6+
import { ColorText, Text } from 'uiSrc/components/base/text'
77
import { type Theme as ThemeType } from 'uiSrc/components/base/theme/types'
8-
import { Col, Row } from 'uiSrc/components/base/layout/flex'
98
import { SearchInput } from 'uiSrc/components/base/inputs'
10-
import { ColorText } from '../../redisinsight/ui/src/components/base/text'
119

1210
const skip = [
1311
'IconProps',

stories/playground/PlaygroundPage.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React, { useState } from 'react'
2-
import { Col, Row } from 'uiSrc/components/base/layout/flex'
3-
import { Title } from 'uiSrc/components/base/text/Title'
4-
import { Theme } from './Theme'
5-
import { Gallery } from './Gallery'
6-
import { Colors } from './Colors'
72
import styled, { ThemeProvider } from 'styled-components'
83
import { themeDark, themeLight, themeOld } from '@redis-ui/styles'
9-
import { type Theme as ThemeType } from 'uiSrc/components/base/theme/types'
4+
import { Col, Row } from 'uiSrc/components/base/layout/flex'
105
import { Text } from 'uiSrc/components/base/text'
6+
import { Title } from 'uiSrc/components/base/text/Title'
7+
import { type Theme as ThemeType } from 'uiSrc/components/base/theme/types'
8+
import { Colors } from './Colors'
9+
import { Gallery } from './Gallery'
10+
import { Theme } from './Theme'
1111

1212
export const Container = styled(Row).attrs({ gap: 'm' })`
1313
padding: 2rem;

0 commit comments

Comments
 (0)