@sarj/eslint-plugin 16.21.0 → 16.21.1
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 +5 -2
- package/dist/index.js +5 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
52
52
|
// package.json
|
|
53
53
|
var package_default = {
|
|
54
54
|
name: "@sarj/eslint-plugin",
|
|
55
|
-
version: "16.21.
|
|
55
|
+
version: "16.21.1",
|
|
56
56
|
packageManager: "npm@12.2.0",
|
|
57
57
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
58
58
|
type: "module",
|
|
@@ -11243,7 +11243,9 @@ var NO_POSITIONAL_TUPLE_RETURN_DOCUMENTATION = {
|
|
|
11243
11243
|
limitations: ["Declared or syntax-proven multi-field tuple returns on named functions and public type surfaces are inspected; anonymous inline callbacks and syntax-proven TanStack Query key factories are excluded."],
|
|
11244
11244
|
examples: [
|
|
11245
11245
|
{ id: "named-object-return", title: "Return named fields", outcome: "no-match", files: [{ path: "src/download.ts", source: "export function download(): { body: string; status: number } { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 0, public: true },
|
|
11246
|
-
{ id: "tuple-return", title: "Do not expose positional fields", outcome: "match", files: [{ path: "src/download.ts", source: "export function download(): [string, number] { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 1, public: true }
|
|
11246
|
+
{ id: "tuple-return", title: "Do not expose positional fields", outcome: "match", files: [{ path: "src/download.ts", source: "export function download(): [string, number] { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 1, public: true },
|
|
11247
|
+
{ id: "query-key-outer-const", scenarioId: "query-key-const-anchor", title: "Inherit the query-key anchor const context", outcome: "no-match", files: [{ path: "src/keys.ts", source: "const userKeys = { all: ['users'], detail: (id: string) => [...userKeys.all, id] as const } as const;" }], focusPath: "src/keys.ts", expectedCount: 0, public: true },
|
|
11248
|
+
{ id: "mutable-query-key-object", scenarioId: "query-key-const-anchor", title: "Keep a mutable tuple-return object checked", outcome: "match", files: [{ path: "src/keys.ts", source: "const userKeys = { all: ['users'], detail: (id: string) => [...userKeys.all, id] as const };" }], focusPath: "src/keys.ts", expectedCount: 1, public: true }
|
|
11247
11249
|
]
|
|
11248
11250
|
};
|
|
11249
11251
|
var MIN_ELEMENTS = 2;
|
|
@@ -11320,6 +11322,7 @@ function isQueryKeyFactory(node) {
|
|
|
11320
11322
|
if (declarator.type !== import_utils65.AST_NODE_TYPES.VariableDeclarator || declarator.id.type !== import_utils65.AST_NODE_TYPES.Identifier || !/Keys$/i.test(declarator.id.name) || declarator.parent.type !== import_utils65.AST_NODE_TYPES.VariableDeclaration || declarator.parent.kind !== "const") return false;
|
|
11321
11323
|
return object.properties.some((candidate2) => {
|
|
11322
11324
|
if (candidate2.type !== import_utils65.AST_NODE_TYPES.Property || staticMemberName4(candidate2.key) !== "all") return false;
|
|
11325
|
+
if (candidate2.value.type === import_utils65.AST_NODE_TYPES.ArrayExpression) return !candidate2.computed;
|
|
11323
11326
|
return candidate2.value.type === import_utils65.AST_NODE_TYPES.TSAsExpression && candidate2.value.expression.type === import_utils65.AST_NODE_TYPES.ArrayExpression && candidate2.value.typeAnnotation.type === import_utils65.AST_NODE_TYPES.TSTypeReference && candidate2.value.typeAnnotation.typeName.type === import_utils65.AST_NODE_TYPES.Identifier && candidate2.value.typeAnnotation.typeName.name === "const";
|
|
11324
11327
|
});
|
|
11325
11328
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
var package_default = {
|
|
3
3
|
name: "@sarj/eslint-plugin",
|
|
4
|
-
version: "16.21.
|
|
4
|
+
version: "16.21.1",
|
|
5
5
|
packageManager: "npm@12.2.0",
|
|
6
6
|
description: "Custom ESLint rules for hypermodern TypeScript / React / Next.js projects",
|
|
7
7
|
type: "module",
|
|
@@ -11224,7 +11224,9 @@ var NO_POSITIONAL_TUPLE_RETURN_DOCUMENTATION = {
|
|
|
11224
11224
|
limitations: ["Declared or syntax-proven multi-field tuple returns on named functions and public type surfaces are inspected; anonymous inline callbacks and syntax-proven TanStack Query key factories are excluded."],
|
|
11225
11225
|
examples: [
|
|
11226
11226
|
{ id: "named-object-return", title: "Return named fields", outcome: "no-match", files: [{ path: "src/download.ts", source: "export function download(): { body: string; status: number } { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 0, public: true },
|
|
11227
|
-
{ id: "tuple-return", title: "Do not expose positional fields", outcome: "match", files: [{ path: "src/download.ts", source: "export function download(): [string, number] { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 1, public: true }
|
|
11227
|
+
{ id: "tuple-return", title: "Do not expose positional fields", outcome: "match", files: [{ path: "src/download.ts", source: "export function download(): [string, number] { return impl(); }" }], focusPath: "src/download.ts", expectedCount: 1, public: true },
|
|
11228
|
+
{ id: "query-key-outer-const", scenarioId: "query-key-const-anchor", title: "Inherit the query-key anchor const context", outcome: "no-match", files: [{ path: "src/keys.ts", source: "const userKeys = { all: ['users'], detail: (id: string) => [...userKeys.all, id] as const } as const;" }], focusPath: "src/keys.ts", expectedCount: 0, public: true },
|
|
11229
|
+
{ id: "mutable-query-key-object", scenarioId: "query-key-const-anchor", title: "Keep a mutable tuple-return object checked", outcome: "match", files: [{ path: "src/keys.ts", source: "const userKeys = { all: ['users'], detail: (id: string) => [...userKeys.all, id] as const };" }], focusPath: "src/keys.ts", expectedCount: 1, public: true }
|
|
11228
11230
|
]
|
|
11229
11231
|
};
|
|
11230
11232
|
var MIN_ELEMENTS = 2;
|
|
@@ -11301,6 +11303,7 @@ function isQueryKeyFactory(node) {
|
|
|
11301
11303
|
if (declarator.type !== AST_NODE_TYPES55.VariableDeclarator || declarator.id.type !== AST_NODE_TYPES55.Identifier || !/Keys$/i.test(declarator.id.name) || declarator.parent.type !== AST_NODE_TYPES55.VariableDeclaration || declarator.parent.kind !== "const") return false;
|
|
11302
11304
|
return object.properties.some((candidate2) => {
|
|
11303
11305
|
if (candidate2.type !== AST_NODE_TYPES55.Property || staticMemberName4(candidate2.key) !== "all") return false;
|
|
11306
|
+
if (candidate2.value.type === AST_NODE_TYPES55.ArrayExpression) return !candidate2.computed;
|
|
11304
11307
|
return candidate2.value.type === AST_NODE_TYPES55.TSAsExpression && candidate2.value.expression.type === AST_NODE_TYPES55.ArrayExpression && candidate2.value.typeAnnotation.type === AST_NODE_TYPES55.TSTypeReference && candidate2.value.typeAnnotation.typeName.type === AST_NODE_TYPES55.Identifier && candidate2.value.typeAnnotation.typeName.name === "const";
|
|
11305
11308
|
});
|
|
11306
11309
|
}
|