Skip to content
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

fix: fix require-meta-schema-description rule crash #496

Conversation

azat-io
Copy link
Contributor

@azat-io azat-io commented Nov 17, 2024

The rule crashes when the rest operator is used in the rule's metadata.

Oops! Something went wrong! :(

ESLint: 9.15.0

TypeError: Error while loading rule 'eslint-plugin/require-meta-schema-description': Cannot read properties of undefined (reading 'type')
Occurred while linting /Users/azat/Developer/eslint-plugin-perfectionist/rules/sort-classes.ts
    at checkSchemaElement (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/eslint-plugin-eslint-plugin/lib/rules/require-meta-schema-description.js:67:15)
    at checkSchemaElement (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/eslint-plugin-eslint-plugin/lib/rules/require-meta-schema-description.js:96:19)
    at Object.create (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected][email protected]_/node_modules/eslint-plugin-eslint-plugin/lib/rules/require-meta-schema-description.js:49:7)
    at createRuleListeners (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:944:21)
    at /Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:1082:84
    at Array.forEach (<anonymous>)
    at runRules (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:1013:34)
    at #flatVerifyWithoutProcessors (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:1911:31)
    at Linter._verifyWithFlatConfigArrayAndWithoutProcessors (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:1993:49)
    at Linter._verifyWithFlatConfigArray (/Users/azat/Developer/eslint-plugin-perfectionist/node_modules/.pnpm/[email protected][email protected]/node_modules/eslint/lib/linter/linter.js:2082:21)

Oops! Something went wrong! :(

ESLint: 9.15.0

Copy link
Contributor

@aladdin-add aladdin-add left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@aladdin-add aladdin-add force-pushed the fix/meta-schema-description-crash branch from 1c8b501 to e639835 Compare November 18, 2024 03:28
@aladdin-add
Copy link
Contributor

aladdin-add commented Nov 18, 2024

can you please fix the linting errors?

no worries, I've amended the commit and cherry-picked to main.

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

Successfully merging this pull request may close these issues.

2 participants