npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nice-linter

v1.1.3

Published

a linter that commends you when you make a code change that reflects best practices, or fixes security flaws

Downloads

8

Readme

A linter that commends you for making changes in the code that reflect best practices.

Forks Stars Watchers Issues PRs MIT License contributors size lines

Inspiration

So, a Linter is basically an automated tool that runs on a static piece of code to find any kind of discrepancy arising due to formatting or due to bad coding practices. Running a Linting tool over the source code helps to improve the quality and readability of the code. But what nice-linter does is, it basically commends you for making changes in the code that reflect best practices. Because, these little thing must be appreciated as well! You can compare the changes in your code to know how you have switched to follow the best practises while coding in javaScript.

How we built it

Node So let’s take a step back and look at how programming languages work in the first place. No matter what programming language you’re using you’ll always need some piece of software which can take the source code and make the computer actually do something. This software can be either an interpreter or a compiler. No matter whether you’re using an interpreted language or a compiled one , there’s always going to be one common part: parsing the source code as plain text to a data structure called abstract syntax tree (AST). Not only do ASTs present the source code in a structured way but they also play a critical role in the semantic analysis where the compiler validates the correctness and proper usage of the program and the language elements. Later on, the ASTs are used to generate the actual bytecode or machine code.

JavaScript parsing

For parsing the code in our tool, we have used espree as the parser, Let’s look into how an AST gets built. We have a simple JavaScript function as an example:

function foo(x) {
    if (x > 10) {
        var a = 2;
        return a * x;
    }
    return x + 10;
}

The parser will produce the following AST. This is just for visualization purposes, it is a simplified version of what the parser would produce. The actual AST is much more complex. For JavaScript, an AST is a JavaScript object containing a tree representation of your source. Lets look at the actual AST in the image below:

Finding Changes

After we have the AST, we just need to compare the AST's of the previous code and the new code to get the changes. On the basis of comparison then,the linter commends you for making changes in the code that reflect best practices.

How To Use The Application

To clone and run this application, you'll need Git and Node.js installed on your computer. From your command line run:

npm install

It downloads a package and it's dependencies. Now run:

node main.js linters --old=<old-file-path> --new=<new-file-path> 

Viola! Now you are done. You should see the comments about the best practises you followed.

Features

  • The tool commends the user if he/she has switched from let to var for declaring variables.
  • Breaking a long function into smaller ones is a good practise. The tool appreciates when you do it!
  • It congratulates the user for switching to cameCase style of naming variables. Since, it makes the variable name more descriptive.
  • When you convert chaining to optional chaining the tool extrol you!
  • The tool praises you if add use Strict in your file.
  • Normal functions sounds boring. The tool supports you if you convert normal function to an arrow function
  • It endroses you, if you convert string concatenation to tempalate literals.

MLH Fellowship(Fall 2021)

This is an orientation hackathon project made by MLH Fellows - Team 1

Team

"Alone we can do so little; together we can do so much."

| S.No. | Name | Role | GitHub Username:octocat: | | ----- | ------------------ | ------------------ | ---------------------------------------------------- | | 1. | M. Danial Saleem | Sofware Engineer | @MDanialSaleem | | 2. | Nilisha Jaiswal | Sofware Developer | @nilisha-jais | | 3. | Zina Kamel | Sofware Engineer | @Zina-Kamel |