@exadev/eslint-config 2.10.3 → 2.10.4

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.
package/dist/index.cjs CHANGED
@@ -119,7 +119,7 @@ function buildReactConfig(options = {}) {
119
119
  }
120
120
  //#endregion
121
121
  //#region package.json
122
- var version = "2.10.3";
122
+ var version = "2.10.4";
123
123
  //#endregion
124
124
  //#region src/rules/barrel-helpers.ts
125
125
  const INDEX_BASENAME$1 = /^index\.[cm]?[tj]sx?$/;
@@ -151,6 +151,19 @@ function isPermittedBarrel(filename, mode) {
151
151
  if (mode === "single") return isMainBarrel(filename);
152
152
  return isIndexFile(filename);
153
153
  }
154
+ function isAncestorNode(value) {
155
+ if (typeof value !== "object" || value === null) return false;
156
+ if (!("type" in value)) return false;
157
+ return typeof value.type === "string";
158
+ }
159
+ function isInsideAmbientModuleDeclaration(node) {
160
+ let current = node;
161
+ while (isAncestorNode(current)) {
162
+ if (current.type === "TSModuleDeclaration") return true;
163
+ current = current.parent;
164
+ }
165
+ return false;
166
+ }
154
167
  function createSplitReexportDetector() {
155
168
  const importsByName = /* @__PURE__ */ new Map();
156
169
  const bareExportSpecifiers = [];
@@ -312,7 +325,7 @@ const barrelPolicy = {
312
325
  },
313
326
  ExportNamedDeclaration(node) {
314
327
  detector.visitExportNamed(node);
315
- if (hasSource(node)) {
328
+ if (hasSource(node) && !isInsideAmbientModuleDeclaration(node)) {
316
329
  const source = node.source === null || node.source === void 0 ? void 0 : node.source.value;
317
330
  if (!isPermittedBarrel(filename, mode)) context.report({
318
331
  node,
@@ -326,6 +339,7 @@ const barrelPolicy = {
326
339
  }
327
340
  },
328
341
  ExportAllDeclaration(node) {
342
+ if (isInsideAmbientModuleDeclaration(node)) return;
329
343
  const source = node.source.value;
330
344
  if (!isPermittedBarrel(filename, mode)) context.report({
331
345
  node,
package/dist/index.js CHANGED
@@ -90,7 +90,7 @@ function buildReactConfig(options = {}) {
90
90
  }
91
91
  //#endregion
92
92
  //#region package.json
93
- var version = "2.10.3";
93
+ var version = "2.10.4";
94
94
  //#endregion
95
95
  //#region src/rules/barrel-helpers.ts
96
96
  const INDEX_BASENAME$1 = /^index\.[cm]?[tj]sx?$/;
@@ -122,6 +122,19 @@ function isPermittedBarrel(filename, mode) {
122
122
  if (mode === "single") return isMainBarrel(filename);
123
123
  return isIndexFile(filename);
124
124
  }
125
+ function isAncestorNode(value) {
126
+ if (typeof value !== "object" || value === null) return false;
127
+ if (!("type" in value)) return false;
128
+ return typeof value.type === "string";
129
+ }
130
+ function isInsideAmbientModuleDeclaration(node) {
131
+ let current = node;
132
+ while (isAncestorNode(current)) {
133
+ if (current.type === "TSModuleDeclaration") return true;
134
+ current = current.parent;
135
+ }
136
+ return false;
137
+ }
125
138
  function createSplitReexportDetector() {
126
139
  const importsByName = /* @__PURE__ */ new Map();
127
140
  const bareExportSpecifiers = [];
@@ -283,7 +296,7 @@ const barrelPolicy = {
283
296
  },
284
297
  ExportNamedDeclaration(node) {
285
298
  detector.visitExportNamed(node);
286
- if (hasSource(node)) {
299
+ if (hasSource(node) && !isInsideAmbientModuleDeclaration(node)) {
287
300
  const source = node.source === null || node.source === void 0 ? void 0 : node.source.value;
288
301
  if (!isPermittedBarrel(filename, mode)) context.report({
289
302
  node,
@@ -297,6 +310,7 @@ const barrelPolicy = {
297
310
  }
298
311
  },
299
312
  ExportAllDeclaration(node) {
313
+ if (isInsideAmbientModuleDeclaration(node)) return;
300
314
  const source = node.source.value;
301
315
  if (!isPermittedBarrel(filename, mode)) context.report({
302
316
  node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exadev/eslint-config",
3
- "version": "2.10.3",
3
+ "version": "2.10.4",
4
4
  "description": "Shared custom ESLint rules and plugin for ExaDev projects",
5
5
  "type": "module",
6
6
  "sideEffects": false,