Skip to content

Fix: Handle meta: {} as const for TypeScript rules #219

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

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

bmish
Copy link
Member

@bmish bmish commented Oct 15, 2021

Some TypeScript rules are written with meta: {} as const:

export default createRule({
  meta: {
    type: 'suggestion',
    schema: []
  } as const,
});

https://github.com/jest-community/eslint-plugin-jest/blob/973e2b564600ef047ff66bb812c940770ef7627c/src/rules/prefer-lowercase-title.ts#L105

We have to unwrap the as const expression to get the meta object.

Fixes #214.

@aladdin-add aladdin-add merged commit 08df927 into eslint-community:master Oct 15, 2021
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.

[v4] require-meta-schema throws TypeError: Cannot read property 'length' of undefined
2 participants