Skip to content

Commit aea4e2c

Browse files
committed
fix: adjust "is source type module" checks for flat config
Also see jest-community/eslint-plugin-jest#1639
1 parent 4fe0a7b commit aea4e2c

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/rules/no-default-export.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ module.exports = {
1515

1616
create(context) {
1717
// ignore non-modules
18-
if (context.parserOptions.sourceType !== 'module') {
18+
if (
19+
context.parserOptions.sourceType !== 'module'
20+
&& (!context.languageOptions || context.languageOptions.sourceType !== 'module')
21+
) {
1922
return {};
2023
}
2124

src/rules/no-named-export.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ module.exports = {
1313

1414
create(context) {
1515
// ignore non-modules
16-
if (context.parserOptions.sourceType !== 'module') {
16+
if (
17+
context.parserOptions.sourceType !== 'module'
18+
&& (!context.languageOptions || context.languageOptions.sourceType !== 'module')
19+
) {
1720
return {};
1821
}
1922

src/rules/unambiguous.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ module.exports = {
1919

2020
create(context) {
2121
// ignore non-modules
22-
if (context.parserOptions.sourceType !== 'module') {
22+
if (
23+
context.parserOptions.sourceType !== 'module'
24+
&& (!context.languageOptions || context.languageOptions.sourceType !== 'module')
25+
) {
2326
return {};
2427
}
2528

0 commit comments

Comments
 (0)