Move things, fix eslint import error

This commit is contained in:
ShootingStar91
2024-02-28 12:06:31 +02:00
parent e1f8cb0c04
commit 6583c99b8a
9 changed files with 2949 additions and 10 deletions
+4
View File
@@ -7,6 +7,7 @@ module.exports = {
'plugin:react-hooks/recommended',
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
@@ -16,5 +17,8 @@ module.exports = {
'warn',
{ allowConstantExport: true },
],
'prettier/prettier': "error",
'no-console': "error",
"no-async-promise-executor": "off",
},
}
+1 -1
View File
@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "npx tsx watch --clear-screen=false index.ts"
"dev": "npx tsx watch --clear-screen=false src/index.ts"
},
"author": "",
"license": "ISC",
+6 -2
View File
@@ -1,15 +1,19 @@
import express from 'express'
import cors from 'cors'
import logger from './utils/logger'
const app = express()
app.use(express.json())
app.use(cors())
const PORT = 4000
app.get('/ping', (_req, res) => {
console.log("someone pinged")
logger.info('someone pinged')
res.send({ message: 'pong' })
})
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`)
logger.info(`Server running on port ${PORT}`)
})
+6
View File
@@ -0,0 +1,6 @@
const info = (msg: string) => {
// eslint-disable-next-line no-console
console.log(msg)
}
export default { info }
+3 -2
View File
@@ -1,8 +1,9 @@
{
"compilerOptions": {
"target": "ES6",
"target": "ES2022",
"outDir": "./build/",
"module": "commonjs",
"module": "ES2022",
"moduleResolution": "node",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
+5 -2
View File
@@ -1,10 +1,13 @@
import { useState } from "react"
/* eslint-disable no-console */
import { useState } from 'react'
const App = () => {
const [text, setText] = useState('___')
const onClick = () => {
fetch('http://localhost:4000/ping').then(response => response.json().then(result => setText(result.message))).catch(e => console.log("Error"))
fetch('http://localhost:4000/ping')
.then(response => response.json().then(result => setText(result.message)))
.catch(e => console.log('Error', e))
}
return (
+1 -1
View File
@@ -5,5 +5,5 @@ import App from './App.tsx'
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
</React.StrictMode>
)
+2913 -1
View File
File diff suppressed because it is too large Load Diff
+10 -1
View File
@@ -10,6 +10,15 @@
"author": "",
"license": "ISC",
"dependencies": {
"prettier": "^3.2.5"
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-prettier": "^5.1.3",
"prettier": "^3.2.5",
"typescript-eslint": "^7.0.2"
},
"devDependencies": {
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5"
}
}