This package has been deprecated

Author message:

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

iamturns-js-toolbox

3.0.0 • Public • Published

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.

Readme

Keywords

none

Package Sidebar

Install

npm i iamturns-js-toolbox

Weekly Downloads

2

Version

3.0.0

License

MIT

Unpacked Size

23.5 kB

Total Files

34

Last publish

Collaborators

  • iamturns