diff --git a/.eslintrc.yml b/.eslintrc.yml
index eb1850f..abcafd7 100644
--- a/.eslintrc.yml
+++ b/.eslintrc.yml
@@ -1,13 +1,15 @@
root: true
extends:
- - plugin:@mysticatea/es2015
- - plugin:@mysticatea/+modules
- - plugin:@mysticatea/+node
+- plugin:@mysticatea/es2015
-rules:
- init-declarations: "off"
- "@mysticatea/node/no-unsupported-features/es-syntax":
+overrides:
+- files:
+ - src/**/*.js
+ - test/**/*.js
+ extends: plugin:@mysticatea/+modules
+ rules:
+ init-declarations: "off"
+ "@mysticatea/node/no-unsupported-features/es-syntax":
- error
- - ignores:
- - modules
+ - ignores: [modules]
diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js
index f33f588..edc74c0 100644
--- a/docs/.vuepress/config.js
+++ b/docs/.vuepress/config.js
@@ -1,3 +1,5 @@
+"use strict"
+
module.exports = {
title: "eslint-utils",
description: "Utilities for ESLint plugins and custom rules.",
diff --git a/docs/.vuepress/override.styl b/docs/.vuepress/palette.styl
similarity index 100%
rename from docs/.vuepress/override.styl
rename to docs/.vuepress/palette.styl
diff --git a/package.json b/package.json
index e92523c..39e64df 100644
--- a/package.json
+++ b/package.json
@@ -12,23 +12,23 @@
"index.*"
],
"dependencies": {
- "eslint-visitor-keys": "^1.0.0"
+ "eslint-visitor-keys": "^1.1.0"
},
"devDependencies": {
- "@mysticatea/eslint-plugin": "^10.0.3",
- "codecov": "^3.0.2",
+ "@mysticatea/eslint-plugin": "^12.0.0",
+ "codecov": "^3.6.1",
"dot-prop": "^4.2.0",
- "eslint": "^5.16.0",
- "esm": "^3.0.55",
- "espree": "^5.0.1",
- "mocha": "^5.2.0",
+ "eslint": "^6.5.1",
+ "esm": "^3.2.25",
+ "espree": "^6.1.1",
+ "mocha": "^6.2.2",
"npm-run-all": "^4.1.5",
- "nyc": "^13.0.1",
- "opener": "^1.4.3",
- "rimraf": "^2.6.2",
- "rollup": "^1.16.7",
+ "nyc": "^14.1.1",
+ "opener": "^1.5.1",
+ "rimraf": "^3.0.0",
+ "rollup": "^1.25.0",
"rollup-plugin-sourcemaps": "^0.4.2",
- "vuepress": "^0.14.4",
+ "vuepress": "^1.2.0",
"warun": "^1.0.0"
},
"scripts": {
diff --git a/src/get-static-value.js b/src/get-static-value.js
index 0848083..173c01a 100644
--- a/src/get-static-value.js
+++ b/src/get-static-value.js
@@ -1,7 +1,18 @@
-/* globals BigInt */
+/* globals BigInt, globalThis, global, self, window */
import { findVariable } from "./find-variable"
+const globalObject =
+ typeof globalThis !== "undefined"
+ ? globalThis
+ : typeof self !== "undefined"
+ ? self
+ : typeof window !== "undefined"
+ ? window
+ : typeof global !== "undefined"
+ ? global
+ : {}
+
const builtinNames = Object.freeze(
new Set([
"Array",
@@ -76,13 +87,13 @@ const callAllowed = new Set(
Number.parseFloat,
Number.parseInt,
Object,
- Object.entries, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins
+ Object.entries,
Object.is,
Object.isExtensible,
Object.isFrozen,
Object.isSealed,
Object.keys,
- Object.values, //eslint-disable-line @mysticatea/node/no-unsupported-features/es-builtins
+ Object.values,
parseFloat,
parseInt,
RegExp,
@@ -294,9 +305,9 @@ const operations = Object.freeze({
variable != null &&
variable.defs.length === 0 &&
builtinNames.has(variable.name) &&
- variable.name in global
+ variable.name in globalObject
) {
- return { value: global[variable.name] }
+ return { value: globalObject[variable.name] }
}
// Constants.
diff --git a/src/reference-tracker.js b/src/reference-tracker.js
index e1fc8cd..f63c2bd 100644
--- a/src/reference-tracker.js
+++ b/src/reference-tracker.js
@@ -162,11 +162,11 @@ export class ReferenceTracker {
esm
? nextTraceMap
: this.mode === "legacy"
- ? Object.assign(
- { default: nextTraceMap },
- nextTraceMap
- )
- : { default: nextTraceMap }
+ ? Object.assign(
+ { default: nextTraceMap },
+ nextTraceMap
+ )
+ : { default: nextTraceMap }
)
if (esm) {
diff --git a/test/pattern-matcher.js b/test/pattern-matcher.js
index c14fd3b..717867f 100644
--- a/test/pattern-matcher.js
+++ b/test/pattern-matcher.js
@@ -3,7 +3,7 @@ import { PatternMatcher } from "../src/"
const NAMED_CAPTURE_GROUP_SUPPORTED = (() => {
try {
- new RegExp("(?)", "u") //eslint-disable-line no-new, @mysticatea/node/no-unsupported-features/es-syntax
+ new RegExp("(?)", "u") //eslint-disable-line no-new, prefer-regex-literals, @mysticatea/node/no-unsupported-features/es-syntax
return true
} catch (_error) {
return false