lint the npmcli way

Overview

@npmcli/lint

Lint the npmcli way

USAGE

This package contains two executable scripts. One for linting your code, and the other for automatically setting up your package.json to lint code at convenient times.

Quick and Opinionated

npm exec --package @npmcli/lint -c npmcli-lint-init

This installs the dev dependency, removes an existing .eslintrc.json and existing eslint dependencies, and forcibly sets up all your scripts appropriately.

Customizable Approach

npm i -D @npmcli/lint

# setup package.json with the linting scripts for npm run
npm exec --package @npmcli/lint -c npmcli-lint-setup

# setup package.json, clobbering any existing scripts
npm exec --package @npmcli/lint -c 'npmcli-lint-setup --force'

# just run manually, linting with our style rules
npm exec --package @npmcli/lint -- # any args to eslint go here...

The setup script adds the following script targets for npm run. If a script already exists in that spot, it is not modified unless --force is provided.

  • npmclilint - runs npmcli-lint
  • lint - runs npm run npmclilint -- *.js lib/**/*.js test/**/*.js
  • lintfix - runs npm run lint -- --fix to automatically fix linting errors if possible.
  • posttest - runs npm run lint -- to lint automatically after running tests)
  • postsnap - runs npm run lintfix -- to fix lint errors automatically when generating snapshots with tap.

Appropriate versions of eslint and necessary plugins are listed as peer dependencies, so that they will be loaded in the project and found where needed.

You might also like...

🛠 Nodejs configuration the easy way.

@elite-libs/auto-config Intro A Unified Config & Arguments Library for Node.js! Featuring support for environment variables, command line arguments, a

May 17, 2022

Demonstration of how you build full-stack, typed, NPM packages, the right way

NPM Packages - The Right way This repository aims to demonstrate how to build NPM packages the right way. my-package should import the shared code, bu

Nov 27, 2022

An easy way to animate SVG elements.

Walkway I loved the animations for the polygon ps4 review a few months back and decided to create a small library to re-create them (simple demo). It

Jan 2, 2023

Use your web inspector to hack your way through a series of challenges.

hacker-challenge Use your inspector to hack your way through a series of challenges. Made for those who are new to the inspector. A web inspector is a

Jun 17, 2022

JavaScript framework for creating beautiful, fast and lightweight websites based on flutter way of coding ☜(゚ヮ゚☜)

Welcome to Flutjs project 😀 Flutjs is a javascript framework for creating beautiful, fast and lightweight websites. As the name suggests, Flutejs is

Nov 9, 2022

Slime jumper game is a simple game that requires you to escape from the enemies that come your way.

Slime Jumper What is this game? The slime jumper game is a game with a simple logic (but it was not so easy to do) where you have to escape from the e

Mar 1, 2022

This app offers users a quick way to check the current temperature and humidity of any location in the world.

This app offers users a quick way to check the current temperature and humidity of any location in the world.

Pretty Weather App This app offers users a quick way to check weather data for any location in the world. The specific data provided by the app includ

Jun 7, 2022

A fun and functional way to write regular expressions (RegExp)

funexp A fun and functional way to write regular expressions (RegExp). FunExp is a useful tool for larger projects that depends on RegExp to do heavy

Feb 7, 2022

Logs the output, time, arguments, and stacktrace of any function when it's called in a gorgeous way.

Function.prototype.log Logs the output, time, arguments, and stacktrace of any function when it's called. How to use: Like this: function yourFunction

Apr 9, 2022
Comments
  • remove line length limits

    remove line length limits

    pros:

    • avoids having to break up long lines, which is sometimes awkward (especially when the line is only very slightly over the limit)
    • line length is not auto-fix friendly, so it requires manual intervention when the rule is broken

    cons:

    • potentially more awkward appearance of lines when the editor does the wrapping for you
    • harder to say no to PRs where an excessively long line gets added

    alternatives:

    • raise the limit instead of removing it
    opened by nlf 2
  • feat: remove init and setup scripts and use `@npmcli/eslint-config`

    feat: remove init and setup scripts and use `@npmcli/eslint-config`

    This also converts the project to use @npmcli/template-oss

    BREAKING CHANGE: this removes the init and setup executables which are now a part of @npmcli/template-oss.

    Closes #5.

    opened by lukekarrys 1
  • Deprecate in favor of template-oss

    Deprecate in favor of template-oss

    As we move towards @npmcli/template-oss which handles linting for us, is there any reason to keep this around?

    The only differences in the configs between the two projects right now are below. @nlf confirmed that all the deletions in eslint-config are correct, and the two additions made it to eslint-config but not this repo.

    Diff

    diff --git a/npmcli-lint.json b/eslint-config.json
    index e12cc23..65c2a4d 100644
    --- a/npmcli-lint.json
    +++ b/eslint-config.json
    @@ -15,10 +15,7 @@
         "sourceType": "script"
       },
       "plugins": [
    -    "standard",
    -    "promise",
    -    "node",
    -    "import"
    +    "node"
       ],
       "rules": {
         "accessor-pairs": [
    @@ -176,7 +173,7 @@
         ],
         "max-len": [
           "error",
    -      80,
    +      100,
           {
             "ignoreUrls": true,
             "ignoreComments": false,
    @@ -503,7 +500,8 @@
           "off"
         ],
         "object-curly-spacing": [
    -      "off"
    +      "error",
    +      "always"
         ],
         "object-property-newline": [
           "error",
    @@ -656,39 +654,13 @@
           "error",
           "never"
         ],
    -    "import/export": [
    -      "error"
    -    ],
    -    "import/first": [
    -      "error"
    -    ],
    -    "import/no-absolute-path": [
    -      "error",
    -      {
    -        "esmodule": true,
    -        "commonjs": true,
    -        "amd": false
    -      }
    -    ],
    -    "import/no-duplicates": [
    -      "error"
    -    ],
    -    "import/no-named-default": [
    -      "error"
    -    ],
    -    "import/no-webpack-loader-syntax": [
    -      "error"
    -    ],
         "node/no-deprecated-api": [
           "error"
         ],
         "node/process-exit-as-throw": [
           "error"
         ],
    -    "promise/param-names": [
    -      "off"
    -    ],
    -    "standard/no-callback-literal": [
    +    "node/no-callback-literal": [
           "error"
         ]
       },
    

    Is there any other reason to keep this around, or features from this repo we should port to template-oss?

    opened by lukekarrys 0
Owner
npm
node package manager
npm
Free, open-source client or server-side APIs to "lint" user input.

passbird Free, open-source client or server-side APIs to lint user input. Right now, you can check type for an email address i.e., either of disposabl

Vaibhav Pandey 1 Dec 26, 2021
Validate your Markdown frontmatter data against a JSON schema — remark-lint rule plugin

remark-lint-frontmatter-schema Validate Markdown frontmatter YAML against an associated JSON schema with this remark-lint rule plugin. Supports: Types

Julian Cataldo 20 Dec 10, 2022
A Nextjs-Typescript boilerplate , configured with Tailwindcss, Eslint, Prettier, Lint-staged ,Husky and commitizen

Minimal Nextjs Typescript boilerplate A Minimal Next-Typescript boilerplate to quickly and easily bootstrap your next project. Comes pre-configured wi

TEYIM ASOBO 3 Nov 4, 2022
Catalogist is the easy way to catalog and make your software and (micro)services visible to your organization in a lightweight and developer-friendly way.

catalogist ?? ?? ?? ?? ?? The easy way to catalog and make your software and (micro)services visible to your organization through an API You were a pe

Mikael Vesavuori 11 Dec 13, 2022
🎨 Beautify your github profile with this amazing tool, creating the readme your way in a simple and fast way 🚀 The best profile readme generator you will find ⚡

Demo Profile Readme Generator The best profile readme generator you will find! About | Technologies | Requirements | Starting | Contributing ?? About

Mauro de Souza 476 Jan 1, 2023
The JavaScript Way book

The JavaScript Way A gentle introduction to an essential language. Copyright © 2017-2020 Baptiste Pesquet. Overview This book aims to be a useful comp

The JavaScript Way 7.7k Dec 30, 2022
CryptoDappy is the fastest way to get started with Flow.

Demo application (testnet) Learning hub (start learning here) What's CryptoDappy? CryptoDappy is the fastest way to get started with blockchain develo

Benjamin Ebner 91 Aug 18, 2022
A stupid simple way to test

@asdgf A stupid simple way to test. Packages @asdgf/core The core of the test framework, and nothing else @asdgf/cli CLI tool to run tests in node, us

Pascal Schilp 16 Nov 17, 2022
A simple way to share files and clipboard within a local network.

Shortcut Simple way to share files and clipboard with devices within a local network. Usage Run the ./shortcut executable. A browser window will be op

Dhamith Hewamullage 17 Mar 13, 2022
Secure-electron-template - The best way to build Electron apps with security in mind.

secure-electron-template A current electron app template with the most popular frameworks, designed and built with security in mind. (If you are curio

reZach 1.4k Dec 29, 2022