Quick Take

import { strict as assert } from "assert";
import { Linter } from "emlint";
const linter = new Linter();

// Correct "not" type Outlook conditional would be:
// <!--[if !mso]><!-->
//   <span class="foo">z</span>
// <!--<![endif]-->

// We have a "not" type opening but "only" type
// closing:
const messages = linter.verify(
  `<!--[if !mso]><!-->
  <span class="foo">z</span>
    rules: {
      all: 2,

assert.deepEqual(messages, [
    line: 3,
    column: 1,
    severity: 2,
    ruleId: "comment-mismatching-pair",
    message: `Add "<!--".`,
    idxFrom: 49,
    idxTo: 61,
    fix: {
      ranges: [[49, 49, "<!--"]],
    keepSeparateWhenFixing: true,


EMLint is currently being developed. Please come back later.


See it in the monorepo opens in a new tab, on GitHub.


To report bugs or request features or assistance, raise an issue on GitHub opens in a new tab.

Any code contributions welcome! All Pull Requests will be dealt promptly.


MIT opens in a new tab

Copyright © 2010–2021 Roy Revelt and other contributors

Related packages:

📦 codsen-parser 0.12.1
Parser aiming at broken or mixed code, especially HTML & CSS
📦 codsen-tokenizer 6.0.1
HTML and CSS lexer aimed at code with fatal errors, accepts mixed coding languages
📦 detergent 8.0.1
Extracts, cleans and encodes text
📦 html-crush 5.0.1
Minifies HTML/CSS: valid or broken, pure or mixed with other languages
📦 email-comb 6.0.1
Remove unused CSS from email templates
📦 string-strip-html 9.0.1
Strips HTML tags from strings. No parser, accepts mixed sources
📦 json-variables 11.0.1
Resolves custom-marked, cross-referenced paths in parsed JSON