@dloizides/frontend-devtools 1.6.0 → 1.7.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 +122 -106
- package/dist/eslint/index.d.mts +4 -1
- package/dist/eslint/index.d.ts +4 -1
- package/dist/eslint/index.js +159 -14
- package/dist/eslint/index.js.map +1 -1
- package/dist/eslint/index.mjs +158 -15
- package/dist/eslint/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,106 +1,122 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to `@dloizides/frontend-devtools` are documented here.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
### Added
|
|
13
|
-
|
|
14
|
-
- `
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- `
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
`x
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
`
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@dloizides/frontend-devtools` are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.7.0] - 2026-10-19
|
|
9
|
+
|
|
10
|
+
NAV-1 "Every game menu works with arrow keys and controller", phase 3.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `game-menu-focusable`: reports a `click` / `pointerdown` / `pointerup` listener or `onclick =` on an element created as
|
|
15
|
+
`div` / `span` / `li` / `img` whose variable never gets `tabIndex` / `role` (property or `setAttribute`), and every
|
|
16
|
+
`stopPropagation()` inside a `keydown` / `onkeydown` handler (inline, named function or const). No options, no autofix.
|
|
17
|
+
- `gameConfig` flat-config preset (`GAME_RULE_NAMES`): enables `game-menu-focusable` at `error`. Not part of
|
|
18
|
+
`recommendedConfig`; game repos opt in.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- `testdoc-results.v1.schema.json` copy synced to Dloizides.Testing 7fbf809 (adds the optional `features` array).
|
|
23
|
+
|
|
24
|
+
## [1.5.0] - 2026-10-07
|
|
25
|
+
|
|
26
|
+
KEFI-ACT-1 "Same attendee actions everywhere" (generalized: one row-action source per entity, every portal).
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `single-row-action-source`: reports `<RowActionGroup actions>` from `@dloizides/ui-buttons` built in the same file
|
|
31
|
+
(inline array, array-bound identifier, `useMemo` returning an array, local builder function, `RowActionSpec[]`
|
|
32
|
+
annotated local). Imported builders/sets and props pass. No options, no autofix.
|
|
33
|
+
- `rowActionsConfig` and `recommendedConfig` flat-config blocks (`recommendedConfig` = comments + row actions, all `error`).
|
|
34
|
+
|
|
35
|
+
## [1.4.0] - 2026-10-07
|
|
36
|
+
|
|
37
|
+
COMMENTS-1 "No code comments; only short doc comments on public members", decision D-CMT-4 "One-line summary, no call chains".
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- `doc-comment-max-lines`: the description (lines other than `@param` / `@returns`) is capped at ONE line
|
|
42
|
+
(`summaryMaxLines`, default 1), every doc line at 120 chars (`lineMaxChars`), and a line containing an arrow
|
|
43
|
+
(U+2192 or `->`) or starting `Flow:` is reported (`callChain`). Matches `.claude/hooks/review-violations.js` docBlock().
|
|
44
|
+
The 3-line total cap is unchanged. One report per block; banned tags take precedence.
|
|
45
|
+
|
|
46
|
+
## [1.3.0] - 2026-10-06
|
|
47
|
+
|
|
48
|
+
COMMENTS-1 "No code comments; only short doc comments on public members" (decisions D-CMT-1, D-CMT-3).
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- `no-comments`: reports every comment that is not a `/**` doc block and not a tool directive
|
|
53
|
+
(`eslint-*`, `@ts-*`, `prettier-ignore`, `istanbul`/`c8`, `/// <reference>`, `#__PURE__`,
|
|
54
|
+
`webpackChunkName`, shebang). `allow: string[]` adds directive regexes. Suggestion only, no autofix.
|
|
55
|
+
- `doc-comment-public-only`: a doc block must sit on an exported declaration (incl. `export { x }`,
|
|
56
|
+
`export default x`, `module.exports`, ambient `declare module`) or a public member of one;
|
|
57
|
+
`private` / `protected` / `#` members and local declarations are reported.
|
|
58
|
+
- `doc-comment-max-lines`: doc body capped at `max` (default 3) content lines; block tags other than
|
|
59
|
+
`allowedTags` (default `@param`, `@returns`) are reported. JSDoc type-annotation blocks
|
|
60
|
+
(`@type`, `@typedef`, ...) are exempt from both doc rules.
|
|
61
|
+
- `commentsConfig` flat-config block (the three rules at `error`) and `COMMENT_RULE_NAMES`, exported
|
|
62
|
+
from `/eslint`. Not adopted by any app yet: each repo opts in as step 1 of its COMMENTS-CLEAN sweep.
|
|
63
|
+
|
|
64
|
+
## [1.1.0] - 2026-07-13
|
|
65
|
+
|
|
66
|
+
Both changes come out of the ES-04 (agora-web) build, which surfaced two ways the
|
|
67
|
+
rule pack misbehaved against a freshly scaffolded app.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- **`no-null-check`: the autofixer no longer corrupts files.** It rewrote
|
|
72
|
+
`x === undefined` → `!isValueDefined(x)` *without importing `isValueDefined`*,
|
|
73
|
+
so `eslint --fix` emitted source referencing an undeclared global. Running
|
|
74
|
+
`lint:fix` on agora-web rewrote ~20 files and produced 67 `no-unsafe-call` /
|
|
75
|
+
`strict-boolean-expressions` errors. A fixer that produces broken code is worse
|
|
76
|
+
than no fixer — `lint:fix` is the first thing anyone runs.
|
|
77
|
+
|
|
78
|
+
The fixer now inserts `import { isValueDefined } from '@dloizides/utils';` (the
|
|
79
|
+
path is configurable via the pre-existing but previously **unused**
|
|
80
|
+
`utilImportPath` option) when the file has no binding for the guard, and skips
|
|
81
|
+
the autofix entirely in the module that defines or re-exports it. Proven with
|
|
82
|
+
`Linter.verifyAndFix` multipass tests — the actual `--fix` code path.
|
|
83
|
+
|
|
84
|
+
⚠️ The package's own test suite had *codified* the bug: it asserted the
|
|
85
|
+
import-less output was correct. Those expectations were wrong and are updated.
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
- **`smart-max-lines`: `functionWarn` is now opt-in (default: off).** ESLint has
|
|
90
|
+
no per-report severity, so a `functionWarn` report is emitted at the severity
|
|
91
|
+
the *rule* is configured with. Every app configured the rule as `'error'` and
|
|
92
|
+
passed `functionWarn: 30` — which made the real, enforced limit **30 lines**
|
|
93
|
+
while the docs promised **50**. The rule lied about its own threshold.
|
|
94
|
+
|
|
95
|
+
Out of the box the only enforced thresholds are now `componentMax` (200) and
|
|
96
|
+
`functionMax` (50) — exactly what the documentation has always promised.
|
|
97
|
+
`functionWarn` remains available as an explicit *stricter second threshold*,
|
|
98
|
+
and its schema/message now say plainly that it reports at the rule's severity
|
|
99
|
+
rather than as a warning.
|
|
100
|
+
|
|
101
|
+
Migration: drop `functionWarn: 30` from your ESLint config. This only relaxes
|
|
102
|
+
linting (30 → 50), so it cannot introduce new failures.
|
|
103
|
+
|
|
104
|
+
## [1.0.0] - 2026-06-14
|
|
105
|
+
|
|
106
|
+
### Added
|
|
107
|
+
|
|
108
|
+
- Initial extraction of the shared RN-web dev tooling duplicated across
|
|
109
|
+
erevna-web, katalogos-web, and kefi-web.
|
|
110
|
+
- **ESLint custom rule pack** (17 rules) exported as `plugin` / `rules` /
|
|
111
|
+
`legacyPlugins`, also available under the `@dloizides/frontend-devtools/eslint`
|
|
112
|
+
subpath. Rule names preserved byte-for-byte so existing config keys and
|
|
113
|
+
`eslint-disable-next-line <rule>` comments keep working:
|
|
114
|
+
`enforce-function-style`, `enforce-module-structure`, `enforce-route-preload`,
|
|
115
|
+
`enforce-test-colocation`, `enum-file-isolation`, `i18n-interpolation`,
|
|
116
|
+
`i18n-param-names`, `no-barrel-companion-file`, `no-duplicate-nav-prefix`,
|
|
117
|
+
`no-duplicate-shared-patterns`, `no-generated-models-barrel-value-import`,
|
|
118
|
+
`no-null-check`, `no-optional-undefined`, `no-product-imports-in-shared`,
|
|
119
|
+
`prefer-const-enum`, `require-stable-hook-args`, `smart-max-lines`.
|
|
120
|
+
- **`initI18n(options)`** — parameterized i18next + react-i18next init factory.
|
|
121
|
+
Carries the `import/no-named-as-default-member` disable so apps stop repeating
|
|
122
|
+
it. The app owns its `locales/*.json` strings and the active language.
|
package/dist/eslint/index.d.mts
CHANGED
|
@@ -80,7 +80,10 @@ declare const commentsConfig: FlatConfig;
|
|
|
80
80
|
declare const ROW_ACTION_RULE_NAMES: readonly string[];
|
|
81
81
|
/** Flat-config block for row actions: RowActionGroup actions come from one shared defineRowActions set. */
|
|
82
82
|
declare const rowActionsConfig: FlatConfig;
|
|
83
|
+
declare const GAME_RULE_NAMES: readonly string[];
|
|
84
|
+
/** The game preset: menus stay walkable with arrow keys and a controller (NAV-1). Game repos only. */
|
|
85
|
+
declare const gameConfig: FlatConfig;
|
|
83
86
|
/** The recommended flat-config block: every rule the pack enables by default, at error. */
|
|
84
87
|
declare const recommendedConfig: FlatConfig;
|
|
85
88
|
|
|
86
|
-
export { COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, commentsConfig, legacyPlugins, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
|
|
89
|
+
export { COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, commentsConfig, gameConfig, legacyPlugins, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
|
package/dist/eslint/index.d.ts
CHANGED
|
@@ -80,7 +80,10 @@ declare const commentsConfig: FlatConfig;
|
|
|
80
80
|
declare const ROW_ACTION_RULE_NAMES: readonly string[];
|
|
81
81
|
/** Flat-config block for row actions: RowActionGroup actions come from one shared defineRowActions set. */
|
|
82
82
|
declare const rowActionsConfig: FlatConfig;
|
|
83
|
+
declare const GAME_RULE_NAMES: readonly string[];
|
|
84
|
+
/** The game preset: menus stay walkable with arrow keys and a controller (NAV-1). Game repos only. */
|
|
85
|
+
declare const gameConfig: FlatConfig;
|
|
83
86
|
/** The recommended flat-config block: every rule the pack enables by default, at error. */
|
|
84
87
|
declare const recommendedConfig: FlatConfig;
|
|
85
88
|
|
|
86
|
-
export { COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, commentsConfig, legacyPlugins, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
|
|
89
|
+
export { COMMENT_RULE_NAMES, type CustomRule, type FlatConfig, type FlatConfigPlugin, GAME_RULE_NAMES, ROW_ACTION_RULE_NAMES, type SingleRulePlugin, commentsConfig, gameConfig, legacyPlugins, plugin, recommendedConfig, rowActionsConfig, ruleNames, rules };
|
package/dist/eslint/index.js
CHANGED
|
@@ -957,12 +957,147 @@ var enum_file_isolation_default = {
|
|
|
957
957
|
}
|
|
958
958
|
};
|
|
959
959
|
|
|
960
|
+
// src/rules/game-menu-focusable.js
|
|
961
|
+
var POINTER_EVENTS = /* @__PURE__ */ new Set(["click", "pointerdown", "pointerup"]);
|
|
962
|
+
var NON_FOCUSABLE_TAGS = /* @__PURE__ */ new Set(["div", "span", "li", "img"]);
|
|
963
|
+
var FOCUS_ATTRIBUTES = /* @__PURE__ */ new Set(["tabindex", "role"]);
|
|
964
|
+
var FOCUS_PROPERTIES = /* @__PURE__ */ new Set(["tabIndex", "role"]);
|
|
965
|
+
var KEYDOWN = "keydown";
|
|
966
|
+
function getScopeFor(context, node) {
|
|
967
|
+
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
968
|
+
if (typeof sourceCode.getScope === "function") return sourceCode.getScope(node);
|
|
969
|
+
return context.getScope();
|
|
970
|
+
}
|
|
971
|
+
function findVariable(scope, name) {
|
|
972
|
+
let current = scope;
|
|
973
|
+
while (current) {
|
|
974
|
+
const found = current.set.get(name);
|
|
975
|
+
if (found) return found;
|
|
976
|
+
current = current.upper;
|
|
977
|
+
}
|
|
978
|
+
return void 0;
|
|
979
|
+
}
|
|
980
|
+
function unwrap(node) {
|
|
981
|
+
let current = node;
|
|
982
|
+
while (current && (current.type === "TSAsExpression" || current.type === "TSNonNullExpression" || current.type === "TSTypeAssertion")) {
|
|
983
|
+
current = current.expression;
|
|
984
|
+
}
|
|
985
|
+
return current;
|
|
986
|
+
}
|
|
987
|
+
function stringValue(node) {
|
|
988
|
+
const target = unwrap(node);
|
|
989
|
+
if (!target) return void 0;
|
|
990
|
+
if (target.type === "Literal" && typeof target.value === "string") return target.value;
|
|
991
|
+
if (target.type === "TemplateLiteral" && target.expressions.length === 0) return target.quasis[0].value.cooked;
|
|
992
|
+
return void 0;
|
|
993
|
+
}
|
|
994
|
+
function propertyName(member) {
|
|
995
|
+
if (member.computed) return stringValue(member.property);
|
|
996
|
+
return member.property.type === "Identifier" ? member.property.name : void 0;
|
|
997
|
+
}
|
|
998
|
+
function createdTag(init) {
|
|
999
|
+
const call = unwrap(init);
|
|
1000
|
+
if (!call || call.type !== "CallExpression") return void 0;
|
|
1001
|
+
if (call.callee.type !== "MemberExpression" || propertyName(call.callee) !== "createElement") return void 0;
|
|
1002
|
+
const tag = stringValue(call.arguments[0]);
|
|
1003
|
+
return tag === void 0 ? void 0 : tag.toLowerCase();
|
|
1004
|
+
}
|
|
1005
|
+
function nonFocusableTag(variable) {
|
|
1006
|
+
const initializers = variable.defs.filter((def) => def.node.type === "VariableDeclarator").map((def) => def.node.init);
|
|
1007
|
+
const assigned = variable.references.filter((ref) => ref.isWrite() && ref.writeExpr).map((ref) => ref.writeExpr);
|
|
1008
|
+
return [...initializers, ...assigned].map(createdTag).find((tag) => NON_FOCUSABLE_TAGS.has(tag ?? ""));
|
|
1009
|
+
}
|
|
1010
|
+
function setsFocusAttribute(reference) {
|
|
1011
|
+
const member = reference.identifier.parent;
|
|
1012
|
+
if (!member || member.type !== "MemberExpression" || member.object !== reference.identifier) return false;
|
|
1013
|
+
const name = propertyName(member);
|
|
1014
|
+
const outer = member.parent;
|
|
1015
|
+
if (FOCUS_PROPERTIES.has(name ?? "")) return outer.type === "AssignmentExpression" && outer.left === member;
|
|
1016
|
+
if (name !== "setAttribute" || outer.type !== "CallExpression" || outer.callee !== member) return false;
|
|
1017
|
+
return FOCUS_ATTRIBUTES.has((stringValue(outer.arguments[0]) ?? "").toLowerCase());
|
|
1018
|
+
}
|
|
1019
|
+
function unfocusableTag(context, node, identifier) {
|
|
1020
|
+
if (!identifier || identifier.type !== "Identifier") return void 0;
|
|
1021
|
+
const variable = findVariable(getScopeFor(context, node), identifier.name);
|
|
1022
|
+
if (!variable || variable.references.some(setsFocusAttribute)) return void 0;
|
|
1023
|
+
return nonFocusableTag(variable);
|
|
1024
|
+
}
|
|
1025
|
+
function resolveHandler(context, node, handler) {
|
|
1026
|
+
const target = unwrap(handler);
|
|
1027
|
+
if (!target) return void 0;
|
|
1028
|
+
if (target.type === "ArrowFunctionExpression" || target.type === "FunctionExpression") return target;
|
|
1029
|
+
if (target.type !== "Identifier") return void 0;
|
|
1030
|
+
const variable = findVariable(getScopeFor(context, node), target.name);
|
|
1031
|
+
const def = variable && variable.defs[0];
|
|
1032
|
+
if (!def) return void 0;
|
|
1033
|
+
if (def.node.type === "FunctionDeclaration") return def.node;
|
|
1034
|
+
if (def.node.type === "VariableDeclarator") return resolveHandler(context, node, def.node.init);
|
|
1035
|
+
return void 0;
|
|
1036
|
+
}
|
|
1037
|
+
function stopPropagationCalls(fn) {
|
|
1038
|
+
const found = [];
|
|
1039
|
+
const visit = (node) => {
|
|
1040
|
+
if (!node || typeof node.type !== "string") return;
|
|
1041
|
+
if (node !== fn && node.type.includes("Function")) return;
|
|
1042
|
+
const isStop = node.type === "CallExpression" && node.callee.type === "MemberExpression" && propertyName(node.callee) === "stopPropagation";
|
|
1043
|
+
if (isStop) found.push(node);
|
|
1044
|
+
for (const key of Object.keys(node)) {
|
|
1045
|
+
if (key === "parent") continue;
|
|
1046
|
+
const child = node[key];
|
|
1047
|
+
if (Array.isArray(child)) child.forEach(visit);
|
|
1048
|
+
else if (child && typeof child === "object") visit(child);
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
visit(fn.body);
|
|
1052
|
+
return found;
|
|
1053
|
+
}
|
|
1054
|
+
var rule = {
|
|
1055
|
+
meta: {
|
|
1056
|
+
type: "problem",
|
|
1057
|
+
docs: {
|
|
1058
|
+
description: "Game menus stay walkable with arrow keys and a controller: no pointer-only div/span/li/img items, no keydown stopPropagation."
|
|
1059
|
+
},
|
|
1060
|
+
schema: [],
|
|
1061
|
+
messages: {
|
|
1062
|
+
pointerOnlyItem: "'{{name}}' is a <{{tag}}> with a {{event}} handler but no tabindex or role: keyboard and controller users cannot reach it. Use a <button>, or set tabIndex and role.",
|
|
1063
|
+
keydownStopPropagation: "A keydown handler calls stopPropagation(), which hides keys from every other listener. If it is needed, disable this line with the reason."
|
|
1064
|
+
}
|
|
1065
|
+
},
|
|
1066
|
+
create(context) {
|
|
1067
|
+
const reportPointerOnly = (node, identifier, event) => {
|
|
1068
|
+
const tag = unfocusableTag(context, node, identifier);
|
|
1069
|
+
if (tag === void 0) return;
|
|
1070
|
+
context.report({ node, messageId: "pointerOnlyItem", data: { name: identifier.name, tag, event } });
|
|
1071
|
+
};
|
|
1072
|
+
const reportKeydown = (node, handler) => {
|
|
1073
|
+
const fn = resolveHandler(context, node, handler);
|
|
1074
|
+
if (!fn) return;
|
|
1075
|
+
stopPropagationCalls(fn).forEach((call) => context.report({ node: call, messageId: "keydownStopPropagation" }));
|
|
1076
|
+
};
|
|
1077
|
+
return {
|
|
1078
|
+
CallExpression(node) {
|
|
1079
|
+
if (node.callee.type !== "MemberExpression" || propertyName(node.callee) !== "addEventListener") return;
|
|
1080
|
+
const event = stringValue(node.arguments[0]);
|
|
1081
|
+
if (event === KEYDOWN) reportKeydown(node, node.arguments[1]);
|
|
1082
|
+
else if (POINTER_EVENTS.has(event ?? "")) reportPointerOnly(node, node.callee.object, event);
|
|
1083
|
+
},
|
|
1084
|
+
AssignmentExpression(node) {
|
|
1085
|
+
if (node.left.type !== "MemberExpression") return;
|
|
1086
|
+
const name = propertyName(node.left);
|
|
1087
|
+
if (name === "onclick") reportPointerOnly(node, node.left.object, "onclick");
|
|
1088
|
+
else if (name === "onkeydown") reportKeydown(node, node.right);
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
};
|
|
1093
|
+
var game_menu_focusable_default = { rules: { "game-menu-focusable": rule } };
|
|
1094
|
+
|
|
960
1095
|
// src/rules/i18n-interpolation.js
|
|
961
1096
|
var DOUBLE_BRACE_REGEX = /\{\{(\w+)\}\}/g;
|
|
962
1097
|
var SINGLE_BRACE_REGEX = /(?<!\{)\{(\w+)\}(?!\})/g;
|
|
963
1098
|
var ALLOWED_NAMES = /* @__PURE__ */ new Set(["p1", "p2", "p3"]);
|
|
964
1099
|
var MAX_POSITIONAL_PARAMS = 3;
|
|
965
|
-
var
|
|
1100
|
+
var rule2 = {
|
|
966
1101
|
meta: {
|
|
967
1102
|
type: "problem",
|
|
968
1103
|
docs: {
|
|
@@ -1081,7 +1216,7 @@ var rule = {
|
|
|
1081
1216
|
};
|
|
1082
1217
|
var i18n_interpolation_default = {
|
|
1083
1218
|
rules: {
|
|
1084
|
-
"i18n-interpolation":
|
|
1219
|
+
"i18n-interpolation": rule2
|
|
1085
1220
|
}
|
|
1086
1221
|
};
|
|
1087
1222
|
|
|
@@ -1103,7 +1238,7 @@ var I18NEXT_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
|
1103
1238
|
"formatParams",
|
|
1104
1239
|
"missingInterpolationHandler"
|
|
1105
1240
|
]);
|
|
1106
|
-
var
|
|
1241
|
+
var rule3 = {
|
|
1107
1242
|
meta: {
|
|
1108
1243
|
type: "problem",
|
|
1109
1244
|
docs: {
|
|
@@ -1144,7 +1279,7 @@ var rule2 = {
|
|
|
1144
1279
|
};
|
|
1145
1280
|
var i18n_param_names_default = {
|
|
1146
1281
|
rules: {
|
|
1147
|
-
"i18n-param-names":
|
|
1282
|
+
"i18n-param-names": rule3
|
|
1148
1283
|
}
|
|
1149
1284
|
};
|
|
1150
1285
|
|
|
@@ -2154,12 +2289,12 @@ var SPEC_TYPE = "RowActionSpec";
|
|
|
2154
2289
|
var MEMO_HOOKS = /* @__PURE__ */ new Set(["useMemo", "useCallback"]);
|
|
2155
2290
|
var MAX_DEPTH = 8;
|
|
2156
2291
|
var Source = Object.freeze({ LOCAL: "local", EXTERNAL: "external" });
|
|
2157
|
-
function
|
|
2292
|
+
function getScopeFor2(context, node) {
|
|
2158
2293
|
const sourceCode = context.sourceCode ?? context.getSourceCode();
|
|
2159
2294
|
if (typeof sourceCode.getScope === "function") return sourceCode.getScope(node);
|
|
2160
2295
|
return context.getScope();
|
|
2161
2296
|
}
|
|
2162
|
-
function
|
|
2297
|
+
function findVariable2(scope, name) {
|
|
2163
2298
|
let current = scope;
|
|
2164
2299
|
while (current) {
|
|
2165
2300
|
const found = current.set.get(name);
|
|
@@ -2231,7 +2366,7 @@ function createClassifier(context) {
|
|
|
2231
2366
|
}
|
|
2232
2367
|
const root = rootIdentifier(node.callee);
|
|
2233
2368
|
if (!root) return Source.EXTERNAL;
|
|
2234
|
-
const variable =
|
|
2369
|
+
const variable = findVariable2(getScopeFor2(context, node), root.name);
|
|
2235
2370
|
if (!variable || variable.defs.length === 0) return Source.EXTERNAL;
|
|
2236
2371
|
const def = variable.defs[0];
|
|
2237
2372
|
if (def.type === "ImportBinding" || def.type === "Parameter") return Source.EXTERNAL;
|
|
@@ -2256,7 +2391,7 @@ function createClassifier(context) {
|
|
|
2256
2391
|
case "CallExpression":
|
|
2257
2392
|
return classifyCall(node, depth, seen);
|
|
2258
2393
|
case "Identifier": {
|
|
2259
|
-
const variable =
|
|
2394
|
+
const variable = findVariable2(getScopeFor2(context, node), node.name);
|
|
2260
2395
|
return variable ? classifyVariable(variable, depth, seen) : Source.EXTERNAL;
|
|
2261
2396
|
}
|
|
2262
2397
|
default:
|
|
@@ -2569,6 +2704,7 @@ var ruleModules = [
|
|
|
2569
2704
|
enforce_route_preload_default,
|
|
2570
2705
|
enforce_test_colocation_default,
|
|
2571
2706
|
enum_file_isolation_default,
|
|
2707
|
+
game_menu_focusable_default,
|
|
2572
2708
|
i18n_interpolation_default,
|
|
2573
2709
|
i18n_param_names_default,
|
|
2574
2710
|
no_barrel_companion_file_default,
|
|
@@ -2588,11 +2724,11 @@ var ruleModules = [
|
|
|
2588
2724
|
function mergeRules(modules) {
|
|
2589
2725
|
const merged = {};
|
|
2590
2726
|
for (const mod of modules) {
|
|
2591
|
-
for (const [name,
|
|
2727
|
+
for (const [name, rule4] of Object.entries(mod.rules)) {
|
|
2592
2728
|
if (merged[name] !== void 0) {
|
|
2593
2729
|
throw new Error(`Duplicate ESLint rule name: "${name}"`);
|
|
2594
2730
|
}
|
|
2595
|
-
merged[name] =
|
|
2731
|
+
merged[name] = rule4;
|
|
2596
2732
|
}
|
|
2597
2733
|
}
|
|
2598
2734
|
return merged;
|
|
@@ -2608,15 +2744,15 @@ var ruleNames = Object.keys(plugin.rules).sort();
|
|
|
2608
2744
|
var legacyPlugins = buildLegacyPlugins();
|
|
2609
2745
|
function buildLegacyPlugins() {
|
|
2610
2746
|
const out = {};
|
|
2611
|
-
for (const [name,
|
|
2612
|
-
out[name] = oneRulePlugin(name,
|
|
2747
|
+
for (const [name, rule4] of Object.entries(rules)) {
|
|
2748
|
+
out[name] = oneRulePlugin(name, rule4);
|
|
2613
2749
|
}
|
|
2614
2750
|
return out;
|
|
2615
2751
|
}
|
|
2616
|
-
function oneRulePlugin(name,
|
|
2752
|
+
function oneRulePlugin(name, rule4) {
|
|
2617
2753
|
return {
|
|
2618
2754
|
meta: { name, version: "1.0.0" },
|
|
2619
|
-
rules: { [name]:
|
|
2755
|
+
rules: { [name]: rule4 }
|
|
2620
2756
|
};
|
|
2621
2757
|
}
|
|
2622
2758
|
|
|
@@ -2642,14 +2778,23 @@ var rowActionsConfig = {
|
|
|
2642
2778
|
"@dloizides/single-row-action-source": "error"
|
|
2643
2779
|
}
|
|
2644
2780
|
};
|
|
2781
|
+
var GAME_RULE_NAMES = ["game-menu-focusable"];
|
|
2782
|
+
var gameConfig = {
|
|
2783
|
+
plugins: commentsConfig.plugins,
|
|
2784
|
+
rules: {
|
|
2785
|
+
"@dloizides/game-menu-focusable": "error"
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2645
2788
|
var recommendedConfig = {
|
|
2646
2789
|
plugins: commentsConfig.plugins,
|
|
2647
2790
|
rules: { ...commentsConfig.rules, ...rowActionsConfig.rules }
|
|
2648
2791
|
};
|
|
2649
2792
|
|
|
2650
2793
|
exports.COMMENT_RULE_NAMES = COMMENT_RULE_NAMES;
|
|
2794
|
+
exports.GAME_RULE_NAMES = GAME_RULE_NAMES;
|
|
2651
2795
|
exports.ROW_ACTION_RULE_NAMES = ROW_ACTION_RULE_NAMES;
|
|
2652
2796
|
exports.commentsConfig = commentsConfig;
|
|
2797
|
+
exports.gameConfig = gameConfig;
|
|
2653
2798
|
exports.legacyPlugins = legacyPlugins;
|
|
2654
2799
|
exports.plugin = plugin;
|
|
2655
2800
|
exports.recommendedConfig = recommendedConfig;
|