Skip to content

Conversation

JoshuaKGoldberg
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg commented May 18, 2020

PR Checklist

Overview

I could only reproduce #581's crash for an existing .eslintrc.js containing a rule specifying multiple arguments:

"@typescript-eslint/indent": [
    "error",
    4,
    {
        "ignoreComments": false
    }
],

The root issue was that normalizeESLintRules was converting the raw rules into an object with a single value in ruleArguments, not an array:

const [rawRuleSeverity, ruleArguments] =
    configuration instanceof Array ? configuration : [configuration, {}];
const ruleSeverity = normalizeRawESLintRuleSeverity(rawRuleSeverity);
{
  ruleArguments: 4,
  ruleName: '@typescript-eslint/indent',
  ruleSeverity: 'error'
}

If configuration is an array, it should be [configuration[0], configuration.slice(1)] to capture the rule arguments as an array.

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for reviewer Waiting for a maintainer to review label May 18, 2020
@JoshuaKGoldberg JoshuaKGoldberg merged commit fc527b0 into master May 19, 2020
@KingDarBoja KingDarBoja deleted the eslint-multiple-arguments branch May 19, 2020 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting for reviewer Waiting for a maintainer to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: rule.ruleArguments is not iterable

2 participants