-
Notifications
You must be signed in to change notification settings - Fork 36
@html-eslint/parser
doesn't support eslint-plugin-tailwindcss
#211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @LatenPath Can you share the configuration? |
"devDependencies": {
"@angular-eslint/template-parser": "^18.3.0",
"@html-eslint/eslint-plugin": "^0.26.0",
"@html-eslint/parser": "^0.26.0",
"eslint": "^9.9.0",
"eslint-plugin-tailwindcss": "^3.17.4",
"tailwindcss": "^3.4.10",
"typescript": "~5.5.4",
"typescript-eslint": "^8.2.0"
}
import eslintHTML from "@html-eslint/eslint-plugin";
import eslintTypescript from "typescript-eslint";
import eslintTailwindCSS from "eslint-plugin-tailwindcss";
import eslintHTMLParser from "@html-eslint/parser";
import eslintAngularParser from "@angular-eslint/template-parser";
export default eslintTypescript.config(
//
// HTML plugin configs
{
"files": [ "**/*.html" ],
"languageOptions": {
parser: eslintHTMLParser,
},
"plugins": {
"@html-eslint": eslintHTML,
},
"rules": {
"@html-eslint/require-doctype": 1 // For testing
}
}
// The above code will run fine alone, below is the code used to run TailwindCSS Eslint
// (**will cause 'TypeError: Cannot read' error, but will run fine without the above code**)
// {
// "files": [ "**/*.html" ],
// "languageOptions": {
// parser: eslintAngularParser,
// },
// "plugins": {
// "tailwindcss": eslintTailwindCSS,
// },
// "rules": {
// "tailwindcss/classnames-order": [ 1 ] // For testing
// },
// },
// I tried to combine them, but this one will cause an error too:
// {
// "files": [ "**/*.html" ],
// "languageOptions": {
// parser: eslintHTMLParser,
// },
// "plugins": {
// "@html-eslint": eslintHTML,
// "tailwindcss": eslintTailwindCSS,
// },
// "rules": {
// "@html-eslint/require-doctype": 1,
// "tailwindcss/classnames-order": [ 1 ],
// },
// },
//
); TailwindCSS Eslint Github link: https://github.com/francoismassart/eslint-plugin-tailwindcss |
@LatenPath It would be great if you could also share the contents of the HTML file you ran the lint on to reproduce the error. |
I think tailwindcss plugin should support this parser. Created a PR for them. |
I did not hear back from tailwind maintainers.. I created new eslint plugin to lint HTML files with this parser and that would support alpinejs syntax (it works with vanilla HTML as well). Give it a try, let me know! |
Thank you so much for your efforts <3 I tried the plugin and this is my feedback: At first, I installed the plugin and got an import error: I'm still a newbie so it made me a little confused (==') ... But I found a way to work around it: No more error. So I can test the plugin: Everything works perfectly. Once again, thank you so much. Your plugin is an awesome solution, and I can't wait to see more in the future! |
@LatenPath , oh nice, thanks for trying it! I will look into that bundling issue to fix the import. |
@LatenPath I couldn't repro specific error you were getting. There is another issue I ran into with |
I'm using

html-eslint
and it works fine:But, then I want to use



eslint-plugin-tailwindcss
to lint tailwind elements.It works. But, as you can see, I need to use

@angular-eslint/template-parser
for HTML file to make Tailwind-eslint worked.And as I know so far, I'm not able to use both
@angular-eslint/template-parser
and@html-eslint/parser
at the same time.I wonder if I can do something to solve this problem? I would love some advice, thank you all very much.
The text was updated successfully, but these errors were encountered: