Repository: eslint/eslint (js)

Issue:
Change "readable" to "readonly" and "writeable" to "writable" in new globals configuration
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).

    This template is for requesting a change that is not a bug fix, rule change, or new rule. If you are here for another reason, please see below:

    1. To report a bug: https://eslint.org/docs/developer-guide/contributing/reporting-bugs
    2. To request a rule change: https://eslint.org/docs/developer-guide/contributing/rule-changes
    3. To propose a new rule: https://eslint.org/docs/developer-guide/contributing/new-rules
    4. If you have any questions, please stop by our chatroom: https://gitter.im/eslint/eslint

    Note that leaving sections blank will make it difficult for us to troubleshoot and we may have to close the issue.
-->

**The version of ESLint you are using.**

master


**The problem you want to solve.**

#11338 merged a change that allowed globals to be specified as "writeable" or "readable". I believe "readable" doesn't accurately convey the setting. All variables present in the environment are readable, including writable variables

Also, "writeable" is misspelled. It should be spelled "writable".

**Your take on the correct solution to problem.**

1. Change "readable" to "readonly".
1. Change "writeable" to "writable".

**Are you willing to submit a pull request to implement this change?**

Yes, if no one else wants to.

Pull request description:
Update: Use 'readonly' and 'writable' for globals (fixes #11359)
<!--
    ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
-->

**What is the purpose of this pull request? (put an "X" next to item)**

[ ] Documentation update
[ ] Bug fix ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/bug-report.md))
[ ] New rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-proposal.md))
[ ] Changes an existing rule ([template](https://raw.githubusercontent.com/eslint/eslint/master/templates/rule-change-proposal.md))
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[x] Other, please explain:

Changes globals configuration to also accept "readonly" and "writable".

<!--
    If the item you've checked above has a template, please paste the template questions below and answer them. (If this pull request is addressing an issue, you can just paste a link to the issue here instead.)
-->

<!--
    Please ensure your pull request is ready:

    - Read the pull request guide (https://eslint.org/docs/developer-guide/contributing/pull-requests)
    - Include tests for this change
    - Update documentation for this change (if appropriate)
-->

<!--
    The following is required for all pull requests:
-->

**What changes did you make? (Give an overview)**

* Updated `config-ops#normalizeGlobalsConfig()` to also accept "readonly" and "writable" (the values returned from this function are unchanged).
* Updated the related tests.
* Updated documentation related to configuring globals.

**Is there anything you'd like reviewers to focus on?**

Did I miss anything?


Patch:
diff --git a/Makefile.js b/Makefile.js
index fc1d5b40c..fa9227a5b 100644
--- a/Makefile.js
+++ b/Makefile.js
@@ -821,13 +821,13 @@ target.browserify = function() {
     }
 
     // 2. browserify the temp directory
-    exec(`${getBinFile("browserify")} -x espree lib/linter.js -o ${BUILD_DIR}eslint.js -s eslint --global-transform [ babelify --presets [ es2015 ] ]`);
+    exec(`${getBinFile("browserify")} -x espree lib/linter.js -o ${BUILD_DIR}eslint.js -s eslint --global-transform [ babelify --presets [ @babel/preset-env ] ]`);
 
     // 3. Browserify espree
-    exec(`${getBinFile("browserify")} -r espree -o ${TEMP_DIR}espree.js --global-transform [ babelify --presets [ es2015 ] ]`);
+    exec(`${getBinFile("browserify")} -r espree -o ${TEMP_DIR}espree.js --global-transform [ babelify --presets [ @babel/preset-env ] ]`);
 
     // 4. Concatenate Babel polyfill, Espree, and ESLint files together
-    cat("./node_modules/babel-polyfill/dist/polyfill.js", `${TEMP_DIR}espree.js`, `${BUILD_DIR}eslint.js`).to(`${BUILD_DIR}eslint.js`);
+    cat("./node_modules/@babel/polyfill/dist/polyfill.js", `${TEMP_DIR}espree.js`, `${BUILD_DIR}eslint.js`).to(`${BUILD_DIR}eslint.js`);
 
     // 5. remove temp directory
     rm("-rf", TEMP_DIR);
diff --git a/docs/developer-guide/working-with-rules.md b/docs/developer-guide/working-with-rules.md
index a0524ea5b..38c2a8319 100644
--- a/docs/developer-guide/working-with-rules.md
+++ b/docs/developer-guide/working-with-rules.md
@@ -333,6 +333,7 @@ Best practices for fixes:
 
         ({ "foo": 1 })
         ```
+
     * This fixer can just select a quote type arbitrarily. If it guesses wrong, the resulting code will be automatically reported and fixed by the [`quotes`](/docs/rules/quotes.md) rule.
 
 ### context.options
@@ -405,16 +406,19 @@ Once you have an instance of `SourceCode`, you can use the methods on it to work
 * `commentsExistBetween(nodeOrToken1, nodeOrToken2)` - returns `true` if comments exist between two nodes.
 
 > `skipOptions` is an object which has 3 properties; `skip`, `includeComments`, and `filter`. Default is `{skip: 0, includeComments: false, filter: null}`.
+>
 > * `skip` is a positive integer, the number of skipping tokens. If `filter` option is given at the same time, it doesn't count filtered tokens as skipped.
 > * `includeComments` is a boolean value, the flag to include comment tokens into the result.
 > * `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
 >
 > `countOptions` is an object which has 3 properties; `count`, `includeComments`, and `filter`. Default is `{count: 0, includeComments: false, filter: null}`.
+>
 > * `count` is a positive integer, the maximum number of returning tokens.
 > * `includeComments` is a boolean value, the flag to include comment tokens into the result.
 > * `filter` is a function which gets a token as the first argument, if the function returns `false` then the result excludes the token.
 >
 > `rangeOptions` is an object which has 1 property: `includeComments`.
+>
 > * `includeComments` is a boolean value, the flag to include comment tokens into the result.
 
 There are also some properties you can access:
diff --git a/docs/rules/comma-spacing.md b/docs/rules/comma-spacing.md
index a04d5ae5e..ffa2bfd11 100644
--- a/docs/rules/comma-spacing.md
+++ b/docs/rules/comma-spacing.md
@@ -1,6 +1,6 @@
 # Enforces spacing around commas (comma-spacing)
 
-Spacing around commas improve readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.
+Spacing around commas improves readability of a list of items. Although most of the style guidelines for languages prescribe adding a space after a comma and not before it, it is subjective to the preferences of a project.
 
 ```js
 var foo = 1, bar = 2;
diff --git a/docs/rules/no-extra-bind.md b/docs/rules/no-extra-bind.md
index 0294d3e5c..6d6bf138d 100644
--- a/docs/rules/no-extra-bind.md
+++ b/docs/rules/no-extra-bind.md
@@ -1,6 +1,6 @@
 # Disallow unnecessary function binding (no-extra-bind)
 
-The `bind()` method is used to create functions with specific `this` values and, optionally, binds arguments to specific values. When used to specify the value of `this`, it's important that the function actually use `this` in its function body. For example:
+The `bind()` method is used to create functions with specific `this` values and, optionally, binds arguments to specific values. When used to specify the value of `this`, it's important that the function actually uses `this` in its function body. For example:
 
 ```js
 var boundGetName = (function getName() {
diff --git a/docs/rules/no-shadow-restricted-names.md b/docs/rules/no-shadow-restricted-names.md
index 9dfc03719..890353da7 100644
--- a/docs/rules/no-shadow-restricted-names.md
+++ b/docs/rules/no-shadow-restricted-names.md
@@ -1,6 +1,6 @@
 # Disallow Shadowing of Restricted Names (no-shadow-restricted-names)
 
-ES5 §15.1.1 Value Properties of the Global Object (`NaN`, `Infinity`, `undefined`) as well as strict mode restricted identifiers `eval` and `arguments` are considered to be restricted names in JavaScript. Defining them to mean something else can have unintended consequences and confuse others reading the code. For example, there's nothing prevent you from writing:
+ES5 §15.1.1 Value Properties of the Global Object (`NaN`, `Infinity`, `undefined`) as well as strict mode restricted identifiers `eval` and `arguments` are considered to be restricted names in JavaScript. Defining them to mean something else can have unintended consequences and confuse others reading the code. For example, there's nothing preventing you from writing:
 
 ```js
 var undefined = "foo";
diff --git a/docs/user-guide/configuring.md b/docs/user-guide/configuring.md
index c2400a99c..367315ea8 100644
--- a/docs/user-guide/configuring.md
+++ b/docs/user-guide/configuring.md
@@ -208,19 +208,19 @@ To specify globals using a comment inside of your JavaScript file, use the follo
 /* global var1, var2 */
 ```
 
-This defines two global variables, `var1` and `var2`. If you want to optionally specify that these global variables can be written to (rather than only being read), then you can set each with a `writeable` flag:
+This defines two global variables, `var1` and `var2`. If you want to optionally specify that these global variables can be written to (rather than only being read), then you can set each with a `"writable"` flag:
 
 ```js
-/* global var1:writeable, var2:writeable */
+/* global var1:writable, var2:writable */
 ```
 
-To configure global variables inside of a configuration file, set the `globals` configuration property to an object containing keys named for each of the global variables you want to use. For each global variable key, set the corresponding value equal to `"writeable"` to allow the variable to be overwritten or `"readable"` to disallow overwriting. For example:
+To configure global variables inside of a configuration file, set the `globals` configuration property to an object containing keys named for each of the global variables you want to use. For each global variable key, set the corresponding value equal to `"writable"` to allow the variable to be overwritten or `"readonly"` to disallow overwriting. For example:
 
 ```json
 {
     "globals": {
-        "var1": "writeable",
-        "var2": "readable"
+        "var1": "writable",
+        "var2": "readonly"
     }
 }
 ```
@@ -230,8 +230,8 @@ And in YAML:
 ```yaml
 ---
   globals:
-    var1: writeable
-    var2: readable
+    var1: writable
+    var2: readonly
 ```
 
 These examples allow `var1` to be overwritten in your code, but disallow it for `var2`.
@@ -249,7 +249,7 @@ Globals can be disabled with the string `"off"`. For example, in an environment
 }
 ```
 
-For historical reasons, the boolean values `false` and `true` can also be used to configure globals, and are equivalent to `"readable"` and `"writeable"`, respectively. However, this usage of booleans is deprecated.
+For historical reasons, the boolean value `false` and the string value `"readable"` are equivalent to `"readonly"`. Similarly, the boolean value `true` and the string value `"writeable"` are equivalent to `"writable"`. However, the use of older values is deprecated.
 
 **Note:** Enable the [no-global-assign](../rules/no-global-assign.md) rule to disallow modifications to read-only global variables in your code.
 
diff --git a/karma.conf.js b/karma.conf.js
index e8a027e54..9b26395e9 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -36,7 +36,7 @@ module.exports = function(config) {
         },
         babelPreprocessor: {
             options: {
-                presets: ["es2015"]
+                presets: ["@babel/preset-env"]
             }
         },
 
diff --git a/lib/config/config-ops.js b/lib/config/config-ops.js
index 48f38b490..b38cdf7d7 100644
--- a/lib/config/config-ops.js
+++ b/lib/config/config-ops.js
@@ -386,12 +386,14 @@ module.exports = {
             case true:
             case "true":
             case "writeable":
+            case "writable":
                 return "writeable";
 
             case null:
             case false:
             case "false":
             case "readable":
+            case "readonly":
                 return "readable";
 
             // Fallback to minimize compatibility impact
diff --git a/package.json b/package.json
index ad2790622..cd25a4013 100644
--- a/package.json
+++ b/package.json
@@ -36,11 +36,11 @@
   "bugs": "https://github.com/eslint/eslint/issues/",
   "dependencies": {
     "@babel/code-frame": "^7.0.0",
-    "ajv": "^6.5.3",
+    "ajv": "^6.9.1",
     "chalk": "^2.1.0",
     "cross-spawn": "^6.0.5",
     "debug": "^4.0.1",
-    "doctrine": "^2.1.0",
+    "doctrine": "^3.0.0",
     "eslint-scope": "^4.0.0",
     "eslint-utils": "^1.3.1",
     "eslint-visitor-keys": "^1.0.0",
@@ -54,11 +54,11 @@
     "ignore": "^4.0.6",
     "import-fresh": "^3.0.0",
     "imurmurhash": "^0.1.4",
-    "inquirer": "^6.1.0",
+    "inquirer": "^6.2.2",
     "js-yaml": "^3.12.0",
     "json-stable-stringify-without-jsonify": "^1.0.1",
     "levn": "^0.3.0",
-    "lodash": "^4.17.5",
+    "lodash": "^4.17.11",
     "minimatch": "^3.0.4",
     "mkdirp": "^0.5.1",
     "natural-compare": "^1.4.0",
@@ -69,14 +69,14 @@
     "semver": "^5.5.1",
     "strip-ansi": "^4.0.0",
     "strip-json-comments": "^2.0.1",
-    "table": "^5.0.2",
+    "table": "^5.2.3",
     "text-table": "^0.2.0"
   },
   "devDependencies": {
-    "babel-core": "^6.26.3",
-    "babel-polyfill": "^6.26.0",
-    "babel-preset-es2015": "^6.24.1",
-    "babelify": "^8.0.0",
+    "@babel/core": "^7.2.2",
+    "@babel/polyfill": "^7.2.5",
+    "@babel/preset-env": "^7.3.1",
+    "babelify": "^10.0.0",
     "beefy": "^2.1.8",
     "brfs": "^2.0.0",
     "browserify": "^16.2.2",
@@ -91,26 +91,26 @@
     "eslint-plugin-rulesdir": "^0.1.0",
     "eslint-release": "^1.2.0",
     "eslint-rule-composer": "^0.3.0",
-    "eslump": "^1.6.2",
+    "eslump": "^2.0.0",
     "esprima": "^4.0.1",
     "istanbul": "^0.4.5",
     "jsdoc": "^3.5.5",
-    "karma": "^3.0.0",
-    "karma-babel-preprocessor": "^7.0.0",
+    "karma": "^3.1.4",
+    "karma-babel-preprocessor": "^8.0.0",
     "karma-chrome-launcher": "^2.2.0",
     "karma-mocha": "^1.3.0",
     "karma-mocha-reporter": "^2.2.3",
     "leche": "^2.2.3",
     "load-perf": "^0.2.0",
-    "markdownlint": "^0.11.0",
+    "markdownlint": "^0.12.0",
     "mocha": "^5.0.5",
-    "mock-fs": "^4.6.0",
+    "mock-fs": "^4.8.0",
     "npm-license": "^0.3.3",
     "proxyquire": "^2.0.1",
-    "puppeteer": "^1.9.0",
+    "puppeteer": "^1.12.2",
     "shelljs": "^0.8.2",
     "sinon": "^3.3.0",
-    "temp": "^0.8.3",
+    "temp": "^0.9.0",
     "through": "^2.3.8"
   },
   "keywords": [
diff --git a/packages/eslint-config-eslint/package.json b/packages/eslint-config-eslint/package.json
index a12cf52a9..dfa84638a 100644
--- a/packages/eslint-config-eslint/package.json
+++ b/packages/eslint-config-eslint/package.json
@@ -20,7 +20,7 @@
   "homepage": "https://eslint.org",
   "bugs": "https://github.com/eslint/eslint/issues/",
   "dependencies": {
-    "js-yaml": "^3.5.1"
+    "js-yaml": "^3.12.1"
   },
   "peerDependencies": {
     "eslint-plugin-node": "^6.0.1 || ^7.0.1 || ^8.0.0"


Test patch:
diff --git a/tests/lib/config/config-ops.js b/tests/lib/config/config-ops.js
index 7cde4ff0f..8d5ad5fa5 100644
--- a/tests/lib/config/config-ops.js
+++ b/tests/lib/config/config-ops.js
@@ -908,7 +908,9 @@ describe("ConfigOps", () => {
             ["false", "readable"],
             [null, "readable"],
             ["writeable", "writeable"],
+            ["writable", "writeable"],
             ["readable", "readable"],
+            ["readonly", "readable"],
             ["writable", "writeable"],
             ["something else", "writeable"]
         ].forEach(([input, output]) => {
diff --git a/tests/lib/util/npm-utils.js b/tests/lib/util/npm-utils.js
index 5c8e4cc84..1b07f3715 100644
--- a/tests/lib/util/npm-utils.js
+++ b/tests/lib/util/npm-utils.js
@@ -162,15 +162,8 @@ describe("npmUtils", () => {
         });
 
         it("should return false if package.json does not exist", () => {
-
-            /*
-             * Checking local file system directly, which does not
-             * contains package.json. This is necessary because mock-fs
-             * doesn't work in Node.js 11: it throws an error when
-             * a file is missing rather than returning false.
-             * TODO: Find a replacement for mock-fs that works in Node 11.
-             */
-            assert.strictEqual(npmUtils.checkPackageJson("/"), false);
+            mockFs({});
+            assert.strictEqual(npmUtils.checkPackageJson(), false);
         });
     });