@samitouri / QOS-React-2 / commits / a8643e905e

add no-restricted-globals to eslint config (#18076)

Our current lint config assumes a browser environment, which means it won't warn you if you use a variable like `name` without declaring it earlier. This imports the same list as the one used by create-react-app, and enables it against our codebase.

Sunil Pai committed Feb 19, 2020 at 17:14 UTC a8643e905e39f041cda80b498dc06018b27f6554
3 files changed +9
.eslintrc.js
+3
@@ -5,6 +5,8 @@ const {
5 esNextPaths,
6 } = require('./scripts/shared/pathsByLanguageVersion');
7
8 +const restrictedGlobals = require('confusing-browser-globals');
9 +
10 const OFF = 0;
11 const ERROR = 2;
12
@@ -45,6 +47,7 @@ module.exports = {
47 'no-bitwise': OFF,
48 'no-inner-declarations': [ERROR, 'functions'],
49 'no-multi-spaces': ERROR,
50 + 'no-restricted-globals': [ERROR].concat(restrictedGlobals),
51 'no-restricted-syntax': [ERROR, 'WithStatement'],
52 'no-shadow': ERROR,
53 'no-unused-expressions': ERROR,
package.json
+1
@@ -40,6 +40,7 @@
40 "chalk": "^3.0.0",
41 "cli-table": "^0.3.1",
42 "coffee-script": "^1.12.7",
43 + "confusing-browser-globals": "^1.0.9",
44 "core-js": "^3.6.4",
45 "coveralls": "^3.0.9",
46 "create-react-class": "^15.6.3",
yarn.lock
+5
@@ -3871,6 +3871,11 @@ configstore@^4.0.0:
3871 write-file-atomic "^2.0.0"
3872 xdg-basedir "^3.0.0"
3873
3874 +confusing-browser-globals@^1.0.9:
3875 + version "1.0.9"
3876 + resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.9.tgz#72bc13b483c0276801681871d4898516f8f54fdd"
3877 + integrity sha512-KbS1Y0jMtyPgIxjO7ZzMAuUpAKMt1SzCL9fsrKsX6b0zJPTaT0SiSPmewwVZg9UAO83HVIlEhZF84LIjZ0lmAw==
3878 +
3879 connect-history-api-fallback@^1.6.0:
3880 version "1.6.0"
3881 resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc"