eslint-plugin-better-dates
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

eslint-plugin-better-dates npm version

An ESlint plugin to prevent Date-related bugs.

Installation

Make sure you have TypeScript and @typescript-eslint/parser installed:

$ yarn add -D typescript @typescript-eslint/parser
$ npm i --save-dev typescript @typescript-eslint/parser

Then install the plugin:

$ yarn add -D eslint-plugin-better-dates
$ npm i --save-dev eslint-plugin-better-dates

Usage

Add @typescript-eslint/parser to the parser field, your tsconfig.json relative path to parserOptions.project, and better-dates to the plugins section of your .eslintrc configuration file, then configure the rules you want to use under the rules section.

{
  "parser": "@typescript-eslint/parser",
  "parserOptions": { "project": "./tsconfig.json" },
  "plugins": ["better-dates"],
  "rules": {
    "better-dates/ban-date-mutation": "error"
  }
}

Note: Make sure to use eslint --ext .js,.ts since by default eslint will only search for .js files.

Rules

Key: 🔧 = fixable, 💭 = requires type information

Name Description 🔧 💭
better-dates/ban-date-mutation Bans calling methods on Date that will mutate the date. 💭

Project layout and configuration modified from typescript-eslint/eslint-plugin.

Package Sidebar

Install

npm i eslint-plugin-better-dates

Weekly Downloads

31

Version

0.0.3

License

MIT

Unpacked Size

30.4 kB

Total Files

28

Last publish

Collaborators

  • cdignam