File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -43,13 +43,13 @@ async function unusedImportsActiveFile(editor) {
4343 if ( text . includes ( solhintRuleString ) ) return ;
4444
4545 const importRegex = / i m p o r t \s + ( (?: \{ .+ ?\} \s + f r o m \s + ) ? (?: \" .* ?\" | ' .* ?' ) ) ; / g;
46- const imports = text . match ( importRegex ) || [ ] ;
46+ const importStatements = text . match ( importRegex ) || [ ] ;
4747 const unusedImportDecorations = [ ] ;
4848
49- for ( const importStatement of imports ) {
49+ for ( const importStatement of importStatements ) {
5050 const imports = extractImports ( importStatement ) ;
5151 for ( const item of imports ) {
52- const regex = new RegExp ( item , 'g' ) ;
52+ const regex = new RegExp ( `\\b ${ item } \\b` , 'g' ) ;
5353 const itemOccurrencesInImportStatement = ( importStatement . replace ( / \. s o l \b / g, '' ) . match ( regex ) || [ ] ) . length ;
5454 const totalOccurrencesOfItem = ( text . match ( new RegExp ( `\\b${ item } \\b` , 'gi' ) ) || [ ] ) . length ;
5555 if ( totalOccurrencesOfItem == itemOccurrencesInImportStatement ) {
You can’t perform that action at this time.
0 commit comments