Skip to content

Using ES modules in custom rules #477

@pxl9588

Description

@pxl9588

Is it possible to use ES module in custom rules? I’m running into this error when I use const urlExist = require(‘url-exist’);:

Must use import to load ES module

When I use import urlExist from ‘url-exist’ I get

Cannot use import statement outside of a module

When I change the custom rule to a .mjs I get:

Property ‘names’ of custom rule at index 0 is incorrect

I believe that happens because the rules are imported by markdowlint by require.

Is there a work around for this?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions