v0.9.0
Herb v0.9
Check out the "What's new in Herb v0.9" post on the Herb Blog.
Core
- Fix
TS2304: Cannot find name 'TextDecoder'error by @marcoroth in #1175 - Types: Add discriminated union support across language bindings by @marcoroth in #1154
- Implement
lex_fileandparse_filein language bindings by @marcoroth in #1325 - Expose
Herb.parse_pubyto parse Ruby with Prism by @marcoroth in #1353
Parser
- Fix ERB control flow tags in attribute positions by @marcoroth in #873
- Add
analyzeoption toparser_options_Tby @citizen428 in #1144 - Introduce
HTMLConditionalElementNodeby @marcoroth in #1146 - Make
parser_optionsparameterconstinherb_parseby @citizen428 in #1151 - Introduce
HTMLConditionalOpenTagNodeby @marcoroth in #1153 - Handle invalid HTML comment closing tag
--!>by @marcoroth in #1156 - Improve error recovery for unclosed open tags and unterminated quotes by @marcoroth in #1169
- Add
strictoption toparser_optionsby @marcoroth in #1171 - Improve error recovery for ERB tags by @marcoroth in #1170
- Introduce
HTMLOmittedCloseTagNodeandOmittedClosingTagErrorby @marcoroth in #1173 - Introduce
MissingAttributeValueErrorfor empty attribute values by @marcoroth in #1182 - Mention
strict: falseinOmittedClosingTagErrormessage by @marcoroth in #1189 - Don't treat backslash as escape character in attribute values by @marcoroth in #1213
- Fix regressions in analyzing conditional open tags by @marcoroth in #1208
- Store parser options on
ParseResultby @marcoroth in #1190 - Introduce
UnclosedCloseTagErrorby @marcoroth in #1216 - Improve ERB
casenode andendtag matching by @marcoroth in #1237 - Fix
ConditionalElementMultipleTagsErroron valid templates by @marcoroth in #1240 - Fix lambda block detection by @marcoroth in #1250
- Introduce
StrayERBClosingTagErrorby @marcoroth in #1256 - Friendly token names in Unexpected Token error messages by @marcoroth in #194
- Allow inline
case/whenandcase/inin strict mode by @marcoroth in #1263 - Rename
sourcetoelement_sourceforHTMLElementNodeby @marcoroth in #1331 - Analyze and transform Action View helpers by @marcoroth in #1347
- Expose Prism Nodes in Herb Syntax Tree by @marcoroth in #1350
- Detect
turbo_frame_taghelper by @marcoroth in #1354
Engine
- Turn on
strictby default by @marcoroth in #1184 - Fix ERB expression compilation when code contains a heredoc by @pinzonjulian in #1206
- Ensure Engine produces valid Ruby in test suite by @marcoroth in #1207
- Ensure
assert_evaluated_snapshotproduces valid Ruby in tests by @marcoroth in #1209 - Fix newline handling after heredoc terminators by @marcoroth in #1246
- Add support for disabling debug spans in
ERBBlockNodevia comments by @kozy4324 in #977 <%= -%>does not trim trailing newline by @joelhawksley in #1361- Inline comments on
<% end %>on output blocks produce invalid Ruby by @joelhawksley in #1363 - Whitespace stripped between HTML closing tag and ERB control tag by @joelhawksley in #1366
Formatter
- Make sure
herb-formatrespects.herb.ymlby @marcoroth in #1185 - Don't collapse multiple ERB expressions in block elements by @marcoroth in #1214
- Add
expectFormattedToMatchtest helper by @marcoroth in #1215 - Fix infinite loop when rendering multiple groups of adjacent inline elements by @ydah in #1008
- Fix ERB text flow formatting to keep adjacent inline elements together by @ydah in #1010
- Fix punctuation separating from ERB tags in mixed content by @marcoroth in #1266
- Extract Text Flow Engine by @marcoroth in #1267
- Extract Attribute Renderer by @marcoroth in #1269
- Extract Spacing Analyzer and Comment Helpers by @marcoroth in #1270
- Fix adjacent ERB tags in ERB block by @marcoroth in #1278
- Preserve user newlines in block elements with mixed content by @marcoroth in #1279
- Preserve content in
white-spacesignificant elements by @marcoroth in #1280 - Refactor Format Printer using
withInlineModeby @marcoroth in #1285 - Preserve user newlines for block elements with ERB children by @marcoroth in #1295
- Preserve user newlines for inline elements by @marcoroth in #1305
Linter
- Fix
html-no-empty-headingsto detect non-output ERB by @marcoroth in #1162 - Update
html-anchor-require-hrefwitherblint-githubinsights by @marcoroth in #1228 - Link Linter rule IDs to docs in CLI output by @marcoroth in #1241
- Improve colors in Linter CLI output by @marcoroth in #1242
- Link file paths in Linter CLI output by @marcoroth in #1243
- Make
RuleClass().namestatic by @citizen428 in #1268 - Fix false positive for dynamic IDs across separate ERB blocks by @marcoroth in #1299
- Access rule
typefrom class instead of instance by @marcoroth in #1298 - Accessibility rules should be warnings, not errors by @joelhawksley in #1066
- Improve
html-img-require-altrule by @marcoroth in #1311 - Move
pathto CLI-only bundle by @marcoroth in #1352 - Make
html-anchor-require-hrefAction View Helper aware by @marcoroth in #1367 - CLI: Implement a Linter Worker to parallelize file processing by @marcoroth in #1371
Linter Rules
New Rules
- Implement
erb-no-conditional-html-elementrule by @marcoroth in #1150 - Implement
html-no-aria-hidden-on-bodyrule by @marcoroth in #1163 - Implement
html-no-abstract-rolesrule by @marcoroth in #1164 - Implement
erb-no-trailing-whitespacerule by @markokajzer in #1168 - Implement
erb-no-conditional-open-tagrule by @markokajzer in #1200 - Implement
html-allowed-script-typerule by @markokajzer in #1201 - Implement
html-require-closing-tagsrule by @markokajzer in #1199 - Implement
turbo-permanent-require-idrule by @pardeyke in #1229 - Implement
erb-no-inline-case-conditionsrule by @marcoroth in #1265 - Implement
erb-no-interpolated-class-namesrule by @marcoroth in #1283 - Implement
erb-no-duplicate-branch-elementsrule by @marcoroth in #1301 - Implement
erb-no-then-in-control-flowrule by @marcoroth in #1309 - Implement
erb-no-statement-in-scriptrule by @marcoroth in #1330 - Implement
erb-no-javascript-tag-helperrule by @marcoroth in #1330 - Implement
erb-no-unsafe-script-interpolationrule by @marcoroth in #1330 - Implement
erb-no-raw-output-in-attribute-valuerule by @marcoroth in #1330 - Implement
erb-no-unsafe-rawrule by @marcoroth in #1330 - Implement
erb-no-unsafe-js-attributerule by @marcoroth in #1330 - Implement
erb-no-output-in-attribute-positionrule by @marcoroth in #1330 - Implement
erb-no-output-in-attribute-namerule by @marcoroth in #1330 - Implement
erb-no-instance-variables-in-partialslinter rule by @marcoroth in #1355 - Implement
actionview-no-silent-helperrule by @marcoroth in #1358 - Implement
html-details-has-summaryrule by @marcoroth in #1370
Autofixes
- Implement autofix for
erb-no-duplicate-branch-elementsby @marcoroth in #1302
Language Server
- Respect
.herb.ymlfiles.excludeinLintServiceby @marcoroth in #1271 - Implement Document Highlights by @marcoroth in #1284
- Implement Folding Ranges by @marcoroth in #801
- Implement Toggle Comment Service by @marcoroth in #1308
- Improve edge cases in Comment Service by @marcoroth in #1329
- Implement Hover Provider for Action View Helpers by @marcoroth in #1356
- Action View Helper rewrite Code Actions by @marcoroth in #1357
Playground
- Add
analyzeandstrictparser options by @marcoroth in #1172 - Implement a Ruby Prism playground by @marcoroth in #1360
Rewriter
- Preserve interpolated ERB class names in tailwind rewriter by @marcoroth in #1085
- Implement Action View Tag Helpers <-> HTML rewriters by @marcoroth in #1348
- Fix single-arg
link_toin Action View rewriter by @marcoroth in #1351
Printer
- Implement Indentation Printer by @marcoroth in #1300
Extractor
- Add
extract_ruby_optionsacross all language bindings by @Lusqinha in #675 - Fix multi-line ERB comment extraction in
extract_rubyby @marcoroth in #1297
Ruby
- Ruby: Respect
.herb.ymland makeexcludeadditive by @marcoroth in #1166 - Ruby: Remove
tsortfromGemfilesince it's fixed in RBS by @marcoroth in #1187 - Ruby: Don't run tests with forking threads by default by @marcoroth in #1255
- Ruby: Add more granular test rake tasks by @marcoroth in #1257
- Ruby: Re-enable Sorbet check by @mickeytgl in #465
- Ruby: Fix native extension loading for new RubyGems (Ruby 4.1+) by @marcoroth in #1281
- Ruby: Add
arena_statskwarg and--arena-statsCLI flag by @marcoroth in #1293 - Ruby: Improve
--arena-statsoutput inanalyzeby @marcoroth in #1324 - Ruby: Add ability to install gem from a branch by @joelhawksley in #1337
Ruby CLI
- Improve and flesh out
herb analyzecommand by @marcoroth in #1259 - Support
stdinas an option for[file]by @marcoroth in #1186 - Expose Node.js binaries in Herb Ruby CLI by @marcoroth in #1192
- Expose
--no-analyzeand--track-whitespaceoptions by @marcoroth in #1249 - Add
--arena-statsflag toanalyzesubcommand by @marcoroth in #1294 - Show compiled source when
compileproduces invalid Ruby by @marcoroth in #1365
Rust
- Rust: Implement Visitors in Rust Bindings by @marcoroth in #1260
- Rust: Implement Herb Configuration in Rust by @marcoroth in #1261
Node.js/Deno
- Fix CommonJS packaging in
@herb-tools/nodeby @fc-anjos in #375 - Test Deno compatibility in CI by @marcoroth in #1296
Java
- Java: Add JUnit and proper Java tests by @citizen428 in #1152
- Java: Migrate snapshot tests to JUnit by @marcoroth in #1217
Config
- Add
engine.*configuration options by @joelhawksley in #1315 and @marcoroth in #1375
Visual Studio Code Extension
- Register Toggle Comment Service in VS Code Extension by @marcoroth in #1308
Documentation
- Branding updates by @marcoroth in #1286
Internal
- Upgrade to TypeScript 6.0 Beta by @marcoroth in #1148
- Upgrade to TypeScript 6.0 RC by @marcoroth in #1349
- CI: Reorder build steps to fail fast on cheap checks by @citizen428 in #1145
- Apply fixes from
oxlintby @marcoroth in #1238 - Lock
pkg-pr-newtov0.0.63for now by @marcoroth in #1258
WebAssembly
- Remove
ERROR_ON_UNDEFINED_SYMBOLSflag by @marcoroth in #1165 - Upgrade to Emscripten 5.x by @marcoroth in #1247
libherb
- Remove unused imports and fix signatures by @citizen428 in #1191
- Cleanup parser and bindings by @marcoroth in #1212
- Refactor
analyze.cintosrc/analyze/by @marcoroth in #714 - Add
HERB_EXCLUDE_PRETTYPRINTpreprocessor flag by @marcoroth in #1262 - Extract
hb_allocator_Tby @marcoroth in #1287 - Use Arena Allocator for Lexing and Parsing by @marcoroth in #726
- Implement merging arena pages by @timkaechele in #719
- Implement Tracking Allocator and add
--leak-checktoanalyzeby @marcoroth in #1304 - Use
hb_allocator_Tforlocation_createby @marcoroth in #1306 - Remove unnecessary
mallocusage in errors andhb_stringby @marcoroth in #1307 - Use
hb_string_Tfortoken_T.valueby @timkaechele in #687 - Use
hb_string_TforERROR_T.messageand error functions by @marcoroth in #1313 - Add
trim,blankand simplifyhb_string_Toperations by @marcoroth in #1314 - Migrate
token_type_to_friendly_stringtohb_string_Tby @marcoroth in #1316 - Update Prism and Ruby helpers to use
hb_string_Tby @marcoroth in #1317 - Optimize
hb_string()to compute length at compile time by @marcoroth in #1318 - Inline hot-path lexer peek helpers by @marcoroth in #1319
- Inline hot-path
hb_stringfunctions by @marcoroth in #1320 - Implement
reallocforhb_allocator_Tby @marcoroth in #1322 - Migrate
hb_arrayto usehb_allocator_Tinfrastructure by @marcoroth in #1323 - Migrate
hb_bufferto usehb_allocator_Tinfrastructure by @marcoroth in #1326 - Add
HB_STRING_LISTfor statichb_string_Tarray initialization by @marcoroth in #1321 - Migrate
hb_narrayto use new allocator system by @timkaechele in #1327
Dependencies
- Bump qs from 6.14.1 to 6.14.2 by @dependabot[bot] in #1149
- Bump markdown-it from 14.1.0 to 14.1.1 by @dependabot[bot] in #1159
- Bump rimraf from 6.1.2 to 6.1.3 by @dependabot[bot] in #1194
- Bump playwright from 1.58.1 to 1.58.2 by @dependabot[bot] in #1195
- Bump oxlint from 1.43.0 to 1.48.0 by @dependabot[bot] in #1197
- Bump esbuild from 0.27.2 to 0.27.3 by @dependabot[bot] in #1198
- Bump ajv from 6.12.6 to 6.14.0 by @dependabot[bot] in #1227
- Bump oxlint from 1.48.0 to 1.50.0 by @dependabot[bot] in #1235
- Bump @typescript-eslint/parser from 8.54.0 to 8.56.1 by @dependabot[bot] in #1234
- Bump rollup from 4.57.1 to 4.59.0 by @dependabot[bot] in #1248
- Bump @shikijs/vitepress-twoslash from 3.22.0 to 4.0.1 by @dependabot[bot] in #1273
- Bump oxlint from 1.50.0 to 1.51.0 by @dependabot[bot] in #1275
- Bump yeoman-generator from 7.5.1 to 8.0.0 by @dependabot[bot] in #1276
- Bump @types/node from 22.19.13 to 25.3.3 in /javascript/packages/language-server by @dependabot[bot] in #1272
- Bump @typescript-eslint/eslint-plugin from 8.55.0 to 8.56.1 by @dependabot[bot] in #1274
- Bump underscore from 1.13.7 to 1.13.8 by @dependabot[bot] in #1290
- Bump svgo from 2.8.0 to 2.8.2 by @dependabot[bot] in #1303
- Bump postcss from 8.5.6 to 8.5.8 by @dependabot[bot] in #1333
- Bump node-addon-api from 8.5.0 to 8.6.0 by @dependabot[bot] in #1335
- Bump yeoman-generator from 8.0.0 to 8.0.2 by @dependabot[bot] in #1334
- Bump @shikijs/vitepress-twoslash from 4.0.1 to 4.0.2 by @dependabot[bot] in #1336
New Contributors
- @Lusqinha made their first contribution in #675
- @markokajzer made their first contribution in #1168
- @pinzonjulian made their first contribution in #1206
- @pardeyke made their first contribution in #1229
- @fc-anjos made their first contribution in #375
- @joelhawksley made their first contribution in #1066
Commits
Full Changelog: v0.8.10...v0.9.0