eslint-plugin-html
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "eslint-plugin-html", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "An ESLint plugin to extract and lint scripts from HTML files.", | ||
@@ -5,0 +5,0 @@ "repository": { |
eslint-plugin-html | ||
================== | ||
[![Build Status](https://travis-ci.org/BenoitZugmeyer/eslint-plugin-html.svg?branch=master)](https://travis-ci.org/BenoitZugmeyer/eslint-plugin-html) | ||
This [`ESLint`](http://eslint.org) plugin extracts and lints scripts from HTML files. | ||
Supported HTML extensions: `.html`, `.xhtml`, `.htm`, `.vue`, `.hbs` | ||
Supported HTML extensions: `.html`, `.xhtml`, `.htm`, `.vue`, `.hbs`, `.mustache` | ||
Only script tags with no type attribute or with a type containing `text/javascript` will be linted. | ||
Only script tags with no type attribute or with a type containing `text/javascript` or `text/babel` will be linted. | ||
@@ -10,0 +12,0 @@ Usage |
@@ -22,3 +22,3 @@ "use strict"; | ||
if (attrs.type && attrs.type.toLowerCase().indexOf("text/javascript") < 0) { | ||
if (attrs.type && !/text\/(javascript|babel)/i.test(attrs.type)) { | ||
return; | ||
@@ -25,0 +25,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
var currentInfos; | ||
var allowedExtensions = ["htm", "html", "xhtml", "vue", "hbs"]; | ||
var allowedExtensions = ["htm", "html", "xhtml", "vue", "hbs", "mustache"]; | ||
@@ -9,0 +9,0 @@ var htmlProcessor = { |
@@ -164,2 +164,17 @@ "use strict"; | ||
}); | ||
it("extracts a script tag with type=text/babel", function() { | ||
assertExtract( | ||
s( | ||
"some html", | ||
"<script type=\"text/babel\">var foo = 1;</script>", | ||
"other" | ||
), | ||
s( | ||
htmlLine, | ||
"var foo = 1;" | ||
), | ||
[ { line: 2, column: 0 } ] | ||
); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
268
27
8138
9