@blumintinc/eslint-plugin-blumint 1.18.1 → 1.18.2
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/lib/index.js +1 -1
- package/lib/rules/enforce-callable-types.js +5 -1
- package/lib/rules/enforce-is-prefix-validators.js +6 -1
- package/lib/rules/enforce-timestamp-now.js +6 -2
- package/lib/rules/prefer-use-base62-id.js +15 -3
- package/lib/rules/require-https-error.js +5 -1
- package/lib/rules/require-props-composition.js +14 -2
- package/package.json +1 -1
- package/release-manifest.json +54 -0
package/lib/index.js
CHANGED
|
@@ -21,7 +21,11 @@ exports.enforceCallableTypes = (0, createRule_1.createRule)({
|
|
|
21
21
|
},
|
|
22
22
|
defaultOptions: [],
|
|
23
23
|
create(context) {
|
|
24
|
-
|
|
24
|
+
// Normalize Windows backslash separators so the forward-slash `/callable/`
|
|
25
|
+
// path checks below match on every platform. Without this, `getFilename()`
|
|
26
|
+
// returns `C:\repo\...\callable\foo.f.ts` on Windows, the guard bails, and
|
|
27
|
+
// the rule silently enforces nothing (issue #1265).
|
|
28
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
25
29
|
// Only apply to .f.ts files in the callable directory, but ignore scripts directory
|
|
26
30
|
if (!filename.endsWith('.f.ts') ||
|
|
27
31
|
!filename.includes('/callable/') ||
|
|
@@ -180,7 +180,12 @@ exports.enforceIsPrefixValidators = (0, createRule_1.createRule)({
|
|
|
180
180
|
const disallowedPrefixes = options.disallowedPrefixes ?? DEFAULT_DISALLOWED_PREFIXES;
|
|
181
181
|
const excludeNames = options.excludeNames ?? DEFAULT_EXCLUDE_NAMES;
|
|
182
182
|
const excludePatterns = options.excludePatterns ?? DEFAULT_EXCLUDE_PATTERNS;
|
|
183
|
-
|
|
183
|
+
// Normalize Windows backslash separators to forward slashes. `getFilename()`
|
|
184
|
+
// returns backslash paths on Windows, and Minimatch treats `\` as an escape
|
|
185
|
+
// character, so the `**/validators/**` globs never match — the rule silently
|
|
186
|
+
// no-ops on Windows (issue #1269). The `**/`-anchored globs already match
|
|
187
|
+
// absolute POSIX paths, so normalization alone closes the gap.
|
|
188
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
184
189
|
// Build matchers once per file to avoid repeated Minimatch construction.
|
|
185
190
|
const targetMatchers = targetPaths.map((p) => new minimatch_1.Minimatch(p));
|
|
186
191
|
const excludeMatchers = excludePatterns.map((p) => new minimatch_1.Minimatch(p));
|
|
@@ -22,8 +22,12 @@ exports.enforceTimestampNow = (0, createRule_1.createRule)({
|
|
|
22
22
|
defaultOptions: [],
|
|
23
23
|
create(context) {
|
|
24
24
|
const sourceCode = context.getSourceCode();
|
|
25
|
-
// Only apply this rule to backend code (functions/src/)
|
|
26
|
-
|
|
25
|
+
// Only apply this rule to backend code (functions/src/). Normalize Windows
|
|
26
|
+
// backslash separators first so the forward-slash path check matches on
|
|
27
|
+
// every platform — otherwise `getFilename()` returns `C:\repo\functions\
|
|
28
|
+
// src\...` on Windows, the guard bails, and the rule silently enforces
|
|
29
|
+
// nothing (issue #1266).
|
|
30
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
27
31
|
if (!filename.includes('functions/src/')) {
|
|
28
32
|
return {};
|
|
29
33
|
}
|
|
@@ -204,9 +204,21 @@ exports.preferUseBase62Id = (0, createRule_1.createRule)({
|
|
|
204
204
|
defaultOptions: [{}],
|
|
205
205
|
create(context, [options]) {
|
|
206
206
|
const targetPaths = options.targetPaths ?? DEFAULT_TARGET_PATHS;
|
|
207
|
-
// Check whether the current file is inside a target path
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
// Check whether the current file is inside a target path. `getFilename()`
|
|
208
|
+
// returns an absolute, platform-native path, but `targetPaths` are
|
|
209
|
+
// repo-relative globs (`src/hooks/**`), so a raw minimatch never matches an
|
|
210
|
+
// absolute path — on any platform. Normalize backslashes, then match the
|
|
211
|
+
// pattern against both the full path and the repo-relative slice (from
|
|
212
|
+
// `/src/`) so absolute POSIX and Windows paths both resolve (issue #1267).
|
|
213
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
214
|
+
const isInTargetPath = targetPaths.some((pattern) => {
|
|
215
|
+
if ((0, minimatch_1.minimatch)(filename, pattern, { matchBase: false })) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
const srcIdx = filename.indexOf('/src/');
|
|
219
|
+
return (srcIdx !== -1 &&
|
|
220
|
+
(0, minimatch_1.minimatch)(filename.slice(srcIdx + 1), pattern, { matchBase: false }));
|
|
221
|
+
});
|
|
210
222
|
if (!isInTargetPath)
|
|
211
223
|
return {};
|
|
212
224
|
// Local names bound to the uuidv4Base62 export in the current file
|
|
@@ -17,7 +17,11 @@ module.exports = (0, createRule_1.createRule)({
|
|
|
17
17
|
},
|
|
18
18
|
defaultOptions: [],
|
|
19
19
|
create(context) {
|
|
20
|
-
|
|
20
|
+
// Normalize Windows backslash separators so the forward-slash path check
|
|
21
|
+
// below matches on every platform. Without this, `getFilename()` returns
|
|
22
|
+
// `C:\repo\functions\src\...` on Windows, the guard bails, and the rule
|
|
23
|
+
// silently enforces nothing (issue #1264).
|
|
24
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
21
25
|
// Only apply rule to files in functions/src directory
|
|
22
26
|
if (!filename.includes('functions/src')) {
|
|
23
27
|
return {};
|
|
@@ -282,8 +282,20 @@ exports.requirePropsComposition = (0, createRule_1.createRule)({
|
|
|
282
282
|
const minDependencyCount = options?.minDependencyCount ?? 1;
|
|
283
283
|
const requireAllDependencies = options?.requireAllDependencies ?? false;
|
|
284
284
|
// Check whether the current file matches any of the targetPaths globs.
|
|
285
|
-
|
|
286
|
-
|
|
285
|
+
// `getFilename()` returns an absolute, platform-native path, but the globs
|
|
286
|
+
// are repo-relative (`src/components/**`), so a raw minimatch never matches
|
|
287
|
+
// an absolute path — on any platform. Normalize backslashes, then match each
|
|
288
|
+
// pattern against both the full path and the repo-relative slice (from
|
|
289
|
+
// `/src/`) so absolute POSIX and Windows paths both resolve (issue #1268).
|
|
290
|
+
const filename = context.getFilename().replace(/\\/g, '/');
|
|
291
|
+
const matchesTargetPath = targetPaths.some((pattern) => {
|
|
292
|
+
if ((0, minimatch_1.minimatch)(filename, pattern, { matchBase: false })) {
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
const srcIdx = filename.indexOf('/src/');
|
|
296
|
+
return (srcIdx !== -1 &&
|
|
297
|
+
(0, minimatch_1.minimatch)(filename.slice(srcIdx + 1), pattern, { matchBase: false }));
|
|
298
|
+
});
|
|
287
299
|
if (!matchesTargetPath) {
|
|
288
300
|
return {};
|
|
289
301
|
}
|
package/package.json
CHANGED
package/release-manifest.json
CHANGED
|
@@ -1,4 +1,58 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "1.18.2",
|
|
4
|
+
"date": "2026-07-06T05:00:28.741Z",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "enforce-callable-types",
|
|
8
|
+
"changeType": "fix",
|
|
9
|
+
"issues": [
|
|
10
|
+
1265
|
|
11
|
+
],
|
|
12
|
+
"summary": "normalize Windows path separators before path check (closes #1265)"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "enforce-is-prefix-validators",
|
|
16
|
+
"changeType": "fix",
|
|
17
|
+
"issues": [
|
|
18
|
+
1269
|
|
19
|
+
],
|
|
20
|
+
"summary": "normalize Windows path separators before matching (closes #1269)"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "enforce-timestamp-now",
|
|
24
|
+
"changeType": "fix",
|
|
25
|
+
"issues": [
|
|
26
|
+
1266
|
|
27
|
+
],
|
|
28
|
+
"summary": "normalize Windows path separators before path check (closes #1266)"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "prefer-use-base62-id",
|
|
32
|
+
"changeType": "fix",
|
|
33
|
+
"issues": [
|
|
34
|
+
1267
|
|
35
|
+
],
|
|
36
|
+
"summary": "resolve absolute filenames against target path globs (closes #1267)"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "require-https-error",
|
|
40
|
+
"changeType": "fix",
|
|
41
|
+
"issues": [
|
|
42
|
+
1264
|
|
43
|
+
],
|
|
44
|
+
"summary": "normalize Windows path separators before path check (closes #1264)"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "require-props-composition",
|
|
48
|
+
"changeType": "fix",
|
|
49
|
+
"issues": [
|
|
50
|
+
1268
|
|
51
|
+
],
|
|
52
|
+
"summary": "resolve absolute filenames against target path globs (closes #1268)"
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
},
|
|
2
56
|
{
|
|
3
57
|
"version": "1.18.1",
|
|
4
58
|
"date": "2026-07-06T03:35:53.804Z",
|