Provide custom messages for the no-restricted-globals
ESLint rule, and refactor the .eslintrc
files (PR 9868 follow-up)
Without providing useful (custom) error messages for the `no-restricted-globals` rule, see https://eslint.org/docs/rules/no-restricted-globals, it's quite likely that the rule will be incorrectly disabled rather than the required globals being imported as intended. To reduced duplication of the `no-restricted-globals` rule in multiple `.eslintrc` files, it's instead moved to the top-level `.eslintrc` file and disabled as needed on a folder/file basis outside of `/src` and `/web`.
This commit is contained in:
parent
1aaeaf3338
commit
36b683ca55
15
.eslintrc
15
.eslintrc
@ -100,7 +100,20 @@
|
||||
"no-catch-shadow": "error",
|
||||
"no-delete-var": "error",
|
||||
"no-label-var": "error",
|
||||
"no-restricted-globals": "off",
|
||||
"no-restricted-globals": ["error",
|
||||
{
|
||||
"name": "ReadableStream",
|
||||
"message": "Import it from `src/shared/util.js` or `pdfjsLib` instead; outside of the `/src` and `/web` folders, the rule may be disabled as needed. ",
|
||||
},
|
||||
{
|
||||
"name": "URL",
|
||||
"message": "Import it from `src/shared/util.js` or `pdfjsLib` instead; outside of the `/src` and `/web` folders, the rule may be disabled as needed. ",
|
||||
},
|
||||
{
|
||||
"name": "WritableStream",
|
||||
"message": "Import it from `src/shared/util.js` or `pdfjsLib` instead; outside of the `/src` and `/web` folders, the rule may be disabled as needed. ",
|
||||
},
|
||||
],
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-shadow": "off",
|
||||
"no-undef-init": "error",
|
||||
|
9
extensions/.eslintrc
Normal file
9
extensions/.eslintrc
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": [
|
||||
../.eslintrc
|
||||
],
|
||||
|
||||
"rules": {
|
||||
"no-restricted-globals": "off",
|
||||
},
|
||||
}
|
2
external/.eslintrc
vendored
2
external/.eslintrc
vendored
@ -9,7 +9,7 @@
|
||||
|
||||
"rules": {
|
||||
"mozilla/use-includes-instead-of-indexOf": "off",
|
||||
|
||||
"object-shorthand": "off",
|
||||
"no-restricted-globals": "off",
|
||||
},
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
../.eslintrc
|
||||
],
|
||||
|
||||
"rules": {
|
||||
// Variables
|
||||
"no-restricted-globals": ["error",
|
||||
"ReadableStream",
|
||||
"URL",
|
||||
"WritableStream",
|
||||
],
|
||||
},
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/* eslint-disable no-restricted-globals */
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -7,4 +7,8 @@
|
||||
"node": true,
|
||||
"jasmine": true,
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"no-restricted-globals": "off",
|
||||
},
|
||||
}
|
||||
|
@ -4,13 +4,6 @@
|
||||
],
|
||||
|
||||
"rules": {
|
||||
// Variables
|
||||
"no-restricted-globals": ["error",
|
||||
"ReadableStream",
|
||||
"URL",
|
||||
"WritableStream",
|
||||
],
|
||||
|
||||
// ECMAScript 6
|
||||
"no-var": "error",
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user