Skip to content

Commit

Permalink
fix: adjust "is source type module" checks for flat config
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Sep 15, 2024
1 parent 01a4d31 commit 9946f58
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/rules/no-default-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ module.exports = {

create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
if (
context.parserOptions.sourceType !== 'module'
&& (context.languageOptions && context.languageOptions.sourceType !== 'module')
) {
return {};
}

Expand Down
5 changes: 4 additions & 1 deletion src/rules/no-named-export.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module.exports = {

create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
if (
context.parserOptions.sourceType !== 'module'
&& (context.languageOptions && context.languageOptions.sourceType !== 'module')
) {
return {};
}

Expand Down
5 changes: 4 additions & 1 deletion src/rules/unambiguous.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ module.exports = {

create(context) {
// ignore non-modules
if (context.parserOptions.sourceType !== 'module') {
if (
context.parserOptions.sourceType !== 'module'
&& (context.languageOptions && context.languageOptions.sourceType !== 'module')
) {
return {};
}

Expand Down

0 comments on commit 9946f58

Please sign in to comment.