Skip to content

Commit

Permalink
support in own file, #1453
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Kauzmann <michael.kauzmann@colorado.edu>
  • Loading branch information
zepumph committed Aug 19, 2024
1 parent 8f5be97 commit 9e16075
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions eslint/rules/no-html-constructors.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,14 @@ module.exports = function( context ) {
// }

if ( node.callee && node.callee.name && nativeConstructors.indexOf( node.callee.name ) !== -1 ) {
if ( declaredTypes.indexOf( node.callee.name ) === -1 ) {
const constructorName = node.callee.name;
const filename = context.getFilename();
const constructorUsedInOwnFile = filename.endsWith( `${constructorName}.ts` );
if ( !constructorUsedInOwnFile && declaredTypes.indexOf( constructorName ) === -1 ) {
context.report( {
node: node,
loc: node.callee.loc,
message: `${node.callee.name}: using native constructor instead of project module, did you forget an import statement?`
message: `${constructorName}: using native constructor instead of project module, did you forget an import statement?`
} );
}
}
Expand Down

0 comments on commit 9e16075

Please sign in to comment.