Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Commit

Permalink
fix: remove_import(mymodule) pattern to not delete the whole line
Browse files Browse the repository at this point in the history
  • Loading branch information
amedeedaboville authored Nov 22, 2023
1 parent db2b3bc commit 85bc6c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .grit/patterns/importing.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import fetch from 'elsewhere';
import { fetch } from 'node-fetch';
import { fetch, more } from 'node-fetch';
import fetch from 'node-fetch';
import defaultNotNamedFetch, { fetch } from 'node-fetch';

console.log(orderBy([1, 2, 3]));

Expand All @@ -60,6 +61,8 @@ import fetch from 'elsewhere';

import { more } from 'node-fetch';

import defaultNotNamedFetch from 'node-fetch';

console.log(orderBy([1, 2, 3]));

console.log(v4());
Expand Down
8 changes: 6 additions & 2 deletions .grit/patterns/imports.grit
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,14 @@ pattern remove_import($from) {
$import => .
},
// Handle named import
import_clause(name = named_imports($imports)) where {
import_clause($default, name=named_imports($imports)) as $clause where {
$others = `false`,
if ($imports <: [$name]) {
$import => .
if ($default <: .) {
$import => .
} else {
$clause => $default
}
} else {
$imports <: some $name => .
}
Expand Down

0 comments on commit 85bc6c0

Please sign in to comment.