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

[BUG] TypeError on Latest Version 3.14.2 #317

Closed
coltonhurst opened this issue Feb 13, 2024 · 8 comments
Closed

[BUG] TypeError on Latest Version 3.14.2 #317

coltonhurst opened this issue Feb 13, 2024 · 8 comments
Assignees
Labels
bug Something isn't working work in progress

Comments

@coltonhurst
Copy link

Describe the bug

Hello! Thank you for all of the great work on this plugin.

When running npm run lint on version 3.14.2, I receive the following TypeError:

TypeError: Cannot convert undefined or null to object
Occurred while linting /Users/coltonhurst/github/bitwarden/clients/apps/browser/src/auth/popup/account-switching/account-switcher.component.html:5
Rule: "tailwindcss/enforces-shorthand"
    at Function.keys (<anonymous>)
    at /Users/coltonhurst/github/bitwarden/clients/node_modules/eslint-plugin-tailwindcss/lib/rules/enforces-shorthand.js:248:37
    at Array.filter (<anonymous>)
    at parseForShorthandCandidates (/Users/coltonhurst/github/bitwarden/clients/node_modules/eslint-plugin-tailwindcss/lib/rules/enforces-shorthand.js:239:52)
    at attributeVisitor (/Users/coltonhurst/github/bitwarden/clients/node_modules/eslint-plugin-tailwindcss/lib/rules/enforces-shorthand.js:479:9)
    at ruleErrorHandler (/Users/coltonhurst/github/bitwarden/clients/node_modules/eslint/lib/linter/linter.js:1076:28)
    at /Users/coltonhurst/github/bitwarden/clients/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/coltonhurst/github/bitwarden/clients/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/coltonhurst/github/bitwarden/clients/node_modules/eslint/lib/linter/node-event-generator.js:297:26)

This was discovered and is visible through this PR.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the Bitwarden clients repository here
  2. Run npm install
  3. Run npm ci
  4. Run npm run lint
  • Note: In our package.json we have lint defined as so: "lint": "eslint . --cache --cache-strategy content && prettier --check .",

Expected behavior

That npm run lint runs successfully.

Screenshots

image

Environment (please complete the following information):

  • OS: macOS Sonoma 14.3.1
  • Softwares + version used:
    • VSCode 1.86.1
    • Local node version is: v18.16.0

Thank you!

@coltonhurst coltonhurst added the bug Something isn't working label Feb 13, 2024
@francoismassart
Copy link
Owner

Hi @coltonhurst
I think it was due to the fact that I was always expecting to get a value from theme.size which may not exists depending on your version of Tailwind CSS... Your old MR code is not available however, I did:

  1. clone the latest version of the repo
  2. install dependencies
  3. npm run lint
  4. npm i eslint-plugin-tailwindcss@3.15.0
  5. npm run lint

Maybe it was fixed by the update of Tailwind CSS but I'll patch v3.15.1 to address the issue.

I would be curious to investigate more on this. Do you still have your old PR somewhere.

@francoismassart
Copy link
Owner

If you still get the runtime error try this patched version

npm i eslint-plugin-tailwindcss@3.15.1-beta.0

@andriibyk
Copy link

Hi @francoismassart

The same type of issue is for tailwindcss/no-unnecessary-arbitrary-value" rule for patched version "eslint-plugin-tailwindcss@3.15.1-beta.0"

image

index.tsx:41

- <span className="!absolute !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]">Loading...</span>
+ <span className="!absolute !whitespace-nowrap !border-0 !p-0  [clip:rect(0,0,0,0)]">Loading...</span>

Once removed ! for ![clip:rect(0,0,0,0)] value - it does not cause an error

@francoismassart
Copy link
Owner

Thanks for the infos, I'll take a look at it

@francoismassart
Copy link
Owner

@coltonhurst please try with
npm i eslint-plugin-tailwindcss@3.15.1-beta.1

@francoismassart
Copy link
Owner

fixed in eslint-plugin-tailwindcss@3.15.1

@francoismassart
Copy link
Owner

@coltonhurst please re-open the issue if eslint-plugin-tailwindcss@3.15.1 does not fix your issue

@coltonhurst
Copy link
Author

@francoismassart apologies for the late reply. Thank you so much! This is fixed, I've tested 3.15.1 on this PR. Thank you for the support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working work in progress
Projects
None yet
Development

No branches or pull requests

3 participants