chore: add eslint config

This commit is contained in:
fanxingqiang 2021-07-05 17:39:00 +08:00 committed by 踏学吾痕
parent 0adc256d53
commit e1200f2dbe
10 changed files with 1873 additions and 3158 deletions

14
.editorconfig Normal file
View File

@ -0,0 +1,14 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

3
.eslintignore Normal file
View File

@ -0,0 +1,3 @@
public
dist
*.d.ts

16
.eslintrc.js Normal file
View File

@ -0,0 +1,16 @@
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended',
'@vue/prettier',
'@vue/prettier/@typescript-eslint'
],
parserOptions: {
ecmaVersion: 2020
}
};

17
.gitignore vendored
View File

@ -1,3 +1,18 @@
node_modules
dist
.DS_Store
dist
dist-ssr
*.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
tests/**/coverage/
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln

7
.prettierrc.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
bracketSpacing: true,
jsxBracketSameLine: true,
singleQuote: true,
arrowParens: 'avoid',
trailingComma: 'all'
};

View File

@ -1,4 +1,4 @@
import dotenv from 'dotenv';
import * as dotenv from 'dotenv';
export interface ViteEnv {
VITE_PORT: number;
@ -35,4 +35,4 @@ export function loadEnv(): ViteEnv {
process.env[envName] = realName;
}
return ret;
}
}

View File

@ -19,7 +19,7 @@
<style>
* {
margin: 0;
pad: 0;
padding: 0;
box-sizing: border-box;
}
@ -72,7 +72,7 @@
50.1%,
100% {
background: #0f0;
box-sizing: 0 0 5px #0f0,
box-shadow: 0 0 5px #0f0,
0 0 15px #0f0,
0 0 30px #0f0,
0 0 60px #0f0,
@ -136,4 +136,4 @@
<script type="module" src="/src/main.ts"></script>
</body>
</html>
</html>

4936
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,11 +7,13 @@
"serve": "cross-env --max_old_space_size=4096 vite",
"build": "cross-env vite build",
"preview": "vite preview",
"preview:build": "npm run build && vite preview"
"preview:build": "npm run build && vite preview",
"lint": "eslint --ext .js,.jsx,.vue,.ts,.tsx src"
},
"husky": {
"hooks": {
"commit-msg": "node scripts/verify-commit.js"
"commit-msg": "node scripts/verify-commit.js",
"pre-commit": "lint-staged"
}
},
"dependencies": {
@ -53,21 +55,37 @@
"@types/mockjs": "^1.0.3",
"@types/node": "^14.14.14",
"@types/nprogress": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"@vitejs/plugin-vue": "^1.2.4",
"@vitejs/plugin-vue-jsx": "^1.1.6",
"@vue/compiler-sfc": "^3.1.2",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^7.0.0",
"autoprefixer": "^10.2.4",
"babel-plugin-transform-remove-console": "^6.9.4",
"chalk": "^2.4.2",
"cross-env": "^7.0.3",
"eslint": "^7.30.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-vue": "^7.12.1",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"postcss": "^8.2.6",
"postcss-import": "^14.0.0",
"prettier": "^2.3.2",
"sass": "^1.32.8",
"sass-loader": "^11.0.1",
"typescript": "^4.2.4",
"vite": "^2.3.8",
"vite-plugin-mock": "^2.8.0",
"vite-plugin-style-import": "^1.0.1"
"vite-plugin-style-import": "^1.0.1",
"vue-eslint-parser": "^7.7.2"
},
"lint-staged": {
"*.{js,jsx,vue,ts,tsx}": [
"npm run lint",
"git add"
]
}
}

View File

@ -1,4 +1,4 @@
import { App } from "vue";
import {App, Component} from "vue";
import {
ElAffix,
ElSkeleton,
@ -74,7 +74,7 @@ import zhLocale from "element-plus/lib/locale/lang/zh-cn";
ElementLocale.use(zhLocale);
export function useElementPlus(app: App) {
components.forEach((component) => {
components.forEach((component: Component) => {
app.component(component.name, component);
});
plugins.forEach((plugin) => {