@io-arc/webpack-loaders-pug-linter

A webpack loader that handles Pug's Lint.

Usage#

$ npm i @io-arc/webpack-loaders-pug-linter
index.ts
import PugLintLoader from '@io-arc/webpack-loaders-pug-linter'
import lint from '../.pug-lintrc.json'
export default {
// (abbreviation)
module: {
rules: [PugLintLoader(/^(?!_).*\.pug$/, 'pug-lint-loader', lint)]
}
}

Functions#

PugLintLoader(regex, loader[, linter])#

Return: webpack.RuleSetRule

Setting Pug lint loader.

Parameters

paramstypedefaultdescription
regexRegExp-Target regular expression
loaderstring-Specify the Pug Lint loader to use
linterobject(*)Lint settings

(*) Lint default

{
"validateIndentation": 2,
"requireClassLiteralsBeforeAttributes": true,
"requireIdLiteralsBeforeAttributes": true,
"requireLowerCaseAttributes": true,
"requireLowerCaseTags": true,
"requireSpaceAfterCodeOperator": true,
"requireSpecificAttributes": [{ "img": ["alt"] }],
"requireStrictEqualityOperators": true
}