Skip to content

Commit

Permalink
chore: upgrade to prettier@latest (#422)
Browse files Browse the repository at this point in the history
* chore: upgrade to prettier@latest

* fix: test new headless
  • Loading branch information
redonkulus authored Aug 29, 2023
1 parent 44d345c commit 8053978
Show file tree
Hide file tree
Showing 21 changed files with 5,533 additions and 180 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
env: {
browser: true,
es2023: true,
mocha: true,
node: true,
},
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ app.use(
console.log(serviceInfo.resource, serviceInfo.operation);
return Object.assign({ foo: 'fillDefaultValueForFoo' }, params);
},
})
}),
);
```

Expand All @@ -339,7 +339,7 @@ app.use(
data.debug = 'some debug information';
return data;
},
})
}),
);
```

Expand Down Expand Up @@ -587,7 +587,7 @@ const fetcher = new Fetcher({
stats.statusCode,
' within',
stats.time,
'ms'
'ms',
);
},
});
Expand All @@ -611,10 +611,10 @@ app.use(
stats.statusCode,
' within',
stats.time,
'ms'
'ms',
);
},
})
}),
);
```
Expand Down
2 changes: 1 addition & 1 deletion examples/simple/shared/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<title>Fetchr Example</title>
Expand Down
8 changes: 4 additions & 4 deletions libs/fetcher.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Request.prototype.end = function (callback) {
callback(
null,
result && result.data,
result && result.meta
result && result.meta,
);
});
},
Expand All @@ -133,7 +133,7 @@ Request.prototype.end = function (callback) {
setTimeout(function () {
callback(err);
});
}
},
);
return request;
}
Expand All @@ -146,7 +146,7 @@ Request.prototype.end = function (callback) {
function (err) {
self._captureMetaAndStats(err);
throw err;
}
},
);

promise.abort = request.abort;
Expand Down Expand Up @@ -323,7 +323,7 @@ Fetcher.prototype = {
contextPicker = Object.assign(
{},
this.options.contextPicker,
options.contextPicker
options.contextPicker,
);
}

Expand Down
20 changes: 10 additions & 10 deletions libs/fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function badOperationError(resource, operation) {
`Unsupported "${resourceName}.${operation}" operation`,
{
debug: 'Only "create", "read", "update" or "delete" operations are allowed',
}
},
);
error.source = 'fetchr';
return error;
Expand Down Expand Up @@ -166,7 +166,7 @@ class Request {
? this._paramsProcessor(
this.req,
{ operation: this.operation, resource: this.resource },
params
params,
)
: params;
return this;
Expand Down Expand Up @@ -238,7 +238,7 @@ class Request {
(errData) => {
this._captureMetaAndStats(errData);
throw errData.err;
}
},
);

if (callback) {
Expand All @@ -248,7 +248,7 @@ class Request {
},
(err) => {
setImmediate(callback, err);
}
},
);
} else {
return promise;
Expand Down Expand Up @@ -286,7 +286,7 @@ function executeRequest(request, resolve, reject) {
const service = Fetcher.getService(request.resource);
if (!service[op]) {
throw new FetchrError(
`operation: ${op} is undefined on service: ${request.resource}`
`operation: ${op} is undefined on service: ${request.resource}`,
);
}
service[op].apply(service, args);
Expand Down Expand Up @@ -347,7 +347,7 @@ class Fetcher {
static registerService(service) {
if (!service) {
throw new FetchrError(
'Fetcher.registerService requires a service definition (ex. registerService(service)).'
'Fetcher.registerService requires a service definition (ex. registerService(service)).',
);
}

Expand All @@ -359,7 +359,7 @@ class Fetcher {
Fetcher._deprecatedServicesDefinitions.push(resource);
} else {
throw new FetchrError(
'"resource" property is missing in service definition.'
'"resource" property is missing in service definition.',
);
}

Expand Down Expand Up @@ -391,7 +391,7 @@ class Fetcher {
const service = Fetcher.isRegistered(name);
if (!service) {
throw new FetchrError(
`Service "${sanitizeResourceName(name)}" could not be found`
`Service "${sanitizeResourceName(name)}" could not be found`,
);
}
return service;
Expand Down Expand Up @@ -479,11 +479,11 @@ following services definitions: ${services}.`);
if (err) {
const { statusCode, output } = getErrorResponse(err);
res.status(statusCode).json(
formatResponse(req, res, { output, meta })
formatResponse(req, res, { output, meta }),
);
} else {
res.status(meta.statusCode || 200).json(
formatResponse(req, res, { data, meta })
formatResponse(req, res, { data, meta }),
);
}
});
Expand Down
12 changes: 6 additions & 6 deletions libs/util/httpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function io(options, controller) {
'Cannot parse response into a JSON object',
options,
request,
response
response,
);
});
} else {
Expand All @@ -69,7 +69,7 @@ function io(options, controller) {
message,
options,
request,
response
response,
);
});
}
Expand All @@ -82,25 +82,25 @@ function io(options, controller) {
FetchrError.TIMEOUT,
'Request failed due to timeout',
options,
request
request,
);
}

throw new FetchrError(
FetchrError.ABORT,
err.message,
options,
request
request,
);
}

throw new FetchrError(
FetchrError.UNKNOWN,
err.message,
options,
request
request,
);
}
},
);
}

Expand Down
8 changes: 4 additions & 4 deletions libs/util/normalizeOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function requestToOptions(request) {
{
xhrTimeout: request.options.xhrTimeout,
},
request._clientConfig
request._clientConfig,
);
options.config = config;
options.headers = config.headers || request.options.headers || {};
Expand All @@ -33,7 +33,7 @@ function requestToOptions(request) {
var context = pickContext(
request.options.context,
request.options.contextPicker,
'GET'
'GET',
);

var args = [
Expand Down Expand Up @@ -93,7 +93,7 @@ function normalizeRetry(request) {
statusCodes: [0, 408, 999],
},
request.options.retry,
request._clientConfig.retry
request._clientConfig.retry,
);

if ('unsafeAllowRetry' in request._clientConfig) {
Expand All @@ -102,7 +102,7 @@ function normalizeRetry(request) {

if (retry.max_retries) {
console.warn(
'"max_retries" is deprecated and will be removed in a future release, use "maxRetries" instead.'
'"max_retries" is deprecated and will be removed in a future release, use "maxRetries" instead.',
);
retry.maxRetries = retry.max_retries;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/util/pickContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function pickContext(context, picker, method) {
});
} else {
throw new TypeError(
'picker must be an string, an array, or a function.'
'picker must be an string, an array, or a function.',
);
}

Expand Down
6 changes: 3 additions & 3 deletions libs/util/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function buildGETUrl(baseUrl, resource, params, config, context) {
} else if (v !== undefined) {
try {
matrix.push(
k + '=' + encodeURIComponent(jsonifyComplexType(v))
k + '=' + encodeURIComponent(jsonifyComplexType(v)),
);
} catch (err) {
console.debug('jsonifyComplexType failed: ' + err);
Expand Down Expand Up @@ -92,11 +92,11 @@ function buildPOSTUrl(baseUrl, request) {
pickContext(
request.options.context,
request.options.contextPicker,
'POST'
'POST',
),
function eachContext(v, k) {
query.push(k + '=' + encodeURIComponent(v));
}
},
);
if (query.length > 0) {
finalUrl += '?' + query.sort().join('&');
Expand Down
Loading

0 comments on commit 8053978

Please sign in to comment.