A customizable HTML linter that runs via a terminal command. Define your own rules and ensure code consistency across your projects.
- Run manually with a terminal command for specific files or folders.
- Lightweight and fast.
Install globally to use the ctm-htmllinter
command:
npm install -g ctm-htmllinter
Use the ctm-htmllinter
command to lint specific files or directories.
ctm-htmllinter -a, -all
ctm-htmllinter ./index.html
ctm-htmllinter ./html/
ctm-htmllinter comes with a set of preconfigured rules:
- Avoid empty alt attributes.
- Enforce consistent spacing and indentation.
- Enforce consistent naming convention.
You can customize which rules and folders will be ignored by the module by executing the following command to create a config file:
ctm-htmllinter -i, -init
{
"rules": {
"avoidEmptyAlt": true,
"noNestedCss": true,
"missingDoctype": true,
"consistentIndentation": 4,
"noTrailingWhitespace": true,
"fileNamingConvention": true
},
"ignore": ["folder"]
}
rules
: List of enabled rules.ignore
: Array of folders or files to exclude from linting.
If you'd like to contribute to this module, feel free to submit a pull request or open an issue to discuss improvements.