feat: add eslint for code verification

This commit is contained in:
syy11cn 2021-10-29 15:06:11 +08:00
parent 017fc69661
commit 91a7c85e2f
4 changed files with 1912 additions and 2 deletions

5
.eslintignore Normal file
View File

@ -0,0 +1,5 @@
.DS_Store
node_modules
dist
build
public

18
.eslintrc Normal file
View File

@ -0,0 +1,18 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "react-hooks"],
"extends": [
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
}
}

View File

@ -4,14 +4,23 @@
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
"serve": "vite preview",
"lint-staged:js": "eslint --ext .js,.jsx,.ts,.tsx",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx ./src",
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx"
},
"dependencies": {
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.2.0",
"@typescript-eslint/parser": "^5.2.0",
"@vitejs/plugin-react": "^1.0.0",
"eslint": "^8.1.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"esprima": "^4.0.1",
"vite": "^2.6.4"
}
}
}

1878
yarn.lock Normal file

File diff suppressed because it is too large Load Diff