Browse Source

add eslint

scorpio 2 years ago
parent
commit
d0ac119e71
6 changed files with 949 additions and 33 deletions
  1. 22 0
      .eslintrc.cjs
  2. 6 0
      package.json
  3. 0 1
      src/App.vue
  4. 8 9
      src/views/home/index.vue
  5. 12 12
      src/views/setting/index.vue
  6. 901 11
      yarn.lock

+ 22 - 0
.eslintrc.cjs

@@ -0,0 +1,22 @@
+module.exports = {
+  env: {
+    browser: true,
+    es2021: true
+  },
+  extends: [
+    'plugin:vue/vue3-essential',
+    'standard'
+  ],
+  parserOptions: {
+    ecmaVersion: 'latest',
+    sourceType: 'module'
+  },
+  plugins: [
+    'vue'
+  ],
+  rules: {
+    'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
+    "vue/multi-word-component-names":"off",
+  }
+}

+ 6 - 0
package.json

@@ -16,6 +16,12 @@
   "devDependencies": {
     "@vitejs/plugin-vue": "^3.0.0",
     "axios": "^0.27.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.2.0",
     "js-cookie": "^3.0.1",
     "sass": "^1.53.0",
     "sass-loader": "^13.0.2",

+ 0 - 1
src/App.vue

@@ -7,7 +7,6 @@
 <script setup>
 // This starter template is using Vue 3 <script setup> SFCs
 // Check out https://vuejs.org/api/sfc-script-setup.html#script-setup
-import HelloWorld from './components/HelloWorld.vue'
 </script>
 
 <style scoped>

+ 8 - 9
src/views/home/index.vue

@@ -5,19 +5,18 @@
 </template>
 
 <script>
-import HelloWorld from "../../components/HelloWorld.vue";
-import useCounterStore from "../../store/user.js";
-import tokenStore from "../../store/token.js";
-import {setToken} from "../../utils/auth.js";
+import HelloWorld from '../../components/HelloWorld.vue'
+import useCounterStore from '../../store/user.js'
+import tokenStore from '../../store/token.js'
+import { setToken } from '../../utils/auth.js'
 export default {
-  name: "index",
-  components: {HelloWorld},
-  setup(){
+  components: { HelloWorld },
+  setup () {
     const store = useCounterStore()
     const token = tokenStore()
-    return {store,token}
+    return { store, token }
   },
-  created() {
+  created () {
     console.log(this.store.info.name)
     console.log(this.token.value)
     setToken('asfddas129rq34-rda')

+ 12 - 12
src/views/setting/index.vue

@@ -7,35 +7,35 @@
 </template>
 
 <script>
-import useCounterStore from  '../../store/user.js'
+import useCounterStore from '../../store/user.js'
 
 export default {
-  name: "index",
-  setup() {
+  name: 'index',
+  setup () {
     const user = useCounterStore()
-    return {user}
+    return { user }
   },
-  data() {
+  data () {
     return {
-      list: [],
+      list: []
     }
   },
-  created() {
+  created () {
     this.init()
   },
   methods: {
-    init() {
+    init () {
       console.log(this.user.info)
-      this.user.info = {user:'123',name:'holle'}
+      this.user.info = { user: '123', name: 'holle' }
       this.user.$dispose()
       console.log(this.user.info.name)
-      this.$api.loginApi.sendSMS({code:1231}).then((res)=>{
-        if (res.code === 200){
+      this.$api.loginApi.sendSMS({ code: 1231 }).then((res) => {
+        if (res.code === 200) {
           this.list = res.data.records
         }
       })
     }
-  },
+  }
 }
 </script>
 

File diff suppressed because it is too large
+ 901 - 11
yarn.lock


Some files were not shown because too many files changed in this diff