{"id":25504,"library":"eslint-plugin-date","title":"eslint-plugin-date","description":"An ESLint plugin that enforces safe Date usage in JavaScript to prevent timezone-related bugs. It bans direct usage of `new Date()`, `moment`, `dayjs`, and `date-fns` in favor of safer alternatives. The current version is 0.0.0 and has not seen active development. It is forked from Skyscanner's eslint-plugin-skyscanner-dates with business-specific changes. The plugin provides three config presets: recommended, error, and warn.","status":"active","version":"0.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install eslint-plugin-date","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-date","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-date","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; ESLint plugin requires ESLint to run.","package":"eslint","optional":false}],"imports":[{"note":"ESM-only package. Use import for ES modules.","wrong":"const date = require('eslint-plugin-date')","symbol":"plugin","correct":"import date from 'eslint-plugin-date'"},{"note":"Configs are exported as named exports. CommonJS require is not supported.","wrong":"const { configs } = require('eslint-plugin-date')","symbol":"configs","correct":"import { configs } from 'eslint-plugin-date'"},{"note":"Rules are also named exports. Direct require of property works but dispreferred.","wrong":"const rules = require('eslint-plugin-date').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-date'"}],"quickstart":{"code":"// .eslintrc.js\nmodule.exports = {\n  plugins: ['date'],\n  extends: ['plugin:date/recommended'],\n  rules: {\n    'date/no-date-fns': 'off',\n    'date/no-moment-dayjs': 'error',\n    'date/no-new-date-with-args': 'error',\n    'date/no-new-date-without-args': 'off'\n  }\n};","lang":"javascript","description":"Configures ESLint to use the date plugin with recommended settings and custom rule overrides."},"warnings":[{"fix":"Use import syntax or enable ESM in your project.","message":"Plugin uses ESM exports only; CommonJS require may fail in older Node versions.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use the plugin's recommended config or selectively disable rules for allowed libraries.","message":"Rules like 'no-date-fns' and 'no-moment-dayjs' are loosely named; they prevent any usage including safe patterns.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Manually replace forbidden Date patterns with approved date handling utilities.","message":"The plugin does not provide automatic fixes; it only reports errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Consider using a maintained alternative like eslint-plugin-date-rules or a custom rule.","message":"The plugin is based on an older fork of Skyscanner's dates plugin and may not receive updates.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install --save-dev eslint-plugin-date","cause":"Plugin not installed or missing from package.json.","error":"Error: Failed to load plugin 'date' declared in '.eslintrc': Cannot find module 'eslint-plugin-date'"},{"fix":"Use `import date from 'eslint-plugin-date'` or adjust ESLint config to use string 'date'.","cause":"Incorrect import of plugin; using require instead of import.","error":"TypeError: date is not a function"},{"fix":"Check available rules: 'date/no-new-date-with-args', 'date/no-new-date-without-args', 'date/no-date-fns', 'date/no-moment-dayjs'.","cause":"Using a rule name that doesn't exist in the plugin.","error":"ESLint: 'date/no-date-fns' rule has been removed or is not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}