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

semiless.js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semiless.js

Safely forget the semicolons

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

semiless.js

Forget about the semicolons safely.

I really dislike semicolons, they add a lot of visual noise, with no real benefits, but it's a shame that javascript kind of botched up statement termination. But worry not, this tool is here to help with those deficiencies

If you type something like this:

var myNumber = 32
(function(text){ console.log(text) })(myNumber)

you will get en error message, since this would like to invoke 32 as a function :

error in file: /opt/code/mysuperproject/js_source/forms.js
    2 : (function(text){ console.log(text) })(myNumber), 

When does an error occures?

if a line starts with one of these :

/ + - * ( [ & % | < > = ^

Of course, an error is only raised if the error is real, for example this will not cause and error:

if (
    (cat && dog) &&
    (turtle && penguin)
)
++animalPairsCount

because the & symbol clearly signals that you want to continue on the next line, since there is no other meaning for symbol without a next statement, after that the double plus signs will close the previous statement

Usage:

This will recoursively check all folders and files, if the file extension matches

var semiless = require('semiless')
var errors = semiless.fileChecker('js_source', [.js, .ts])

if (errors) {
    console.error(errors)
} else {
    console.log('no error found in source files')
 }


Keywords

semicolon

FAQs

Package last updated on 30 Dec 2015

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