Skip to content

Commit

Permalink
feat: 增加云开发目录, 增加 eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
arleyGuoLei committed Oct 18, 2021
1 parent a13827c commit 25bd48f
Show file tree
Hide file tree
Showing 22 changed files with 1,588 additions and 201 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
typings/
25 changes: 8 additions & 17 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
// https://www.npmjs.com/package/eslint-config-standard-with-typescript

module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
extends: 'standard-with-typescript',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
project: './tsconfig.json'
},
globals: {
wx: true,
Expand All @@ -25,7 +14,9 @@ module.exports = {
Component: true,
requirePlugin: true,
requireMiniProgram: true,
__wxConfig: true
},
// extends: 'eslint:recommended',
rules: {},
rules: {
'@typescript-eslint/triple-slash-reference': 0
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"eslint.validate": ["javascript"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
3 changes: 1 addition & 2 deletions miniprogram/app.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"pages": [
"pages/index/index",
"pages/logs/logs"
"pages/home/home"
],
"window": {
"backgroundTextStyle": "light",
Expand Down
10 changes: 0 additions & 10 deletions miniprogram/app.less
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
19 changes: 3 additions & 16 deletions miniprogram/app.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
// app.ts
App<IAppOption>({
globalData: {},
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)

// 登录
wx.login({
success: res => {
console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
},
})
},
})
onLaunch () {
}
})
File renamed without changes.
1 change: 1 addition & 0 deletions miniprogram/pages/home/home.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* pages/home/home.wxss */
66 changes: 66 additions & 0 deletions miniprogram/pages/home/home.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// pages/home/home.ts
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad () {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh () {
console.log(2)
},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage () {

}
})
2 changes: 2 additions & 0 deletions miniprogram/pages/home/home.wxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!--pages/home/home.wxml-->
<text>pages/home/home.wxml</text>
19 changes: 0 additions & 19 deletions miniprogram/pages/index/index.less

This file was deleted.

49 changes: 0 additions & 49 deletions miniprogram/pages/index/index.ts

This file was deleted.

23 changes: 0 additions & 23 deletions miniprogram/pages/index/index.wxml

This file was deleted.

4 changes: 0 additions & 4 deletions miniprogram/pages/logs/logs.json

This file was deleted.

8 changes: 0 additions & 8 deletions miniprogram/pages/logs/logs.less

This file was deleted.

19 changes: 0 additions & 19 deletions miniprogram/pages/logs/logs.ts

This file was deleted.

6 changes: 0 additions & 6 deletions miniprogram/pages/logs/logs.wxml

This file was deleted.

19 changes: 0 additions & 19 deletions miniprogram/utils/util.ts
Original file line number Diff line number Diff line change
@@ -1,19 +0,0 @@
export const formatTime = (date: Date) => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()

return (
[year, month, day].map(formatNumber).join('/') +
' ' +
[hour, minute, second].map(formatNumber).join(':')
)
}

const formatNumber = (n: number) => {
const s = n.toString()
return s[1] ? s : '0' + s
}
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"name": "miniprogram-ts-less-quickstart",
"name": "wechat-words-pk-typescript",
"version": "1.0.0",
"description": "",
"scripts": {
},
"description": "单词天天斗,是一款支持英语单词对战学习(好友对战、随机匹配、人机对战)、挑战模式学习(单词选意)、含生词本等业务闭环、体验极致的小程序",
"scripts": {},
"keywords": [],
"author": "",
"license": "",
"dependencies": {
},
"author": "arley",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"miniprogram-api-typings": "^2.8.3-1"
"@typescript-eslint/eslint-plugin": "^4.0.1",
"eslint": "^7.12.1",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.0.0",
"miniprogram-api-typings": "^2.8.3-1",
"typescript": "^4"
}
}
1 change: 1 addition & 0 deletions project.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"ignore": []
},
"miniprogramRoot": "miniprogram/",
"cloudfunctionRoot": "cloudfunctions/",
"compileType": "miniprogram",
"libVersion": "2.15.0",
"projectname": "wechat-words-pk-typescript",
Expand Down
Loading

0 comments on commit 25bd48f

Please sign in to comment.