Socket
Socket
Sign inDemoInstall

iamturns-js-toolbox

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iamturns-js-toolbox

Toolbox for my JavaScript projects


Version published
Maintainers
1
Created
Source

WARNING!

This package is deprecated.

Features have been migrated to create-iamturns-app and iamturns-scripts.


iamturns-js-toolbox

Toolbox for my JavaScript projects

  • Sensible default configs for Jest, Prettier, and lint-staged
  • Useful scripts: format, lint, validate, upgrade, reinstall, and reset
  • TypeScript supported

Table of Contents

Install

npm install iamturns-js-toolbox --save-dev

Configs

Jest

  • Collect coverage from src/
  • TypeScript support
  • Web mode, enables jsdom and sets testURL

Example jest.config.js file:

const { createJestConfig } = require("iamturns-js-toolbox")

module.exports = createJestConfig({
  srcPath: "app", // default = 'src'/
  web: true, // default = false
})

Prettier

  • Default settings with exceptions:
    • No semi colons
      • Why include an unnecessary character at the end of every line? Break the habit (automatically)!
    • Trailing commas
      • Helps with git merging and conflict resolution
  • Ensure .editorconfig is parsed as YAML

Example prettier.config.js file:

// Some settings automatically inherited from .editorconfig

const { createPrettierConfig } = require("iamturns-js-toolbox")

module.exports = createPrettierConfig()

lint-staged

  • Format, lint, and test staged files
  • README.md changed? Update "Table of Contents" (using doctoc)

Example lint-staged.config.js file:

const { createLintStagedConfig } = require("iamturns-js-toolbox")

module.exports = createLintStagedConfig({
  skipDoctoc: true, // default = false
  skipFormat: true, // default = false
  skipLint: true, // default = false
  skipTest: true, // default = false
})

Scripts

iamturns-js-toolbox format

  1. Run Prettier on all supported files (js, ts, css, json, md, yaml, etc).

  2. Run ESLint with --fix to automatically fix any linting issues.

Note: all files will be formatted. Use a .prettierignore file to prevent formatting specific files or directories.

Example .prettierignore file:

/node_modules
/package-lock.json

iamturns-js-toolbox lint

Run ESLint on all supported files.

Note: all files will be linted. Use an .eslintignore file to prevent linting specific files or directories.

Example .eslintignore file:

/node_modules

iamturns-js-toolbox validate

Concurrently run lint, test, and build commands.

iamturns-js-toolbox pre-commit

Run lint-staged, then run build command.

Note: lint-staged requires a configuration file.

iamturns-js-toolbox upgrade

  1. Update /node_modules and /package-lock.json according to semver rules defined in /package.json files.

    This is a safe operation (assuming dependencies correctly follow semantic versioning).

  2. Once complete, check for outdated dependencies (outside of semver rules in /package.json), and interactively select dependencies to update.

iamturns-js-toolbox reinstall

Remove /node_modules and reinstall.

iamturns-js-toolbox reset

Reset to a fresh git checkout and reinstall.

Inspiration

Credits

Authored and maintained by Matt Turnbull (iamturns.com / @iamturns)

To all contributors (if you exist) - thank you!

License

Open source software licensed as MIT.

FAQs

Package last updated on 01 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc