Skip to content

Commit

Permalink
better support for requiring "import/export default" modules, #372
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed Nov 1, 2024
1 parent 0bdd141 commit 3025036
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions js/eslint/rules/no-property-in-require-statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@ module.exports = {

if ( node.declarations &&
node.declarations.length > 0 &&
node.declarations[ 0 ] &&
node.declarations[ 0 ].init &&
node.declarations[ 0 ].init.type &&
node.declarations[ 0 ].init.type === 'MemberExpression' &&
node.declarations[ 0 ].init.object &&
node.declarations[ 0 ].init.object.callee &&
node.declarations[ 0 ].init.object.callee.name &&
node.declarations[ 0 ].init.object.callee.name === 'require' ) {
node.declarations[ 0 ]?.init?.type === 'MemberExpression' &&
node.declarations[ 0 ].init.property?.name !== 'default' &&
node.declarations[ 0 ].init?.object?.callee?.name === 'require' ) {

context.report( {
node: node,
Expand Down

0 comments on commit 3025036

Please sign in to comment.