Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

⏱ An ESlint plugin to encourage better `Date` usage and prevent `Date`-related bugs.

License

NotificationsYou must be signed in to change notification settings

chdsbd/eslint-plugin-better-dates

Repository files navigation

An ESlint plugin to preventDate-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 theparser field, yourtsconfig.json relative path toparserOptions.project, andbetter-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 useeslint --ext .js,.ts since bydefaulteslint will only search for.js files.

Rules

Key: 🔧 = fixable, 💭 = requires type information

NameDescription🔧💭
better-dates/ban-date-mutationBans calling methods onDate that will mutate the date.💭

Project layout and configuration modified fromtypescript-eslint/eslint-plugin.

About

⏱ An ESlint plugin to encourage better `Date` usage and prevent `Date`-related bugs.

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp