@exadev/eslint-config 2.10.3 → 2.10.5
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 +23 -4
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +23 -4
- package/package.json +1 -1
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.
|
|
122
|
+
var version = "2.10.5";
|
|
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,
|
|
@@ -1407,14 +1421,19 @@ const recommendedTypeChecked = [
|
|
|
1407
1421
|
}
|
|
1408
1422
|
];
|
|
1409
1423
|
//#endregion
|
|
1424
|
+
//#region src/to-public-config-array.ts
|
|
1425
|
+
function toPublicConfigArray(built) {
|
|
1426
|
+
return built;
|
|
1427
|
+
}
|
|
1428
|
+
//#endregion
|
|
1410
1429
|
//#region src/create-config.ts
|
|
1411
1430
|
function exadevConfig(options = {}, ...userConfigs) {
|
|
1412
|
-
return [
|
|
1431
|
+
return toPublicConfigArray([
|
|
1413
1432
|
...recommendedTypeChecked,
|
|
1414
1433
|
...buildReactConfig({ enabled: options.react }),
|
|
1415
1434
|
...buildNextjsConfig({ enabled: options.nextjs }),
|
|
1416
1435
|
...userConfigs
|
|
1417
|
-
];
|
|
1436
|
+
]);
|
|
1418
1437
|
}
|
|
1419
1438
|
const defaultConfig = exadevConfig();
|
|
1420
1439
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
import { Config } from "eslint/config";
|
|
2
3
|
//#region src/config-types.d.ts
|
|
3
|
-
type
|
|
4
|
-
type ConfigArrayValue = Extract<ConfigValue, unknown[]>;
|
|
4
|
+
type PublicConfigArray = Config[];
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/create-config.d.ts
|
|
7
7
|
interface ExadevConfigOptions {
|
|
8
8
|
readonly react?: boolean;
|
|
9
9
|
readonly nextjs?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function exadevConfig(options?: ExadevConfigOptions, ...userConfigs: readonly TSESLint.FlatConfig.Config[]):
|
|
12
|
-
declare const defaultConfig:
|
|
11
|
+
declare function exadevConfig(options?: ExadevConfigOptions, ...userConfigs: readonly TSESLint.FlatConfig.Config[]): PublicConfigArray;
|
|
12
|
+
declare const defaultConfig: PublicConfigArray;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/plugin.d.ts
|
|
15
15
|
declare const plugin: TSESLint.FlatConfig.Plugin;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TSESLint } from "@typescript-eslint/utils";
|
|
2
|
+
import { Config } from "eslint/config";
|
|
2
3
|
//#region src/config-types.d.ts
|
|
3
|
-
type
|
|
4
|
-
type ConfigArrayValue = Extract<ConfigValue, unknown[]>;
|
|
4
|
+
type PublicConfigArray = Config[];
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/create-config.d.ts
|
|
7
7
|
interface ExadevConfigOptions {
|
|
8
8
|
readonly react?: boolean;
|
|
9
9
|
readonly nextjs?: boolean;
|
|
10
10
|
}
|
|
11
|
-
declare function exadevConfig(options?: ExadevConfigOptions, ...userConfigs: readonly TSESLint.FlatConfig.Config[]):
|
|
12
|
-
declare const defaultConfig:
|
|
11
|
+
declare function exadevConfig(options?: ExadevConfigOptions, ...userConfigs: readonly TSESLint.FlatConfig.Config[]): PublicConfigArray;
|
|
12
|
+
declare const defaultConfig: PublicConfigArray;
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region src/plugin.d.ts
|
|
15
15
|
declare const plugin: TSESLint.FlatConfig.Plugin;
|
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.
|
|
93
|
+
var version = "2.10.5";
|
|
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,
|
|
@@ -1378,14 +1392,19 @@ const recommendedTypeChecked = [
|
|
|
1378
1392
|
}
|
|
1379
1393
|
];
|
|
1380
1394
|
//#endregion
|
|
1395
|
+
//#region src/to-public-config-array.ts
|
|
1396
|
+
function toPublicConfigArray(built) {
|
|
1397
|
+
return built;
|
|
1398
|
+
}
|
|
1399
|
+
//#endregion
|
|
1381
1400
|
//#region src/create-config.ts
|
|
1382
1401
|
function exadevConfig(options = {}, ...userConfigs) {
|
|
1383
|
-
return [
|
|
1402
|
+
return toPublicConfigArray([
|
|
1384
1403
|
...recommendedTypeChecked,
|
|
1385
1404
|
...buildReactConfig({ enabled: options.react }),
|
|
1386
1405
|
...buildNextjsConfig({ enabled: options.nextjs }),
|
|
1387
1406
|
...userConfigs
|
|
1388
|
-
];
|
|
1407
|
+
]);
|
|
1389
1408
|
}
|
|
1390
1409
|
const defaultConfig = exadevConfig();
|
|
1391
1410
|
//#endregion
|