From f76ceb011e32ce4f312476e9a969683ad122f245 Mon Sep 17 00:00:00 2001 From: ntr Date: Thu, 26 Jan 2023 15:24:05 +1100 Subject: [PATCH] lint --- client/.eslintrc.js | 18 +++++--- client/package.json | 2 +- client/src/components/nav.tsx | 2 +- client/src/components/offer.group.tsx | 2 +- client/src/components/offer.tsx | 2 +- client/src/components/want.tsx | 2 +- client/src/http.ts | 4 +- client/src/routes/acp.tsx | 4 +- client/src/routes/login.tsx | 2 +- client/src/routes/search.tsx | 4 +- client/src/store.tsx | 66 +++++++++++++-------------- 11 files changed, 56 insertions(+), 52 deletions(-) diff --git a/client/.eslintrc.js b/client/.eslintrc.js index e5690ff..4659290 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -8,23 +8,27 @@ module.exports = { "build/" ], rules: { + 'arrow-body-style': [0], + + 'max-len': ['error', 120], + + 'no-console': [0], + 'no-multi-spaces': [0], // prevents stupid complaints a la // (req) { // req.something = x; // } 'no-param-reassign': [2, { props: false }], - 'no-multi-spaces': [0], - 'max-len': ['error', 120], - 'import/no-extraneous-dependencies': [0], - 'prefer-arrow-callback': [0], - 'arrow-body-style': [0], 'no-return-assign': 0, - 'no-console': [0], + + 'prefer-arrow-callback': [0], + // i like loops 'no-plusplus': [0], - 'no-await-in-loop': [0], + indent: ['error', 4], + 'keyword-spacing': ['error'], 'key-spacing': ['error'], }, diff --git a/client/package.json b/client/package.json index 4b24086..3b129ca 100644 --- a/client/package.json +++ b/client/package.json @@ -6,7 +6,7 @@ "scripts": { "build": "preact build --no-prerender", "start": "preact --no-clear watch", - "lint": "eslint src" + "lint": "eslint --fix src" }, "dependencies": { "@reduxjs/toolkit": "^1.8.5", diff --git a/client/src/components/nav.tsx b/client/src/components/nav.tsx index 859e72d..a24d8ca 100644 --- a/client/src/components/nav.tsx +++ b/client/src/components/nav.tsx @@ -72,7 +72,7 @@ const Nav = () => { return (
{user ? nav() : anonNav()} - {showAdmin(user) ? adminNav() :
} + {showAdmin(user) ? adminNav() :
} {user ? userNav() : null}
); diff --git a/client/src/components/offer.group.tsx b/client/src/components/offer.group.tsx index 2cbb83c..68c4bec 100644 --- a/client/src/components/offer.group.tsx +++ b/client/src/components/offer.group.tsx @@ -65,7 +65,7 @@ export default function OfferGroup(group, i) { return (
-

{group.details.artists_sort} - {group.details.title}

+

{group.details.artists_sort} - {group.details.title}

{group.details.year} - {detailText}
diff --git a/client/src/components/offer.tsx b/client/src/components/offer.tsx index bb845e2..76dec96 100644 --- a/client/src/components/offer.tsx +++ b/client/src/components/offer.tsx @@ -29,7 +29,7 @@ export default function Offer(offer) { return (
-

{details.artists_sort} - {details.title}

+

{details.artists_sort} - {details.title}

{details.year}
{details.formats[0].descriptions.join(' ')}
mcrates price: ${offer.total}
diff --git a/client/src/components/want.tsx b/client/src/components/want.tsx index aafde16..e85c8b6 100644 --- a/client/src/components/want.tsx +++ b/client/src/components/want.tsx @@ -27,7 +27,7 @@ function Want(want) { return (
-

{r.artists_sort} - {r.title}

+

{r.artists_sort} - {r.title}

diff --git a/client/src/http.ts b/client/src/http.ts index a1e9605..095b3fb 100644 --- a/client/src/http.ts +++ b/client/src/http.ts @@ -15,8 +15,8 @@ declare module 'axios' { } const api = axios.create({ - baseURL: '/api', - withCredentials: true + baseURL: '/api', + withCredentials: true }); function onSuccess(response) { diff --git a/client/src/routes/acp.tsx b/client/src/routes/acp.tsx index 0874e69..5d59b65 100644 --- a/client/src/routes/acp.tsx +++ b/client/src/routes/acp.tsx @@ -34,7 +34,7 @@ function Item({ item }) { return (
- +

{item.listing.data.release.description}

{item.user.email}
@@ -53,7 +53,7 @@ function SellerGroup(group) { return (
-
+

{group.username} - {group.seller}

{ready} / {group.offers.length} offers

Ships: {group.mentionsAustralia && 'AU'} {group.mentionsWorldwide && 'WORLD'}

diff --git a/client/src/routes/login.tsx b/client/src/routes/login.tsx index 87742f7..9fa9871 100644 --- a/client/src/routes/login.tsx +++ b/client/src/routes/login.tsx @@ -93,7 +93,7 @@ const Login = ({ mode }) => {
- +
diff --git a/client/src/routes/search.tsx b/client/src/routes/search.tsx index 46ec12a..9d0ce0a 100644 --- a/client/src/routes/search.tsx +++ b/client/src/routes/search.tsx @@ -27,7 +27,7 @@ function Result(r, wants) {
-

{r.title}

+

{r.title}

{r.year}
{r.country}
{r.format.join(' ')}
@@ -89,7 +89,7 @@ const User = () => { : null; const infoEl = infoText - ?
{infoText}
+ ?
{infoText}
: null; return ( diff --git a/client/src/store.tsx b/client/src/store.tsx index b2cb56e..149c17c 100644 --- a/client/src/store.tsx +++ b/client/src/store.tsx @@ -2,58 +2,58 @@ import { createStore, combineReducers } from 'redux' import { configureStore, createSlice } from '@reduxjs/toolkit' export const userState = createSlice({ - name: 'user', - initialState: null, - reducers: { - set: (state, action) => action.payload - }, + name: 'user', + initialState: null, + reducers: { + set: (state, action) => action.payload + }, }); export const offersState = createSlice({ - name: 'offers', - initialState: null, - reducers: { - set: (state, action) => action.payload - }, + name: 'offers', + initialState: null, + reducers: { + set: (state, action) => action.payload + }, }); export const acpOffersState = createSlice({ - name: 'acpOffers', - initialState: [], - reducers: { - set: (state, action) => action.payload - }, + name: 'acpOffers', + initialState: [], + reducers: { + set: (state, action) => action.payload + }, }); export const wantsState = createSlice({ - name: 'wants', - initialState: null, - reducers: { - set: (state, action) => action.payload - }, + name: 'wants', + initialState: null, + reducers: { + set: (state, action) => action.payload + }, }); export const wsState = createSlice({ - name: 'ws', - initialState: null, - reducers: { - set: (state, action) => action.payload - }, + name: 'ws', + initialState: null, + reducers: { + set: (state, action) => action.payload + }, }); const reducer = combineReducers({ - offers: offersState.reducer, - wants: wantsState.reducer, - ws: wsState.reducer, - user: userState.reducer, + offers: offersState.reducer, + wants: wantsState.reducer, + ws: wsState.reducer, + user: userState.reducer, - acpOffers: acpOffersState.reducer, + acpOffers: acpOffersState.reducer, }); const store = createStore( - reducer, - // @ts-ignore -- devtools window exists on dev - window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() + reducer, + // @ts-ignore -- devtools window exists on dev + window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ); export default store;