Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-skyscanner-dates

Package Overview
Dependencies
Maintainers
11
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-skyscanner-dates

eslint plugin to handle dates safely

  • 4.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
decreased by-45.83%
Maintainers
11
Weekly downloads
 
Created
Source

eslint-plugin-skyscanner-dates

Build Status

eslint plugin to handle safely dates.

Features

This eslint plugin is meant to be used to avoid explicit usage/manupulation of date in JS, so to avoid issues with timezones.

Installation

npm install --save-dev eslint-plugin-skyscanner-dates

Rules

  • rules no-moment, no-dayjs, no-saddlebag-date for stopping the use of moment, moment-timezone, dayjs, saddlebag-date date libraries.
  • rule no-date-fns-format for stopping using the date formatting in date-fns and stop using date formatting in date-fns-tz.
  • rule no-saddlebag-localisation-tz for stopping performing timezone manipulation in saddlebag-localisation
  • rule no-new-date-with-args for stopping using new Date("some string").

Usage

Add to the .eslintrc.json file inside the root folder of a linted project:

The rules no-moment and no-new-date-with-string-args will raise an error and others will be just a warning. A few months later, we will change the rules to be error severity, to force people to honour the rulers.

{
  "extends": "plugin:skyscanner-dates/recommended",
  "plugins": ["skyscanner-dates"]
}

Any rule failing will raise a blocking error.

{
  "extends": "plugin:skyscanner-dates/error",
  "plugins": ["skyscanner-dates"]
}

Any rule failing will just raise a warning.

{
  "extends": "plugin:skyscanner-dates/warn",
  "plugins": ["skyscanner-dates"]
}

Each rule can be configured on its own following eslint conventions:

{
  "plugins": ["skyscanner-dates"],
  "rules": {
    "skyscanner-dates/no-moment": "warn",
    "skyscanner-dates/no-dayjs": "warn",
    "skyscanner-dates/no-saddlebag-date": "warn",
    "skyscanner-dates/no-date-fns-format": "warn",
    "skyscanner-dates/no-saddlebag-localisation-tz": "warn"
    "skyscanner-dates/no-new-date-with-args": "warn"
  }
}

API

Your favourite code editor should provide information about API using code completion.

API docs can be generated by cloning the project and running:

npm install
npm run build-docs

API docs will now be generated in docs/api.md.

Developing

  • npm install - installs dependencies
  • npm run lint - runs linter
  • npm run build-docs - produces API documentation in Markdown format in docs/api.md
  • npm test - runs linter and tests

Contributing

See CONTRIBUTING.md if you want to contribute.

Release

See How to release eslint-plugin-skyscanner-dates if you want to release a new version.

FAQs

Package last updated on 20 Jul 2023

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