Skip to content

Commit

Permalink
chore: upgrade depencencies, eslint auto fix
Browse files Browse the repository at this point in the history
  • Loading branch information
BuptStEve committed Sep 11, 2019
1 parent 21db34b commit 36addf5
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 14,798 deletions.
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
'/': { title: name, description },
},
head: [
['link', { rel: 'icon', href: `/logo.png` }],
['link', { rel: 'icon', href: '/logo.png' }],
],
evergreen: true,
serviceWorker: true,
Expand Down
14,758 changes: 0 additions & 14,758 deletions package-lock.json

This file was deleted.

42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,41 +67,41 @@
"koa-compose": "^4.1.0"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/core": "^7.6.0",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-decorators": "^7.4.4",
"@babel/plugin-proposal-decorators": "^7.6.0",
"@babel/plugin-proposal-object-rest-spread": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@babel/preset-env": "^7.6.0",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@types/jest": "^24.0.17",
"@types/jest": "^24.0.18",
"axios-mock-adapter": "^1.17.0",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.2",
"babel-jest": "^24.8.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"eslint": "^6.1.0",
"eslint-config-standard": "^13.0.1",
"cross-env": "^5.2.1",
"eslint": "^6.3.0",
"eslint-config-standard": "^14.1.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"gh-pages": "^2.1.0",
"husky": "^3.0.2",
"jest": "^24.8.0",
"lint-staged": "^9.2.1",
"rimraf": "^2.6.3",
"rollup": "^1.19.4",
"eslint-plugin-standard": "^4.0.1",
"gh-pages": "^2.1.1",
"husky": "^3.0.5",
"jest": "^24.9.0",
"lint-staged": "^9.2.5",
"rimraf": "^3.0.0",
"rollup": "^1.21.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-eslint": "^7.0.0",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-uglify": "^6.0.2",
"typescript": "^3.5.3",
"vuepress": "^1.0.3"
"rollup-plugin-uglify": "^6.0.3",
"typescript": "^3.6.3",
"vuepress": "^1.0.4"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import nodeResolve from 'rollup-plugin-node-resolve'

import pkg from './package.json'

const input = `src/index.js`
const input = 'src/index.js'
const banner = `/* ${pkg.name} version ${pkg.version} */`

const output = {
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getAxiosPromise = ({

logger.log(`Req Url: ${url}`)
if (data && (Object.keys(data).length || isFD)) {
logger.log(`Req Data:`, data)
logger.log('Req Data:', data)
}

transformRequest = isFD ? null : transformRequest
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/wx.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getWxPromise = ({
} else {
logger.log(`Req Url: ${url}`)
if (data && Object.keys(data).length) {
logger.log(`Req Data:`, data)
logger.log('Req Data:', data)
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const DEFAULT_HEADER = { 'Content-Type': 'application/x-www-form-urlencoded' }

// 错误信息
const ERROR_STRINGS = {
noData: `no data!`,
argsType: `the first parameter must be an object!`,
middleware: `middleware must be a function!`,
noData: 'no data!',
argsType: 'the first parameter must be an object!',
middleware: 'middleware must be a function!',

reqTypeFn: (reqType) => `invalid reqType: "${reqType}", ` +
`support these reqTypes: ["${VALID_REQ_TYPES.join('", "')}"].`,
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ class TuaApi {
}) {
if (type) {
logger.warn(
`[type] will be deprecated, please use [method] instead!\n` +
`[type] 属性将被废弃, 请用 [method] 替代!`
'[type] will be deprecated, please use [method] instead!\n' +
'[type] 属性将被废弃, 请用 [method] 替代!'
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const logByType = (type) => (...out) => {
if (env === 'test' || env === 'production') return

/* istanbul ignore next */
console[type](`[TUA-API]:`, ...out)
console[type]('[TUA-API]:', ...out)
}

export const logger = {
Expand Down
18 changes: 9 additions & 9 deletions test/__tests__/axios.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ const params = {
param2: 'young',
}

const reqAPUrl = `http://example-base.com/fake-post/array-params`
const reqOPUrl = `http://example-base.com/fake-post/object-params`
const reqGOPUrl = `http://example-base.com/fake-get/object-params`
const reqOHUrl = `http://example-test.com/fake-post/own-host`
const reqTAUrl = `http://example-base.com/fake-get/req-type-axios?asyncCp=asyncCp`
const reqEAPUrl = `http://example-base.com/fake-post/empty-array-params`
const reqMFDUrl = `http://example-base.com/fake-get/mock-function-data`
const reqAPUrl = 'http://example-base.com/fake-post/array-params'
const reqOPUrl = 'http://example-base.com/fake-post/object-params'
const reqGOPUrl = 'http://example-base.com/fake-get/object-params'
const reqOHUrl = 'http://example-test.com/fake-post/own-host'
const reqTAUrl = 'http://example-base.com/fake-get/req-type-axios?asyncCp=asyncCp'
const reqEAPUrl = 'http://example-base.com/fake-post/empty-array-params'
const reqMFDUrl = 'http://example-base.com/fake-get/mock-function-data'

describe('middleware', () => {
test('change host before request', async () => {
const data = { code: 0, data: 'custom host' }
const reqHAPUrl = `http://custom-host.com/fake-post/array-params`
const reqHAPUrl = 'http://custom-host.com/fake-post/array-params'
mock.onPost(reqHAPUrl).reply(200, data)
const resData = await fakePostApi.hap()

Expand Down Expand Up @@ -86,7 +86,7 @@ describe('fake get requests', () => {

test('required param', async () => {
const data = [0, 'array data']
mock.onGet(reqGOPUrl + `?param1=1217&param2=steve&param3=young`).reply(200, data)
mock.onGet(reqGOPUrl + '?param1=1217&param2=steve&param3=young').reply(200, data)
const resData = await fakeGetApi.op({ param3: 'young' }, { reqType: 'axios' })

expect(mock.history.get[0].params).toBe(undefined)
Expand Down

0 comments on commit 36addf5

Please sign in to comment.