diff --git a/.eslintrc b/.eslintrc index d10247d296..e609aa23be 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,61 +22,61 @@ "object-shorthand": [2, "always", { "ignoreConstructors": false, "avoidQuotes": false, // this is the override vs airbnb - }], - "max-len": [2, 120, { - "ignoreStrings": true, - "ignoreTemplateLiterals": true, - "ignoreComments": true, - }], - "consistent-return": 0, + }], + "max-len": [2, 140, { + "ignoreStrings": true, + "ignoreTemplateLiterals": true, + "ignoreComments": true, + }], + "consistent-return": 0, - "prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }], - "prefer-object-spread": 0, // until node 8 is required - "prefer-rest-params": 0, // until node 6 is required - "prefer-spread": 0, // until node 6 is required - "function-call-argument-newline": 1, // TODO: enable - "function-paren-newline": 0, - "no-plusplus": [2, {"allowForLoopAfterthoughts": true}], - "no-param-reassign": 1, - "no-restricted-syntax": [2, { - "selector": "ObjectPattern", - "message": "Object destructuring is not compatible with Node v4" - }], - "strict": [2, "safe"], - "valid-jsdoc": [2, { - "requireReturn": false, - "requireParamDescription": false, - "requireReturnDescription": false, - }], + "prefer-destructuring": [2, { "array": false, "object": false }, { "enforceForRenamedProperties": false }], + "prefer-object-spread": 0, // until node 8 is required + "prefer-rest-params": 0, // until node 6 is required + "prefer-spread": 0, // until node 6 is required + "function-call-argument-newline": 1, // TODO: enable + "function-paren-newline": 0, + "no-plusplus": [2, {"allowForLoopAfterthoughts": true}], + "no-param-reassign": 1, + "no-restricted-syntax": [2, { + "selector": "ObjectPattern", + "message": "Object destructuring is not compatible with Node v4" + }], + "strict": [2, "safe"], + "valid-jsdoc": [2, { + "requireReturn": false, + "requireParamDescription": false, + "requireReturnDescription": false, + }], - "eslint-plugin/consistent-output": 0, - "eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }], - "eslint-plugin/require-meta-schema": 0, - "eslint-plugin/require-meta-type": 0 - }, - "overrides": [ - { - "files": "tests/**", - "rules": { - "no-template-curly-in-string": 1, - }, - }, - { - "files": "markdown.config.js", - "rules": { - "no-console": 0, - }, - }, - { - "files": ".github/workflows/*.js", - "parserOptions": { - "ecmaVersion": 2019, - }, - "rules": { - "camelcase": 0, - "no-console": 0, - "no-restricted-syntax": 0, - }, - }, - ], - } + "eslint-plugin/consistent-output": 0, + "eslint-plugin/require-meta-docs-description": [2, { "pattern": "^(Enforce|Require|Disallow)" }], + "eslint-plugin/require-meta-schema": 0, + "eslint-plugin/require-meta-type": 0 + }, + "overrides": [ + { + "files": "tests/**", + "rules": { + "no-template-curly-in-string": 1, + }, + }, + { + "files": "markdown.config.js", + "rules": { + "no-console": 0, + }, + }, + { + "files": ".github/workflows/*.js", + "parserOptions": { + "ecmaVersion": 2019, + }, + "rules": { + "camelcase": 0, + "no-console": 0, + "no-restricted-syntax": 0, + }, + }, + ], +} diff --git a/lib/rules/forbid-elements.js b/lib/rules/forbid-elements.js index 4ad66eebe0..6d672cf70d 100644 --- a/lib/rules/forbid-elements.js +++ b/lib/rules/forbid-elements.js @@ -60,6 +60,7 @@ module.exports = { const configuration = context.options[0] || {}; const forbidConfiguration = configuration.forbid || []; + /** @type {Record} */ const indexedForbidConfigs = {}; forbidConfiguration.forEach((item) => { diff --git a/lib/rules/no-array-index-key.js b/lib/rules/no-array-index-key.js index 47b8f47b57..2a0ae41e6f 100644 --- a/lib/rules/no-array-index-key.js +++ b/lib/rules/no-array-index-key.js @@ -117,6 +117,8 @@ module.exports = { return null; } + const name = /** @type {keyof iteratorFunctionsToIndexParamPosition} */ (callee.property.name); + const callbackArg = isUsingReactChildren(node) ? node.arguments[1] : node.arguments[0]; @@ -131,7 +133,7 @@ module.exports = { const params = callbackArg.params; - const indexParamPosition = iteratorFunctionsToIndexParamPosition[callee.property.name]; + const indexParamPosition = iteratorFunctionsToIndexParamPosition[name]; if (params.length < indexParamPosition + 1) { return null; } diff --git a/lib/rules/no-unknown-property.js b/lib/rules/no-unknown-property.js index 95359d10fd..674e93071f 100644 --- a/lib/rules/no-unknown-property.js +++ b/lib/rules/no-unknown-property.js @@ -491,10 +491,10 @@ function tagNameHasDot(node) { */ function getStandardName(name, context) { if (has(DOM_ATTRIBUTE_NAMES, name)) { - return DOM_ATTRIBUTE_NAMES[name]; + return DOM_ATTRIBUTE_NAMES[/** @type {keyof DOM_ATTRIBUTE_NAMES} */ (name)]; } if (has(SVGDOM_ATTRIBUTE_NAMES, name)) { - return SVGDOM_ATTRIBUTE_NAMES[name]; + return SVGDOM_ATTRIBUTE_NAMES[/** @type {keyof SVGDOM_ATTRIBUTE_NAMES} */ (name)]; } const names = getDOMPropertyNames(context); // Let's find a possible attribute match with a case-insensitive search. @@ -592,7 +592,7 @@ module.exports = { // Let's dive deeper into tags that are HTML/DOM elements (`