Skip to content

Commit 89ec729

Browse files
committed
chore(linter): fix import resolver to support "exports" maps
1 parent 687217f commit 89ec729

File tree

6 files changed

+21
-9
lines changed

6 files changed

+21
-9
lines changed

eslint.config.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,22 @@ export default [
4242
'n/no-process-exit': 'off',
4343
'n/no-unsupported-features/node-builtins': 'off',
4444
},
45+
settings: {
46+
'import/resolver': {
47+
node: {
48+
pathFilter(pkg, path, relativePath) {
49+
return pkg.exports?.[`./${relativePath}`]?.import?.default ??
50+
pkg.exports?.[`./${relativePath}`]?.import ??
51+
pkg.exports?.[`./${relativePath}`]?.default ??
52+
pkg.exports?.[`./${relativePath}`] ??
53+
pkg.exports?.['.']?.import?.default ??
54+
pkg.exports?.['.']?.import ??
55+
pkg.exports?.['.']?.default ??
56+
pkg.exports?.['.'] ??
57+
(relativePath || pkg.main);
58+
},
59+
},
60+
},
61+
},
4562
},
4663
];

lib/voting_session.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
getEditor, isGhAvailable
1111
} from './utils.js';
1212

13-
// eslint-disable-next-line import/no-unresolved
1413
import voteUsingGit from '@node-core/caritat/voteUsingGit';
1514
import * as yaml from 'js-yaml';
1615

test/unit/ci_start.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, afterEach } from 'node:test';
32
import assert from 'assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65
import { FormData } from 'undici';
76

87
import {

test/unit/pr_checker.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, after, afterEach } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import PRData from '../../lib/pr_data.js';
87
import PRChecker from '../../lib/pr_checker.js';

test/unit/pr_data.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import PRData from '../../lib/pr_data.js';
87

test/unit/team_info.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable import/no-named-as-default-member */
21
import { describe, it, before, after } from 'node:test';
32
import assert from 'node:assert';
43

5-
import sinon from 'sinon';
4+
import * as sinon from 'sinon';
65

76
import TestCLI from '../fixtures/test_cli.js';
87
import TeamInfo from '../../lib/team_info.js';

0 commit comments

Comments
 (0)