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

js-code-linter

v1.0.1

Published

js-code-linter is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.It is inspired from ESlint, JSLint and JSHint with a few exceptions:

Downloads

8

Readme

js-code-linter

js-code-linter is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.It is inspired from ESlint, JSLint and JSHint with a few exceptions:

  • js-code-linter uses Espree for JavaScript parsing.
  • js-code-linter uses an AST to evaluate patterns in code.
  • js-code-linter is completely pluggable, every single rule is a plugin and you can add more at runtime.

Installation and Usage

Prerequisites: Node.js (^12.22.0, ^14.17.0, or >=16.0.0) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)

To install run this command:

npm i js-code-linter

After that, you can run js-code-linter on any file or directory like this:

node_modules/js-code-linter/src/index.js --file <file-path.js>

Configuration

To configure in your project add below line in package.json.

"lint": "node_modules/js-code-linter/src/index.js",

After that, you can run js-code-linter in project using npm run lint commad.

example:

npm run lint --  --file <file-path.js>

What js-code-linter lints ?

js-code-linter performs linting on your JavaScript code, primarily focusing on identifier (variable) declarations and the use of quotes.

It generates a new file <file-name>.linted.js with all the tranformation.

Also give error message with line of code where the lint issue is present.

Identifier Transformations

Variable Declaration Type Optimization:

  1. js-code-linter automatically optimizes:

    • variable declarations by transforming var identifiers to let or const as needed.
  2. Reassignment Analysis:

    • It identifies variables whose values are reassigned and transforms them from var or const to let.
  3. Constant Declaration:

    • Variables that are never reassigned are transformed from var or let to const for better code consistency.

Quote Transformation

  • Double to Single Quote Conversion: js-code-linter convert double quotes "" to single quotes '' for consistent quoting style.

Output File

  • After linting your code, js-code-linter generates a new file named <file-name>.linted.js, which includes all the transformations. This file is created in the same directory as the original file.

Error Messages

  • js-code-linter provides error messages that pinpoint the location of linting issues in your code. Each error message includes the clickable line & column number, making it easy to identify and fix problems in your code.

lint issues