Skip to content

Commit

Permalink
feat: add eslint + prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mz-dfhp committed Nov 4, 2022
1 parent 00a0ec0 commit 3af2039
Show file tree
Hide file tree
Showing 6 changed files with 1,527 additions and 70 deletions.
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true
},
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'plugin:react/jsx-runtime'
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: ['react', '@typescript-eslint', 'prettier'],
rules: {
'prettier/prettier': 'error',
'arrow-body-style': 'off',
'prefer-arrow-callback': 'off'
},
settings: {
react: {
version: 'detect'
}
}
}
9 changes: 9 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
singleQuote: true,
semi: false,
trailingComma: "none",
bracketSpacing: true
}
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview"
"preview": "vite preview",
"lint": "eslint ./src/**/*.{js,jsx,ts,tsx} --fix"
},
"dependencies": {
"react": "^18.2.0",
Expand All @@ -15,8 +16,16 @@
"devDependencies": {
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"@typescript-eslint/eslint-plugin": "^5.42.0",
"@typescript-eslint/parser": "^5.42.0",
"@vitejs/plugin-react": "^2.2.0",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.31.10",
"prettier": "^2.7.1",
"typescript": "^4.6.4",
"vite": "^3.2.0"
"vite": "^3.2.0",
"vite-plugin-eslint": "^1.8.1"
}
}
Loading

0 comments on commit 3af2039

Please sign in to comment.