mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
Move things, fix eslint import error
This commit is contained in:
@@ -7,6 +7,7 @@ module.exports = {
|
|||||||
'plugin:react-hooks/recommended',
|
'plugin:react-hooks/recommended',
|
||||||
"plugin:prettier/recommended",
|
"plugin:prettier/recommended",
|
||||||
"plugin:import/recommended",
|
"plugin:import/recommended",
|
||||||
|
"plugin:import/typescript",
|
||||||
],
|
],
|
||||||
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
@@ -16,5 +17,8 @@ module.exports = {
|
|||||||
'warn',
|
'warn',
|
||||||
{ allowConstantExport: true },
|
{ allowConstantExport: true },
|
||||||
],
|
],
|
||||||
|
'prettier/prettier': "error",
|
||||||
|
'no-console': "error",
|
||||||
|
"no-async-promise-executor": "off",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"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": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
import express from 'express'
|
import express from 'express'
|
||||||
import cors from 'cors'
|
import cors from 'cors'
|
||||||
|
import logger from './utils/logger'
|
||||||
|
|
||||||
const app = express()
|
const app = express()
|
||||||
|
|
||||||
app.use(express.json())
|
app.use(express.json())
|
||||||
app.use(cors())
|
app.use(cors())
|
||||||
|
|
||||||
const PORT = 4000
|
const PORT = 4000
|
||||||
|
|
||||||
app.get('/ping', (_req, res) => {
|
app.get('/ping', (_req, res) => {
|
||||||
console.log("someone pinged")
|
logger.info('someone pinged')
|
||||||
res.send({ message: 'pong' })
|
res.send({ message: 'pong' })
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, () => {
|
||||||
console.log(`Server running on port ${PORT}`)
|
logger.info(`Server running on port ${PORT}`)
|
||||||
})
|
})
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
const info = (msg: string) => {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(msg)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { info }
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES6",
|
"target": "ES2022",
|
||||||
"outDir": "./build/",
|
"outDir": "./build/",
|
||||||
"module": "commonjs",
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "node",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import { useState } from "react"
|
/* eslint-disable no-console */
|
||||||
|
import { useState } from 'react'
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const [text, setText] = useState('___')
|
const [text, setText] = useState('___')
|
||||||
|
|
||||||
const onClick = () => {
|
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 (
|
return (
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ import App from './App.tsx'
|
|||||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||||
<React.StrictMode>
|
<React.StrictMode>
|
||||||
<App />
|
<App />
|
||||||
</React.StrictMode>,
|
</React.StrictMode>
|
||||||
)
|
)
|
||||||
|
|||||||
Generated
+2913
-1
File diff suppressed because it is too large
Load Diff
+10
-1
@@ -10,6 +10,15 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user