Skip to content

Commit c71e204

Browse files
remove ESLint violations
1 parent 2012cb6 commit c71e204

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/ctx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class Ctx {
33
this._temp = '';
44
this._parentTemp = `"use strict";return @temp;`;
55
this._com = null;
6-
if (!(window.hasOwnProperty('Babel') && typeof window.Babel === 'object')) {
6+
if (!(Object.prototype.hasOwnProperty.call(window, 'Babel') && typeof window.Babel === 'object')) {
77
throw new Error(`string-to-react-component package needs @babel/standalone for working correctly.
88
you should load @babel/standalone in the browser.`);
99
}

src/ctx.test.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import Ctx from './ctx.js';
2-
import {TestScheduler} from 'jest';
32
beforeEach(() => {
43
window.Babel = {};
54
});
@@ -53,19 +52,21 @@ describe('methods : ', () => {
5352
test('_validateCodeInsideTheTemp method', () => {
5453
expect.assertions(3);
5554
const ins = new Ctx();
56-
try {
55+
{
5756
ins._com = () => {};
5857
ins._validateCodeInsideTheTemp();
5958
expect(1).toBe(1);
60-
} catch (er) {}
61-
try {
62-
class c {}
59+
}
60+
{
61+
class c {
62+
constructor() {}
63+
}
6364
ins._com = c;
6465
ins._validateCodeInsideTheTemp();
6566
expect(1).toBe(1);
66-
} catch (er) {}
67+
}
6768
try {
68-
ins._com = {};
69+
ins._com = '';
6970
ins._validateCodeInsideTheTemp();
7071
} catch (er) {
7172
expect(er.message).toBe('code inside the passed string into string-to-react-component, should be a function');

src/strintToReact.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable react/prop-types */
12
import React, {useRef} from 'react';
23
window.React = window.React || React;
34
function StringToReactComponent({getCtx}, props) {

0 commit comments

Comments
 (0)