eslint-plugin-imports-regulation 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -243,7 +243,9 @@ const rule = {
243
243
  for (const variable of source.getDeclaredVariables(node)) {
244
244
  if (variable.references.length === 0)
245
245
  continue;
246
- if (variable.references.every(reference => reference.isTypeReference))
246
+ // A plain `export { x }` is flagged as both, and could be a value.
247
+ const typeOnly = variable.references.every(reference => reference.isTypeReference && !reference.isValueReference);
248
+ if (typeOnly)
247
249
  names.add(variable.name);
248
250
  }
249
251
  return names;
@@ -465,13 +467,15 @@ const rule = {
465
467
  fix: fixer => fixer.replaceTextRange([from, to], eol.repeat(blankLinesAfter + 1)),
466
468
  });
467
469
  };
468
- const checkChunk = (chunk) => {
470
+ const checkChunk = (chunk, leading) => {
469
471
  const entries = entriesOf(chunk);
470
472
  const first = entries[0];
471
473
  const last = entries[entries.length - 1];
472
474
  if (!first || !last)
473
475
  return;
474
- checkAfterImports(last);
476
+ // An import after code is not the imports block, so no gap is owed after it.
477
+ if (leading)
478
+ checkAfterImports(last);
475
479
  if (entries.length < 2)
476
480
  return;
477
481
  const rewrite = fixer => {
@@ -548,7 +552,7 @@ const rule = {
548
552
  let chunk = [];
549
553
  const flush = () => {
550
554
  if (chunk.length > 0)
551
- checkChunk(chunk);
555
+ checkChunk(chunk, chunk[0] === program.body[0]);
552
556
  chunk = [];
553
557
  };
554
558
  for (const statement of program.body) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-imports-regulation",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Order imports: external type-only, external, blank line, internal type-only, internal — with type specifiers last inside each import.",
5
5
  "author": "Robert Sandiford",
6
6
  "type": "module",