Skip to content
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

Add support for eslint flat config #174

Closed
TheElegantCoding opened this issue Jan 9, 2024 · 8 comments · Fixed by #176
Closed

Add support for eslint flat config #174

TheElegantCoding opened this issue Jan 9, 2024 · 8 comments · Fixed by #176
Labels
enhancement New feature or request

Comments

@yeonjuan
Copy link
Owner

yeonjuan commented Jan 9, 2024

Hi @TheElegantCoding, Thanks for the report!. Is there anything else we need to do to support flat config?

I've tested the config below and it seems to be working fine, did you run into any issues?

const Plugin = require("@html-eslint/eslint-plugin");
const Parser = require("@html-eslint/parser");

module.exports = [
  {
    plugins: { "@html-eslint": Plugin },
    languageOptions: {
      parser: Parser,
    },
    files: ["*.html"],
    rules: {
      //...
    },
  },
];

@TheElegantCoding
Copy link
Author

thanks that work and also i find an error in my config, in order to work inside all the repo i have to put files: [ '**/*.html' ]

Other problem i have with eslint flat config is the type in typescript my config is in typescript

import { htmlDisabledRule } from '@module/html/rule/html_disabled_rule';
import { htmlGeneralRule } from '@module/html/rule/html_general_rule';
import pluginHtml from "@html-eslint/eslint-plugin";
import parserHtml from "@html-eslint/parser";


const html =
{
  files: [ '**/*.html' ],
  languageOptions:
  {
    parser: parserHtml
  },
  plugins:
  {
    html: pluginHtml
  },
  rules: {
    ...htmlGeneralRule,
    ...htmlDisabledRule
  }
};
export { html };

in the pluginHtml import i get this error Could not find a declaration file for module '@html-eslint/eslint-plugin'.

@yeonjuan
Copy link
Owner

in the pluginHtml import i get this error Could not find a declaration file for module '@html-eslint/eslint-plugin'.

@TheElegantCoding Thank you. I think this should be fixed..!

@yeonjuan yeonjuan added the enhancement New feature or request label Jan 10, 2024
@LatenPath
Copy link

LatenPath commented Jan 16, 2024

@yeonjuan Dear sir, I got this warning when import recommended setting.
image

Hi @TheElegantCoding, Thanks for the report!. Is there anything else we need to do to support flat config?

I've tested the config below and it seems to be working fine, did you run into any issues?

const Plugin = require("@html-eslint/eslint-plugin");
const Parser = require("@html-eslint/parser");

module.exports = [
  {
    plugins: { "@html-eslint": Plugin },
    languageOptions: {
      parser: Parser,
    },
    files: ["*.html"],
    rules: {
      //...
    },
  },
];

Please help me 😢

@yeonjuan
Copy link
Owner

Hi @LatenPath , Could you try pluginHtml.configs.recommended.rules instead of pluginHtml.configs.recommended?

const pluginHtml = require("@html-eslint/eslint-plugin");
const parserHtml = require("@html-eslint/parser");

module.exports = [
  {
    files: ["**/*.html"],
    languageOptions: {
      parser: parserHtml,
    },
    plugins: {
      "@html-eslint": pluginHtml,
    },
    rules: pluginHtml.configs.recommended.rules,
  },
];

@LatenPath
Copy link

LatenPath commented Jan 20, 2024

@yeonjuan It's work, sir!
image

Disable rule/ Auto-fix,... also work fine!

image

Thank you so much!

But I have a small question, as you can see, other plugin which support Flat config have parser/env built-in so it simpler when setup:
image

So I hope we will have one in future too ❤️

@yeonjuan
Copy link
Owner

@LatenPath

But I have a small question, as you can see, other plugin which support Flat config have parser/env built-in so it simpler

HTML-ESLint does not yet support flat config, we will update it to support flat config :)

@yeonjuan
Copy link
Owner

yeonjuan commented Jan 23, 2024

Hi @TheElegantCoding @LatenPath
The new version is released (v0.23.0). html-eslint supports flat config now! Thanks for the reporting issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants