mirror of
https://github.com/wechaty/getting-started.git
synced 2026-10-16 21:12:46 +08:00
add chatie eslint-config
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Editor configuration, see 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]
|
||||
max_line_length = 0
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
# 4 tab indentation
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
const rules = {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
extends: '@chatie',
|
||||
rules,
|
||||
}
|
||||
@@ -12,19 +12,19 @@ function onScan (qrcode) {
|
||||
encodeURIComponent(qrcode),
|
||||
].join('')
|
||||
|
||||
console.log(qrcodeImageUrl)
|
||||
console.info(qrcodeImageUrl)
|
||||
}
|
||||
|
||||
function onLogin (user) {
|
||||
console.log(`${user} login`)
|
||||
console.info(`${user} login`)
|
||||
}
|
||||
|
||||
function onLogout(user) {
|
||||
console.log(`${user} logout`)
|
||||
function onLogout (user) {
|
||||
console.info(`${user} logout`)
|
||||
}
|
||||
|
||||
async function onMessage (msg) {
|
||||
console.log(msg.toString())
|
||||
console.info(msg.toString())
|
||||
}
|
||||
|
||||
const bot = new Wechaty({ name: 'wechaty' })
|
||||
@@ -35,5 +35,5 @@ bot.on('logout', onLogout)
|
||||
bot.on('message', onMessage)
|
||||
|
||||
bot.start()
|
||||
.then(() => console.log('Starter Bot Started.'))
|
||||
.catch(e => console.error(e))
|
||||
.then(() => console.info('Starter Bot Started.'))
|
||||
.catch(e => console.error(e))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Wechaty - WeChat Bot SDK for Personal Account, Powered by TypeScript, Docker, and 💖
|
||||
* - https://github.com/chatie/wechaty
|
||||
*/
|
||||
import {
|
||||
import {
|
||||
Wechaty,
|
||||
Contact,
|
||||
Message,
|
||||
@@ -19,19 +19,19 @@ function onScan (qrcode: string, status: ScanStatus) {
|
||||
encodeURIComponent(qrcode),
|
||||
].join('')
|
||||
|
||||
console.log(`${ScanStatus[status]}(${status})`, qrcodeImageUrl)
|
||||
console.info(`${ScanStatus[status]}(${status})`, qrcodeImageUrl)
|
||||
}
|
||||
|
||||
function onLogin (user: Contact) {
|
||||
console.log(`${user} login`)
|
||||
console.info(`${user} login`)
|
||||
}
|
||||
|
||||
function onLogout(user: Contact) {
|
||||
console.log(`${user} logout`)
|
||||
function onLogout (user: Contact) {
|
||||
console.info(`${user} logout`)
|
||||
}
|
||||
|
||||
async function onMessage (msg: Message) {
|
||||
console.log(msg.toString())
|
||||
console.info(msg.toString())
|
||||
}
|
||||
|
||||
const bot = new Wechaty({ name: 'wechaty' })
|
||||
@@ -42,5 +42,5 @@ bot.on('logout', onLogout)
|
||||
bot.on('message', onMessage)
|
||||
|
||||
bot.start()
|
||||
.then(() => console.log('Starter Bot Started.'))
|
||||
.catch(e => console.error(e))
|
||||
.then(() => console.info('Starter Bot Started.'))
|
||||
.catch(e => console.error(e))
|
||||
|
||||
+2
-1
@@ -7,7 +7,7 @@
|
||||
"node": ">= 10"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "",
|
||||
"lint": "eslint 'examples/*.{js,ts}'",
|
||||
"postinstall": "check-node-version --node \">= 10\"",
|
||||
"start": "node examples/starter-bot.js",
|
||||
"start:ts": "ts-node examples/starter-bot.ts",
|
||||
@@ -29,6 +29,7 @@
|
||||
"wechaty": "^0.27.26"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chatie/eslint-config": "^0.6.17",
|
||||
"@chatie/git-scripts": "^0.2.5",
|
||||
"@chatie/tsconfig": "^0.6.1",
|
||||
"check-node-version": "^3.2.0"
|
||||
|
||||
Reference in New Issue
Block a user