Skip to content

Latest commit

 

History

History
158 lines (96 loc) · 3.99 KB

CONTRIBUTING.md

File metadata and controls

158 lines (96 loc) · 3.99 KB

Contributing Guide

Table of Contents

How to Help?

Help is always welcome. There are areas where you can help:

  • The core functionality (performance improvements, bug fixes, new features, etc.).

  • Documentation (markdown documents, inline JSDoc comments).

  • Test suite & development environment improvements.

  • The website.

If you see a gap, but don't have time, experience, or you just need help with the library, don't hesitate to shoot an issue.

The date-fns functionality is comprehensive and covers most of the use cases, however it doesn't have extended time zone support. Please leave a comment to the Extended time zones support issue if you are interested in the functionality or want to help with development.

If you are interested in Elm/ClojureScript/etc. wrappers, please file an issue.

Contribution Guidelines

Due to the modular nature of date-fns, it's more than open to new features. However, when a new function duplicates the existing functionality, native API or causes significant build size increase, a PR might be rejected or the author can be asked to move the code to a new or another package.

Please follow the main contributing rules, to maintain date-fns' top quality:

Getting Started

  1. Install Node.js and Yarn.

  2. Fork the project and clone the fork repo.

  3. Run yarn to install the application dependencies.

Testing

Run all tests:

yarn test

Run tests once:

yarn test --single-run

To test a function in REPL, use babel-node located in ./node_modules/.bin:

./node_modules/.bin/babel-node

> const toDate = require('./src/toDate')
undefined
> toDate('2017-11-17').toString()
'Fri Nov 17 2017 00:00:00 GMT+0100 (CET)'
>

Build date-fns to test in in your project:

env PACKAGE_OUTPUT_PATH="$(pwd)/../PATH-TO-YOUR-MODULE/node_modules/date-fns" ./scripts/build/package.sh

Before Sending a Pull Request

Rebuild FP functions, typings and indices by using the following script. It could take around a minute:

./scripts/build/build.sh

Code Style Guide

Lint the Code

The project follows JavaScript Standard Style. To lint the code, run:

yarn run lint

Use EditorConfig

The project uses EditorConfig to define basic coding style guides. Please install a plugin for your editor of choice or manually enforce the rules listed in .editorconfig.

Documentation

JSDoc

JSDoc is used for the code documentation. Along with standard JSDoc tags, date-fns uses @category tag that allows to group functions.

jsdoc-parse is used to parse JSDoc annotations.