@dloizides/frontend-devtools 2.1.0 → 2.2.0
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/CHANGELOG.md +8 -0
- package/dist/eslint/index.d.mts +4 -1
- package/dist/eslint/index.d.ts +4 -1
- package/dist/eslint/index.js +170 -26
- package/dist/eslint/index.js.map +1 -1
- package/dist/eslint/index.mjs +169 -27
- package/dist/eslint/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to `@dloizides/frontend-devtools` are documented here.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.0] - 2026-10-23
|
|
9
|
+
|
|
10
|
+
FOCUS-1 "Every screen names its initial focus", D-FOCUS-2 "Lint rule and ledger".
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `explicit-initial-focus`: flags a file that builds a menu of 2+ buttons (HTML strings or `createElement('button')`) with no `MENU_DEFAULT_ATTR` / `data-menu-default` / `dataset.menuDefault` / `initialFocus`, and a JSX `*Dialog` / `*Modal` / `role="dialog"` in a file with no `autoFocus`, `initialFocus(Ref)` or `.focus()` call. Options: `minControls`, `dialogPattern`, `selfFocusing`.
|
|
14
|
+
- `focusConfig` + `FOCUS_RULE_NAMES` (opt-in, not part of `recommendedConfig` or `gameConfig`).
|
|
15
|
+
|
|
8
16
|
## [2.1.0] - 2026-10-20
|
|
9
17
|
|
|
10
18
|
QUAL-ADOPT-1 "Fail lint/arch tests when an app re-implements an existing package" (TS half).
|
package/dist/eslint/index.d.mts
CHANGED
|
@@ -95,5 +95,8 @@ declare const REUSE_RULE_NAMES: readonly string[];
|
|
|
95
95
|
declare const reuseConfig: FlatConfig;
|
|
96
96
|
/** The recommended flat-config block: every rule the pack enables by default, at error. */
|
|
97
97
|
declare const recommendedConfig: FlatConfig;
|
|
98
|
+
declare const FOCUS_RULE_NAMES: readonly string[];
|
|
99
|
+
/** FOCUS-1: a game menu or dialog names the control focused on open. Opt-in, not part of recommendedConfig. */
|
|
100
|
+
declare const focusConfig: FlatConfig;
|
|
98
101
|
|
|
99
|
-
export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
|
|
102
|
+
export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
|
package/dist/eslint/index.d.ts
CHANGED
|
@@ -95,5 +95,8 @@ declare const REUSE_RULE_NAMES: readonly string[];
|
|
|
95
95
|
declare const reuseConfig: FlatConfig;
|
|
96
96
|
/** The recommended flat-config block: every rule the pack enables by default, at error. */
|
|
97
97
|
declare const recommendedConfig: FlatConfig;
|
|
98
|
+
declare const FOCUS_RULE_NAMES: readonly string[];
|
|
99
|
+
/** FOCUS-1: a game menu or dialog names the control focused on open. Opt-in, not part of recommendedConfig. */
|
|
100
|
+
declare const focusConfig: FlatConfig;
|
|
98
101
|
|
|
99
|
-
export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
|
|
102
|
+
export { API_RULE_NAMES, COMMENT_RULE_NAMES, type CustomRule, FOCUS_RULE_NAMES, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, HOUSE_PATTERN_RULE_NAMES, REUSE_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, apiConfig, commentsConfig, focusConfig, gameConfig, legacyPlugins, patternPacksConfig, plugin, recommendedConfig, reuseConfig, rowActionsConfig, ruleNames, rules };
|
package/dist/eslint/index.js
CHANGED
|
@@ -965,6 +965,132 @@ var enum_file_isolation_default = {
|
|
|
965
965
|
}
|
|
966
966
|
};
|
|
967
967
|
|
|
968
|
+
// src/rules/explicit-initial-focus.js
|
|
969
|
+
var DEFAULT_MIN_CONTROLS = 2;
|
|
970
|
+
var DEFAULT_DIALOG_PATTERN = "(Dialog|Modal)$";
|
|
971
|
+
var MENU_DEFAULT_IDENTIFIER = "MENU_DEFAULT_ATTR";
|
|
972
|
+
var MENU_DEFAULT_TEXT = "data-menu-default";
|
|
973
|
+
var MENU_DEFAULT_DATASET_KEY = "menuDefault";
|
|
974
|
+
var FOCUS_METHOD = "focus";
|
|
975
|
+
var FOCUS_PROP_NAMES = /* @__PURE__ */ new Set(["autoFocus", "initialFocus", "initialFocusRef", MENU_DEFAULT_TEXT]);
|
|
976
|
+
var FOCUS_OPTION_KEYS = /* @__PURE__ */ new Set(["initialFocus", "initialFocusRef", "autoFocus"]);
|
|
977
|
+
var DIALOG_ROLE_PROPS = /* @__PURE__ */ new Set(["role", "accessibilityRole"]);
|
|
978
|
+
var BUTTON_TAG = /<button\b/gi;
|
|
979
|
+
function propertyName(member) {
|
|
980
|
+
if (!member.computed && member.property.type === "Identifier") return member.property.name;
|
|
981
|
+
const prop = member.property;
|
|
982
|
+
return prop.type === "Literal" && typeof prop.value === "string" ? prop.value : void 0;
|
|
983
|
+
}
|
|
984
|
+
function keyName(key) {
|
|
985
|
+
if (key.type === "Identifier") return key.name;
|
|
986
|
+
return key.type === "Literal" && typeof key.value === "string" ? key.value : void 0;
|
|
987
|
+
}
|
|
988
|
+
function jsxName(name) {
|
|
989
|
+
if (name.type === "JSXIdentifier") return name.name;
|
|
990
|
+
if (name.type === "JSXMemberExpression") return name.property.name;
|
|
991
|
+
if (name.type === "JSXNamespacedName") return `${name.namespace.name}:${name.name.name}`;
|
|
992
|
+
return void 0;
|
|
993
|
+
}
|
|
994
|
+
function attributeText(attr) {
|
|
995
|
+
const value = attr.value;
|
|
996
|
+
if (!value) return void 0;
|
|
997
|
+
if (value.type === "Literal" && typeof value.value === "string") return value.value;
|
|
998
|
+
const inner = value.type === "JSXExpressionContainer" ? value.expression : void 0;
|
|
999
|
+
return inner && inner.type === "Literal" && typeof inner.value === "string" ? inner.value : void 0;
|
|
1000
|
+
}
|
|
1001
|
+
function isDialogRole(attr) {
|
|
1002
|
+
if (attr.type !== "JSXAttribute" || !DIALOG_ROLE_PROPS.has(jsxName(attr.name) ?? "")) return false;
|
|
1003
|
+
return attributeText(attr) === "dialog";
|
|
1004
|
+
}
|
|
1005
|
+
function readOptions(context) {
|
|
1006
|
+
const options = context.options[0] ?? {};
|
|
1007
|
+
return {
|
|
1008
|
+
minControls: options.minControls ?? DEFAULT_MIN_CONTROLS,
|
|
1009
|
+
dialogPattern: new RegExp(options.dialogPattern ?? DEFAULT_DIALOG_PATTERN),
|
|
1010
|
+
selfFocusing: new Set(options.selfFocusing ?? [])
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
var rule = {
|
|
1014
|
+
meta: {
|
|
1015
|
+
type: "problem",
|
|
1016
|
+
docs: {
|
|
1017
|
+
description: "FOCUS-1: a game menu or a dialog names the control focused on open (data-menu-default, autoFocus, initialFocus or a ref focus), never the first element by default."
|
|
1018
|
+
},
|
|
1019
|
+
schema: [
|
|
1020
|
+
{
|
|
1021
|
+
type: "object",
|
|
1022
|
+
properties: {
|
|
1023
|
+
minControls: { type: "integer", minimum: 1 },
|
|
1024
|
+
dialogPattern: { type: "string" },
|
|
1025
|
+
selfFocusing: { type: "array", items: { type: "string" } }
|
|
1026
|
+
},
|
|
1027
|
+
additionalProperties: false
|
|
1028
|
+
}
|
|
1029
|
+
],
|
|
1030
|
+
messages: {
|
|
1031
|
+
missingMenuDefault: "This file builds a menu of {{count}} buttons but names no initial focus. Mark the primary next step with MENU_DEFAULT_ATTR (data-menu-default) or pass initialFocus; never a destructive action.",
|
|
1032
|
+
missingDialogFocus: "'{{name}}' opens a dialog but the file names no initial focus. Give the primary next step autoFocus, an initialFocus prop or a ref focus on mount; never a destructive action."
|
|
1033
|
+
}
|
|
1034
|
+
},
|
|
1035
|
+
create(context) {
|
|
1036
|
+
const options = readOptions(context);
|
|
1037
|
+
let named = false;
|
|
1038
|
+
let controlCount = 0;
|
|
1039
|
+
let firstControl;
|
|
1040
|
+
const dialogs = [];
|
|
1041
|
+
const countControls = (node, text) => {
|
|
1042
|
+
const found = (text.match(BUTTON_TAG) ?? []).length;
|
|
1043
|
+
if (found === 0) return;
|
|
1044
|
+
controlCount += found;
|
|
1045
|
+
firstControl ?? (firstControl = node);
|
|
1046
|
+
};
|
|
1047
|
+
const scanText = (node, text) => {
|
|
1048
|
+
if (text.includes(MENU_DEFAULT_TEXT)) named = true;
|
|
1049
|
+
countControls(node, text);
|
|
1050
|
+
};
|
|
1051
|
+
return {
|
|
1052
|
+
Identifier(node) {
|
|
1053
|
+
if (node.name === MENU_DEFAULT_IDENTIFIER) named = true;
|
|
1054
|
+
},
|
|
1055
|
+
Literal(node) {
|
|
1056
|
+
if (typeof node.value === "string" && node.parent.type !== "JSXAttribute") scanText(node, node.value);
|
|
1057
|
+
},
|
|
1058
|
+
TemplateElement(node) {
|
|
1059
|
+
scanText(node, node.value.cooked ?? node.value.raw);
|
|
1060
|
+
},
|
|
1061
|
+
MemberExpression(node) {
|
|
1062
|
+
if (propertyName(node) === MENU_DEFAULT_DATASET_KEY) named = true;
|
|
1063
|
+
},
|
|
1064
|
+
Property(node) {
|
|
1065
|
+
if (FOCUS_OPTION_KEYS.has(keyName(node.key) ?? "")) named = true;
|
|
1066
|
+
},
|
|
1067
|
+
CallExpression(node) {
|
|
1068
|
+
if (node.callee.type !== "MemberExpression") return;
|
|
1069
|
+
const name = propertyName(node.callee);
|
|
1070
|
+
if (name === FOCUS_METHOD) named = true;
|
|
1071
|
+
const tag = node.arguments[0];
|
|
1072
|
+
const isButton = name === "createElement" && tag && tag.type === "Literal" && String(tag.value).toLowerCase() === "button";
|
|
1073
|
+
if (isButton) countControls(node, "<button");
|
|
1074
|
+
},
|
|
1075
|
+
JSXAttribute(node) {
|
|
1076
|
+
if (FOCUS_PROP_NAMES.has(jsxName(node.name) ?? "")) named = true;
|
|
1077
|
+
},
|
|
1078
|
+
JSXOpeningElement(node) {
|
|
1079
|
+
const name = jsxName(node.name) ?? "";
|
|
1080
|
+
if (options.selfFocusing.has(name)) return;
|
|
1081
|
+
const isDialog = options.dialogPattern.test(name) || node.attributes.some(isDialogRole);
|
|
1082
|
+
if (isDialog) dialogs.push({ node, name });
|
|
1083
|
+
},
|
|
1084
|
+
"Program:exit"() {
|
|
1085
|
+
if (named) return;
|
|
1086
|
+
if (controlCount >= options.minControls) context.report({ node: firstControl, messageId: "missingMenuDefault", data: { count: String(controlCount) } });
|
|
1087
|
+
dialogs.forEach(({ node, name }) => context.report({ node, messageId: "missingDialogFocus", data: { name } }));
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
};
|
|
1092
|
+
var explicit_initial_focus_default = { rules: { "explicit-initial-focus": rule } };
|
|
1093
|
+
|
|
968
1094
|
// src/rules/game-menu-focusable.js
|
|
969
1095
|
var POINTER_EVENTS = /* @__PURE__ */ new Set(["click", "pointerdown", "pointerup"]);
|
|
970
1096
|
var NON_FOCUSABLE_TAGS = /* @__PURE__ */ new Set(["div", "span", "li", "img"]);
|
|
@@ -999,14 +1125,14 @@ function stringValue(node) {
|
|
|
999
1125
|
if (target.type === "TemplateLiteral" && target.expressions.length === 0) return target.quasis[0].value.cooked;
|
|
1000
1126
|
return void 0;
|
|
1001
1127
|
}
|
|
1002
|
-
function
|
|
1128
|
+
function propertyName2(member) {
|
|
1003
1129
|
if (member.computed) return stringValue(member.property);
|
|
1004
1130
|
return member.property.type === "Identifier" ? member.property.name : void 0;
|
|
1005
1131
|
}
|
|
1006
1132
|
function createdTag(init) {
|
|
1007
1133
|
const call = unwrap(init);
|
|
1008
1134
|
if (!call || call.type !== "CallExpression") return void 0;
|
|
1009
|
-
if (call.callee.type !== "MemberExpression" ||
|
|
1135
|
+
if (call.callee.type !== "MemberExpression" || propertyName2(call.callee) !== "createElement") return void 0;
|
|
1010
1136
|
const tag = stringValue(call.arguments[0]);
|
|
1011
1137
|
return tag === void 0 ? void 0 : tag.toLowerCase();
|
|
1012
1138
|
}
|
|
@@ -1018,7 +1144,7 @@ function nonFocusableTag(variable) {
|
|
|
1018
1144
|
function setsFocusAttribute(reference) {
|
|
1019
1145
|
const member = reference.identifier.parent;
|
|
1020
1146
|
if (!member || member.type !== "MemberExpression" || member.object !== reference.identifier) return false;
|
|
1021
|
-
const name =
|
|
1147
|
+
const name = propertyName2(member);
|
|
1022
1148
|
const outer = member.parent;
|
|
1023
1149
|
if (FOCUS_PROPERTIES.has(name ?? "")) return outer.type === "AssignmentExpression" && outer.left === member;
|
|
1024
1150
|
if (name !== "setAttribute" || outer.type !== "CallExpression" || outer.callee !== member) return false;
|
|
@@ -1047,7 +1173,7 @@ function stopPropagationCalls(fn) {
|
|
|
1047
1173
|
const visit = (node) => {
|
|
1048
1174
|
if (!node || typeof node.type !== "string") return;
|
|
1049
1175
|
if (node !== fn && node.type.includes("Function")) return;
|
|
1050
|
-
const isStop = node.type === "CallExpression" && node.callee.type === "MemberExpression" &&
|
|
1176
|
+
const isStop = node.type === "CallExpression" && node.callee.type === "MemberExpression" && propertyName2(node.callee) === "stopPropagation";
|
|
1051
1177
|
if (isStop) found.push(node);
|
|
1052
1178
|
for (const key of Object.keys(node)) {
|
|
1053
1179
|
if (key === "parent") continue;
|
|
@@ -1059,7 +1185,7 @@ function stopPropagationCalls(fn) {
|
|
|
1059
1185
|
visit(fn.body);
|
|
1060
1186
|
return found;
|
|
1061
1187
|
}
|
|
1062
|
-
var
|
|
1188
|
+
var rule2 = {
|
|
1063
1189
|
meta: {
|
|
1064
1190
|
type: "problem",
|
|
1065
1191
|
docs: {
|
|
@@ -1084,28 +1210,28 @@ var rule = {
|
|
|
1084
1210
|
};
|
|
1085
1211
|
return {
|
|
1086
1212
|
CallExpression(node) {
|
|
1087
|
-
if (node.callee.type !== "MemberExpression" ||
|
|
1213
|
+
if (node.callee.type !== "MemberExpression" || propertyName2(node.callee) !== "addEventListener") return;
|
|
1088
1214
|
const event = stringValue(node.arguments[0]);
|
|
1089
1215
|
if (event === KEYDOWN) reportKeydown(node, node.arguments[1]);
|
|
1090
1216
|
else if (POINTER_EVENTS.has(event ?? "")) reportPointerOnly(node, node.callee.object, event);
|
|
1091
1217
|
},
|
|
1092
1218
|
AssignmentExpression(node) {
|
|
1093
1219
|
if (node.left.type !== "MemberExpression") return;
|
|
1094
|
-
const name =
|
|
1220
|
+
const name = propertyName2(node.left);
|
|
1095
1221
|
if (name === "onclick") reportPointerOnly(node, node.left.object, "onclick");
|
|
1096
1222
|
else if (name === "onkeydown") reportKeydown(node, node.right);
|
|
1097
1223
|
}
|
|
1098
1224
|
};
|
|
1099
1225
|
}
|
|
1100
1226
|
};
|
|
1101
|
-
var game_menu_focusable_default = { rules: { "game-menu-focusable":
|
|
1227
|
+
var game_menu_focusable_default = { rules: { "game-menu-focusable": rule2 } };
|
|
1102
1228
|
|
|
1103
1229
|
// src/rules/i18n-interpolation.js
|
|
1104
1230
|
var DOUBLE_BRACE_REGEX = /\{\{(\w+)\}\}/g;
|
|
1105
1231
|
var SINGLE_BRACE_REGEX = /(?<!\{)\{(\w+)\}(?!\})/g;
|
|
1106
1232
|
var ALLOWED_NAMES = /* @__PURE__ */ new Set(["p1", "p2", "p3"]);
|
|
1107
1233
|
var MAX_POSITIONAL_PARAMS = 3;
|
|
1108
|
-
var
|
|
1234
|
+
var rule3 = {
|
|
1109
1235
|
meta: {
|
|
1110
1236
|
type: "problem",
|
|
1111
1237
|
docs: {
|
|
@@ -1224,7 +1350,7 @@ var rule2 = {
|
|
|
1224
1350
|
};
|
|
1225
1351
|
var i18n_interpolation_default = {
|
|
1226
1352
|
rules: {
|
|
1227
|
-
"i18n-interpolation":
|
|
1353
|
+
"i18n-interpolation": rule3
|
|
1228
1354
|
}
|
|
1229
1355
|
};
|
|
1230
1356
|
|
|
@@ -1246,7 +1372,7 @@ var I18NEXT_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
1246
1372
|
"formatParams",
|
|
1247
1373
|
"missingInterpolationHandler"
|
|
1248
1374
|
]);
|
|
1249
|
-
var
|
|
1375
|
+
var rule4 = {
|
|
1250
1376
|
meta: {
|
|
1251
1377
|
type: "problem",
|
|
1252
1378
|
docs: {
|
|
@@ -1271,14 +1397,14 @@ var rule3 = {
|
|
|
1271
1397
|
const properties = optionsArg.properties;
|
|
1272
1398
|
for (const prop of properties) {
|
|
1273
1399
|
if (prop.type === "SpreadElement") continue;
|
|
1274
|
-
const
|
|
1275
|
-
if (
|
|
1276
|
-
if (I18NEXT_CONFIG_KEYS.has(
|
|
1277
|
-
if (!ALLOWED_PARAM_NAMES.has(
|
|
1400
|
+
const keyName2 = prop.key.type === "Identifier" ? prop.key.name : prop.key.type === "Literal" ? String(prop.key.value) : null;
|
|
1401
|
+
if (keyName2 === null) continue;
|
|
1402
|
+
if (I18NEXT_CONFIG_KEYS.has(keyName2)) continue;
|
|
1403
|
+
if (!ALLOWED_PARAM_NAMES.has(keyName2))
|
|
1278
1404
|
context.report({
|
|
1279
1405
|
node: prop,
|
|
1280
1406
|
messageId: "nonStandardParam",
|
|
1281
|
-
data: { paramName:
|
|
1407
|
+
data: { paramName: keyName2 }
|
|
1282
1408
|
});
|
|
1283
1409
|
}
|
|
1284
1410
|
}
|
|
@@ -1287,7 +1413,7 @@ var rule3 = {
|
|
|
1287
1413
|
};
|
|
1288
1414
|
var i18n_param_names_default = {
|
|
1289
1415
|
rules: {
|
|
1290
|
-
"i18n-param-names":
|
|
1416
|
+
"i18n-param-names": rule4
|
|
1291
1417
|
}
|
|
1292
1418
|
};
|
|
1293
1419
|
|
|
@@ -2186,6 +2312,14 @@ function isExemptFile2(path2, allow) {
|
|
|
2186
2312
|
if (TEST_FILE2.test(path2) || SHARED_SOURCE.test(path2)) return true;
|
|
2187
2313
|
return allow.some((fragment) => path2.includes(fragment));
|
|
2188
2314
|
}
|
|
2315
|
+
var MODULE_DECLARATIONS = /* @__PURE__ */ new Set(["ImportDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration"]);
|
|
2316
|
+
function usesPackage(program, packageName) {
|
|
2317
|
+
return program.body.some((statement) => {
|
|
2318
|
+
if (!MODULE_DECLARATIONS.has(statement.type) || statement.source == null) return false;
|
|
2319
|
+
const source = statement.source.value;
|
|
2320
|
+
return source === packageName || typeof source === "string" && source.startsWith(`${packageName}/`);
|
|
2321
|
+
});
|
|
2322
|
+
}
|
|
2189
2323
|
function literalText(node) {
|
|
2190
2324
|
if (node.type === "Literal") return typeof node.value === "string" ? node.value : "";
|
|
2191
2325
|
return node.quasis.length === 1 ? node.quasis[0].value.cooked ?? "" : "";
|
|
@@ -2227,7 +2361,7 @@ var noReimplementedPackageRule = {
|
|
|
2227
2361
|
return {
|
|
2228
2362
|
Program(node) {
|
|
2229
2363
|
for (const entry of REIMPLEMENTED_PACKAGE_REGISTRY)
|
|
2230
|
-
if (entry.paths.some((pattern) => pattern.test(path2))) report(node, entry);
|
|
2364
|
+
if (entry.paths.some((pattern) => pattern.test(path2)) && !usesPackage(node, entry.package)) report(node, entry);
|
|
2231
2365
|
},
|
|
2232
2366
|
Literal: checkLiteral,
|
|
2233
2367
|
TemplateLiteral: checkLiteral
|
|
@@ -2335,7 +2469,7 @@ function isQueryKeyProperty(node) {
|
|
|
2335
2469
|
if (node.key.type === "Identifier") return node.key.name === QUERY_KEY;
|
|
2336
2470
|
return node.key.type === "Literal" && node.key.value === QUERY_KEY;
|
|
2337
2471
|
}
|
|
2338
|
-
var
|
|
2472
|
+
var rule5 = {
|
|
2339
2473
|
meta: {
|
|
2340
2474
|
type: "suggestion",
|
|
2341
2475
|
docs: {
|
|
@@ -2366,7 +2500,7 @@ var rule4 = {
|
|
|
2366
2500
|
};
|
|
2367
2501
|
}
|
|
2368
2502
|
};
|
|
2369
|
-
var query_key_factory_default = { rules: { "query-key-factory":
|
|
2503
|
+
var query_key_factory_default = { rules: { "query-key-factory": rule5 } };
|
|
2370
2504
|
|
|
2371
2505
|
// src/rules/require-stable-hook-args.js
|
|
2372
2506
|
var STABLE_INIT_CALLS = /* @__PURE__ */ new Set([
|
|
@@ -3037,6 +3171,7 @@ var ruleModules = [
|
|
|
3037
3171
|
enforce_route_preload_default,
|
|
3038
3172
|
enforce_test_colocation_default,
|
|
3039
3173
|
enum_file_isolation_default,
|
|
3174
|
+
explicit_initial_focus_default,
|
|
3040
3175
|
game_menu_focusable_default,
|
|
3041
3176
|
i18n_interpolation_default,
|
|
3042
3177
|
i18n_param_names_default,
|
|
@@ -3060,11 +3195,11 @@ var ruleModules = [
|
|
|
3060
3195
|
function mergeRules(modules) {
|
|
3061
3196
|
const merged = {};
|
|
3062
3197
|
for (const mod of modules) {
|
|
3063
|
-
for (const [name,
|
|
3198
|
+
for (const [name, rule6] of Object.entries(mod.rules)) {
|
|
3064
3199
|
if (merged[name] !== void 0) {
|
|
3065
3200
|
throw new Error(`Duplicate ESLint rule name: "${name}"`);
|
|
3066
3201
|
}
|
|
3067
|
-
merged[name] =
|
|
3202
|
+
merged[name] = rule6;
|
|
3068
3203
|
}
|
|
3069
3204
|
}
|
|
3070
3205
|
return merged;
|
|
@@ -3080,15 +3215,15 @@ var ruleNames = Object.keys(plugin.rules).sort();
|
|
|
3080
3215
|
var legacyPlugins = buildLegacyPlugins();
|
|
3081
3216
|
function buildLegacyPlugins() {
|
|
3082
3217
|
const out = {};
|
|
3083
|
-
for (const [name,
|
|
3084
|
-
out[name] = oneRulePlugin(name,
|
|
3218
|
+
for (const [name, rule6] of Object.entries(rules)) {
|
|
3219
|
+
out[name] = oneRulePlugin(name, rule6);
|
|
3085
3220
|
}
|
|
3086
3221
|
return out;
|
|
3087
3222
|
}
|
|
3088
|
-
function oneRulePlugin(name,
|
|
3223
|
+
function oneRulePlugin(name, rule6) {
|
|
3089
3224
|
return {
|
|
3090
3225
|
meta: { name, version: "1.0.0" },
|
|
3091
|
-
rules: { [name]:
|
|
3226
|
+
rules: { [name]: rule6 }
|
|
3092
3227
|
};
|
|
3093
3228
|
}
|
|
3094
3229
|
var OFF_LEVELS = ["off", 0];
|
|
@@ -3180,15 +3315,24 @@ var recommendedConfig = {
|
|
|
3180
3315
|
plugins: commentsConfig.plugins,
|
|
3181
3316
|
rules: { ...commentsConfig.rules, ...rowActionsConfig.rules, ...apiConfig.rules }
|
|
3182
3317
|
};
|
|
3318
|
+
var FOCUS_RULE_NAMES = ["explicit-initial-focus"];
|
|
3319
|
+
var focusConfig = {
|
|
3320
|
+
plugins: commentsConfig.plugins,
|
|
3321
|
+
rules: {
|
|
3322
|
+
"@dloizides/explicit-initial-focus": "error"
|
|
3323
|
+
}
|
|
3324
|
+
};
|
|
3183
3325
|
|
|
3184
3326
|
exports.API_RULE_NAMES = API_RULE_NAMES;
|
|
3185
3327
|
exports.COMMENT_RULE_NAMES = COMMENT_RULE_NAMES;
|
|
3328
|
+
exports.FOCUS_RULE_NAMES = FOCUS_RULE_NAMES;
|
|
3186
3329
|
exports.GAME_RULE_NAMES = GAME_RULE_NAMES;
|
|
3187
3330
|
exports.HOUSE_PATTERN_RULE_NAMES = HOUSE_PATTERN_RULE_NAMES;
|
|
3188
3331
|
exports.REUSE_RULE_NAMES = REUSE_RULE_NAMES;
|
|
3189
3332
|
exports.ROW_ACTION_RULE_NAMES = ROW_ACTION_RULE_NAMES;
|
|
3190
3333
|
exports.apiConfig = apiConfig;
|
|
3191
3334
|
exports.commentsConfig = commentsConfig;
|
|
3335
|
+
exports.focusConfig = focusConfig;
|
|
3192
3336
|
exports.gameConfig = gameConfig;
|
|
3193
3337
|
exports.legacyPlugins = legacyPlugins;
|
|
3194
3338
|
exports.patternPacksConfig = patternPacksConfig;
|