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

[0.9.0] linthtml() function doesn't default export #471

Open
regseb opened this issue Sep 10, 2022 · 10 comments
Open

[0.9.0] linthtml() function doesn't default export #471

regseb opened this issue Sep 10, 2022 · 10 comments

Comments

@regseb
Copy link

regseb commented Sep 10, 2022

Version 0.9.0 no longer exports the linthtml() function by default. I think the problem is with the TypeScript transpiler or the module bundler, because index.ts exports function by default.


import linthtml from "@linthtml/linthtml";

console.log(linthtml);

With 0.9.0:

{
  config_from_path: [Getter],
  find_local_config: [Getter],
  default: [Function: linthtml] {
    fromConfig: [Function: fromConfig],
    create_linters_for_files: [Function (anonymous)],
    from_config_path: [Function (anonymous)],
    Linter: [class Linter],
    LegacyLinter: [class Linter],
    rules: [Array],
    presets: {
      none: [Object],
      accessibility: [Object],
      validate: [Object],
      default: [Object]
    }
  }
}

With 0.8.6:

[Function: linthtml] {
  fromConfig: [Function (anonymous)],
  create_linters_for_files: [Function (anonymous)],
  from_config_path: [Function (anonymous)],
  Linter: [class Linter],
  LegacyLinter: [class Linter],
  rules: [Array],
  messages: [Object]
}
@KamiKillertO
Copy link
Collaborator

@regseb Thanks for reporting, I'll look into it.

@bootstrapdisruptive
Copy link

Seems like this breaks the LintHTML VSC extension. Celan install of both resluts in the error message "linthtml: lintHTML is not a function. Check your config file" when I open a html file in VSC.

@KamiKillertO
Copy link
Collaborator

I've started invetigating the problem.
I'm curious @regseb, why is that an issue for you? Are you directly using linthtml somewhere?

@regseb
Copy link
Author

regseb commented Oct 5, 2022

I am developing a project that aggregates several linters (using at API) : Metalint. I integrate LintHTML and I found this difference by upgrading to version 0.9.0. I can work around it, but I reported this problem because I don't think this change is voluntary.

@KamiKillertO
Copy link
Collaborator

I'm happy to hear of people using LintHTML to build other things.
Yeah, it's an unwanted change. The Typescript migration was a challenge, and it looks like I missed a few things.

@KamiKillertO
Copy link
Collaborator

@regseb So, I had a look, and because the codebase is now written in Typescript, it's not possible to bring back the previous export.

@KamiKillertO
Copy link
Collaborator

@HOKComics The latest version has a fix for the vscode extension

@regseb
Copy link
Author

regseb commented Oct 13, 2022

If the default export isn't possible, the linthtml method should be exported normally.

Version Import
0.8.x import linthtml from "@linthtml/linthtml";
0.9.x import LintHTML from "@linthtml/linthtml"; const linthtml = LintHTML.default;
0.10.x import { linthtml } from "@linthtml/linthtml";

@KamiKillertO
Copy link
Collaborator

@regseb I need to think about it. Changing the export once again has many impacts, I'll need to update the vscode extension once again to support 3 different kind of export 😓 . I'm not sure it's good idea

@regseb
Copy link
Author

regseb commented Oct 14, 2022

You can keep the default export to not break the API. And add the normal export of the linthtml method.

Versions
import linthtml from "...";
import LintHTML from "...";
const linthtml = LintHTML.default;
import { linthtml } from "...";
0.8.x ✔️
0.9.x ✔️
0.10.x ✔️ ✔️

export { config_from_path, find_local_config, LegacyLinterConfig, LinterConfig };

- export { config_from_path, find_local_config, LegacyLinterConfig, LinterConfig };
+ export { linthtml, config_from_path, find_local_config, LegacyLinterConfig, LinterConfig };

@regseb regseb changed the title [0.9.0] htmllint() function doesn't default export [0.9.0] linthtml() function doesn't default export Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants