Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Static Analysis & Code Quality
  3. ERB Lint

ERB Lint

MITRubyv0.9.0

A Ruby tool to lint ERB and HTML files using built-in and custom linters for code quality and security.

GitHubGitHub
747 stars137 forks0 contributors

What is ERB Lint?

ERB Lint is a Ruby gem that analyzes ERB and HTML template files to detect style violations, security issues, and common errors. It provides a suite of built-in linters for tasks like enforcing safe data interpolation, checking accessibility attributes, and ensuring consistent formatting, helping teams maintain high-quality view code.

Target Audience

Ruby on Rails developers and teams working with ERB templates who need to enforce coding standards, improve security, and ensure consistency across their view layer.

Value Proposition

Developers choose ERB Lint for its comprehensive set of Rails-aware linters, extensibility through custom linters, and seamless integration with existing tools like RuboCop, making it a robust solution for template linting without heavy configuration.

Overview

Lint your ERB or HTML files

Use Cases

Best For

  • Enforcing secure data interpolation in JavaScript contexts within ERB templates
  • Checking HTML input elements for required autocomplete attributes to improve accessibility
  • Ensuring consistent ERB tag formatting and whitespace across a Rails codebase
  • Detecting deprecated CSS classes and suggesting replacements in views
  • Running RuboCop rules specifically on Ruby code embedded in ERB files
  • Writing custom linting rules for project-specific ERB or HTML conventions

Not Ideal For

  • Projects using non-ERB templating engines like Haml or Slim
  • Teams wanting a zero-configuration linting tool out of the box
  • Very small or throwaway prototypes where linting overhead isn't justified
  • Environments with strict CI/CD performance constraints without caching enabled

Pros & Cons

Pros

Strong Security Enforcement

Linters like ErbSafety mandate safe helpers like .to_json for JavaScript interpolations, directly preventing XSS vulnerabilities as highlighted in the README examples.

Deep RuboCop Integration

The Rubocop linter runs RuboCop rules on Ruby code within ERB templates, allowing consistent style and security checks across view and application code.

Highly Extensible Architecture

Supports custom linters loaded from a .erb_linters directory, enabling teams to write project-specific rules, as demonstrated with the CustomLinter example.

Practical Autocorrection

Many linters like RightTrim and NoJavascriptTagHelper offer automatic fixing of violations, reducing manual cleanup effort and enforcing standards quickly.

Cons

Configuration Fragility

Linters such as ErbSafety and Rubocop require external config files (.better-html.yml, .rubocop.yml), and errors occur if missing, adding setup complexity.

Ruby-Only Lock-In

Tightly coupled to Ruby and ERB templates, making it useless for projects using other languages or frontend frameworks, limiting its versatility.

RuboCop Context Limitations

The README admits that RuboCop rules can trigger false positives in ERB, like Lint/UselessAssignment, due to analyzing each Ruby statement independently.

Frequently Asked Questions

Quick Stats

Stars747
Forks137
Contributors0
Open Issues65
Last commit3 months ago
CreatedSince 2016

Tags

#html-linter#rails#rubocop#template-linting#security#accessibility#code-quality#ruby#static-analysis

Built With

R
Ruby

Included in

Static Analysis & Code Quality14.5k
Auto-fetched 7 hours ago

Related Projects

GitleaksGitleaks

Find secrets with Gitleaks 🔑

Stars28,284
Forks2,158
Last commit1 day ago
PHP ParserPHP Parser

A PHP parser written in PHP

Stars17,452
Forks1,129
Last commit12 days ago
TypeScript ESLintTypeScript ESLint

:sparkles: Monorepo for all the tooling which enables ESLint to support TypeScript

Stars16,320
Forks2,952
Last commit1 day ago
pyrightpyright

Static Type Checker for Python

Stars15,545
Forks1,797
Last commit2 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub