Skip to content

[BUG] The plugin does not pick up tailwind configs in projects nested within monorepos #241

@quesabe

Description

@quesabe

Describe the bug
When a frontend project is nested within a monorepo, any linting process run not from the frontend folder does not see the tailwind config. This is especially apparent with VSCode intellisense - the eslint process is run at the project root level, while the tailwind config resides somewhere nested. Since the config is not found the plugin des not pick up any custom colours and other stuff.

To Reproduce
Assumed folder structure:

/rootProject
├ package.json
├ /frontend
│  ├ .eslintrc.js 
│  ├ package.json
│  ├ tailwind.config.js
  1. When eslint is run from rootProject folder the tailwind.config.js is not found.
  2. When eslint is run from frontend folder the tailwind.config.js is found.
  3. eslint process in VSCode is run from rootProject and thus does not find the tailwind.config.js.

BTW, the eslint config is picked up and the rules from eslint-plugin-tailwindcss apply - they just don't use the custom theme and other settings.

Expected behavior
Tailwind config is discoverable as long as it is in the same folder with the eslint config.

Environment (please complete the following information):

  • VSCode@1.77.3
  • eslint@8.37.0
  • tailwindcss@3.3.2
  • eslint-plugin-tailwindcss@3.11.0

Additional context
Seems like this code is the reason for the behaviour:
https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/lib/util/customConfig.js#L26

The path.resolve() resolves to the rootProject folder, while the config is at rootProject/frontend.

PS. I can make it work if I open the frontend folder in a separate editor window. However it is very inconvenient in a large project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions