@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.esm.js CHANGED
@@ -1270,6 +1270,11 @@ function collectVariableDeclarators(node, types) {
1270
1270
  for (const declarator of node.declarations) if (declarator.id.type === "Identifier" && declarator.id.name) types.add(declarator.id.name);
1271
1271
  }
1272
1272
  //#endregion
1273
+ //#region src/rules/maxDeclarationsPerFile/isExportedDeclaration.ts
1274
+ function isExportedDeclaration(parent) {
1275
+ return parent?.type === "ExportNamedDeclaration";
1276
+ }
1277
+ //#endregion
1273
1278
  //#region src/rules/maxDeclarationsPerFile/isTopLevel.ts
1274
1279
  function isTopLevel(node) {
1275
1280
  if (node.parent?.type === "Program") return true;
@@ -1279,32 +1284,44 @@ function isTopLevel(node) {
1279
1284
  //#endregion
1280
1285
  //#region src/rules/maxDeclarationsPerFile/handleClassDeclaration.ts
1281
1286
  function handleClassDeclaration(node, functions) {
1282
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1287
+ if (!isTopLevel(node)) return;
1288
+ if (!isExportedDeclaration(node.parent)) return;
1289
+ if (node.id?.name) functions.add(node.id.name);
1283
1290
  }
1284
1291
  //#endregion
1285
1292
  //#region src/rules/maxDeclarationsPerFile/handleFunctionDeclaration.ts
1286
1293
  function handleFunctionDeclaration(node, functions) {
1287
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1294
+ if (!isTopLevel(node)) return;
1295
+ if (!isExportedDeclaration(node.parent)) return;
1296
+ if (node.id?.name) functions.add(node.id.name);
1288
1297
  }
1289
1298
  //#endregion
1290
1299
  //#region src/rules/maxDeclarationsPerFile/handleTSDeclareFunction.ts
1291
1300
  function handleTSDeclareFunction(node, functions) {
1292
- if (isTopLevel(node) && node.id?.name) functions.add(node.id.name);
1301
+ if (!isTopLevel(node)) return;
1302
+ if (!isExportedDeclaration(node.parent)) return;
1303
+ if (node.id?.name) functions.add(node.id.name);
1293
1304
  }
1294
1305
  //#endregion
1295
1306
  //#region src/rules/maxDeclarationsPerFile/handleTSEnumDeclaration.ts
1296
1307
  function handleTSEnumDeclaration(node, types) {
1297
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1308
+ if (!isTopLevel(node)) return;
1309
+ if (!isExportedDeclaration(node.parent)) return;
1310
+ if (node.id?.name) types.add(node.id.name);
1298
1311
  }
1299
1312
  //#endregion
1300
1313
  //#region src/rules/maxDeclarationsPerFile/handleTSInterfaceDeclaration.ts
1301
1314
  function handleTSInterfaceDeclaration(node, types) {
1302
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1315
+ if (!isTopLevel(node)) return;
1316
+ if (!isExportedDeclaration(node.parent)) return;
1317
+ if (node.id?.name) types.add(node.id.name);
1303
1318
  }
1304
1319
  //#endregion
1305
1320
  //#region src/rules/maxDeclarationsPerFile/handleTSTypeAliasDeclaration.ts
1306
1321
  function handleTSTypeAliasDeclaration(node, types) {
1307
- if (isTopLevel(node) && node.id?.name) types.add(node.id.name);
1322
+ if (!isTopLevel(node)) return;
1323
+ if (!isExportedDeclaration(node.parent)) return;
1324
+ if (node.id?.name) types.add(node.id.name);
1308
1325
  }
1309
1326
  //#endregion
1310
1327
  //#region src/rules/maxDeclarationsPerFile/isExempt.ts
@@ -1316,11 +1333,6 @@ function isExempt$1(filename) {
1316
1333
  return isTest || isSpec || isConfig;
1317
1334
  }
1318
1335
  //#endregion
1319
- //#region src/rules/maxDeclarationsPerFile/isExportedDeclaration.ts
1320
- function isExportedDeclaration(parent) {
1321
- return parent?.type === "ExportNamedDeclaration";
1322
- }
1323
- //#endregion
1324
1336
  //#region src/rules/maxDeclarationsPerFile/index.ts
1325
1337
  var maxDeclarationsPerFile = {
1326
1338
  create(context) {
@@ -1374,7 +1386,7 @@ var maxDeclarationsPerFile = {
1374
1386
  },
1375
1387
  meta: {
1376
1388
  docs: { description: "Enforce single top-level declaration per file." },
1377
- messages: { tooManyDeclarations: "File has {{count}} declarations. Put each function/class/const/type declaration in its own file." },
1389
+ messages: { tooManyDeclarations: "File has {{count}} exported declarations. Each file should only export one function, class, const, or type declaration." },
1378
1390
  schema: [],
1379
1391
  type: "suggestion"
1380
1392
  }
@@ -3323,7 +3335,7 @@ var stylisticRules = { rules: {
3323
3335
  var typescriptRules = { rules: {
3324
3336
  "@typescript-eslint/consistent-indexed-object-style": "off",
3325
3337
  "@typescript-eslint/consistent-type-imports": ["error", { fixStyle: "separate-type-imports" }],
3326
- "@typescript-eslint/explicit-function-return-type": ["error", { allowExpressions: true }],
3338
+ "@typescript-eslint/explicit-function-return-type": "off",
3327
3339
  "@typescript-eslint/no-empty-function": "off",
3328
3340
  "@typescript-eslint/no-unused-vars": ["error", {
3329
3341
  argsIgnorePattern: "^_",