Linter and syntax checker for EJS templates. Version 2.0.1 released September 2022. ESM-only since v2, requires Node 14+. Parses scriptlet and expression tags, replacing template output with whitespace to retain line/column numbers, then validates resulting JavaScript with acorn via node-syntax-error. Distinguishes itself from EJS core by providing meaningful syntax error messages with line context, supporting custom delimiters, CLI and API usage. Does not check for unclosed EJS tags but helps detect malformed scriptlets. Alternatives exist (e.g., eslint-plugin-ejs) but ejs-lint is the standalone, lightweight option.
npm install ejs-lintNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use the ejsLint API to check an EJS template for syntax errors.
Update code to use import statements or use dynamic import().
Upgrade Node.js to version 14 or higher.
Replace .lint(text, options) with ejsLint(text, options).
Use ejsLint() API or ejslint CLI only.
Manually check for unclosed <% or %> before blaming the linter.
Switch to import or use dynamic import: const ejsLint = (await import('ejs-lint')).default;Double-check all <% and %> tags are properly closed.