GithubHelp home page GithubHelp logo

sheerun / modern-node Goto Github PK

View Code? Open in Web Editor NEW
242.0 8.0 13.0 1.08 MB

All-in-one development toolkit for creating node modules with Jest, Prettier, ESLint, and Standard

License: MIT License

JavaScript 96.90% Shell 2.40% TypeScript 0.15% Dockerfile 0.56%
node jest prettier standard es6

modern-node's Introduction

Modern Node Unix CI Modern Node

All-in-one development toolkit for creating node modules with Jest, Prettier, ESLint, and Standard

  • ๐Ÿƒ Testing with Jest
  • ๐Ÿ’… Formatting with prettier
  • ๐ŸŒŸ Linting with eslint configured on standard rules
  • ๐Ÿถ Automatically runs precommit script from package.json from when committing code

Installation (new projects)

yarn create modern-node my-module

If you're using npm: npm init modern-node my-module.

Installation (existing projects)

yarn add --dev modern-node

If you're using npm: npm install --save-dev modern-node.

Now you add appropriate scripts to your package.json:

{
  "scripts": {
    "test": "modern test",
    "format": "modern format",
    "lint": "modern lint",
    "precommit": "modern precommit"
  }
}

Usage

Test your project with Jest (watch mode, unless running on CI server):

modern test

Format all files in the project with prettier-standard (add --help for more options):

modern format             # format all files
modern format --changed   # format only changed files
modern format '**/*.js'   # format only selected files

Format and files in the project (add --help for more options):

modern lint             # lint all files
modern lint --changed   # lint only changed files
modern lint '**/*.js'   # lint only selected files

Format and lint staged changes (useful to put into precommit script):

modern precommit

For now linted extensions can be configured with lint-staged option in package.json.

License

MIT

modern-node's People

Contributors

dandv avatar sheerun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modern-node's Issues

Old version of `remark-parse` dependency has security vulnerability

I get the impression this project is no longer actively maintained, but I'm hoping an exception might be made for a dependency version bump to address a security vulnerability.

The version of remark-parse used by modern-node is old; 5.0.0 while the current version is (as of this writing) 10.0.1.

This old version of remark-parse in turn has a dependency on an old version of trim, which has a security vulnerability: CVE-2020-7753.

Please consider:

  • bumping your dependency on remark-parse to 10.0.1 (or possibly earlier versions if you wanted), or
  • manually overriding the dependency on trim to >=0.0.3

Thanks for this helpful project!

Modern-node and husky aren't able to work together

How to reproduce

  1. Create a package A with modern-node
  2. Create another main package B with husky in its dependency
  3. Add package package A as a dependency on B

Expected behaviour
Package A which has modern-node shouldn't change git hook files

Modern Lint Reporting no-fallthrough linting errors incorrectly

In my codebase I have this switch statement

switch (error.code) {
    case 'code1':
      doSomething()
      process.exit(1)
    case 'code':
      doSomethingElse()
      process.exit(1)
    default:
      throw error
  }

If I run npx standard I don't get any linting errors.

If I run npx prettier-standard --lint or npx modern lint I receive these errors:

  44:5  error  Expected a 'break' statement before 'case'     no-fallthrough
  47:5  error  Expected a 'break' statement before 'default'  no-fallthrough

I believe this package is using prettier-standard under the hood so I'm not sure where the disconnect is. The process.exit() should satisify the no-fallthrough rule.

Here are the relevant package.json versions:

"modern-node": "2.6.0",
"standard": "14.3.1",

EDIT: Ok the issue is standard being at 14.3.1. Looks like prettier-standard is using 14.1.0. I guess there was a change in the higher minor versions.

Build and publish tooling

@sheerun

Considering the tagline is:

All-in-one development toolkit for creating node modules...

How do you feel about incorporating build/publish tooling, something along the lines of pack?

`format` doesn't seem to respect `.prettierrc` rules

I have a .prettierrc.yaml file with some overrides set; specifically to treat files with .tpl extensions as HTML files. But running modern format doesn't seem to look at that file, because it ignores the .tpl files.

Am I missing something? Is there a way to tell modern to look for prettier config?

Use 'snazzy' colors/spacing on precommit script as well as lint script

Great project!

If I run the lint script, I get errors helpfully formatted by snazzy.

But when the precommit script runs, the colors and some of the spacing from snazzy don't show up (though the overall formatting of the errors does).

It'd be nice to have the output of each be the same for the linting section.

Cross Platform Support - Windows line endings formatting

It seems when I run modern format on a windows platform it corrects all the line endings. This is mainly an issue when the project is worked on by unix and windows developers. Is there a way around this?

EDIT: This is most likely an issue with prettiers settings. Users will need to make sure they enforce line endings when working cross-platform projects. https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#end_of_line

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.