Class: ERBLint::Linters::Agent::NoDirectEmoji
- Inherits:
-
ERBLint::Linter
- Object
- ERBLint::Linter
- ERBLint::Linters::Agent::NoDirectEmoji
- Includes:
- ERBLint::LinterRegistry, CustomHelpers
- Defined in:
- lib/erblint/agent/linters/agent/no_direct_emoji.rb
Overview
This class is a custom ERBLint linter that prohibits direct usage of emojis in ERB templates. Instead of writing emojis directly, it encourages the use of appropriate helpers or components. It detects violations and reports them as offenses within ERBLint.
Defined Under Namespace
Classes: ConfigSchema
Constant Summary collapse
- MESSAGE =
"Direct emoji usage is prohibited. " \ "Use Tailwind CSS Icons (i-bi-* classes) instead. " \ "Example: <span class=\"i-bi-emoji-smile\"></span>"
- EMOJI_REGEX =
/[\u{1F300}-\u{1F9FF}]| # Miscellaneous emojis [\u{2600}-\u{26FF}]| # Various symbols [\u{2700}-\u{27BF}]| # Dingbats [\u{1F000}-\u{1F02F}]| # Mahjong tiles [\u{1FA70}-\u{1FAFF}]| # Extended emojis [\u{2300}-\u{23FF}]/x
Instance Method Summary collapse
-
#run(processed_source) ⇒ Object
Technical symbols.
Methods included from CustomHelpers
#generate_offense, #generate_offense_from_source_range, #simple_class_name, #tags
Instance Method Details
#run(processed_source) ⇒ Object
Technical symbols
37 38 39 40 41 |
# File 'lib/erblint/agent/linters/agent/no_direct_emoji.rb', line 37 def run(processed_source) file_content = processed_source.file_content scan_emoji_pattern(processed_source, file_content) end |