eslint-plugin-safer-moment
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

eslint-plugin-safer-moment npm version

An ESlint plugin to prevent moment 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-safer-moment
$ npm i --save-dev eslint-plugin-safer-moment

Usage

Add @typescript-eslint/parser to the parser field, your tsconfig.json relative path to parserOptions.project, and safer-moment 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": ["safer-moment"],
  "rules": {
    "safer-moment/ban-moment-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 🔧 💭
safer-moment/ban-moment-mutation Bans mutating moment objects. 💭

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

Package Sidebar

Install

npm i eslint-plugin-safer-moment

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

5.57 kB

Total Files

4

Last publish

Collaborators

  • sbdchd