diff --git a/.eslintrc b/.eslintrc index 9232aca57..4268f85bb 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,7 +6,10 @@ env: es6: true rules: global-require: off - no-unused-vars: [2, { + no-console: ['error', { + allow: ['warn', 'error', 'info'] + }] + no-unused-vars: ['error', { vars: all, args: after-used, varsIgnorePattern: ^_, diff --git a/package.json b/package.json index 85b261ed0..67c88d9e0 100644 --- a/package.json +++ b/package.json @@ -137,8 +137,7 @@ "memoize-one": "^4.0.3", "prop-types": "^15.6.2", "react-overlays": "^2.0.0-0", - "uncontrollable": "^7.0.0", - "warning": "^4.0.2" + "uncontrollable": "^7.0.0" }, "resolutions": { "babel-core": "7.0.0-bridge.0" diff --git a/src/Calendar.js b/src/Calendar.js index 91cbbc299..1225925f4 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -9,7 +9,6 @@ import { DayLayoutAlgorithmPropType, views as componentViews, } from './utils/propTypes' -import warning from 'warning' import { notify } from './utils/helpers' import { navigate, views } from './utils/constants' @@ -942,7 +941,9 @@ class Calendar extends React.Component { if (viewComponent.range) { onRangeChange(viewComponent.range(date, { localizer }), view) } else { - warning(true, 'onRangeChange prop not supported for this view') + if (process.env.NODE_ENV !== 'production') { + console.error('onRangeChange prop not supported for this view') + } } } } diff --git a/src/localizers/globalize.js b/src/localizers/globalize.js index 4707db063..1d593f3d7 100644 --- a/src/localizers/globalize.js +++ b/src/localizers/globalize.js @@ -1,7 +1,6 @@ import * as dates from '../utils/dates' import oldGlobalize from './oldGlobalize' import { DateLocalizer } from '../localizer' -import warning from 'warning' let dateRangeFormat = ({ start, end }, culture, local) => local.format(start, { date: 'short' }, culture) + @@ -62,11 +61,12 @@ export default function(globalize) { const firstDay = weekData.firstDay[territory || '001'] return days.indexOf(firstDay) } catch (e) { - warning( - true, - `Failed to accurately determine first day of the week. - Is supplemental data loaded into CLDR?` - ) + if (process.env.NODE_ENV !== 'production') { + console.error( + 'Failed to accurately determine first day of the week.' + + ' Is supplemental data loaded into CLDR?' + ) + } // maybe cldr supplemental is not loaded? revert to original method const date = new Date() //cldr-data doesn't seem to be zero based