Skip to content

Commit

Permalink
chore: eslint (ali-sdk#582)
Browse files Browse the repository at this point in the history
eslint and codevcov
  • Loading branch information
luozhang002 authored Jan 4, 2019
1 parent 0163ef2 commit 35c729f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
}],
// wait node version >= 5.10.0 will start this rule
'no-buffer-constructor': [0],
"comma-dangle": [2, "never"]
"comma-dangle": [2, "never"],
"no-tabs":"off"
}
};
32 changes: 16 additions & 16 deletions example/config/webpack.dev.conf.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
const path = require('path')
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack')
const webpack = require('webpack');

const HtmlWebpackPluginConfig = {
filename: 'index.html',
template: './template/index.html',
inject: 'body',
}
template: './template/index.html',
inject: 'body'
};

module.exports = {
context: path.resolve(__dirname,'../src'),
context: path.resolve(__dirname, '../src'),
entry: './main',
output:{
path: path.resolve(__dirname,'../dist'),
output: {
path: path.resolve(__dirname, '../dist'),
filename: './[hash]app.js',
hashDigestLength: 8
},
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
use: ['style-loader', 'css-loader']
},
{
test: /\.(eot|woff|woff2)$/,
loader: "file-loader"
{
test: /\.(eot|woff|woff2)$/,
loader: 'file-loader'
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
loader: 'babel-loader'
}
}
]
Expand All @@ -43,9 +43,9 @@ module.exports = {
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
})
],
],
devServer: {
contentBase: path.resolve(__dirname, "../dist"),
contentBase: path.resolve(__dirname, '../dist'),
port: 3000,
host: '0.0.0.0',
open: true, // open browser auto
Expand All @@ -54,4 +54,4 @@ module.exports = {
hot: false,
compress: true // compress
}
}
};
40 changes: 20 additions & 20 deletions lib/browser/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ proto.append = async function append(name, file, options) {
if (options.position === undefined) options.position = '0';
options.subres = {
append: '',
position: options.position,
position: options.position
};
options.method = 'POST';

Expand Down Expand Up @@ -95,7 +95,7 @@ proto.put = async function put(name, file, options) {
const ret = {
name,
url: this._objectUrl(name),
res: result.res,
res: result.res
};

if (params.headers && params.headers['x-oss-callback']) {
Expand Down Expand Up @@ -135,7 +135,7 @@ proto.putStream = async function putStream(name, stream, options) {
const ret = {
name,
url: this._objectUrl(name),
res: result.res,
res: result.res
};

if (params.headers && params.headers['x-oss-callback']) {
Expand All @@ -154,7 +154,7 @@ proto.head = async function head(name, options) {
const data = {
meta: null,
res: result.res,
status: result.status,
status: result.status
};

if (result.status === 200) {
Expand Down Expand Up @@ -213,7 +213,7 @@ proto.get = async function get(name, file, options) {

return {
res: result.res,
content: result.data,
content: result.data
};
};

Expand All @@ -224,7 +224,7 @@ proto.delete = async function _delete(name, options) {
const result = await this.request(params);

return {
res: result.res,
res: result.res
};
};

Expand Down Expand Up @@ -261,7 +261,7 @@ proto.deleteMulti = async function deleteMulti(names, options) {
}
return {
res: result.res,
deleted,
deleted
};
};

Expand Down Expand Up @@ -297,21 +297,21 @@ proto.copy = async function copy(name, sourceName, options) {
if (data) {
data = {
etag: data.ETag,
lastModified: data.LastModified,
lastModified: data.LastModified
};
}

return {
data,
res: result.res,
res: result.res
};
};

proto.putMeta = async function putMeta(name, meta, options) {
const copyResult = await this.copy(name, name, {
meta: meta || {},
timeout: options && options.timeout,
ctx: options && options.ctx,
ctx: options && options.ctx
});
return copyResult;
};
Expand Down Expand Up @@ -341,8 +341,8 @@ proto.list = async function list(query, options) {
storageClass: obj.StorageClass,
owner: {
id: obj.Owner.ID,
displayName: obj.Owner.DisplayName,
},
displayName: obj.Owner.DisplayName
}
}));
}
let prefixes = result.data.CommonPrefixes || null;
Expand All @@ -357,7 +357,7 @@ proto.list = async function list(query, options) {
objects,
prefixes,
nextMarker: result.data.NextMarker || null,
isTruncated: result.data.IsTruncated === 'true',
isTruncated: result.data.IsTruncated === 'true'
};
};

Expand All @@ -380,7 +380,7 @@ proto.putACL = async function putACL(name, acl, options) {
const result = await this.request(params);

return {
res: result.res,
res: result.res
};
};

Expand All @@ -405,9 +405,9 @@ proto.getACL = async function getACL(name, options) {
acl: result.data.AccessControlList.Grant,
owner: {
id: result.data.Owner.ID,
displayName: result.data.Owner.DisplayName,
displayName: result.data.Owner.DisplayName
},
res: result.res,
res: result.res
};
};

Expand All @@ -426,7 +426,7 @@ proto.restore = async function restore(name, options) {
const result = await this.request(params);

return {
res: result.res,
res: result.res
};
};

Expand All @@ -437,7 +437,7 @@ proto.signatureUrl = function signatureUrl(name, options) {
const expires = utility.timestamp() + (options.expires || 1800);
const params = {
bucket: this.options.bucket,
object: name,
object: name
};

const resource = this._getResource(params);
Expand All @@ -452,7 +452,7 @@ proto.signatureUrl = function signatureUrl(name, options) {
url.query = {
OSSAccessKeyId: this.options.accessKeyId,
Expires: expires,
Signature: signRes.Signature,
Signature: signRes.Signature
};

copy(signRes.subResource).to(url.query);
Expand Down Expand Up @@ -522,7 +522,7 @@ proto._objectRequestParams = function _objectRequestParams(method, name, options
method,
subres: options && options.subres,
timeout: options && options.timeout,
ctx: options && options.ctx,
ctx: options && options.ctx
};

if (options.headers) {
Expand Down
2 changes: 1 addition & 1 deletion test/node/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('test/utils.test.js', () => {
assert.equal(utils._isIP('1.0.0.1'), true);

// test last 3 byte
assert.equal(utils._isIP('200.0.255.255'), true);
assert.equal(utils._isIP('200.0.255.255'), true);
assert.equal(utils._isIP('200.01.255.255'), true);
assert.equal(utils._isIP('200.10.255.255'), true);
assert.equal(utils._isIP('200.256.255.255'), false);
Expand Down

0 comments on commit 35c729f

Please sign in to comment.