![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
eslint-plugin-script-tags
Advanced tools
An ESLint plugin that allows you to lint the content of <script>
tags in arbitrary text.
Unlike eslint-plugin-html, which parses HTML to find <script>
s, this plugin uses a regular expression.
The advantage of using a regular expression, and the reason this plugin exists, is that by avoiding a parser you can find and lint <script>
s in arbitrary text — text that might not parse nicely as HTML, such as Markdown files with HTML fenced code blocks that contain <script>
s. Like this (imagine the '''
s are backticks):
Here is some *markdown*.
'''html
<div>
<script>
// Here is JS you'd like to lint!
var a = "foo";
</script>
'''
(If you want to lint JS fenced code blocks, use eslint-plugin-markdown).
The disadvantage of using a regular expression, of course, is that it's not as robust as a real parser. If your <script>
is within a comment, for example, it will still be linted: the regular expression doesn't know about the comment. You might like that, or you might not.
Use this module like any other ESLint plugin.
Unfortunately, we do need to provide a finite list of file extensions to check. Here's the current list:
.html
.md
.jsp
.tag
.hbs
.ejs
.php
.vue
.erb
There's no reason not to add more: so if you'd like another, please PR!
Expected indentation (if you use the indent
rule) is determined by the first line of code. This can get hairy if you do something sloppy like:
<script>var a = 'foo';
var b = 'bar';
</script>
So I wouldn't do that.
Ideally this module could allow you to arbitrarily modify the expected tags regular expression, from <script>...</script>
to something like {% highlight js %}...{% endhighlight %}
or [javascript-block]...[end javascript-block]
, etc. However, to do so would require adding options, and it doesn't seem that ESLint's built options into the processor API. If you would like this feature and want to work on adding options, your help would be welcome.
0.5.0
.erb
extension.FAQs
Lint the content of <script> tags in arbitrary text
The npm package eslint-plugin-script-tags receives a total of 131 weekly downloads. As such, eslint-plugin-script-tags popularity was classified as not popular.
We found that eslint-plugin-script-tags demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 32 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.