Skip to content

Commit 0db212b

Browse files
Merge pull request #187 from node-strava/deps-and-eslint
Upgrade deps and modernize eslint usage
2 parents 5860d03 + c6cd4d2 commit 0db212b

File tree

10 files changed

+342
-1437
lines changed

10 files changed

+342
-1437
lines changed

eslint.config.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import globals from "globals";
2+
import js from "@eslint/js";
3+
4+
export default [
5+
js.configs.recommended,
6+
{
7+
languageOptions: {
8+
globals: {
9+
...globals.mocha,
10+
...globals.node,
11+
},
12+
},
13+
},
14+
];

index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ strava.defaultRequest = axiosInstance.create({
3737
*/
3838
strava.client = function (token, request = httpRequest) {
3939
if (!(this instanceof strava.client)) {
40-
// eslint-disable-next-line new-cap
4140
return new strava.client(token, request)
4241
}
4342
this.access_token = token

lib/authenticator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ var readConfigFile = function () {
3535
if (config.client_id) clientId = config.client_id
3636
if (config.client_secret) clientSecret = config.client_secret
3737
if (config.redirect_uri) redirectUri = config.redirect_uri
38-
} catch (_err) {
38+
} catch {
3939
// Config file does not exist. This may be a valid case if the config is
4040
// either passed directly as an argument or via environment variables
4141
}

lib/httpClient.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ HttpClient.prototype.getPaginationQS = function (args) {
289289
var qs
290290

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

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

313-
// eslint-disable-next-line camelcase
314312
if (page_size !== null) { qa.page_size = page_size }
315-
// eslint-disable-next-line camelcase
316313
if (after_cursor) { qa.after_cursor = after_cursor }
317314

318315
qs = querystring.stringify(/** @type {import('querystring').ParsedUrlQueryInput} */ (qa))

lib/rateLimiting.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ RateLimit.parseRateLimits = function (headers) {
156156
* @param {Object.<string, string|string[]|undefined>} headers - Response headers containing rate limit fields.
157157
* @returns {ParsedRateLimits|null} Parsed limits object if headers were valid, otherwise null.
158158
*/
159-
// eslint-disable-next-line no-extra-parens -- cast required so assignment satisfies RateLimitState
160159
RateLimit.updateRateLimits = /** @type {RateLimitState['updateRateLimits']} */ (
161160
/**
162161
* @this {RateLimitState}

lib/uploads.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,13 @@ uploads.prototype._check = async function (args, cb) {
141141
* @returns {boolean}
142142
*/
143143
uploads.prototype._uploadIsDone = function (args) {
144-
var isDone = false
145-
146144
switch (args.status) {
147145
case 'Your activity is still being processed.':
148-
isDone = false
149-
break
146+
return false
150147

151148
default:
152-
isDone = true
149+
return true
153150
}
154-
155-
return isDone
156151
}
157152

158153
module.exports = uploads

package.json

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,17 @@
2929
},
3030
"homepage": "https://github.com/node-strava/node-strava-v3",
3131
"dependencies": {
32-
"axios": "^1.12.2",
32+
"axios": "^1.13.5",
3333
"json-bigint": "^1.0.0"
3434
},
3535
"devDependencies": {
36+
"@eslint/js": "^10.0.1",
3637
"@types/json-bigint": "^1.0.4",
3738
"@types/mocha": "^10.0.10",
3839
"@types/node": "^25.2.1",
39-
"eslint": "^8.57.1",
40-
"eslint-config-standard": "^12.0.0",
41-
"eslint-plugin-import": "^2.32.0",
42-
"eslint-plugin-node": "^9.2.0",
43-
"eslint-plugin-promise": "^4.3.1",
44-
"eslint-plugin-standard": "^4.1.0",
45-
"mocha": "11.7.4",
40+
"eslint": "^10.0.1",
41+
"globals": "^17.3.0",
42+
"mocha": "^11.7.5",
4643
"nock": "^11.9.1",
4744
"tmp": "^0.2.5",
4845
"typescript": "^5.9.3"
@@ -53,16 +50,6 @@
5350
"ui": "bdd",
5451
"reporter": "spec"
5552
},
56-
"eslintConfig": {
57-
"extends": "standard",
58-
"env": {
59-
"mocha": true,
60-
"node": true
61-
},
62-
"rules": {
63-
"no-return-await": "off"
64-
}
65-
},
6653
"engines": {
6754
"node": ">=20.0.0"
6855
}

test/athletes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe('athletes', function () {
124124
totalCategories.forEach(category => {
125125
activityTypes.forEach(type => {
126126
const key = `${category}_${type}_totals`
127-
assert.ok(payload.hasOwnProperty(key), `Missing ${key}`)
127+
assert.ok(Object.prototype.hasOwnProperty.call(payload, key), `Missing ${key}`)
128128
assert.strictEqual(typeof payload[key], 'object', `${key} should be an object`)
129129
assert.strictEqual(typeof payload[key].count, 'number', `${key}.count should be a number`)
130130
assert.strictEqual(typeof payload[key].distance, 'number', `${key}.distance should be a number`)

test/pushSubscriptions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('pushSubscriptions_test', function () {
2121
.get('/api/v3/push_subscriptions')
2222
.query(true)
2323
.once()
24-
.reply(200, function (uri, requestBody) {
24+
.reply(200, function () {
2525
return { headers: this.req.headers }
2626
})
2727

@@ -71,7 +71,7 @@ describe('pushSubscriptions_test', function () {
7171
nock('https://www.strava.com')
7272
.post('/api/v3/push_subscriptions')
7373
.once()
74-
.reply(200, function (uri, requestBody) {
74+
.reply(200, function () {
7575
return { headers: this.req.headers }
7676
})
7777

@@ -123,7 +123,7 @@ describe('pushSubscriptions_test', function () {
123123
.delete('/api/v3/push_subscriptions/1')
124124
.query(true) // Accept any query parameters
125125
.once()
126-
.reply(200, function (uri, requestBody) {
126+
.reply(200, function () {
127127
return { headers: this.req.headers }
128128
})
129129

0 commit comments

Comments
 (0)