Skip to content

require-meta-schema-description errors when properties is not iterable #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
FloEdelmann opened this issue Oct 24, 2024 · 0 comments · Fixed by #493
Closed

require-meta-schema-description errors when properties is not iterable #492

FloEdelmann opened this issue Oct 24, 2024 · 0 comments · Fixed by #493

Comments

@FloEdelmann
Copy link
Contributor

See https://github.com/vuejs/eslint-plugin-vue/blob/v9.29.1/lib/rules/no-parsing-error.js:

const DEFAULT_OPTIONS = Object.freeze(
  Object.assign(Object.create(null), {
    'abrupt-closing-of-empty-comment': true,
    // …
    'x-invalid-namespace': true
  })
)

module.exports = {
  meta: {
    // …
    schema: [
      {
        type: 'object',
        properties: Object.fromEntries(
          Object.keys(DEFAULT_OPTIONS).map((code) => [
            code,
            { type: 'boolean' }
          ])
        ),
        additionalProperties: false
      }
    ],
  },
  // …
}

The newly added require-meta-schema-description rule errors for this file:

TypeError: Error while loading rule 'eslint-plugin/require-meta-schema-description': value.properties is not iterable
Occurred while linting …/eslint-plugin-vue/lib/rules/no-parsing-error.js
    at checkSchemaElement (…/eslint-plugin-vue/node_modules/eslint-plugin-eslint-plugin/lib/rules/require-meta-schema-description.js:90:42)
    at Object.create (…/eslint-plugin-vue/node_modules/eslint-plugin-eslint-plugin/lib/rules/require-meta-schema-description.js:49:7)
    at createRuleListeners (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:895:21)
    at …/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:1066:110
    at Array.forEach (<anonymous>)
    at runRules (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:1003:34)
    at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:1730:31)
    at Linter._verifyWithFlatConfigArray (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:1861:21)
    at Linter.verify (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:1433:65)
    at Linter.verifyAndFix (…/eslint-plugin-vue/node_modules/eslint/lib/linter/linter.js:2068:29)

I think that when properties is not iterable, the rule should either report a lint violation, or ignore that. But in either case it shouldn't error.

CC @JoshuaKGoldberg as the author of the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant