question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Variants on Text cause issue with ESLint and cannot build project

See original GitHub issue

Description

When creating a custom theme for the Text component, I except to be able to have variants but I have ESLint error informing me that this is not possible

Link to Reproduction

https://codesandbox.io/s/nervous-alex-uow1k

Steps to reproduce

  1. Go to provided codesandbox demo
  2. Once the project is started go on index.tsx component
  3. The variant is correctly applied to the Text

Chakra UI Version

1.7.4

Browser

Brave 97

Operating System

  • macOS
  • Windows
  • Linux

Additional Information

Variants on the Text components causing an error when trying to build the project or deploying it on Vercel. The variants are correctly displayed on the screens (as showed in the codesandbox) but it’s not possible to build the project (using next build).

The error is the following: `Type error: Type ‘string’ is not assignable to type ‘undefined’.``

It’s possible to fix the issue by using textStyles instead but this is not consistent with other components that all use variants (even the Heading component support variants).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:15
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
primos63commented, Jan 12, 2022

The issue lies in system.types.d.ts and the interface ThemingProps. A recent change has caused the issue. As a temporary fix, please revert back to @chakra-ui/react version 1.7.2.

2reactions
masashi-sutoucommented, Jan 26, 2022

System v1.10.0

  • Updated type ThemingProps to allow string values for the props variant and size even on components which are not in the default theme.

https://github.com/chakra-ui/chakra-ui/blob/main/CHANGELOG.md#25-01-2022

  • I think this issue was solved by @ chakra-ui / react v1.8.0.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Show all warnings and errors in visual studio code
UPDATE 2019. ES-Lint has introduced a new task in VS Code. You have to enable it in the workspace setings. "eslint.lintTask.enable": true.
Read more >
Rules - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
eslint-config-universe | Yarn - Package Manager
This is the log of notable changes to the Expo client that are developer-facing. Package-specific changes not released in any SDK will be...
Read more >
Static Application Security Testing (SAST) - GitLab Docs
your project requires custom build configurations. you use language versions that aren't built into the analyzer. To resolve these issues, you can skip...
Read more >
ESLint Custom Tooling at Scale - Medium
We use ESLint to ensure high code quality and to promote coding best practices, ... It is also used by many open source...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found