From ea6f3004237136e52bfb261087208c45fc4613ab Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 31 Mar 2022 19:57:21 +0700 Subject: [PATCH] Change `forbid` wording everywhere --- docs/rules/explicit-length-check.md | 4 ++-- docs/rules/no-array-method-this-argument.md | 2 +- docs/rules/no-keyword-prefix.md | 4 ++-- docs/rules/no-lonely-if.md | 2 +- docs/rules/no-useless-undefined.md | 2 +- docs/rules/prefer-module.md | 10 +++++----- rules/prefer-modern-dom-apis.js | 4 ++-- rules/prefer-query-selector.js | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/rules/explicit-length-check.md b/docs/rules/explicit-length-check.md index b8080e0033..b4d6b61747 100644 --- a/docs/rules/explicit-length-check.md +++ b/docs/rules/explicit-length-check.md @@ -42,7 +42,7 @@ const isEmpty = 1 > foo.length; ``` ```js -// Negative style is forbidden too +// Negative style is disallowed too const isEmpty = !(foo.length > 0); ``` @@ -107,7 +107,7 @@ const isNotEmpty = Boolean(foo.length); ``` ```js -// Negative style is forbidden too +// Negative style is disallowed too const isNotEmpty = !(foo.length === 0); ``` diff --git a/docs/rules/no-array-method-this-argument.md b/docs/rules/no-array-method-this-argument.md index 5510b70410..53bf0826e7 100644 --- a/docs/rules/no-array-method-this-argument.md +++ b/docs/rules/no-array-method-this-argument.md @@ -7,7 +7,7 @@ 🔧💡 *This rule is [auto-fixable](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems) and provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).* -The rule forbids using the `thisArg` argument in array methods: +The rule disallows using the `thisArg` argument in array methods: - If the callback is an arrow function or a bound function, the `thisArg` won't affect it. - If you intent to use a custom `this` in the callback, it's better to use the variable directly or use `callback.bind(thisArg)`. diff --git a/docs/rules/no-keyword-prefix.md b/docs/rules/no-keyword-prefix.md index 73dd4e86aa..38e8880e7b 100644 --- a/docs/rules/no-keyword-prefix.md +++ b/docs/rules/no-keyword-prefix.md @@ -26,7 +26,7 @@ const fooNew = 'foo'; ### `disallowedPrefixes` -If you want a custom list of forbidden prefixes you can set them with `disallowedPrefixes`: +If you want a custom list of disallowed prefixes you can set them with `disallowedPrefixes`: ```js // eslint unicorn/no-keyword-prefix: ["error", {"disallowedPrefixes": ["new", "for"]}] @@ -55,7 +55,7 @@ foo.newFoo = 2; // pass ### `onlyCamelCase` -The default behavior is to check for camel case usage. If you want to forbid the prefix entirely, set `onlyCamelCase` to `false`: +The default behavior is to check for camel case usage. If you want to disallow the prefix entirely, set `onlyCamelCase` to `false`: ```js // eslint unicorn/no-keyword-prefix: ["error", {"onlyCamelCase": true}] diff --git a/docs/rules/no-lonely-if.md b/docs/rules/no-lonely-if.md index 6e3086d02e..cce9f803cf 100644 --- a/docs/rules/no-lonely-if.md +++ b/docs/rules/no-lonely-if.md @@ -7,7 +7,7 @@ 🔧 *This rule is [auto-fixable](https://eslint.org/docs/user-guide/command-line-interface#fixing-problems).* -This rule adds onto the built-in [`no-lonely-if`](https://eslint.org/docs/rules/no-lonely-if) rule, which only forbids `if` statements in `else`, not in `if`. It is recommended to use `unicorn/no-lonely-if` together with the core ESLint `no-lonely-if` rule. +This rule adds onto the built-in [`no-lonely-if`](https://eslint.org/docs/rules/no-lonely-if) rule, which only disallows `if` statements in `else`, not in `if`. It is recommended to use `unicorn/no-lonely-if` together with the core ESLint `no-lonely-if` rule. ## Fail diff --git a/docs/rules/no-useless-undefined.md b/docs/rules/no-useless-undefined.md index 4abb10ba76..4dc3022691 100644 --- a/docs/rules/no-useless-undefined.md +++ b/docs/rules/no-useless-undefined.md @@ -96,7 +96,7 @@ Type: `object` Type: `boolean`\ Default: `true` -Forbid the use of `undefined` at the end of function call arguments. Pass `checkArguments: false` to disable checking them. +Disallow the use of `undefined` at the end of function call arguments. Pass `checkArguments: false` to disable checking them. #### Fail diff --git a/docs/rules/prefer-module.md b/docs/rules/prefer-module.md index c4bf82903a..000af0d657 100644 --- a/docs/rules/prefer-module.md +++ b/docs/rules/prefer-module.md @@ -9,15 +9,15 @@ Prefer using the [JavaScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) format over the legacy CommonJS module format. -1. Forbids `'use strict'` directive. +1. Disallows `'use strict'` directive. JavaScript modules use “Strict Mode” by default. -1. Forbids “Global Return”. +1. Disallows “Global Return”. This is a CommonJS-only feature. -1. Forbids the global variables `__dirname` and `__filename`. +1. Disallows the global variables `__dirname` and `__filename`. They are [not available in JavaScript modules](https://nodejs.org/api/esm.html#esm_no_filename_or_dirname). @@ -45,11 +45,11 @@ Prefer using the [JavaScript module](https://developer.mozilla.org/en-US/docs/We const foo = new URL('foo.js', import.meta.url); ``` -1. Forbids `require(…)`. +1. Disallows `require(…)`. `require(…)` can be replaced by `import …` or `import(…)`. -1. Forbids `exports` and `module.exports`. +1. Disallows `exports` and `module.exports`. `export …` should be used in JavaScript modules. diff --git a/rules/prefer-modern-dom-apis.js b/rules/prefer-modern-dom-apis.js index 633b8572b8..92d85106cb 100644 --- a/rules/prefer-modern-dom-apis.js +++ b/rules/prefer-modern-dom-apis.js @@ -23,7 +23,7 @@ const replaceChildOrInsertBeforeSelector = [ '[callee.object.type="Identifier"]', ].join(''); -const forbiddenMethods = new Map([ +const disallowedMethods = new Map([ ['replaceChild', 'replaceWith'], ['insertBefore', 'before'], ]); @@ -32,7 +32,7 @@ const checkForReplaceChildOrInsertBefore = (context, node) => { const method = node.callee.property.name; const parentNode = node.callee.object.name; const [newChildNode, oldChildNode] = node.arguments.map(({name}) => name); - const preferredMethod = forbiddenMethods.get(method); + const preferredMethod = disallowedMethods.get(method); const fix = isValueNotUsable(node) ? fixer => fixer.replaceText( diff --git a/rules/prefer-query-selector.js b/rules/prefer-query-selector.js index 4ce7ffc532..e3af1729fd 100644 --- a/rules/prefer-query-selector.js +++ b/rules/prefer-query-selector.js @@ -14,7 +14,7 @@ const selector = [ notDomNodeSelector('callee.object'), ].join(''); -const forbiddenIdentifierNames = new Map([ +const disallowedIdentifierNames = new Map([ ['getElementById', 'querySelector'], ['getElementsByClassName', 'querySelectorAll'], ['getElementsByTagName', 'querySelectorAll'], @@ -103,7 +103,7 @@ const fix = (node, identifierName, preferredSelector) => { const create = () => ({ [selector](node) { const method = node.callee.property.name; - const preferredSelector = forbiddenIdentifierNames.get(method); + const preferredSelector = disallowedIdentifierNames.get(method); const problem = { node: node.callee.property,