@borela-tech/eslint-config 2.5.3 → 2.5.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.js CHANGED
@@ -1279,6 +1279,11 @@ function collectVariableDeclarators(node, types) {
1279
1279
  for (const declarator of node.declarations) if (declarator.id.type === "Identifier" && declarator.id.name) types.add(declarator.id.name);
1280
1280
  }
1281
1281
  //#endregion
1282
+ //#region src/rules/maxDeclarationsPerFile/isExportedDeclaration.ts
1283
+ function isExportedDeclaration(parent) {
1284
+ return parent?.type === "ExportNamedDeclaration";
1285
+ }
1286
+ //#endregion
1282
1287
  //#region src/rules/maxDeclarationsPerFile/isTopLevel.ts
1283
1288
  function isTopLevel(node) {
1284
1289
  if (node.parent?.type === "Program") return true;
@@ -1288,32 +1293,44 @@ function isTopLevel(node) {
1288
1293
  //#endregion
1289
1294
  //#region src/rules/maxDeclarationsPerFile/handleClassDeclaration.ts
1290
1295
  function handleClassDeclaration(node, functions) {
1291
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1296
+ if (!isTopLevel(node)) return;
1297
+ if (!isExportedDeclaration(node.parent)) return;
1298
+ if (node.id?.name) functions.add(node.id.name);
1292
1299
  }
1293
1300
  //#endregion
1294
1301
  //#region src/rules/maxDeclarationsPerFile/handleFunctionDeclaration.ts
1295
1302
  function handleFunctionDeclaration(node, functions) {
1296
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1303
+ if (!isTopLevel(node)) return;
1304
+ if (!isExportedDeclaration(node.parent)) return;
1305
+ if (node.id?.name) functions.add(node.id.name);
1297
1306
  }
1298
1307
  //#endregion
1299
1308
  //#region src/rules/maxDeclarationsPerFile/handleTSDeclareFunction.ts
1300
1309
  function handleTSDeclareFunction(node, functions) {
1301
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1310
+ if (!isTopLevel(node)) return;
1311
+ if (!isExportedDeclaration(node.parent)) return;
1312
+ if (node.id?.name) functions.add(node.id.name);
1302
1313
  }
1303
1314
  //#endregion
1304
1315
  //#region src/rules/maxDeclarationsPerFile/handleTSEnumDeclaration.ts
1305
1316
  function handleTSEnumDeclaration(node, types) {
1306
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1317
+ if (!isTopLevel(node)) return;
1318
+ if (!isExportedDeclaration(node.parent)) return;
1319
+ if (node.id?.name) types.add(node.id.name);
1307
1320
  }
1308
1321
  //#endregion
1309
1322
  //#region src/rules/maxDeclarationsPerFile/handleTSInterfaceDeclaration.ts
1310
1323
  function handleTSInterfaceDeclaration(node, types) {
1311
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1324
+ if (!isTopLevel(node)) return;
1325
+ if (!isExportedDeclaration(node.parent)) return;
1326
+ if (node.id?.name) types.add(node.id.name);
1312
1327
  }
1313
1328
  //#endregion
1314
1329
  //#region src/rules/maxDeclarationsPerFile/handleTSTypeAliasDeclaration.ts
1315
1330
  function handleTSTypeAliasDeclaration(node, types) {
1316
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1331
+ if (!isTopLevel(node)) return;
1332
+ if (!isExportedDeclaration(node.parent)) return;
1333
+ if (node.id?.name) types.add(node.id.name);
1317
1334
  }
1318
1335
  //#endregion
1319
1336
  //#region src/rules/maxDeclarationsPerFile/isExempt.ts
@@ -1325,11 +1342,6 @@ function isExempt$1(filename) {
1325
1342
  return isTest || isSpec || isConfig;
1326
1343
  }
1327
1344
  //#endregion
1328
- //#region src/rules/maxDeclarationsPerFile/isExportedDeclaration.ts
1329
- function isExportedDeclaration(parent) {
1330
- return parent?.type === "ExportNamedDeclaration";
1331
- }
1332
- //#endregion
1333
1345
  //#region src/rules/maxDeclarationsPerFile/index.ts
1334
1346
  var maxDeclarationsPerFile = {
1335
1347
  create(context) {
@@ -1383,7 +1395,7 @@ var maxDeclarationsPerFile = {
1383
1395
  },
1384
1396
  meta: {
1385
1397
  docs: { description: "Enforce single top-level declaration per file." },
1386
- messages: { tooManyDeclarations: "File has {{count}} declarations. Put each function/class/const/type declaration in its own file." },
1398
+ messages: { tooManyDeclarations: "File has {{count}} exported declarations. Each file should only export one function, class, const, or type declaration." },
1387
1399
  schema: [],
1388
1400
  type: "suggestion"
1389
1401
  }
@@ -3332,7 +3344,7 @@ var stylisticRules = { rules: {
3332
3344
  var typescriptRules = { rules: {
3333
3345
  "@typescript-eslint/consistent-indexed-object-style": "off",
3334
3346
  "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "separate-type-imports" }],
3335
- "@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
3347
+ "@typescript-eslint/explicit-function-return-type": "off",
3336
3348
  "@typescript-eslint/no-empty-function": "off",
3337
3349
  "@typescript-eslint/no-unused-vars": ["error", {
3338
3350
  argsIgnorePattern: "^_",