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

mop-cli

v0.3.0

Published

Lint and maintain many projects at once

Downloads

7

Readme

mop-cli Build status for Mop CLI

Lint and maintain many projects at once

Like ESLint for your entire computer and more than just JavaScript.

Contents

Why?

  • Some of us have a lot of modules.
  • We often want to change multiple modules simultaneously.
  • Helps you scale and keep track of todos across projects.
  • Easy maintenance means happy developers and users.

Install

npm install mop-cli --global

Usage

$ mop --help

  Usage
    $ mop [rule-name]

  Option
    --cwd       Working directory to search for projects
    --reporter  How to display and stylize results

  Example
    $ mop caret-deps
    $ mop caret-deps --reporter=eslint

Tip: On Node < 7.6, mop needs to be node --harmony "$(which mop)"

Rules

See the list of rules to change what triggers mop to complain.

Data types

Project

A project is an object with name, path and pkg properties.

name

Type: string

Either pkg.name if it is available or the basename of the project's path.

path

Type: string

Filepath of the project's root directory.

pkg

Type: object, null

Parsed package.json found within path, or null if the file is missing. An error will be thrown if the file is present but cannot be read or is invalid.


Projects are enhanced with the following properties before they are returned to users.

problems

Type: Array<Problem>

A list of all rule violations the project is responsible for.

errors

Type: Array<Problem>

Same as problems, but only those whose severity is error.

warnings

Type: Array<Problem>

Same as problems, but only those whose severity is warn.

Problem

Each rule may optionally return a problem descriptor, which represents a rule violation. The only required property is message.

message

Type: string

A message describing the problem.

path

Type: string

Filepath that is responsible for the problem.

line

Type: number

A positive, zero-based integer within the file where the problem occurred.

column

Type: number

A positive, zero-based integer within the line where the problem occurred.

data

Type: any

Arbitrary data that reporters can use to enhance output.


Problems are enhanced with the following properties before they are returned to users.

ruleId

Type: string

The rule that reported the problem.

severity

Type: string Example: warn

The problem level, as configured by the user for the rule.

rule(project, ...args)

Returns a problem or an Array of problems, optionally wrapped in a Promise, if the project violates the expectations of the rule.

Learn more about rules by creating one.

project

Type: object

A project for the rule to check.

args

Custom arguments for the rule provided by the user in their configuration. Most rules that use this accept just a single option object with properties for configuring the rule.

API

mop(option)

Returns a Promise for an Array of project results with lists of rule violations.

option

cwd

Type: string Default: process.cwd()

Final directory in a downwards search for projects. Only used when no projects are provided.

projects

Type: Array<Project>

List of projects to lint.

rule

Type: object

Map of rules to apply and their arguments. Compatible with ESLint conventions.

Example:

{
    'caret-deps' : 'warn',
    foo          : ['error', 'blah']
}

Tips

Enable rules gently

Because Mop checks many projects at once, enabling a single rule can cause many more errors to be reported than in tools like ESLint that check a single project. THis is good, as it gives you a high level view of where fixes are needed. However, when you are initially configuring Mop, you should enable rules one at a time in order to avoid being overwhelmed.

FAQ

How is this different than ESLint?

Mop checks every project it can find, whereas ESLint only checks a single project. Mop also doesn't care what language you use, although it is optimized for JavaScript projects. It is actually more like clinton than ESLint, but people are more familiar with ESLint, hence the comparison.

Related

  • clinton - Project style linter for individual projects
  • XO - JavaScript linter for individual projects
  • Stylelint - CSS linter for individual projects

Contributing

See our contributing guidelines for more details.

  1. Fork it.
  2. Make a feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request.

License

MPL-2.0 © Seth Holladay

Go make something, dang it.