@deftomat/opinionated
Opinionated tooling for JavaScript & TypeScript projects.
Last updated a month ago by deftomat .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @deftomat/opinionated 
SYNC missed versions from official npm registry.

Opinionated ????

Opinionated tooling for JavaScript & TypeScript projects.

Why?

Because orchestrating all the tools, linters, formatters, etc. in each project can took a long time and their configuration will differ more and more as you will copy it between multiple projects.

Opinionated provides everything in one place and upgrading your tool chain is as easy as upgrading the dependency version.

Installation

$ yarn add @deftomat/opinionated --dev

Usage

Tool provides the following commands:

> Pre-commit

$ opinionated pre-commit

Pre-commit command will try to run simple, auto-fixable operations on staged files. Operations includes common ESLint rules, Prettier, etc.

Command is designed to be opaque and hassle free, so theoretically, pre-commit check should pass for 99% of commits without any error or warning.

> Checkup

$ opinionated checkup

Checkup command allows you to keep your project in top shape.

Command includes:

  • Engine check - Ensures that you are using the right NodeJS version.
  • Integrity - (yarn only) Ensures that dependencies are installed properly.
  • Dependency duplicates check - (yarn only) Ensures no unnecessary dependency duplicates. Especially useful for monorepos.
  • Linter - Strict ESLint rules.
  • TypeScript check - Detects type errors and unused code.
  • Formatting - Runs Prettier.

Command is aware of yarn workspaces and is able to run checks on whole monorepo or just in one package. To run checks in all packages, just run it in project's root. To run checks in one package, you need to run it in package's directory.

???? We recommend to run this command before pull requests and deployments.

> Ensure configs

$ opinionated ensure-configs

Command will add the following configs if necessary:

  • EditorConfig - Makes sure that every developer use the same indentation, charset, EOF, etc.
  • Prettier - Makes sure that every supported editor use the same auto-formatting rules.
  • .nvmrc - Allows to automatically switch to the correct NodeJS version by running nvm use command in project's directory.

???? This command is usually not necessary as every other command runs it by default.

Integration into project

To integrate the tool into your project, we recommend the following packages.json:

{
  ...
  "scripts": {
    "checkup": "opinionated checkup"
  },
  "husky": {
    "hooks": {
      "pre-commit": "opinionated pre-commit"
    }
  },
  "devDependencies": {
    "@deftomat/opinionated": "^0.6.0",
    "husky": "^4.0.0"
  }
  ...
}

This configuration allows you to automatically run pre-commit check before each commit (via Husky git hook) and provides yarn checkup to easily run checkup command.

Custom ESLint rules

If you need to alter the predefined ESLint rules, just follow the ESLint configuration guide.

Any rule specified in your configuration file will be merged over build-in configuration. This allows you to add/edit/remove any rule you want.

Ignoring files and directories

As tool is using ESLint and Prettier, you can follow their guidelines to ignore any file or directory.

However, when tool detects, that there are no .ignore file for these tools, then it tries to use .opinionatedignore file which will be applied to both ESLint and Prettier. If there is no .opinionatedignore, then .gitignore will be used.

Resolution order for ESLint:

  • .eslintignore
  • eslintIgnore property in package.json
  • .opinionatedignore
  • .gitignore

Resolution order for Prettier:

  • .prettierignore
  • .opinionatedignore
  • .gitignore

Current Tags

  • 0.6.3-beta.1                                ...           beta (a month ago)
  • 0.6.3                                ...           latest (a month ago)

46 Versions

  • 0.6.3                                ...           a month ago
  • 0.6.3-beta.1                                ...           a month ago
  • 0.6.3-beta.0                                ...           a month ago
  • 0.6.2                                ...           a month ago
  • 0.6.1                                ...           2 months ago
  • 0.6.0                                ...           2 months ago
  • 0.5.9                                ...           4 months ago
  • 0.5.8                                ...           5 months ago
  • 0.5.7                                ...           5 months ago
  • 0.5.6                                ...           6 months ago
  • 0.5.5                                ...           6 months ago
  • 0.5.4                                ...           6 months ago
  • 0.5.3                                ...           6 months ago
  • 0.5.2                                ...           6 months ago
  • 0.5.1                                ...           6 months ago
  • 0.5.0                                ...           6 months ago
  • 0.5.0-beta.1                                ...           6 months ago
  • 0.5.0-beta.0                                ...           6 months ago
  • 0.4.7                                ...           6 months ago
  • 0.4.6                                ...           a year ago
  • 0.4.5                                ...           a year ago
  • 0.4.4                                ...           a year ago
  • 0.4.3                                ...           a year ago
  • 0.4.2                                ...           a year ago
  • 0.4.1                                ...           a year ago
  • 0.4.0                                ...           a year ago
  • 0.3.10                                ...           a year ago
  • 0.3.9                                ...           2 years ago
  • 0.3.8                                ...           2 years ago
  • 0.3.7                                ...           2 years ago
  • 0.3.6                                ...           2 years ago
  • 0.3.5                                ...           2 years ago
  • 0.3.4                                ...           2 years ago
  • 0.3.3                                ...           2 years ago
  • 0.3.2                                ...           2 years ago
  • 0.3.1                                ...           2 years ago
  • 0.3.0                                ...           2 years ago
  • 0.2.3                                ...           2 years ago
  • 0.2.2                                ...           2 years ago
  • 0.2.1                                ...           2 years ago
  • 0.2.0                                ...           2 years ago
  • 0.1.4                                ...           2 years ago
  • 0.1.3                                ...           2 years ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 123
Dependencies (19)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |