Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed Aug 4, 2018
1 parent b944f1e commit 13afcc6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"main": "dist/lifecycle.es5.js",
"module": "dist/lifecycle.mjs",
"scripts": {
"test": "eslint *.js src/**/*",
"test": "eslint *.js src/**/* test/*.mjs",
"build": "rollup -c"
},
"repository": {
Expand Down Expand Up @@ -58,7 +58,8 @@
},
"globals": {
"assert": false,
"sinon": false
"sinon": false,
"safari": false
},
"parserOptions": {
"ecmaVersion": 2018,
Expand Down
3 changes: 2 additions & 1 deletion src/Lifecycle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ACTIVE = 'active';
const PASSIVE = 'passive';
const HIDDEN = 'hidden';
const FROZEN = 'frozen';
const DISCARDED = 'discarded';
// const DISCARDED = 'discarded'; Not used but show to completeness.
const TERMINATED = 'terminated';

// Detect Safari to work around Safari-specific bugs.
Expand Down Expand Up @@ -222,6 +222,7 @@ export default class Lifecycle extends EventTarget {

/**
* @private
* @param {!Event} originalEvent
* @param {string} newState
*/
_dispatchChangesIfNeeded(originalEvent, newState) {
Expand Down
9 changes: 8 additions & 1 deletion test/Lifecycle-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ const fireEvent = (type, props = {}) => {
/**
* A wrapper around `sinon.stub()` for properties that supports non-existent
* own properties (sinon doesn't).
* @param {!Object} obj
* @param {string} prop
* @param {*} value
* @return {!Object}
*/
const stubProperty = (obj, prop, value) => {
if (!obj.hasOwnProperty(prop)) {
Expand All @@ -86,6 +90,9 @@ const stubProperty = (obj, prop, value) => {
/**
* A wrapper around `sinon.stub()` for methods that automatically unstubs
* an restubs a method if it's already been stubbed.
* @param {!Object} obj
* @param {string} method
* @return {!Object}
*/
const stubMethod = (obj, method) => {
if (obj[method].isSinonProxy) {
Expand All @@ -99,7 +106,7 @@ const stubMethod = (obj, method) => {
* correct state (either at instantiation time or after an event). Note that
* the frozen, terminated, and discarded states cannot be stubbed since
* they require an event to fire to be observable.
* @param {string}
* @param {string} state
*/
const stubState = (state) => {
switch (state) {
Expand Down

0 comments on commit 13afcc6

Please sign in to comment.