Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] : twin.macro with Styled Components doens't show errors #272

Closed
DorianHenry opened this issue Sep 6, 2023 · 2 comments · Fixed by #302
Closed

[BUG] : twin.macro with Styled Components doens't show errors #272

DorianHenry opened this issue Sep 6, 2023 · 2 comments · Fixed by #302
Labels
bug Something isn't working

Comments

@DorianHenry
Copy link

Describe the bug
When I use twin.macro with Styled Components in a React project, ESLint doesn't show errors.

To Reproduce
Steps to reproduce the behavior:

  1. Install twin.macro
  2. Set a Tailwind error with twin.macro.

Expected behavior
It should show an error with the invalid Tailwind classes order.

Environment (please complete the following information):

  • OS: [windows 11]
  • Softwares + version used:
    • [VSCode 1.81.1]
    • [pnpm 8.7.1]
    • [twin.macro 3.4.0]
    • [eslint-plugin-tailwindcss 3.13.0]

Additional context
Here's an example of the code that should show an error:

import tw from "twin.macro";
const AlertWrapper = tw.div`overflow-hidden relative rounded bg-slate p-7 py-5`;
const AlertLine = tw.span`top-0 absolute  left-0 w-2 h-full bg-primary`;

eslint config

module.exports = {
  root: true,
  env: { browser: true, es2020: true },
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:react-hooks/recommended",
    "plugin:storybook/recommended",
    "plugin:tailwindcss/recommended",
  ],
  ignorePatterns: ["dist", ".eslintrc.cjs"],
  parser: "@typescript-eslint/parser",
  plugins: ["react-refresh"],

  rules: {
    "report-unused-disable-directives": 0,
    "react-refresh/only-export-components": [
      "warn",
      { allowConstantExport: true },
    ],
  },
  overrides: [
    {
      files: ["*.ts", "*.tsx", "*.js"],
      parser: "@typescript-eslint/parser",
    },
  ],
  settings: {
    tailwindcss: {
      callees: ["classnames", "clsx", "ctl", "tw"],
      tags: ["tw"],
      classRegex: "^(class(Name)?)|(tw\\.\\w+)$",
    },
  },
};
@DorianHenry DorianHenry added the bug Something isn't working label Sep 6, 2023
@zonterone
Copy link

zonterone commented Dec 23, 2023

Hi!👋
Do you find any solutions?

@francoismassart
Copy link
Owner

Released in v3.17.0Thank you @nihalgonsalves

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

Successfully merging a pull request may close this issue.

3 participants