From 90d4fe2683b4d4367e21e9f09380d2a787c1d94a Mon Sep 17 00:00:00 2001 From: Richard Hallows Date: Mon, 18 May 2020 17:36:09 +0100 Subject: [PATCH] Fix TypeError for shorthand animation in time-min-milliseconds (#4783) --- .../time-min-milliseconds/__tests__/index.js | 18 ++++++++++++++++++ lib/rules/time-min-milliseconds/index.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/rules/time-min-milliseconds/__tests__/index.js b/lib/rules/time-min-milliseconds/__tests__/index.js index c8c666271a..ac8eed4592 100644 --- a/lib/rules/time-min-milliseconds/__tests__/index.js +++ b/lib/rules/time-min-milliseconds/__tests__/index.js @@ -9,6 +9,15 @@ testRule({ config: [MIN_VALUE], accept: [ + { + code: 'a { animation: none; }', + }, + { + code: 'a { animation: none, my-animation; }', + }, + { + code: 'a { transition: opacity var(--x) var(--y) ease-out }', + }, { code: 'a { transition-delay: 0.1s; }', }, @@ -314,6 +323,15 @@ testRule({ config: [MIN_VALUE, { ignore: ['delay'] }], accept: [ + { + code: 'a { animation: none; }', + }, + { + code: 'a { animation: none, my-animation; }', + }, + { + code: 'a { transition: opacity var(--x) var(--y) ease-out }', + }, { code: 'a { transition-duration: 0.15s; }', }, diff --git a/lib/rules/time-min-milliseconds/index.js b/lib/rules/time-min-milliseconds/index.js index c0c6bd1bd2..7971a757b1 100644 --- a/lib/rules/time-min-milliseconds/index.js +++ b/lib/rules/time-min-milliseconds/index.js @@ -63,7 +63,7 @@ function rule(minimum, options) { // Check only duration time values const duration = getDuration(valueList); - if (!isAcceptableTime(duration)) { + if (duration && !isAcceptableTime(duration)) { complain(decl, decl.value.indexOf(duration)); } } else {