Skip to content
Snippets Groups Projects
Commit 00cde8c8 authored by Carl Schönfelder's avatar Carl Schönfelder
Browse files

Issue/4 add format on save

parent 9218c8f2
No related branches found
No related tags found
1 merge request!2Issue/4 add format on save
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"pranaygp.vscode-css-peek", "pranaygp.vscode-css-peek",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"ms-vsliveshare.vsliveshare", "ms-vsliveshare.vsliveshare",
"cssho.vscode-svgviewer" "cssho.vscode-svgviewer",
"esbenp.prettier-vscode"
] ]
} }
\ No newline at end of file
{ {
//editor
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.formatOnPaste": false, "editor.formatOnPaste": false,
"editor.tabCompletion": "on", "editor.tabCompletion": "on",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
},
//python
"python.venvPath": "${workspaceFolder}\\server", "python.venvPath": "${workspaceFolder}\\server",
"python.analysis.extraPaths": ["server"], "python.analysis.extraPaths": ["server"],
"python.terminal.activateEnvironment": true, "python.terminal.activateEnvironment": true,
...@@ -11,5 +17,18 @@ ...@@ -11,5 +17,18 @@
"--line-length", "--line-length",
"119" "119"
], ],
"git.ignoreLimitWarning": true //eslint
"eslint.workingDirectories": ["./client"],
"eslint.options": {
"configFile":"./.eslintrc"
},
//git
"git.ignoreLimitWarning": true,
//language specific
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
} }
\ No newline at end of file
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"project": ["tsconfig.json"],
"ecmaVersion": 2021,
"sourceType": "module"
},
"settings": {
"react": {
"version": "detect"
}
},
"extends": [
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"rules": {
"semi":"off",
"react/jsx-one-expression-per-line": "off"
}
}
{
"semi": false,
"trailingComma": "none",
"singleQuote": true,
"printWidth": 80
}
\ No newline at end of file
This diff is collapsed.
...@@ -17,17 +17,27 @@ ...@@ -17,17 +17,27 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"web-vitals": "^1.1.0" "web-vitals": "^1.1.0"
}, },
"devDependencies": {
"@typescript-eslint/eslint-plugin": "4.2.0",
"@typescript-eslint/parser": "4.2.0",
"eslint": "7.19.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^7.2.0",
"eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-json": "^2.1.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"prettier": "^2.2.1"
},
"scripts": { "scripts": {
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject",
}, "lint": "eslint \"./src/**/*.{js,ts,tsx}\""
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
......
import React from 'react'; import React from 'react'
import { render, screen } from '@testing-library/react'; import { render, screen } from '@testing-library/react'
import App from './App'; import App from './App'
test('renders learn react link', () => { test('renders learn react link', () => {
render(<App />); render(<App />)
const linkElement = screen.getByText(/learn react/i); const linkElement = screen.getByText(/learn react/i)
expect(linkElement).toBeInTheDocument(); expect(linkElement).toBeInTheDocument()
}); })
import React from 'react'; import axios from 'axios'
import logo from './logo.svg'; import React, { useEffect, useState } from 'react'
import './App.css'; import './App.css'
import { useState, useEffect } from "react"; import logo from './logo.svg'
import axios from "axios";
interface Message { interface Message {
message: string; message: string
} }
function App() { const App: React.FC = () => {
const [currentMessage, setCurrentMessage] = useState<Message>(); const [currentMessage, setCurrentMessage] = useState<Message>()
useEffect(() => { useEffect(() => {
axios.get<Message>("users/test").then(response=> { axios.get<Message>('users/test').then((response) => {
setCurrentMessage(response.data); setCurrentMessage(response.data)
}); })
}, []); }, [])
return ( return (
<div className="App"> <div className="App">
...@@ -34,7 +33,7 @@ function App() { ...@@ -34,7 +33,7 @@ function App() {
<p>Current message is {currentMessage?.message}</p> <p>Current message is {currentMessage?.message}</p>
</header> </header>
</div> </div>
); )
} }
export default App; export default App
import React from 'react'; import React from 'react'
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom'
import './index.css'; import App from './App'
import App from './App'; import './index.css'
import reportWebVitals from './reportWebVitals'; import reportWebVitals from './reportWebVitals'
ReactDOM.render( ReactDOM.render(
<React.StrictMode> <React.StrictMode>
<App /> <App />
</React.StrictMode>, </React.StrictMode>,
document.getElementById('root') document.getElementById('root')
); )
// If you want to start measuring performance in your app, pass a function // If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log)) // to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals(); reportWebVitals()
import { ReportHandler } from 'web-vitals'; import { ReportHandler } from 'web-vitals'
const reportWebVitals = (onPerfEntry?: ReportHandler) => { const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) { if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry); getCLS(onPerfEntry)
getFID(onPerfEntry); getFID(onPerfEntry)
getFCP(onPerfEntry); getFCP(onPerfEntry)
getLCP(onPerfEntry); getLCP(onPerfEntry)
getTTFB(onPerfEntry); getTTFB(onPerfEntry)
}); })
} }
}; }
export default reportWebVitals; export default reportWebVitals
...@@ -2,4 +2,4 @@ ...@@ -2,4 +2,4 @@
// allows you to do things like: // allows you to do things like:
// expect(element).toHaveTextContent(/react/i) // expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom // learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom'; import '@testing-library/jest-dom'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment