Skip to content

[BUG] loadConfig never uses cache #343

Closed
@rpereira-anchor

Description

@rpereira-anchor

Describe the bug
I have an issue where a change to the way I set my tailwind.config file started making timeouts when linting. Loading the actual application is fine.
The change was to determine which local packages my app depends on in order to add it to the content that tailwind has to look into.

When debugging I came to a finding that the tailwind.config file was being loaded more times than should be necessary. One time per file it seems.

It seems to me that, when loading tailwind config, the cache is never used. In this line, 2 different instances of dates are compared. These are always different.

To Reproduce
Place a console.log inside each if statement

      if (stats === null) {
        loadedConfig = {};
         console.log("1")
      } else if (lastModifiedDate !== stats.mtime.getTime()) {
        lastModifiedDate = stats.mtime.getTime();
        loadedConfig = requireUncached(resolvedPath);
         console.log("2")
      } else {
        loadedConfig = null;
         console.log("3")
      }

only 2 will appear

Expected behavior
A clear and concise description of what you expected to happen.

I expect 2 to appear once followed by many instances of 3. This means that the last modified date has not changed.

Screenshots
N/A

Environment (please complete the following information):

  • OS: Debian 11
  • Softwares + version used:
    • yarn 4
    • node 18
    • eslint-plugin-tailwindcss 3.17.0

Additional context
N/A

eslint config file or live demo
#344

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions