diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000000000000000000000000000000000..4e18c097c8f5cbd567ff1e09784712b456c24f9f --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,35 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + node: true + }, + extends: [ + 'plugin:vue/essential', + 'standard' + ], + globals: { + uni: 'readonly', + dd: 'readonly', + plus: 'readonly', + wx: 'readonly' + }, + parserOptions: { + ecmaVersion: 'latest', + parser: '@typescript-eslint/parser', + sourceType: 'module' + }, + plugins: [ + 'vue', + '@typescript-eslint' + ], + rules: { + camelcase: 'off', + semi: 'error', + 'import/first': 'off', + 'no-console': 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'vue/multi-word-component-names': 'off' + } +} diff --git a/README.md b/README.md index 08bbce755c35f7ccd1524f536dda2b18529ffdfb..7ec3bb0da0f17cad9fa285586b680a6d0f3ba842 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,23 @@ # uni-app-template ## Project setup -``` + +``` shell yarn install ``` ### Compiles and hot-reloads for development -``` + +``` shell yarn serve ``` ### Compiles and minifies for production -``` + +``` shell yarn build ``` ### Customize configuration + See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/babel.config.js b/babel.config.js index 6d0b7ce60753120b9ac329c161faa7220b155839..c35c8e2c8e6a291df7deab9d2f52ed9dbcd61863 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,10 +1,10 @@ -const plugins = [] +const plugins = [] if (process.env.UNI_OPT_TREESHAKINGNG) { plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js')) -} +} -if ( +if ( ( process.env.UNI_PLATFORM === 'app-plus' && process.env.UNI_USING_V8 @@ -12,7 +12,7 @@ if ( ( process.env.UNI_PLATFORM === 'h5' && process.env.UNI_H5_BROWSER === 'builtin' - ) + ) ) { const path = require('path') @@ -42,8 +42,8 @@ process.UNI_LIBRARIES.forEach(libraryName => { plugins.push([ 'import', { - 'libraryName': libraryName, - 'customName': (name) => { + libraryName, + customName: (name) => { return `${libraryName}/lib/${name}/${name}` } } @@ -60,4 +60,4 @@ module.exports = { ] ], plugins -} +} diff --git a/package.json b/package.json index f43fdf10652f614e073a0fca2c8f4a2b9283bfb1..5acb25e9bdc4510f7b7069ba369746fffde85a93 100644 --- a/package.json +++ b/package.json @@ -95,11 +95,19 @@ "@dcloudio/webpack-uni-mp-loader": "^2.0.1-34920220609002", "@dcloudio/webpack-uni-pages-loader": "^2.0.1-34920220609002", "@types/node": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^5.30.0", + "@typescript-eslint/parser": "^5.30.0", "@vue/cli-plugin-babel": "~4.5.13", "@vue/cli-plugin-typescript": "~4.5.11", "@vue/cli-service": "~4.5.13", "babel-plugin-import": "^1.11.0", "cross-env": "^7.0.2", + "eslint": "^8.0.1", + "eslint-config-standard": "^17.0.0", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0", + "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-vue": "^9.1.1", "jest": "^25.4.0", "mini-types": "*", "miniprogram-api-typings": "*", diff --git a/public/index.html b/public/index.html index a528055daefb6979c7fa525335051cbb6e0994b7..e182836487288089a52c6e823398d0b00ea0991d 100644 --- a/public/index.html +++ b/public/index.html @@ -1,12 +1,12 @@ -