volunteer-contributions-fetch 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'daily'
7
+ - package-ecosystem: 'npm'
8
+ directory: '/'
9
+ schedule:
10
+ interval: 'weekly'
11
+ cooldown:
12
+ default-days: 7
13
+ semver-major-days: 14
14
+ semver-minor-days: 7
15
+ semver-patch-days: 7
16
+ groups:
17
+ production-dependencies:
18
+ dependency-type: 'production'
19
+ update-types:
20
+ - 'minor'
21
+ - 'patch'
22
+ development-dependencies:
23
+ dependency-type: 'development'
24
+ update-types:
25
+ - 'major'
26
+ - 'minor'
27
+ - 'patch'
@@ -14,7 +14,7 @@ jobs:
14
14
  issues: write
15
15
  steps:
16
16
  - name: Checkout
17
- uses: actions/checkout@v5
17
+ uses: actions/checkout@v6
18
18
  - name: Setup Node
19
19
  uses: actions/setup-node@v6
20
20
  with:
@@ -7,7 +7,7 @@ jobs:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
9
  - name: Checkout
10
- uses: actions/checkout@v5
10
+ uses: actions/checkout@v6
11
11
  - name: Setup Node
12
12
  uses: actions/setup-node@v6
13
13
  with:
package/README.md CHANGED
@@ -264,8 +264,6 @@ You then can use `npm run example` which uses `fetchAll` if you would like to te
264
264
  npm run eslint
265
265
  ```
266
266
 
267
- Note that due to the AirBnB config we are still using ESLint 8.
268
-
269
267
  ### Deployments
270
268
 
271
269
  Please use [Angular Commit Message Conventions](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-format) when contributing to this project, as depending on the commit message the GitHub Action will directly publish a new version of the package.
@@ -0,0 +1,44 @@
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import js from '@eslint/js';
5
+ import { FlatCompat } from '@eslint/eslintrc';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const compat = new FlatCompat({
10
+ baseDirectory: __dirname,
11
+ recommendedConfig: js.configs.recommended,
12
+ allConfig: js.configs.all,
13
+ });
14
+
15
+ export default defineConfig([
16
+ globalIgnores(['.nyc_output/**/*', 'coverage/**/*', 'node_modules']),
17
+ {
18
+ extends: compat.extends('plugin:prettier/recommended'),
19
+
20
+ languageOptions: {
21
+ ecmaVersion: 2022,
22
+ sourceType: 'module',
23
+ },
24
+
25
+ settings: {
26
+ 'import/resolver': {
27
+ node: {
28
+ paths: ['lib'],
29
+ extensions: ['.js', '.d.ts'],
30
+ },
31
+ },
32
+ },
33
+
34
+ rules: {
35
+ 'arrow-body-style': 0,
36
+ 'comma-dangle': 0,
37
+ 'import/extensions': 0,
38
+ 'import/prefer-default-export': 0,
39
+ 'no-plusplus': 0,
40
+ 'no-restricted-syntax': 0,
41
+ 'no-use-before-define': 0,
42
+ },
43
+ },
44
+ ]);
package/example/index.js CHANGED
@@ -32,5 +32,4 @@ const existingContributions = [
32
32
 
33
33
  const contributions = await fetchAll(config, existingContributions);
34
34
 
35
- // eslint-disable-next-line no-console
36
35
  console.log(contributions);
package/lib/bugzilla.js CHANGED
@@ -81,11 +81,9 @@ async function* bugPageGenerator(bugzilla, stopDate) {
81
81
  const query = `quicksearch=ALL%20commenter:${bugzilla.username}&limit=${RESULTS_PER_PAGE}&offset=${offset}&last_change_time=${stop}`;
82
82
  const bugsUrl = `${bugzilla.baseUrl}/rest/bug?${query}`;
83
83
  debug(`Fetching from ${bugsUrl}`);
84
- // eslint-disable-next-line no-await-in-loop
85
84
  const response = await fetch(bugsUrl, {
86
85
  signal: AbortSignal.timeout(FETCH_TIMEOUT),
87
86
  });
88
- // eslint-disable-next-line no-await-in-loop
89
87
  const data = await response.json();
90
88
  debug(`Got ${data.bugs.length} bugs results`);
91
89
  // If we have less results than the max result, we're at the end
@@ -104,7 +102,6 @@ async function* getComments(bugzilla, bugs, titleMap) {
104
102
  for await (const bug of bugs) {
105
103
  const commentsUrl = `${bugzilla.baseUrl}/rest/bug/${bug.id}/comment`;
106
104
  debug(`Fetching from ${commentsUrl}`);
107
- // eslint-disable-next-line no-await-in-loop
108
105
  const response = await fetch(commentsUrl, {
109
106
  signal: AbortSignal.timeout(FETCH_TIMEOUT),
110
107
  });
@@ -69,7 +69,7 @@ beforeEach(() => {
69
69
  });
70
70
 
71
71
  afterEach(() => {
72
- vi.restoreAllMocks();
72
+ vi.resetAllMocks();
73
73
  });
74
74
 
75
75
  test('Bugzilla schema - valid config', () => {
@@ -17,7 +17,7 @@ beforeEach(() => {
17
17
  });
18
18
 
19
19
  afterEach(() => {
20
- vi.restoreAllMocks();
20
+ vi.resetAllMocks();
21
21
  });
22
22
 
23
23
  test('Community Portal schema - valid config', () => {
package/lib/discourse.js CHANGED
@@ -104,7 +104,7 @@ async function* topicPageGenerator(baseUrl, username) {
104
104
  while (true) {
105
105
  debug(`Getting page ${page}`);
106
106
  const url = `${baseUrl}/topics/created-by/${username}.json?page=${page}`;
107
- const results = await getDiscourseData(url); // eslint-disable-line no-await-in-loop
107
+ const results = await getDiscourseData(url);
108
108
  page++;
109
109
  yield results;
110
110
  }
@@ -116,7 +116,7 @@ async function* postPageGenerator(baseUrl, username) {
116
116
  debug(`Getting page ${page}`);
117
117
  const offset = page * RESULTS_PER_PAGE;
118
118
  const url = `${baseUrl}/user_actions.json?username=${username}&filter=5&offset=${offset}`;
119
- const results = await getDiscourseData(url); // eslint-disable-line no-await-in-loop
119
+ const results = await getDiscourseData(url);
120
120
  page++;
121
121
  yield results;
122
122
  }
@@ -1,5 +1,4 @@
1
1
  import Debug from 'debug';
2
- // eslint-disable-next-line import/no-unresolved
3
2
  import { Octokit } from '@octokit/rest';
4
3
 
5
4
  const debug = Debug('contributions:github-fetcher');
package/lib/github.js CHANGED
@@ -367,7 +367,7 @@ async function* pageGenerator(github, period, cb, { skipProcessing } = {}) {
367
367
  let page = 1;
368
368
  while (hasMoreToFetch) {
369
369
  debug(`Getting data for period between ${period[1]} and ${period[0]}`);
370
- const results = await cb(period, page); // eslint-disable-line no-await-in-loop
370
+ const results = await cb(period, page);
371
371
 
372
372
  if (!Array.isArray(results)) {
373
373
  return;
@@ -13,27 +13,27 @@ const config = {
13
13
  },
14
14
  };
15
15
 
16
+ vi.mock('./github-fetcher.js', async () => {
17
+ return {
18
+ PRIVATE_SCOPE_ERROR: 'PRIVATE_SCOPE',
19
+ RESULTS_PER_PAGE: 100,
20
+ searchCommits: vi.fn().mockResolvedValue([]),
21
+ searchIssues: vi.fn().mockResolvedValue([]),
22
+ listReviews: vi.fn().mockResolvedValue([]),
23
+ listComments: vi.fn().mockResolvedValue([]),
24
+ throwIfTokenHasPrivateRepoScope: vi.fn(),
25
+ };
26
+ });
27
+
16
28
  beforeEach(() => {
17
29
  vi.useFakeTimers();
18
30
  vi.setSystemTime(new Date('2022-03-02'));
19
31
 
20
- vi.mock('./github-fetcher.js', async () => {
21
- return {
22
- PRIVATE_SCOPE_ERROR: 'PRIVATE_SCOPE',
23
- RESULTS_PER_PAGE: 100,
24
- searchCommits: vi.fn().mockResolvedValue([]),
25
- searchIssues: vi.fn().mockResolvedValue([]),
26
- listReviews: vi.fn().mockResolvedValue([]),
27
- listComments: vi.fn().mockResolvedValue([]),
28
- throwIfTokenHasPrivateRepoScope: vi.fn(),
29
- };
30
- });
31
-
32
- vi.stubEnv('GITHUB_TOKEN', 'some_test_token');
32
+ process.env.GITHUB_TOKEN = 'some_test_token';
33
33
  });
34
34
 
35
35
  afterEach(() => {
36
- vi.restoreAllMocks();
36
+ vi.resetAllMocks();
37
37
  });
38
38
 
39
39
  test('should validate valid config', () => {
package/lib/osm.js CHANGED
@@ -37,7 +37,6 @@ async function processEdits({ displayName, stopDate }) {
37
37
  let createdBefore = new Date().toISOString();
38
38
 
39
39
  while (hasMoreData) {
40
- // eslint-disable-next-line no-await-in-loop
41
40
  const edits = await getPage(displayName, stopDate, createdBefore);
42
41
  debug(`Got ${edits.length} results to filter`);
43
42
  const processed = processEntities(edits);
package/lib/osm.test.js CHANGED
@@ -20,7 +20,7 @@ beforeEach(() => {
20
20
  });
21
21
 
22
22
  afterEach(() => {
23
- vi.restoreAllMocks();
23
+ vi.resetAllMocks();
24
24
  });
25
25
 
26
26
  test('should validate valid config', () => {
package/lib/wiki.test.js CHANGED
@@ -24,7 +24,7 @@ beforeEach(() => {
24
24
  });
25
25
 
26
26
  afterEach(() => {
27
- vi.restoreAllMocks();
27
+ vi.resetAllMocks();
28
28
  });
29
29
 
30
30
  test('should validate config - missing completely', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volunteer-contributions-fetch",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "description": "Library to fetch volunteer contributions from several sources such as GitHub",
5
5
  "author": "Michael Kohler",
6
6
  "license": "MIT",
@@ -13,22 +13,23 @@
13
13
  "dependencies": {
14
14
  "@octokit/rest": "^22.0.0",
15
15
  "debug": "^4.4.3",
16
- "jsdom": "^27.0.0",
16
+ "jsdom": "^29.0.0",
17
17
  "xml2js": "^0.6.2",
18
18
  "zod": "^4.1.12"
19
19
  },
20
20
  "devDependencies": {
21
- "@commitlint/cli": "^20.1.0",
22
- "@commitlint/config-angular": "^20.0.0",
23
- "@vitest/coverage-v8": "^3.2.4",
24
- "eslint": "^8.47.0",
25
- "eslint-config-airbnb-base": "^15.0.0",
26
- "eslint-config-prettier": "^9.0.0",
21
+ "@commitlint/cli": "^20.5.0",
22
+ "@commitlint/config-angular": "^20.5.0",
23
+ "@eslint/eslintrc": "^3.3.5",
24
+ "@eslint/js": "^10.0.1",
25
+ "@vitest/coverage-v8": "^4.1.0",
26
+ "eslint": "^10.0.3",
27
+ "eslint-config-prettier": "^10.1.8",
27
28
  "eslint-plugin-prettier": "^5.5.4",
28
29
  "husky": "^9.1.7",
29
- "prettier": "^3.6.2",
30
+ "prettier": "^3.7.4",
30
31
  "semantic-release": "^25.0.1-beta.1",
31
- "vitest": "^3.2.4"
32
+ "vitest": "^4.1.0"
32
33
  },
33
34
  "scripts": {
34
35
  "prepare": "husky",
package/.eslintrc DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "extends": ["airbnb-base", "plugin:prettier/recommended"],
3
- "settings": {
4
- "import/resolver": {
5
- "node": {
6
- "paths": ["lib"],
7
- "extensions": [".js", ".ts", ".d.ts", ".tsx"]
8
- }
9
- }
10
- },
11
- "parserOptions": {
12
- "ecmaVersion": 2022
13
- },
14
- "rules": {
15
- "arrow-body-style": 0,
16
- "comma-dangle": 0,
17
- "import/extensions": 0,
18
- "import/prefer-default-export": 0,
19
- "no-plusplus": 0,
20
- "no-restricted-syntax": 0,
21
- "no-use-before-define": 0
22
- }
23
- }