Skip to content

Commit d0dd8a2

Browse files
committed
fixing linting for learneth
1 parent 46fed54 commit d0dd8a2

File tree

6 files changed

+46
-46
lines changed

6 files changed

+46
-46
lines changed

apps/learneth/src/redux/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {useDispatch, type TypedUseSelectorHook, useSelector} from 'react-redux'
2-
import {type AppDispatch, type RootState} from './store'
1+
import { useDispatch, type TypedUseSelectorHook, useSelector } from 'react-redux'
2+
import { type AppDispatch, type RootState } from './store'
33

44
export const useAppDispatch: () => AppDispatch = useDispatch
55
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector

apps/learneth/src/redux/models/loading.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {type ModelType} from '../store'
1+
import { type ModelType } from '../store'
22

33
const Model: ModelType = {
44
namespace: 'loading',
5-
state: {screen: true},
5+
state: { screen: true },
66
reducers: {
7-
save(state, {payload}) {
8-
return {...state, ...payload}
7+
save(state, { payload }) {
8+
return { ...state, ...payload }
99
},
1010
},
1111
effects: {},

apps/learneth/src/redux/models/remixide.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {toast} from 'react-toastify'
2-
import {type ModelType} from '../store'
1+
import { toast } from 'react-toastify'
2+
import { type ModelType } from '../store'
33
import remixClient from '../../remix-client'
4-
import {router} from '../../App'
4+
import { router } from '../../App'
55

66
function getFilePath(file: string): string {
77
const name = file.split('/')
@@ -17,12 +17,12 @@ const Model: ModelType = {
1717
// theme: '',
1818
},
1919
reducers: {
20-
save(state, {payload}) {
21-
return {...state, ...payload}
20+
save(state, { payload }) {
21+
return { ...state, ...payload }
2222
},
2323
},
2424
effects: {
25-
*connect(_, {put}) {
25+
*connect(_, { put }) {
2626
toast.info('connecting to the REMIX IDE')
2727

2828
yield put({
@@ -45,7 +45,7 @@ const Model: ModelType = {
4545

4646
yield router.navigate('/home')
4747
},
48-
*displayFile({payload: step}, {select, put}) {
48+
*displayFile({ payload: step }, { select, put }) {
4949
let content = ''
5050
let path = ''
5151
if (step.solidity?.file) {
@@ -73,7 +73,7 @@ const Model: ModelType = {
7373
},
7474
})
7575

76-
const {detail, selectedId} = yield select((state) => state.workshop)
76+
const { detail, selectedId } = yield select((state) => state.workshop)
7777

7878
const workshop = detail[selectedId]
7979
console.log('loading ', step, workshop)
@@ -87,15 +87,15 @@ const Model: ModelType = {
8787
yield remixClient.call('fileManager', 'switchFile', `${path}`)
8888
yield put({
8989
type: 'remixide/save',
90-
payload: {errorLoadingFile: false},
90+
payload: { errorLoadingFile: false },
9191
})
9292
toast.dismiss()
9393
} catch (error) {
9494
toast.dismiss()
9595
toast.error('File could not be loaded. Please try again.')
9696
yield put({
9797
type: 'remixide/save',
98-
payload: {errorLoadingFile: true},
98+
payload: { errorLoadingFile: true },
9999
})
100100
}
101101
yield put({
@@ -105,7 +105,7 @@ const Model: ModelType = {
105105
},
106106
})
107107
},
108-
*testStep({payload: step}, {select, put}) {
108+
*testStep({ payload: step }, { select, put }) {
109109
yield put({
110110
type: 'loading/save',
111111
payload: {
@@ -116,9 +116,9 @@ const Model: ModelType = {
116116
try {
117117
yield put({
118118
type: 'remixide/save',
119-
payload: {success: false},
119+
payload: { success: false },
120120
})
121-
const {detail, selectedId} = yield select((state) => state.workshop)
121+
const { detail, selectedId } = yield select((state) => state.workshop)
122122

123123
const workshop = detail[selectedId]
124124

@@ -141,15 +141,15 @@ const Model: ModelType = {
141141
if (!result) {
142142
yield put({
143143
type: 'remixide/save',
144-
payload: {errors: ['Compiler failed to test this file']},
144+
payload: { errors: ['Compiler failed to test this file']},
145145
})
146146
} else {
147147
const success = result.totalFailing === 0
148148

149149
if (success) {
150150
yield put({
151151
type: 'remixide/save',
152-
payload: {errors: [], success: true},
152+
payload: { errors: [], success: true },
153153
})
154154
} else {
155155
yield put({
@@ -164,7 +164,7 @@ const Model: ModelType = {
164164
console.log('TESTING ERROR', err)
165165
yield put({
166166
type: 'remixide/save',
167-
payload: {errors: [String(err)]},
167+
payload: { errors: [String(err)]},
168168
})
169169
}
170170
yield put({
@@ -174,7 +174,7 @@ const Model: ModelType = {
174174
},
175175
})
176176
},
177-
*showAnswer({payload: step}, {select, put}) {
177+
*showAnswer({ payload: step }, { select, put }) {
178178
yield put({
179179
type: 'loading/save',
180180
payload: {
@@ -189,7 +189,7 @@ const Model: ModelType = {
189189
const content = step.answer.content
190190
let path = getFilePath(step.answer.file)
191191

192-
const {detail, selectedId} = yield select((state) => state.workshop)
192+
const { detail, selectedId } = yield select((state) => state.workshop)
193193

194194
const workshop = detail[selectedId]
195195
path = `.learneth/${workshop.name}/${step.name}/${path}`
@@ -198,7 +198,7 @@ const Model: ModelType = {
198198
} catch (err) {
199199
yield put({
200200
type: 'remixide/save',
201-
payload: {errors: [String(err)]},
201+
payload: { errors: [String(err)]},
202202
})
203203
}
204204

@@ -210,7 +210,7 @@ const Model: ModelType = {
210210
},
211211
})
212212
},
213-
*testSolidityCompiler(_, {put, select}) {
213+
*testSolidityCompiler(_, { put, select }) {
214214
try {
215215
yield remixClient.call('solidity', 'getCompilationResult')
216216
} catch (err) {

apps/learneth/src/redux/models/workshop.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import axios from 'axios'
2-
import {toast} from 'react-toastify'
2+
import { toast } from 'react-toastify'
33
import groupBy from 'lodash/groupBy'
44
import pick from 'lodash/pick'
5-
import {type ModelType} from '../store'
5+
import { type ModelType } from '../store'
66
import remixClient from '../../remix-client'
7-
import {router} from '../../App'
7+
import { router } from '../../App'
88

99
// const apiUrl = 'http://localhost:3001';
1010
const apiUrl = 'https://static.220.14.12.49.clients.your-server.de:3000'
@@ -17,12 +17,12 @@ const Model: ModelType = {
1717
selectedId: '',
1818
},
1919
reducers: {
20-
save(state, {payload}) {
21-
return {...state, ...payload}
20+
save(state, { payload }) {
21+
return { ...state, ...payload }
2222
},
2323
},
2424
effects: {
25-
*init(_, {put}) {
25+
*init(_, { put }) {
2626
const cache = localStorage.getItem('workshop.state')
2727

2828
if (cache) {
@@ -41,7 +41,7 @@ const Model: ModelType = {
4141
})
4242
}
4343
},
44-
*loadRepo({payload}, {put, select}) {
44+
*loadRepo({ payload }, { put, select }) {
4545
toast.info(`loading ${payload.name}/${payload.branch}`)
4646

4747
yield put({
@@ -51,18 +51,18 @@ const Model: ModelType = {
5151
},
5252
})
5353

54-
const {list, detail} = yield select((state) => state.workshop)
54+
const { list, detail } = yield select((state) => state.workshop)
5555

5656
const url = `${apiUrl}/clone/${encodeURIComponent(payload.name)}/${payload.branch}?${Math.random()}`
5757
console.log('loading ', url)
58-
const {data} = yield axios.get(url)
58+
const { data } = yield axios.get(url)
5959
const repoId = `${payload.name}-${payload.branch}`
6060

6161
for (let i = 0; i < data.ids.length; i++) {
6262
const {
6363
steps,
6464
metadata: {
65-
data: {steps: metadataSteps},
65+
data: { steps: metadataSteps },
6666
},
6767
} = data.entities[data.ids[i]]
6868

@@ -130,8 +130,8 @@ const Model: ModelType = {
130130
})
131131

132132
if (payload.id) {
133-
const {detail, selectedId} = workshopState
134-
const {ids, entities} = detail[selectedId]
133+
const { detail, selectedId } = workshopState
134+
const { ids, entities } = detail[selectedId]
135135
for (let i = 0; i < ids.length; i++) {
136136
const entity = entities[ids[i]]
137137
if (entity.metadata.data.id === payload.id || i + 1 === payload.id) {
@@ -141,7 +141,7 @@ const Model: ModelType = {
141141
}
142142
}
143143
},
144-
*resetAll(_, {put}) {
144+
*resetAll(_, { put }) {
145145
yield put({
146146
type: 'workshop/save',
147147
payload: {

apps/learneth/src/redux/store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {configureStore, createSlice, type PayloadAction, type Reducer} from '@reduxjs/toolkit'
1+
import { configureStore, createSlice, type PayloadAction, type Reducer } from '@reduxjs/toolkit'
22
import createSagaMiddleware from 'redux-saga'
3-
import {call, put, takeEvery, delay, select, all, fork, type ForkEffect} from 'redux-saga/effects'
3+
import { call, put, takeEvery, delay, select, all, fork, type ForkEffect } from 'redux-saga/effects'
44

55
// @ts-expect-error
66
const context = require.context('./models', false, /\.ts$/)
@@ -39,7 +39,7 @@ function createReducer(model: ModelType): Reducer {
3939
}
4040

4141
const rootReducer = models.reduce((prev: any, model: ModelType) => {
42-
return {...prev, [model.namespace]: createReducer(model)}
42+
return { ...prev, [model.namespace]: createReducer(model) }
4343
}, {})
4444

4545
function watchEffects(model: ModelType): ForkEffect {

apps/learneth/src/remix-client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {PluginClient} from '@remixproject/plugin'
2-
import {createClient} from '@remixproject/plugin-webview'
3-
import {store} from './redux/store'
4-
import {router} from './App'
1+
import { PluginClient } from '@remixproject/plugin'
2+
import { createClient } from '@remixproject/plugin-webview'
3+
import { store } from './redux/store'
4+
import { router } from './App'
55

66
class RemixClient extends PluginClient {
77
constructor() {

0 commit comments

Comments
 (0)