Skip to content

Commit 1190c8f

Browse files
committed
Remove airbng config and use prettier config
1 parent 92cb8ba commit 1190c8f

File tree

5 files changed

+38
-59
lines changed

5 files changed

+38
-59
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"parser": "babel-eslint",
3-
"extends": "airbnb",
3+
"extends": "eslint-config-prettier",
44
"env": {
55
"mocha": true
66
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"chai": "^4.2.0",
5050
"cross-env": "^7.0.2",
5151
"eslint": "^7.3.1",
52-
"eslint-config-airbnb": "^18.2.0",
52+
"eslint-config-prettier": "^8.3.0",
5353
"eslint-plugin-import": "^2.21.2",
5454
"eslint-plugin-jsx-a11y": "^6.3.1",
5555
"eslint-plugin-react": "^7.20.0",

src/index.js

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
1-
/* global window self */
1+
const isBrowser =
2+
typeof window !== "undefined" && typeof window.document !== "undefined";
23

3-
const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
4+
const isWebWorker =
5+
typeof self === "object" &&
6+
self.constructor &&
7+
self.constructor.name === "DedicatedWorkerGlobalScope";
48

5-
/* eslint-disable no-restricted-globals */
6-
const isWebWorker = typeof self === 'object'
7-
&& self.constructor
8-
&& self.constructor.name === 'DedicatedWorkerGlobalScope';
9-
/* eslint-enable no-restricted-globals */
10-
11-
const isNode = typeof process !== 'undefined'
12-
&& process.versions != null
13-
&& process.versions.node != null;
9+
const isNode =
10+
typeof process !== "undefined" &&
11+
process.versions != null &&
12+
process.versions.node != null;
1413

1514
/**
1615
* @see https://github.com/jsdom/jsdom/releases/tag/12.0.0
1716
* @see https://github.com/jsdom/jsdom/issues/1537
1817
*/
19-
/* eslint-disable no-undef */
20-
const isJsDom = (() => (typeof window !== 'undefined' && window.name === 'nodejs')
21-
|| navigator.userAgent.includes('Node.js')
22-
|| navigator.userAgent.includes('jsdom'))();
18+
const isJsDom = (() =>
19+
(typeof window !== "undefined" && window.name === "nodejs") ||
20+
navigator.userAgent.includes("Node.js") ||
21+
navigator.userAgent.includes("jsdom"))();
2322

24-
const isDeno = typeof Deno !== 'undefined' && typeof Deno.core !== 'undefined';
23+
const isDeno = typeof Deno !== "undefined" && typeof Deno.core !== "undefined";
2524

26-
export {
27-
isBrowser, isWebWorker, isNode, isJsDom, isDeno
28-
};
25+
export { isBrowser, isWebWorker, isNode, isJsDom, isDeno };

test/index.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import { assert } from 'chai';
2-
import { isBrowser, isWebBrowser, isNode, isDeno, isJsDom } from '../src';
1+
import { assert } from "chai";
2+
import { isBrowser, isWebBrowser, isNode, isDeno, isJsDom } from "../src";
33

4-
console.log('Browser?', isBrowser);
5-
console.log('Node?', isNode);
6-
console.log('Web browser?', isWebBrowser);
7-
console.log('JS Dom?', isJsDom);
8-
console.log('Deno?', isDeno);
4+
console.log("Browser?", isBrowser);
5+
console.log("Node?", isNode);
6+
console.log("Web browser?", isWebBrowser);
7+
console.log("JS Dom?", isJsDom);
8+
console.log("Deno?", isDeno);
99

10-
describe('Browser or Node.js', () => {
11-
it('should check node env', () => {
12-
assert(isNode === true, 'isNode didn\'t work :(');
10+
describe("Browser or Node.js", () => {
11+
it("should check node env", () => {
12+
assert(isNode === true, "isNode didn't work :(");
1313
});
1414

15-
it('should check browser env', () => {
15+
it("should check browser env", () => {
1616
//should figure out how to automate this
17-
assert(isBrowser === false, 'isBrowser didn\'t work :(');
17+
assert(isBrowser === false, "isBrowser didn't work :(");
1818
});
1919

20-
it('should check web worker env', () => {
21-
assert(isNode === true, 'isWebWorker didn\'t work :(');
20+
it("should check web worker env", () => {
21+
assert(isNode === true, "isWebWorker didn't work :(");
2222
});
23-
});
23+
});

yarn.lock

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,11 +1313,6 @@ [email protected]:
13131313
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
13141314
integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
13151315

1316-
confusing-browser-globals@^1.0.9:
1317-
version "1.0.9"
1318-
resolved "https://packages.atlassian.com/api/npm/npm-remote/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd"
1319-
integrity sha1-crwTtIPAJ2gBaBhx1ImFFvj1T90=
1320-
13211316
console-control-strings@^1.0.0, console-control-strings@~1.1.0:
13221317
version "1.1.0"
13231318
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
@@ -1577,23 +1572,10 @@ [email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1
15771572
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
15781573
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
15791574

1580-
eslint-config-airbnb-base@^14.2.0:
1581-
version "14.2.0"
1582-
resolved "https://packages.atlassian.com/api/npm/npm-remote/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.2.0.tgz#fe89c24b3f9dc8008c9c0d0d88c28f95ed65e9c4"
1583-
integrity sha1-/onCSz+dyACMnA0NiMKPle1l6cQ=
1584-
dependencies:
1585-
confusing-browser-globals "^1.0.9"
1586-
object.assign "^4.1.0"
1587-
object.entries "^1.1.2"
1588-
1589-
eslint-config-airbnb@^18.2.0:
1590-
version "18.2.0"
1591-
resolved "https://packages.atlassian.com/api/npm/npm-remote/eslint-config-airbnb/-/eslint-config-airbnb-18.2.0.tgz#8a82168713effce8fc08e10896a63f1235499dcd"
1592-
integrity sha1-ioIWhxPv/Oj8COEIlqY/EjVJnc0=
1593-
dependencies:
1594-
eslint-config-airbnb-base "^14.2.0"
1595-
object.assign "^4.1.0"
1596-
object.entries "^1.1.2"
1575+
eslint-config-prettier@^8.3.0:
1576+
version "8.3.0"
1577+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a"
1578+
integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==
15971579

15981580
eslint-import-resolver-node@^0.3.3:
15991581
version "0.3.4"
@@ -3161,7 +3143,7 @@ [email protected], object.assign@^4.1.0:
31613143
has-symbols "^1.0.0"
31623144
object-keys "^1.0.11"
31633145

3164-
object.entries@^1.1.1, object.entries@^1.1.2:
3146+
object.entries@^1.1.1:
31653147
version "1.1.2"
31663148
resolved "https://packages.atlassian.com/api/npm/npm-remote/object.entries/-/object.entries-1.1.2.tgz#bc73f00acb6b6bb16c203434b10f9a7e797d3add"
31673149
integrity sha1-vHPwCstra7FsIDQ0sQ+afnl9Ot0=

0 commit comments

Comments
 (0)