Skip to content

Commit d4931ae

Browse files
committed
correcting eslint errors
1 parent 94fbe8b commit d4931ae

File tree

20 files changed

+170
-148
lines changed

20 files changed

+170
-148
lines changed

.env

Whitespace-only changes.

.eslintrc

+17-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,25 @@
77
"plugin:@typescript-eslint/recommended-requiring-type-checking"
88
],
99
"parser": "@typescript-eslint/parser",
10-
"plugins": ["@typescript-eslint", "react-hooks"],
10+
"plugins": [
11+
"@typescript-eslint",
12+
"react-hooks"
13+
],
1114
"root": true,
1215
"parserOptions": {
13-
"project": ["tsconfig.json"]
16+
"project": [
17+
"tsconfig.json"
18+
]
1419
},
1520
"rules": {
16-
"react-hooks/exhaustive-deps": "warn"
21+
"react-hooks/exhaustive-deps": "warn",
22+
"react/react-in-jsx-scope": "error",
23+
"@typescript-eslint/no-misused-promises": [
24+
"warn",
25+
{
26+
"checksVoidReturn": false
27+
}
28+
],
29+
"@typescript-eslint/explicit-function-return-type": "off"
1730
}
18-
}
31+
}

.eslintrc.cjs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
extends: [
77
'plugin:react/recommended',
88
'standard-with-typescript',
9-
'plugin:react-hooks/recommended'
9+
'plugin:react-hooks/recommended',
1010
],
1111
overrides: [],
1212
parserOptions: {
@@ -17,6 +17,8 @@ module.exports = {
1717
plugins: ['react', 'react-hooks'],
1818
rules: {
1919
'react-hooks/exhaustive-deps': 'warn',
20-
semi: 'error'
20+
semi: 'error',
21+
"react/react-in-jsx-scope": 'error',
22+
"@typescript-eslint/explicit-function-return-type": "off"
2123
}
2224
}

.vscode/settings.json

+10-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,14 @@
1616
"files.eol": "\n",
1717
"editor.formatOnPaste": true,
1818
"eslint.lintTask.options": "-c C:/Users/artur/Documents/GitHub/pray-the-rosary/.eslintrc.cjs",
19-
"eslint.options": { "overrideConfigFile": "C:/Users/artur/Documents/GitHub/pray-the-rosary/.eslintrc.cjs" },
20-
"eslint.validate": ["typescriptreact", "typescript", "javascript", "javascriptreact"],
19+
"eslint.options": {
20+
"overrideConfigFile": "C:/Users/artur/Documents/GitHub/pray-the-rosary/.eslintrc.cjs"
21+
},
22+
"eslint.validate": [
23+
"typescriptreact",
24+
"typescript",
25+
"javascript",
26+
"javascriptreact"
27+
],
2128
"typescript.format.enable": true,
22-
}
29+
}

src/components/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export { default as MainLayout } from './layout'
77

88
export { Text } from './typography'
99
export {
10-
type TextProps,
10+
type TextProps
1111
} from './typography/Text.interface'
1212

1313
export { default as Tabs } from './tabs'
1414
export {
15-
type TabsProps,
15+
type TabsProps
1616
} from './tabs/index.interface'
1717

1818
export {

src/components/layout/header.tsx

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { Layout, Row } from 'antd';
2-
import SelectCountry from 'src/domains/countries/SelectCountry';
3-
import styles from './header.module.css';
4-
import setLanguage from 'next-translate/setLanguage';
5-
import useTranslation from 'next-translate/useTranslation';
1+
import React from 'react'
2+
import { Layout, Row } from 'antd'
3+
import SelectCountry from 'src/domains/countries/SelectCountry'
4+
import styles from './header.module.css'
5+
import setLanguage from 'next-translate/setLanguage'
6+
import useTranslation from 'next-translate/useTranslation'
67
import { setDefaultOptions } from 'date-fns'
7-
import { getDateFnsLocale } from 'src/helpers/locale';
8-
import { removeHyphens } from 'src/helpers/string';
8+
import { getDateFnsLocale } from 'src/helpers/locale'
9+
import { removeHyphens } from 'src/helpers/string'
910

10-
11-
12-
const Header = () => {
13-
function onSelectLanguage(value: string, option: any) {
14-
setLanguage(value);
11+
const Header: React.FunctionComponent = (): JSX.Element => {
12+
async function onSelectLanguage (value: string, option: any): Promise<void> {
13+
await setLanguage(value)
1514

1615
const locale = getDateFnsLocale(removeHyphens(value))
1716

@@ -20,20 +19,20 @@ const Header = () => {
2019
})
2120
}
2221

23-
const { lang } = useTranslation();
22+
const { lang } = useTranslation()
2423

2524
return (
2625
<Layout.Header>
2726
<Row justify="end" align="middle" className={styles.headerRow}>
2827
<SelectCountry
29-
onSelect={onSelectLanguage}
28+
handleOnSelect={onSelectLanguage}
3029
defaultValue={lang}
3130
variableCountryAttribute="language"
3231
showFlag={false}
3332
/>
3433
</Row>
3534
</Layout.Header>
36-
);
37-
};
35+
)
36+
}
3837

39-
export default Header;
38+
export default Header

src/components/layout/index.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import React, { PropsWithChildren } from 'react';
2-
import Header from './header';
1+
import React, { type PropsWithChildren } from 'react'
2+
import Header from './header'
33

44
interface LayoutProps {
5-
name?: 'Layout';
5+
name?: 'Layout'
66
}
77

8-
const Layout = (props: PropsWithChildren<LayoutProps>) => {
8+
const Layout: React.FunctionComponent = (props: PropsWithChildren<LayoutProps>): JSX.Element => {
99
return (
1010
<React.Fragment {...props}>
11-
<Header></Header>
11+
<Header />
1212

1313
{props?.children}
1414
</React.Fragment>
15-
);
16-
};
15+
)
16+
}
1717

18-
export default Layout;
18+
export default Layout
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { SelectProps as AntdSelectProps } from 'antd';
1+
import { type SelectProps as AntdSelectProps } from 'antd'
22

3-
import { OptionProps } from 'rc-select/lib/Option';
3+
import { type OptionProps } from 'rc-select/lib/Option'
44

5-
export type SelectProps = AntdSelectProps;
6-
export type SelectOptionProps = OptionProps;
5+
export type SelectProps = AntdSelectProps
6+
export type SelectOptionProps = OptionProps

src/components/select/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { type FunctionComponent } from 'react'
22

33
import AntdSelect from 'antd/lib/select'
4-
import { SelectProps } from './index.interface'
4+
import { type SelectProps } from './index.interface'
55

66
const Select: FunctionComponent<SelectProps> = (props) => {
77
return <AntdSelect size="large" {...props} />
+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { TabsProps as AntdTabsProps } from 'antd/es/tabs'
2-
import { Tab } from 'rc-tabs/lib/interface'
1+
import { type TabsProps as AntdTabsProps } from 'antd/es/tabs'
2+
import { type Tab } from 'rc-tabs/lib/interface'
33

44
export type TabsProps = AntdTabsProps
55
export type ItemTab = Tab
6-

src/components/tabs/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import React from 'react'
22
import { Tabs as AntdTabs } from 'antd'
3-
import { TabsProps } from './index.interface';
3+
import { type TabsProps } from './index.interface'
44

5-
const Tabs = (props: TabsProps) => {
6-
const { children } = props;
5+
const Tabs: React.FunctionComponent = (props: TabsProps): JSX.Element => {
6+
const { children } = props
77

88
return (
99
<AntdTabs {...props}>{children}</AntdTabs>
1010
)
1111
}
1212

13-
export default Tabs
13+
export default Tabs
+20-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
import React from "react";
2-
import { Text } from "../typography";
1+
import React from 'react'
2+
import { Text } from '../typography'
33

44
interface TextMultipleLinesProps {
5-
text: string;
5+
text: string
6+
className: string
67
}
78

8-
const TextMultipleLines = (props: TextMultipleLinesProps & React.HTMLAttributes<HTMLDivElement>) => {
9-
const { text = '' } = props;
9+
const TextMultipleLines = (props: TextMultipleLinesProps & React.HTMLAttributes<HTMLDivElement>): JSX.Element => {
10+
const { text = '' } = props
1011

11-
const lines: string[] = text?.split('\n') || [];
12+
const lines: string[] = text.split('\n')
1213

13-
return (
14-
<div className={props?.className}>
15-
{lines?.map((line, i) => (
16-
<React.Fragment key={i}>
17-
<Text>
18-
{line}
19-
</Text>
20-
{i < lines.length - 1 && <br />}
21-
</React.Fragment>
22-
))}
23-
</div>
24-
);
14+
return (
15+
<div className={props?.className}>
16+
{lines?.map((line, i) => (
17+
<React.Fragment key={i}>
18+
<Text>
19+
{line}
20+
</Text>
21+
{i < lines.length - 1 && <br />}
22+
</React.Fragment>
23+
))}
24+
</div>
25+
)
2526
}
2627

27-
export default TextMultipleLines
28+
export default TextMultipleLines
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { type TextProps as AntdTextProps } from 'antd/es/typography/Text';
1+
import { type TextProps as AntdTextProps } from 'antd/es/typography/Text'
22

33
export interface TextProps extends AntdTextProps {
4-
upperCase?: boolean
4+
upperCase?: boolean
5+
children?: any | string
56
};

src/components/typography/Text.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React from 'react'
22
import { Typography } from 'antd'
3-
import { TextProps } from './Text.interface';
4-
import styles from './Text.module.css';
5-
import classNames from 'classnames';
6-
import { omit } from 'src/helpers/omit';
3+
import { type TextProps } from './Text.interface'
4+
import styles from './Text.module.css'
5+
import classNames from 'classnames'
6+
import { omit } from 'src/helpers/omit'
77

8-
const { Text: AntdText } = Typography;
8+
const { Text: AntdText } = Typography
99

10-
const Text = (props: TextProps) => {
11-
const { upperCase = false } = props;
10+
const Text: React.FunctionComponent<TextProps> = (props): JSX.Element => {
11+
const { upperCase = false } = props
1212

1313
const classnames = classNames(
1414
[
1515
upperCase ? styles.upperCase : '',
16-
styles.text,
16+
styles.text
1717
]
1818
)
1919

@@ -24,4 +24,4 @@ const Text = (props: TextProps) => {
2424
)
2525
}
2626

27-
export default Text
27+
export default Text
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { type TitleProps as AntdTitleProps } from 'antd/es/typography/Title';
1+
import { type TitleProps as AntdTitleProps } from 'antd/es/typography/Title'
22

33
export interface TitleProps extends AntdTitleProps {
4-
upperCase?: boolean
4+
upperCase?: boolean
55
};

src/components/typography/Title.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React from 'react'
22
import { Typography } from 'antd'
3-
import styles from './Text.module.css';
4-
import classNames from 'classnames';
5-
import { omit } from 'src/helpers/omit';
6-
import { TitleProps } from './Title.interface';
3+
import styles from './Text.module.css'
4+
import classNames from 'classnames'
5+
import { omit } from 'src/helpers/omit'
6+
import { type TitleProps } from './Title.interface'
77

8-
const { Title: AntdComponent } = Typography;
8+
const { Title: AntdComponent } = Typography
99

10-
const Title = (props: TitleProps) => {
11-
const { upperCase = false } = props;
10+
const Title: React.FunctionComponent = (props: TitleProps): JSX.Element => {
11+
const { upperCase = false } = props
1212

1313
const classnames = classNames(
1414
[
1515
upperCase ? styles.upperCase : '',
16-
styles.text,
16+
styles.text
1717
]
1818
)
1919

@@ -24,4 +24,4 @@ const Title = (props: TitleProps) => {
2424
)
2525
}
2626

27-
export default Title
27+
export default Title

src/components/typography/index.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
export { default as Text } from './Text'
22
export {
3-
type TextProps,
3+
type TextProps
44
} from './Text.interface'
55

66
export { default as Title } from './Title'
77
export {
8-
type TitleProps,
8+
type TitleProps
99
} from './Title.interface'
10-
11-
12-

0 commit comments

Comments
 (0)