Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import globals from "globals";
import js from "@eslint/js";

export default [
js.configs.recommended,
{
languageOptions: {
globals: {
...globals.mocha,
...globals.node,
},
},
},
];
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ strava.defaultRequest = axiosInstance.create({
*/
strava.client = function (token, request = httpRequest) {
if (!(this instanceof strava.client)) {
// eslint-disable-next-line new-cap
return new strava.client(token, request)
}
this.access_token = token
Expand Down
2 changes: 1 addition & 1 deletion lib/authenticator.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var readConfigFile = function () {
if (config.client_id) clientId = config.client_id
if (config.client_secret) clientSecret = config.client_secret
if (config.redirect_uri) redirectUri = config.redirect_uri
} catch (_err) {
} catch {
// Config file does not exist. This may be a valid case if the config is
// either passed directly as an argument or via environment variables
}
Expand Down
3 changes: 0 additions & 3 deletions lib/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ HttpClient.prototype.getPaginationQS = function (args) {
var qs

if (page) { qa.page = page }
// eslint-disable-next-line camelcase
if (per_page !== null) { qa.per_page = per_page }

qs = querystring.stringify(/** @type {import('querystring').ParsedUrlQueryInput} */ (qa))
Expand All @@ -310,9 +309,7 @@ HttpClient.prototype.getCursorPaginationQS = function (args) {
var qa = {}
var qs

// eslint-disable-next-line camelcase
if (page_size !== null) { qa.page_size = page_size }
// eslint-disable-next-line camelcase
if (after_cursor) { qa.after_cursor = after_cursor }

qs = querystring.stringify(/** @type {import('querystring').ParsedUrlQueryInput} */ (qa))
Expand Down
1 change: 0 additions & 1 deletion lib/rateLimiting.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ RateLimit.parseRateLimits = function (headers) {
* @param {Object.<string, string|string[]|undefined>} headers - Response headers containing rate limit fields.
* @returns {ParsedRateLimits|null} Parsed limits object if headers were valid, otherwise null.
*/
// eslint-disable-next-line no-extra-parens -- cast required so assignment satisfies RateLimitState
RateLimit.updateRateLimits = /** @type {RateLimitState['updateRateLimits']} */ (
/**
* @this {RateLimitState}
Expand Down
9 changes: 2 additions & 7 deletions lib/uploads.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,13 @@ uploads.prototype._check = async function (args, cb) {
* @returns {boolean}
*/
uploads.prototype._uploadIsDone = function (args) {
var isDone = false

switch (args.status) {
case 'Your activity is still being processed.':
isDone = false
break
return false

default:
isDone = true
return true
}

return isDone
}

module.exports = uploads
23 changes: 5 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,17 @@
},
"homepage": "https://github.com/node-strava/node-strava-v3",
"dependencies": {
"axios": "^1.12.2",
"axios": "^1.13.5",
"json-bigint": "^1.0.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/json-bigint": "^1.0.4",
"@types/mocha": "^10.0.10",
"@types/node": "^25.2.1",
"eslint": "^8.57.1",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-node": "^9.2.0",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"mocha": "11.7.4",
"eslint": "^10.0.1",
"globals": "^17.3.0",
"mocha": "^11.7.5",
"nock": "^11.9.1",
"tmp": "^0.2.5",
"typescript": "^5.9.3"
Expand All @@ -53,16 +50,6 @@
"ui": "bdd",
"reporter": "spec"
},
"eslintConfig": {
"extends": "standard",
"env": {
"mocha": true,
"node": true
},
"rules": {
"no-return-await": "off"
}
},
"engines": {
"node": ">=20.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion test/athletes.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('athletes', function () {
totalCategories.forEach(category => {
activityTypes.forEach(type => {
const key = `${category}_${type}_totals`
assert.ok(payload.hasOwnProperty(key), `Missing ${key}`)
assert.ok(Object.prototype.hasOwnProperty.call(payload, key), `Missing ${key}`)
assert.strictEqual(typeof payload[key], 'object', `${key} should be an object`)
assert.strictEqual(typeof payload[key].count, 'number', `${key}.count should be a number`)
assert.strictEqual(typeof payload[key].distance, 'number', `${key}.distance should be a number`)
Expand Down
6 changes: 3 additions & 3 deletions test/pushSubscriptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('pushSubscriptions_test', function () {
.get('/api/v3/push_subscriptions')
.query(true)
.once()
.reply(200, function (uri, requestBody) {
.reply(200, function () {
return { headers: this.req.headers }
})

Expand Down Expand Up @@ -71,7 +71,7 @@ describe('pushSubscriptions_test', function () {
nock('https://www.strava.com')
.post('/api/v3/push_subscriptions')
.once()
.reply(200, function (uri, requestBody) {
.reply(200, function () {
return { headers: this.req.headers }
})

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('pushSubscriptions_test', function () {
.delete('/api/v3/push_subscriptions/1')
.query(true) // Accept any query parameters
.once()
.reply(200, function (uri, requestBody) {
.reply(200, function () {
return { headers: this.req.headers }
})

Expand Down
Loading