Skip to content

Commit

Permalink
Code style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Senexis committed Nov 1, 2023
1 parent 92fea2c commit 8dbe9c1
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 234 deletions.
42 changes: 42 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"standard-with-typescript",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react"
],
"ignorePatterns": [
".docusaurus",
".github",
".swagger-codegen",
".vscode",
"build",
"node_modules"
],
"rules": {
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/semi": ["error", "always"],
"@typescript-eslint/space-before-function-paren": ["error", "never"],
"react/no-unescaped-entities": "off",
"sort-imports": ["error", {
"ignoreCase": true,
"ignoreDeclarationSort": true,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
}],
},
"settings": {
"react": {
"version": "detect"
}
}
}
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

26 changes: 13 additions & 13 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import autoprefixer from 'autoprefixer';
import { themes as prismThemes } from 'prism-react-renderer';
import tailwindcss from 'tailwindcss';
import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';

Expand Down Expand Up @@ -64,13 +66,18 @@ const config: Config = {
items: [
{
type: 'doc',
label: 'Information & Guides',
label: 'Wiki',
position: 'left',
docId: 'getting-started',
},
{
to: '/news',
label: 'News & Updates',
label: 'News',
position: 'left',
},
{
to: '/api',
label: 'API',
position: 'left',
},
{
Expand Down Expand Up @@ -107,13 +114,6 @@ const config: Config = {
title: 'Visit @rdo_gg on X',
'aria-label': 'Visit @rdo_gg on X',
},
{
to: '/api',
position: 'right',
className: 'fa-solid fa-code',
title: 'Learn how to use the API',
'aria-label': 'Learn how to use the API',
},
],
},
footer: {
Expand All @@ -125,7 +125,7 @@ const config: Config = {
{
label: 'Terms of Service',
to: 'wiki/legal/terms-of-service',
}
},
],
copyright: `
© ${new Date().getFullYear()} - RDO.GG<br>
Expand Down Expand Up @@ -184,8 +184,8 @@ const config: Config = {
() => ({
name: 'tailwind',
configurePostCss(postcssOptions) {
postcssOptions.plugins.push(require('tailwindcss'));
postcssOptions.plugins.push(require('autoprefixer'));
postcssOptions.plugins.push(tailwindcss);
postcssOptions.plugins.push(autoprefixer);
return postcssOptions;
},
}),
Expand All @@ -200,7 +200,7 @@ const config: Config = {
test: /\.ya?ml$/,
use: 'yaml-loader',
},
]
],
},
};
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"typecheck": "tsc",
"build:pre": "node .github/scripts/images.js",
"build:post": "node .github/scripts/redirects.js",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint src --fix --ext .js,.jsx,.ts,.tsx"
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --fix --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"@docusaurus/core": "^3.0.0",
Expand Down
4 changes: 2 additions & 2 deletions sidebars.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';

/**
* Creating a sidebar enables you to:
Expand All @@ -12,7 +12,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
*/
const sidebars: SidebarsConfig = {
// By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
tutorialSidebar: [{ type: 'autogenerated', dirName: '.' }],

// But you can create a sidebar manually
/*
Expand Down
42 changes: 21 additions & 21 deletions src/components/GetStarted.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
/* eslint-disable import/no-absolute-path */

// @ts-expect-error ts(2307)
import Image from '@theme/IdealImage'
import Image from '@theme/IdealImage';

import React from 'react'
import PropTypes from 'prop-types'
import { Steps, StepsProvider, useSteps } from 'react-step-builder'
import React from 'react';
import PropTypes from 'prop-types';
import { Steps, StepsProvider, useSteps } from 'react-step-builder';

// @ts-expect-error ts(2307)
import getStarted1 from '/img/wiki/get-started-1.png'
import getStarted1 from '/img/wiki/get-started-1.png';

// @ts-expect-error ts(2307)
import getStarted2 from '/img/wiki/get-started-2.png'
import getStarted2 from '/img/wiki/get-started-2.png';

// @ts-expect-error ts(2307)
import getStarted3 from '/img/wiki/get-started-3.png'
import getStarted3 from '/img/wiki/get-started-3.png';

// @ts-expect-error ts(2307)
import getStarted4 from '/img/wiki/get-started-4.png'
import getStarted4 from '/img/wiki/get-started-4.png';

// @ts-expect-error ts(2307)
import getStarted5 from '/img/wiki/get-started-5.png'
import getStarted5 from '/img/wiki/get-started-5.png';

// @ts-expect-error ts(2307)
import getStarted6 from '/img/wiki/get-started-6.png'
import getStarted6 from '/img/wiki/get-started-6.png';

// @ts-expect-error ts(2307)
import getStarted7 from '/img/wiki/get-started-7.png'
import getStarted7 from '/img/wiki/get-started-7.png';

function GetStartedStep ({ title, children }): React.JSX.Element {
const { isFirst, isLast, hasNext, next, hasPrev, prev, current, total } = useSteps()
function GetStartedStep({ title, children }): React.JSX.Element {
const { isFirst, isLast, hasNext, next, hasPrev, prev, current, total } = useSteps();

return (
<div className="w-full h-[70vh] overflow-hidden flex flex-col rounded-lg text-black dark:text-white bg-white dark:bg-[#18191c] shadow-lg mb-8">
Expand Down Expand Up @@ -63,15 +63,15 @@ function GetStartedStep ({ title, children }): React.JSX.Element {
</div>
</div>
</div >
)
);
}

GetStartedStep.propTypes = {
title: PropTypes.string,
children: PropTypes.node
}
children: PropTypes.node,
};

function GetStartedSteps (): React.JSX.Element {
function GetStartedSteps(): React.JSX.Element {
return (
<Steps>
<GetStartedStep title="Welcome!">
Expand Down Expand Up @@ -159,15 +159,15 @@ function GetStartedSteps (): React.JSX.Element {
<p>Thank you so much for using the guide, and we hope it showed you the way to adding RDO Compendium to your server!</p>
</GetStartedStep>
</Steps>
)
);
}

function GetStarted (): React.JSX.Element {
function GetStarted(): React.JSX.Element {
return (
<StepsProvider>
<GetStartedSteps />
</StepsProvider>
)
);
}

export default GetStarted
export default GetStarted;
52 changes: 26 additions & 26 deletions src/components/Locations.tsx
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
// @ts-expect-error ts(2307)
import Image from '@theme/IdealImage'
import Image from '@theme/IdealImage';

import { type LocationResponse } from '@site/types'
import clsx from 'clsx'
import React from 'react'
import { useFetch } from 'usehooks-ts'
import { type LocationResponse } from '@site/types';
import clsx from 'clsx';
import React from 'react';
import { useFetch } from 'usehooks-ts';

function ToastsPlaceholder (): React.JSX.Element {
function ToastsPlaceholder(): React.JSX.Element {
return (
<>
<div className="animate-pulse mb-4">
{[...Array(2)].map((_, i) => {
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24', 'w-28', 'w-32']
const width = items[Math.floor(Math.random() * items.length)]
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24', 'w-28', 'w-32'];
const width = items[Math.floor(Math.random() * items.length)];
return (
<div key={i} className={clsx(width, 'inline-block h-6 bg-neutral-600 dark:bg-neutral-400 rounded mr-2')}></div>
)
);
})}
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 grid-flow-row gap-4 mb-8">
{[...Array(15)].map((_, i) => {
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24']
const width = items[Math.floor(Math.random() * items.length)]
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24'];
const width = items[Math.floor(Math.random() * items.length)];
return (
<div key={i} className="animate-pulse text-center bg-neutral-300 dark:bg-neutral-700 shadow-sm p-2 rounded">
<div className="w-full h-12 bg-neutral-600 dark:bg-neutral-400 rounded mb-1"></div>
<div className={clsx(width, 'inline-block h-2 bg-neutral-600 dark:bg-neutral-400 rounded')}></div>
</div>
)
);
})}
</div>
<div className="animate-pulse mb-4">
{[...Array(2)].map((_, i) => {
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24', 'w-28', 'w-32']
const width = items[Math.floor(Math.random() * items.length)]
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24', 'w-28', 'w-32'];
const width = items[Math.floor(Math.random() * items.length)];
return (
<div key={i} className={clsx(width, 'inline-block h-6 bg-neutral-600 dark:bg-neutral-400 rounded mr-2')}></div>
)
);
})}
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 grid-flow-row gap-4 mb-8">
{[...Array(11)].map((_, i) => {
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24']
const width = items[Math.floor(Math.random() * items.length)]
const items = ['w-8', 'w-10', 'w-12', 'w-14', 'w-16', 'w-20', 'w-24'];
const width = items[Math.floor(Math.random() * items.length)];
return (
<div key={i} className="animate-pulse text-center bg-neutral-300 dark:bg-neutral-700 shadow-sm p-2 rounded">
<div className="w-full h-12 bg-neutral-600 dark:bg-neutral-400 rounded mb-1"></div>
<div className={clsx(width, 'inline-block h-2 bg-neutral-600 dark:bg-neutral-400 rounded')}></div>
</div>
)
);
})}
</div>
</>
)
);
}

function Toasts (): React.JSX.Element {
const { data } = useFetch<LocationResponse>('/json/locations.json')
function Toasts(): React.JSX.Element {
const { data } = useFetch<LocationResponse>('/json/locations.json');

if (data === undefined) return <ToastsPlaceholder />
if (data === undefined) return <ToastsPlaceholder />;

const categories = {
district: 'Districts',
Expand All @@ -68,8 +68,8 @@ function Toasts (): React.JSX.Element {
settlement: 'Settlements',
state: 'States',
town: 'Towns',
water: 'Bodies of Water'
}
water: 'Bodies of Water',
};

return (
<>
Expand All @@ -90,7 +90,7 @@ function Toasts (): React.JSX.Element {
</section>
))}
</>
)
);
}

export default Toasts
export default Toasts;
Loading

0 comments on commit 8dbe9c1

Please sign in to comment.