Skip to content

Commit 51d342b

Browse files
committed
[patch] make TS happy
1 parent f1ae6ed commit 51d342b

File tree

4 files changed

+63
-60
lines changed

4 files changed

+63
-60
lines changed

.eslintrc

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -22,61 +22,61 @@
2222
"object-shorthand": [2, "always", {
2323
"ignoreConstructors": false,
2424
"avoidQuotes": false, // this is the override vs airbnb
25-
}],
26-
"max-len": [2, 120, {
27-
"ignoreStrings": true,
28-
"ignoreTemplateLiterals": true,
29-
"ignoreComments": true,
30-
}],
31-
"consistent-return": 0,
25+
}],
26+
"max-len": [2, 140, {
27+
"ignoreStrings": true,
28+
"ignoreTemplateLiterals": true,
29+
"ignoreComments": true,
30+
}],
31+
"consistent-return": 0,
3232

33-
"prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
34-
"prefer-object-spread": 0, // until node 8 is required
35-
"prefer-rest-params": 0, // until node 6 is required
36-
"prefer-spread": 0, // until node 6 is required
37-
"function-call-argument-newline": 1, // TODO: enable
38-
"function-paren-newline": 0,
39-
"no-plusplus": [2, {"allowForLoopAfterthoughts": true}],
40-
"no-param-reassign": 1,
41-
"no-restricted-syntax": [2, {
42-
"selector": "ObjectPattern",
43-
"message": "Object destructuring is not compatible with Node v4"
44-
}],
45-
"strict": [2, "safe"],
46-
"valid-jsdoc": [2, {
47-
"requireReturn": false,
48-
"requireParamDescription": false,
49-
"requireReturnDescription": false,
50-
}],
33+
"prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }],
34+
"prefer-object-spread": 0, // until node 8 is required
35+
"prefer-rest-params": 0, // until node 6 is required
36+
"prefer-spread": 0, // until node 6 is required
37+
"function-call-argument-newline": 1, // TODO: enable
38+
"function-paren-newline": 0,
39+
"no-plusplus": [2, {"allowForLoopAfterthoughts": true}],
40+
"no-param-reassign": 1,
41+
"no-restricted-syntax": [2, {
42+
"selector": "ObjectPattern",
43+
"message": "Object destructuring is not compatible with Node v4"
44+
}],
45+
"strict": [2, "safe"],
46+
"valid-jsdoc": [2, {
47+
"requireReturn": false,
48+
"requireParamDescription": false,
49+
"requireReturnDescription": false,
50+
}],
5151

52-
"eslint-plugin/consistent-output": 0,
53-
"eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }],
54-
"eslint-plugin/require-meta-schema": 0,
55-
"eslint-plugin/require-meta-type": 0
56-
},
57-
"overrides": [
58-
{
59-
"files": "tests/**",
60-
"rules": {
61-
"no-template-curly-in-string": 1,
62-
},
63-
},
64-
{
65-
"files": "markdown.config.js",
66-
"rules": {
67-
"no-console": 0,
68-
},
69-
},
70-
{
71-
"files": ".github/workflows/*.js",
72-
"parserOptions": {
73-
"ecmaVersion": 2019,
74-
},
75-
"rules": {
76-
"camelcase": 0,
77-
"no-console": 0,
78-
"no-restricted-syntax": 0,
79-
},
80-
},
81-
],
82-
}
52+
"eslint-plugin/consistent-output": 0,
53+
"eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }],
54+
"eslint-plugin/require-meta-schema": 0,
55+
"eslint-plugin/require-meta-type": 0
56+
},
57+
"overrides": [
58+
{
59+
"files": "tests/**",
60+
"rules": {
61+
"no-template-curly-in-string": 1,
62+
},
63+
},
64+
{
65+
"files": "markdown.config.js",
66+
"rules": {
67+
"no-console": 0,
68+
},
69+
},
70+
{
71+
"files": ".github/workflows/*.js",
72+
"parserOptions": {
73+
"ecmaVersion": 2019,
74+
},
75+
"rules": {
76+
"camelcase": 0,
77+
"no-console": 0,
78+
"no-restricted-syntax": 0,
79+
},
80+
},
81+
],
82+
}

lib/rules/forbid-elements.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module.exports = {
6060
const configuration = context.options[0] || {};
6161
const forbidConfiguration = configuration.forbid || [];
6262

63+
/** @type {Record<string, { element: string, message?: string }>} */
6364
const indexedForbidConfigs = {};
6465

6566
forbidConfiguration.forEach((item) => {

lib/rules/no-array-index-key.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ module.exports = {
117117
return null;
118118
}
119119

120+
const name = /** @type {keyof iteratorFunctionsToIndexParamPosition} */ (callee.property.name);
121+
120122
const callbackArg = isUsingReactChildren(node)
121123
? node.arguments[1]
122124
: node.arguments[0];
@@ -131,7 +133,7 @@ module.exports = {
131133

132134
const params = callbackArg.params;
133135

134-
const indexParamPosition = iteratorFunctionsToIndexParamPosition[callee.property.name];
136+
const indexParamPosition = iteratorFunctionsToIndexParamPosition[name];
135137
if (params.length < indexParamPosition + 1) {
136138
return null;
137139
}

lib/rules/no-unknown-property.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,10 @@ function tagNameHasDot(node) {
491491
*/
492492
function getStandardName(name, context) {
493493
if (has(DOM_ATTRIBUTE_NAMES, name)) {
494-
return DOM_ATTRIBUTE_NAMES[name];
494+
return DOM_ATTRIBUTE_NAMES[/** @type {keyof DOM_ATTRIBUTE_NAMES} */ (name)];
495495
}
496496
if (has(SVGDOM_ATTRIBUTE_NAMES, name)) {
497-
return SVGDOM_ATTRIBUTE_NAMES[name];
497+
return SVGDOM_ATTRIBUTE_NAMES[/** @type {keyof SVGDOM_ATTRIBUTE_NAMES} */ (name)];
498498
}
499499
const names = getDOMPropertyNames(context);
500500
// Let's find a possible attribute match with a case-insensitive search.
@@ -592,7 +592,7 @@ module.exports = {
592592
// Let's dive deeper into tags that are HTML/DOM elements (`<button>`), and not React components (`<Button />`)
593593

594594
// Some attributes are allowed on some tags only
595-
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) ? ATTRIBUTE_TAGS_MAP[name] : null;
595+
const allowedTags = has(ATTRIBUTE_TAGS_MAP, name) ? ATTRIBUTE_TAGS_MAP[/** @type {keyof ATTRIBUTE_TAGS_MAP} */ (name)] : null;
596596
if (tagName && allowedTags) {
597597
// Scenario 1A: Allowed attribute found where not supposed to, report it
598598
if (allowedTags.indexOf(tagName) === -1) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy