New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

eslint-plugin-template

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-template

Parses out template declarations found in JS/HTML files

latest
Source
npmnpm
Version
0.7.3
Version published
Weekly downloads
5.6K
23.75%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-template

Parses out template declarations found in js and html files.

For example if you have a file like below, eslint will not be able to parse it normally due to the template markers. With this plugin, the linter is able to work normally. Note that whatever is inside the markers is replaced with {}.

  {# Set data in the JS variable data #}    // ignored
  {% import json %}                         // ignored
  var x = {{ json.dumps(data) }}            // becomes var x = {}
  var y = {% raw json.dumps(data) %}        // becomes var y = {}

It handles conditional templates within JavaScript similarly.

{% if true %}
  var x = 1
{% else %}
  var x = 2
{% endif %}

becomes:

  var x = 1
  var x = 2

If there are edge cases that still cannot be handled, wrap them inside /* eslint-disable */ and /* eslint-enable */:

foo({{x}})
/* eslint-disable */
var x = {% if x %}{{x}}{% else %}0{% endif %}
/* eslint-enable */

becomes:

foo({})

Installation

npm install --save-dev eslint eslint-plugin-template

Usage

Add template to the plugins section of your .eslintrc configuration file:

{
    "plugins": [
        "template"
    ]
}

Tests

npm test

Release

  • Update the version in package.json
  • Commit to the master branch, update the tag, and push
  • Run npm publish

Keywords

template

FAQs

Package last updated on 08 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts