-
-
Notifications
You must be signed in to change notification settings - Fork 96
Description
Describe the bug
A configuration like this:
[
tailwind.configs["flat/recommended"],
{
files: ["project/**/*.tsx"],
settings: {
tailwind: {
config: "config1"
}
}
}
]
Will result in files from project one loading with a default configuration instead of the specified one.
The default and custom configs get mixed up.
To Reproduce
See "Additional information"
It is tricky to reproduce because there is some indeterminism in the order the files are processed. But I have a reproducible environment, however I can't share it as is as it is not open source.
I can create a repo to reproduce it but it would take me some time, and I think I can point to the code where the bug is
Expected behavior
Every file should get the correct config.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: [e.g. macOS, windows 10]
- Softwares + version used:
- [e.g. VSCode 1.54.3]
- [... Terminal 2.9.5, npm 6.14.5, node v14.5.0]
Additional context
So, here is the problem. In this file https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/lib/util/customConfig.js
Between the functions resolve()
and loadConfig()
.
Suppose the following sequence of events:
// Processing a project1/sample.tsx
resolve("project1/tailwind.config.json")
// new config, so calls loadConfig()
// set lastModifiedDate, return correct config
// Processing some file outside
resolve(null)
// new config, calls loadConfig()
// returns `{}` WITHOUT CHANGING lastModifiedDate
// Processing another file, project1/foobar.tsx
resolve("project1/tailwind.config.json")
// new config, calls loadConfig()
// lastModified DID NOT CHANGE since the last call, so **returns NULL** instead of the correct config
A good solution would be to add a newConfig
argument for loadConfig so it won't return null
in that case.
And/or resetting lastModifiedDate to null if the input is null.