diff --git a/.eslintrc.json b/.eslintrc.json index 57d4ac6..17c3430 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,9 +7,7 @@ "eslint:recommended", "plugin:react/recommended", "plugin:react-hooks/recommended", - "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier" + "plugin:@typescript-eslint/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -24,10 +22,10 @@ ], "rules": { "@typescript-eslint/ban-ts-comment": "off", - "@typescript-eslint/no-explicit-any": "error", + "@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-unused-vars": "error", "no-console": "error", - "react/jsx-no-bind": "error", + "react/jsx-no-bind": "off", "react/jsx-sort-props": [ "warn", { diff --git a/.prettierrc.json b/.prettierrc.json index 368bebf..8f2802d 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,5 +3,7 @@ "semi": false, "singleQuote": true, "tabWidth": 2, + "endOfLine": "auto", + "printWidth": 160, "trailingComma": "es5" } diff --git a/src/Ticker.test.tsx b/src/Ticker.test.tsx index e7f45b4..b97c69a 100644 --- a/src/Ticker.test.tsx +++ b/src/Ticker.test.tsx @@ -47,28 +47,16 @@ describe('Ticker', function () { expect(screen.getByText('Loading')).toBeInTheDocument() - expect( - await screen.findByText('It seems that you are offline.') - ).toBeInTheDocument() + expect(await screen.findByText('It seems that you are offline.')).toBeInTheDocument() }) test('renders ErrorView', async function () { - jest - .spyOn(api, 'getInit') - .mockRejectedValue( - new Error( - 'The server responses with an error: Internal Server Error (500)' - ) - ) + jest.spyOn(api, 'getInit').mockRejectedValue(new Error('The server responses with an error: Internal Server Error (500)')) renderTicker() expect(screen.getByText('Loading')).toBeInTheDocument() - expect( - await screen.findByText( - 'There seems to be a problem connecting to the server.' - ) - ).toBeInTheDocument() + expect(await screen.findByText('There seems to be a problem connecting to the server.')).toBeInTheDocument() }) test('renders InactiveView', async function () { @@ -82,9 +70,7 @@ describe('Ticker', function () { expect(screen.getByText('Loading')).toBeInTheDocument() - expect( - await screen.findByText('The ticker is currently inactive.') - ).toBeInTheDocument() + expect(await screen.findByText('The ticker is currently inactive.')).toBeInTheDocument() }) test('renders ActiveView', async function () { @@ -102,21 +88,13 @@ describe('Ticker', function () { const intersectionObserverMock = () => ({ observe: () => null, }) - window.IntersectionObserver = jest - .fn() - .mockImplementation(intersectionObserverMock) + window.IntersectionObserver = jest.fn().mockImplementation(intersectionObserverMock) renderTicker() expect(screen.getByText('Loading')).toBeInTheDocument() - expect( - await screen.findByText( - 'The messages update automatically. There is no need to reload the entire page.' - ) - ).toBeInTheDocument() + expect(await screen.findByText('The messages update automatically. There is no need to reload the entire page.')).toBeInTheDocument() - expect( - await screen.findByText('We dont have any messages at the moment.') - ).toBeInTheDocument() + expect(await screen.findByText('We dont have any messages at the moment.')).toBeInTheDocument() }) }) diff --git a/src/Ticker.tsx b/src/Ticker.tsx index b4ba31e..862957d 100644 --- a/src/Ticker.tsx +++ b/src/Ticker.tsx @@ -25,9 +25,7 @@ const Ticker: FC = () => { } if (hasError) { - return ( - - ) + return } if (isOffline) { diff --git a/src/components/About.tsx b/src/components/About.tsx index 1e5a6d3..b90eadb 100644 --- a/src/components/About.tsx +++ b/src/components/About.tsx @@ -20,47 +20,16 @@ const About: FC = ({ isModal }) => { const renderDescriptionList = () => ( - {ticker.information.author && ( - - )} - {ticker.information.email && ( - - )} - {ticker.information.url && ( - - )} - {ticker.information.twitter && ( - - )} - {ticker.information.facebook && ( - - )} - {ticker.information.telegram && ( - - )} + {ticker.information.author && } + {ticker.information.email && } + {ticker.information.url && } + {ticker.information.twitter && } + {ticker.information.facebook && } + {ticker.information.telegram && } - Atom |{' '} - RSS + Atom | RSS diff --git a/src/components/Attachments.test.tsx b/src/components/Attachments.test.tsx index f019db6..2bfa7c1 100644 --- a/src/components/Attachments.test.tsx +++ b/src/components/Attachments.test.tsx @@ -3,9 +3,7 @@ import Attachments from './Attachments' describe('Attachment', function () { test('renders single image correctly', function () { - const attachments = [ - { contentType: 'image/jpeg', url: 'https://example.com/image.jpg' }, - ] + const attachments = [{ contentType: 'image/jpeg', url: 'https://example.com/image.jpg' }] const { asFragment } = render() expect(asFragment()).toMatchSnapshot() diff --git a/src/components/Attachments.tsx b/src/components/Attachments.tsx index 11afd3c..6385ea1 100644 --- a/src/components/Attachments.tsx +++ b/src/components/Attachments.tsx @@ -1,13 +1,5 @@ import { FC } from 'react' -import { - ButtonBack, - ButtonNext, - CarouselProvider, - Dot, - Image, - Slide, - Slider, -} from 'pure-react-carousel' +import { ButtonBack, ButtonNext, CarouselProvider, Dot, Image, Slide, Slider } from 'pure-react-carousel' import styled from 'styled-components' import { Attachment } from '../lib/types' import 'pure-react-carousel/dist/react-carousel.es.css' @@ -48,40 +40,18 @@ const Attachments: FC = props => { ))} -