{"id":15681698,"url":"https://github.com/jonschlinkert/handlebars-lint","last_synced_at":"2025-06-29T06:33:47.981Z","repository":{"id":57260560,"uuid":"58842158","full_name":"jonschlinkert/handlebars-lint","owner":"jonschlinkert","description":"Pass a context and a string with handlebars templates and lint for missing variables, helpers, block helpers or partials.","archived":false,"fork":false,"pushed_at":"2018-04-27T16:54:02.000Z","size":15,"stargazers_count":10,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T13:59:31.799Z","etag":null,"topics":["ast","handlebars","lint","template","templates"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-15T03:26:02.000Z","updated_at":"2021-04-12T22:26:04.000Z","dependencies_parsed_at":"2022-08-25T06:00:46.678Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/handlebars-lint","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jonschlinkert/handlebars-lint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fhandlebars-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fhandlebars-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fhandlebars-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fhandlebars-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/handlebars-lint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fhandlebars-lint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262269909,"owners_count":23285160,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","handlebars","lint","template","templates"],"created_at":"2024-10-03T16:58:42.156Z","updated_at":"2025-06-29T06:33:47.967Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# handlebars-lint [![NPM version](https://img.shields.io/npm/v/handlebars-lint.svg?style=flat)](https://www.npmjs.com/package/handlebars-lint) [![NPM monthly downloads](https://img.shields.io/npm/dm/handlebars-lint.svg?style=flat)](https://npmjs.org/package/handlebars-lint) [![NPM total downloads](https://img.shields.io/npm/dt/handlebars-lint.svg?style=flat)](https://npmjs.org/package/handlebars-lint) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/handlebars-lint.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/handlebars-lint)\n\n\u003e Lint for missing variables, helpers, block helpers or partials.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save handlebars-lint\n```\n\n## Usage\n\n### [lint](index.js#L26)\n\nPass a context and a string with handlebars templates and lint for missing variables, helpers, block helpers or partials.\n\n**Params**\n\n* `str` **{String}**: The string to lint.\n* `options` **{Object}**: Pass a context on `options.context` or your own instance of handlebars on `options.hbs`.\n* `returns` **{Object}**\n\n**Example**\n\n```js\nconst lint = require('handlebars-lint');\nlint(string, options);\n```\n\n## Example\n\nAssuming we lint the following string:\n\n```handlebars\nTitle: {{upper foo}}\nHi, my name is {{proper name}}\n```\n\nWith the following context:\n\n```js\nconst missing = lint(str, {\n  context: {\n    helpers: {\n      upper: function() {},\n      proper: function() {},\n    },\n    variables: {\n      name: 'Brian'\n    }\n  }\n});\nconsole.log(missing);\n//=\u003e { variables: [ 'foo' ] }\n```\n\n## Extended example\n\nAssuming we lint the following string:\n\n```handlebars\n{{upper \"bar\"}}\n{{upper varname}}\n{{baz}}\n{{zzz name=name}}\n\nMore content.\n\n{{abc (sub blah)}}\n\n{{\u003e onetwo (three blah)}}\n{{\u003e four five}}\n\n{{#markdown foo}}\n\u003e A markdown blockquote\n{{\u003e six (seven eight)}}\n{{lower whatever}}\n{{/markdown}}\n\nThe end.\n```\n\nThe following:\n\n```js\nvar missing = lint(str, {\n  context: {\n    helpers: {\n      upper: function() {}\n    },\n    variables: {\n      name: 'Brian'\n    }\n  }\n});\nconsole.log(missing);\n```\n\nResults in:\n\n```js\n{ \n  helpers: [ 'upper', 'baz', 'zzz', 'abc', 'sub', 'three', 'seven', 'lower' ],\n  variables: [ 'varname', 'name', 'blah', 'five', 'eight', 'whatever', 'foo' ],\n  partials: [ 'onetwo', 'four', 'six' ],\n  blockHelpers: [ 'markdown' ] \n}\n```\n\n**Heads up!**\n\nThe linter assumes that an expression is a variable when:\n\n1. The expression has no params or hash arguments, as in `{{foo}}`, versus `{{foo bar}}` or `{{foo bar=baz}}`\n2. There is no variable or helper on the context to distinguish otherwise.\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [handlebars-helpers](https://www.npmjs.com/package/handlebars-helpers): More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate… [more](https://github.com/helpers/handlebars-helpers) | [homepage](https://github.com/helpers/handlebars-helpers \"More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate, Verb, Ghost, gulp-handlebars, grunt-handlebars, consolidate, or any node.js/Handlebars project.\")\n* [template-helpers](https://www.npmjs.com/package/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… [more](https://github.com/jonschlinkert/template-helpers) | [homepage](https://github.com/jonschlinkert/template-helpers \"Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 27, 2018._","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fhandlebars-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fhandlebars-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fhandlebars-lint/lists"}