Add eslint and prettier

This commit is contained in:
Lukáš Kucharczyk 2023-01-25 13:31:05 +01:00
parent f6edc8688a
commit c64c68791f
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
4 changed files with 35 additions and 2 deletions

17
frontend/.eslintrc.cjs Normal file
View File

@ -0,0 +1,17 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: ["eslint/recommended", "plugin:react/recommended", "plugin:prettier/recommended"],
overrides: [],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
},
plugins: ["react"],
rules: {},
parserOptions: {
ecmaFeatures: { jsx: true }
}
};

9
frontend/.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"semi": true,
"tabWidth": 2,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "none",
"bracketSameLine": false,
"singleAttributePerLine": true
}

View File

@ -23,6 +23,10 @@
"@types/react-dom": "^18.0.9", "@types/react-dom": "^18.0.9",
"@vitejs/plugin-react": "^3.0.0", "@vitejs/plugin-react": "^3.0.0",
"eslint": "^8.32.0", "eslint": "^8.32.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.1",
"eslint-plugin-react-hooks": "^4.6.0",
"vite": "^4.0.0" "vite": "^4.0.0"
} }
} }

View File

@ -2,7 +2,10 @@ function Nav() {
return ( return (
<nav className="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded"> <nav className="mb-4 bg-white dark:bg-gray-900 border-gray-200 rounded">
<div className="container flex flex-wrap items-center justify-between mx-auto"> <div className="container flex flex-wrap items-center justify-between mx-auto">
<a href="{% url 'index' %}" className="flex items-center"> <a
href="{% url 'index' %}"
className="flex items-center"
>
<span className="text-4xl"></span> <span className="text-4xl"></span>
<span className="self-center text-xl font-semibold whitespace-nowrap text-white"> <span className="self-center text-xl font-semibold whitespace-nowrap text-white">
Timetracker Timetracker
@ -63,4 +66,4 @@ function Nav() {
); );
} }
export default Nav export default Nav;