@iobroker/repochecker 5.10.1 → 5.10.3

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/README.md CHANGED
@@ -25,6 +25,14 @@ Example:
25
25
  Placeholder for the next version (at the beginning of the line):
26
26
  ### **WORK IN PROGRESS**
27
27
  -->
28
+ ### 5.10.3 (2026-04-11)
29
+ - (@copilot) Fixed false positive W5042 for TypeScript type-only imports: `import type { Foo } from 'pkg'` no longer registers `pkg` as a required runtime dependency. Related to [#833]
30
+
31
+ ### 5.10.2 (2026-04-11)
32
+ - (@copilot) Fixed false positive `[E9507]` for i18n directories inside source directories (`src-rules`, `rules-src`, `src-editor`, `src-widgets`, `admin/src`, etc.) by expanding the ignored source directory list and checking the full parent path instead of only the top-level segment. Related to [#828].
33
+ - (@copilot) Added adapter-specific exceptions to E0050 blacklist: `@iobroker/plugin-sentry` is now allowed as a dependency for `ioBroker.javascript`.
34
+ - (@copilot) Added system-provided packages ignore list for W5042: `@iobroker/plugin-sentry` will no longer raise "dependency might be missing" warnings as it is provided by js-controller.
35
+
28
36
  ### 5.10.1 (2026-04-10)
29
37
  - (@copilot) Fixed `TypeError: minimatch is not a function` in `checkNpmIgnore` by correctly destructuring `minimatch` from the `minimatch` v10+ package export.
30
38
  - (@copilot) Added `minimatch` as an explicit dependency in `package.json` (used by `M9000_GitNpmIgnore.js` for glob pattern matching).
@@ -131,6 +131,7 @@ const blacklistedAllDependenciesPackageJson = {
131
131
  '@iobroker/plugin-sentry': {
132
132
  msg: "'@iobroker/plugin-sentry' must not be listed as any dependency at package.json as it will crash js-controller 7 systems. Please remove and create new release.",
133
133
  err: true,
134
+ exceptions: ['javascript'],
134
135
  },
135
136
  '@iobroker/repochecker': {
136
137
  msg: "'@iobroker/repochecker' must not be listed as any dependency at package.json. Please remove and create new release.",
@@ -749,6 +750,13 @@ async function checkPackageJson(context) {
749
750
  continue;
750
751
  }
751
752
 
753
+ if (
754
+ blacklistedDependenciesPackageJson[blacklist].exceptions &&
755
+ blacklistedDependenciesPackageJson[blacklist].exceptions.includes(adapterName)
756
+ ) {
757
+ continue;
758
+ }
759
+
752
760
  // if (context.packageJson.dependencies[blacklist]) {
753
761
  // if (blacklistedDependenciesPackageJson[blacklist].err) {
754
762
  // context.errors.push(`[E0050] ${blacklistedDependenciesPackageJson[blacklist].msg}`);
@@ -795,6 +803,13 @@ async function checkPackageJson(context) {
795
803
  continue;
796
804
  }
797
805
 
806
+ if (
807
+ blacklistedDevDependenciesPackageJson[blacklist].exceptions &&
808
+ blacklistedDevDependenciesPackageJson[blacklist].exceptions.includes(adapterName)
809
+ ) {
810
+ continue;
811
+ }
812
+
798
813
  // if (context.packageJson.devDependencies[blacklist]) {
799
814
  // if (blacklistedDevDependenciesPackageJson[blacklist].err) {
800
815
  // context.errors.push(`[E0050] ${blacklistedDevDependenciesPackageJson[blacklist].msg}`);
@@ -841,6 +856,13 @@ async function checkPackageJson(context) {
841
856
  continue;
842
857
  }
843
858
 
859
+ if (
860
+ blacklistedPeerDependenciesPackageJson[blacklist].exceptions &&
861
+ blacklistedPeerDependenciesPackageJson[blacklist].exceptions.includes(adapterName)
862
+ ) {
863
+ continue;
864
+ }
865
+
844
866
  if (context.packageJson.peerDependencies[blacklist]) {
845
867
  if (blacklistedPeerDependenciesPackageJson[blacklist].err) {
846
868
  context.errors.push(`[E0050] ${blacklistedPeerDependenciesPackageJson[blacklist].msg}`);
@@ -866,6 +888,13 @@ async function checkPackageJson(context) {
866
888
  continue;
867
889
  }
868
890
 
891
+ if (
892
+ blacklistedOptionalDependenciesPackageJson[blacklist].exceptions &&
893
+ blacklistedOptionalDependenciesPackageJson[blacklist].exceptions.includes(adapterName)
894
+ ) {
895
+ continue;
896
+ }
897
+
869
898
  if (context.packageJson.optionalDependencies[blacklist]) {
870
899
  if (blacklistedOptionalDependenciesPackageJson[blacklist].err) {
871
900
  context.errors.push(`[E0052] ${blacklistedOptionalDependenciesPackageJson[blacklist].msg}`);
package/lib/M5000_Code.js CHANGED
@@ -226,7 +226,9 @@ function extractImports(content) {
226
226
  // import statements are each matched independently.
227
227
  // The negative lookahead (?!\s*\() excludes dynamic imports like import("pkg")
228
228
  // which would otherwise span many lines and falsely match 'from' in string literals.
229
- const fromPattern = /\b(?:import)\b(?!\s*\()[\s\S]*?\bfrom\s+['"`]([^'"`\n]+)['"`]/g;
229
+ // The negative lookahead (?!\s+type\b) excludes TypeScript type-only imports like
230
+ // `import type { Foo } from 'pkg'` which do not require runtime dependencies.
231
+ const fromPattern = /\b(?:import)\b(?!\s*\()(?!\s+type\b)[\s\S]*?\bfrom\s+['"`]([^'"`\n]+)['"`]/g;
230
232
  while ((match = fromPattern.exec(code)) !== null) {
231
233
  common.debug(` import from: found ${match[1]}`);
232
234
  imports.add(match[1]);
@@ -1274,6 +1276,9 @@ async function checkCode(context) {
1274
1276
  }
1275
1277
  }
1276
1278
 
1279
+ // Packages known to be provided by the js-controller/system and therefore not required as dependencies
1280
+ const systemProvidedPackages = new Set(['@iobroker/plugin-sentry']);
1281
+
1277
1282
  // W5042/S5043: Scan source files for require/import statements and check dependencies
1278
1283
  // Exclude files in admin/, build/, doc/, src-admin/, admin-src/, test/ directories
1279
1284
  // and *.test.* and *.config.* files
@@ -1284,9 +1289,11 @@ async function checkCode(context) {
1284
1289
  'doc',
1285
1290
  'src-admin',
1286
1291
  'src-editor', // java-script adapter
1292
+ 'src-rules',
1287
1293
  'src-widgets',
1288
1294
  'widgets',
1289
1295
  'admin-src',
1296
+ 'rules-src',
1290
1297
  'test',
1291
1298
  'node_modules',
1292
1299
  '.git',
@@ -1385,6 +1392,11 @@ async function checkCode(context) {
1385
1392
  continue;
1386
1393
  }
1387
1394
 
1395
+ // Skip packages known to be provided by the js-controller/system
1396
+ if (systemProvidedPackages.has(packageName)) {
1397
+ continue;
1398
+ }
1399
+
1388
1400
  // For @types/* packages, devDependencies is also acceptable
1389
1401
  if (packageName.startsWith('@types/') && packageDevDependencies[packageName]) {
1390
1402
  continue;
@@ -17,15 +17,27 @@
17
17
  // const common = require('./common.js');
18
18
  const { minimatch } = require('minimatch');
19
19
 
20
- // Source directories whose i18n subdirectories are excluded from npm packaging checks,
21
- // since their contents are typically compiled/moved to build/ or admin/ during the build process.
22
- const SRC_DIRS_TO_IGNORE = ['src', 'src-admin', 'admin-src'];
20
+ // Source directories (or directory paths) whose i18n subdirectories are excluded from npm packaging
21
+ // checks, since their contents are typically compiled/moved to build/ or admin/ during the build
22
+ // process. Entries may be top-level directory names (e.g. 'src') or multi-level paths (e.g.
23
+ // 'admin/src'). An i18n directory is ignored when its parent path equals one of these entries or
24
+ // starts with one of these entries followed by '/'.
25
+ const SRC_DIRS_TO_IGNORE = [
26
+ 'src',
27
+ 'src-admin',
28
+ 'src-editor',
29
+ 'src-rules',
30
+ 'src-widgets',
31
+ 'admin-src',
32
+ 'rules-src',
33
+ 'admin/src',
34
+ ];
23
35
 
24
36
  /**
25
37
  * Returns a deduplicated list of i18n directory paths found in the given file list.
26
38
  * Example: '/admin/i18n/en/translations.json' → '/admin/i18n'
27
- * Directories under src, src-admin or admin-src are excluded as those are build sources
28
- * and are not packaged directly.
39
+ * Directories whose parent path matches any entry in SRC_DIRS_TO_IGNORE (exact match or prefix)
40
+ * are excluded because their contents are build sources and are not packaged directly.
29
41
  *
30
42
  * @param {string[]} filesList list of file paths from the repository (each with a leading slash)
31
43
  * @returns {string[]} array of unique i18n directory paths with leading slash
@@ -35,10 +47,16 @@ function findI18nDirs(filesList) {
35
47
  for (const file of filesList) {
36
48
  const match = file.match(/^(\/(?:[^/]+\/)*i18n)(?:\/|$)/);
37
49
  if (match) {
38
- const i18nDir = match[1]; // e.g. '/admin/i18n'
39
- // Skip i18n dirs that reside directly inside a source directory
40
- const topLevel = i18nDir.replace(/^\//, '').split('/')[0];
41
- if (!SRC_DIRS_TO_IGNORE.includes(topLevel)) {
50
+ const i18nDir = match[1]; // e.g. '/admin/i18n' or '/src-rules/src/i18n'
51
+ const i18nPath = i18nDir.replace(/^\//, ''); // strip leading slash
52
+ // parentPath is everything before the final '/i18n' segment
53
+ const parts = i18nPath.split('/');
54
+ const parentPath = parts.slice(0, -1).join('/'); // e.g. 'admin', 'src-rules/src', ''
55
+ // Skip i18n dirs that reside inside a known source directory (or sub-path thereof)
56
+ const isInSrcDir = SRC_DIRS_TO_IGNORE.some(
57
+ srcDir => parentPath === srcDir || parentPath.startsWith(`${srcDir}/`),
58
+ );
59
+ if (!isInSrcDir) {
42
60
  i18nDirs.add(i18nDir);
43
61
  }
44
62
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.10.1",
2
+ "version": "5.10.3",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.18.0",