Pure agnostic function and posthtml plugin for linting a bem html. Fork of gulp-html-bemlinter, enriched by returning warnongs count and AST.
First, install posthtml-bem-linter as a development dependency:
npm i --DE posthtml-bem-linterThen, add it to your posthtml.config.js:
import { getPosthtmlBemLinter } from "posthtml-bem-linter";
export default {
plugins: [
getPosthtmlBemLinter({
getSourceName: (filename) => filename
})
]
};Or use function lintBem in pure Node:
import { lintBem } from "posthtml-bem-linter";
const { nodes, warningCount } = lintBem({ content, name });