Skip to content

chore: adding taiwlind intellisense and linting#17349

Merged
georgewrmarshall merged 7 commits into
mainfrom
fix/tailwind-eslint-intellisense
Jul 22, 2025
Merged

chore: adding taiwlind intellisense and linting#17349
georgewrmarshall merged 7 commits into
mainfrom
fix/tailwind-eslint-intellisense

Conversation

@georgewrmarshall

@georgewrmarshall georgewrmarshall commented Jul 17, 2025

Copy link
Copy Markdown
Contributor

Description

This PR sets up Tailwind CSS with IntelliSense and ESLint integration for the MetaMask mobile project to improve the developer experience when working with the design system.

What is the reason for the change?

  • Developers need better tooling support when using Tailwind CSS classes from the MetaMask design system
  • The existing setup lacked proper IntelliSense, validation, and linting for custom design system classes like bg-default, border-default, etc.
  • There was no automated enforcement of consistent Tailwind CSS class ordering and best practices

What is the improvement/solution?

  • Tailwind Config: Created tailwind.config.js that integrates with @metamask/design-system-twrnc-preset to provide proper class definitions for IntelliSense and linting
  • VSCode IntelliSense: Added Tailwind CSS extension configuration in .vscode/settings.json for autocompletion, validation, and color decorators
  • ESLint Integration: Added eslint-plugin-tailwindcss with rules to enforce consistent class ordering and validate custom design system classes
  • Preview Package Integration: Updated to use @metamask-previews/* design system packages for testing before release

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

  1. Test IntelliSense:

    • Open app/component-library/components/design-system.stories.tsx in VSCode
    • Start typing twClassName="bg- and verify autocomplete shows bg-default, bg-alternative, etc.
    • Verify color decorators appear for design system color classes
  2. Test ESLint Integration:

    • Run yarn eslint app/component-library/components/design-system.stories.tsx
    • Verify no errors for valid design system classes like bg-default and border-default
    • Test class ordering validation by rearranging Tailwind classes
  3. Test Design System Classes:

    • Verify custom design system classes are recognized:
      • bg-default, bg-alternative, bg-muted
      • border-default, border-muted
      • text-default, text-alternative, text-muted
  4. Test Configuration:

    • Run node -e "const config = require('./tailwind.config.js'); console.log('Config loaded successfully:', !!config.theme)" to verify config loads

Screenshots/Recordings

Before

  • No Tailwind CSS IntelliSense for design system classes
  • No ESLint validation for Tailwind CSS classes

After

  • Full IntelliSense support for MetaMask design system classes
  • ESLint validation and automatic class ordering
  • Proper recognition of all custom design system classes
eslint-tailwind-intellisense.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall self-assigned this Jul 17, 2025
@georgewrmarshall georgewrmarshall added No QA Needed Apply this label when your PR does not need any QA effort. team-design-system All issues relating to design system in Mobile No E2E Smoke Needed labels Jul 17, 2025
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment thread .eslintrc.js Outdated
Comment thread .eslintrc.js Outdated
@socket-security

socket-security Bot commented Jul 17, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​metamask/​design-system-twrnc-preset@​0.1.0 ⏵ 0.2.081 +8100100 +2391 +2100
Updatednpm/​@​metamask/​design-system-react-native@​0.1.0 ⏵ 0.2.083 +710082 +191 +4100
Addednpm/​eslint-plugin-tailwindcss@​3.18.29910010090100

View full report

Comment thread .eslintrc.js Outdated
Comment thread .eslintrc.js Outdated
Comment thread .github/CODEOWNERS Outdated
Comment thread .vscode/settings.json Outdated
Comment thread package.json Outdated
Comment thread tailwind.config.js Outdated
@georgewrmarshall georgewrmarshall force-pushed the fix/tailwind-eslint-intellisense branch from bc57815 to 25aae23 Compare July 18, 2025 22:56
Comment thread package.json
Comment thread package.json
Comment thread package.json
Comment thread .vscode/settings.json
Comment thread .gitignore
Comment thread .vscode/extensions.json
@georgewrmarshall georgewrmarshall marked this pull request as ready for review July 21, 2025 16:11
@georgewrmarshall georgewrmarshall requested a review from a team July 21, 2025 16:11
Comment thread .vscode/settings.json
cursor[bot]

This comment was marked as outdated.

Comment thread .vscode/settings.json Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bug: Tailwind IntelliSense Misconfiguration in VSCode

The tailwindCSS.classAttributes setting in .vscode/settings.json is incorrectly configured as ["twClassName", "style"]. In React Native, the style prop expects style objects, not CSS class strings, causing Tailwind IntelliSense to inappropriately trigger for inline styles. This also creates an inconsistency with the ESLint plugin, which is configured to validate ["twClassName", "tw"]. The correct value should be ["twClassName", "tw"] to ensure proper IntelliSense for tw attributes and align with ESLint validation.

.vscode/settings.json#L18-L19

},
"tailwindCSS.classAttributes": ["twClassName", "style"],

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Comment thread .vscode/settings.json
Comment thread .vscode/settings.json
Comment thread .vscode/settings.json
Comment thread .vscode/settings.json
@georgewrmarshall georgewrmarshall requested review from a team and Copilot July 21, 2025 16:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR integrates Tailwind CSS tooling support for the MetaMask mobile project by setting up IntelliSense, ESLint validation, and proper configuration for the design system classes.

  • Updates design system packages to version 0.2.0 for enhanced Tailwind CSS support
  • Configures VSCode with Tailwind CSS IntelliSense for autocompletion and validation of design system classes
  • Adds ESLint rules to enforce Tailwind CSS best practices and validate custom design system classes

Reviewed Changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Updates design system packages and adds Tailwind CSS ESLint plugin
.vscode/settings.json Configures Tailwind CSS IntelliSense for design system class attributes
.vscode/extensions.json Recommends Tailwind CSS extension for the project
.github/CODEOWNERS Assigns design system team ownership of Tailwind config
.eslintrc.js Adds Tailwind CSS ESLint rules for component directories

Comment thread .vscode/settings.json
Comment thread .eslintrc.js
@sonarqubecloud

Copy link
Copy Markdown

@georgewrmarshall georgewrmarshall added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Jul 21, 2025

@sethkfman sethkfman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed CODEOWNERs and package.json

@georgewrmarshall georgewrmarshall added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit e782ad8 Jul 22, 2025
49 checks passed
@georgewrmarshall georgewrmarshall deleted the fix/tailwind-eslint-intellisense branch July 22, 2025 18:21
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 22, 2025
@metamaskbot metamaskbot added the release-7.53.0 Issue or pull request that will be included in release 7.53.0 label Jul 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.53.0 Issue or pull request that will be included in release 7.53.0 team-design-system All issues relating to design system in Mobile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants