Closed unncommon closed 5 years ago
no-undef
is called the linter. It seems YouTube is not defined as a global var. Let me check it today.
Yep, my suggestion is true https://github.com/selectnull/eslint-plugin-googleappsscript/blob/master/lib/index.js
We need to patch this.
Alternatively, you can make your repository branch and update it. Do I do this for you?
@unncommon , you always can specify the eslint config file regards globals
variables https://eslint.org/docs/user-guide/configuring#specifying-globals
Yep, my suggestion is true https://github.com/selectnull/eslint-plugin-googleappsscript/blob/master/lib/index.js
We need to patch this.
Alternatively, you can make your repository branch and update it. Do I do this for you?
Yes, would be great if you can update this! After you update I then need to update the eslint plugin ?
Thank you.
I've changed the .eslintrc file to include Youtube, and the eslint-plugin-googleappsscript/lib/index.js file - but i'm still getting the same error. Is there anything else I need to do ?
index.js file :
/**
var requireIndex = require("requireindex");
module.exports = { environments: { googleappsscript: { globals: { BigNumber: false, Browser: false, CacheService: false, CalendarApp: false, CardService: false, Charts: false, ContactsApp: false, ContentService: false, DocumentApp: false, DriveApp: false, FormApp: false, GmailApp: false, GroupsApp: false, HtmlService: false, Jdbc: false, LanguageApp: false, LinearOptimizationService: false, LockService: false, Logger: false, MailApp: false, Maps: false, MimeType: false, PropertiesService: false, ScriptApp: false, Session: false, SitesApp: false, SlidesApp: false, SpreadsheetApp: false, UrlFetchApp: false, Utilities: false, XmlService: false, YouTube: false } } } };
.eslintrc file :
{ "root": true, "parser": "babel-eslint", "extends": [ "eslint:recommended", "airbnb-base", "plugin:prettier/recommended" ], "plugins": [ "prettier", "googleappsscript" ], "env": { "googleappsscript/googleappsscript": true }, "rules": { "prettier/prettier": "error", "import/prefer-default-export": "error" }, "globals": { "CardService": true, "Gmail": true, "Drive": true, "Slides": true, "OAuth1": true, "OAuth2": true, "YouTube": true, "FirebaseApp": true } }
@unncommon , ok. Try the next changes:
Add to your .eslintrc to globals
part the next line YouTube: false
. Don't edit eslint-plugin-googleappsscript/lib/index.js now.
@unncommon , ok. Try the next changes:
Add to your .eslintrc to
globals
part the next lineYouTube: false
. Don't edit eslint-plugin-googleappsscript/lib/index.js now.
Done - but still getting the same error...
Hm... It's really strange. Could you share an example?
There is my one
/tmp/my-project
user⎇ master> npm run build ✔ 85 16:01:08
> apps-script-starter@3.5.0 build /tmp/my-project
> webpack
webpack is watching the files…
Hash: 34ba247eac234da566e8
Version: webpack 4.35.2
Time: 1292ms
Built at: 07/08/2019 4:04:02 PM
Asset Size Chunks Chunk Names
appsscript.json 1.39 KiB [emitted]
code-3.5.0.js 18.2 KiB 0 [emitted] main
index.html 1.74 KiB [emitted]
Entrypoint main = code-3.5.0.js
[0] ./src/index.js 363 bytes {0} [built]
[1] (webpack)/buildin/global.js 472 bytes {0} [built]
[2] ./src/server/webapp.js 256 bytes {0} [built]
[3] ./src/es6/index.js 268 bytes {0} [built]
[4] ./src/es6/arrow-functions.js 527 bytes {0} [built]
[5] ./src/es6/block-scopes.js 125 bytes {0} [built]
[6] ./src/es6/destructuring.js 403 bytes {0} [built]
[7] ./src/es6/es6-classes.js 3.34 KiB {0} [built]
[8] ./src/es6/es7-classes.js 1.76 KiB {0} [built]
[9] ./src/es6/export-import.js 180 bytes {0} [built]
[10] ./src/es6/filter-map-reduce.js 939 bytes {0} [built]
[11] ./src/es6/let-const.js 164 bytes {0} [built]
[12] ./src/es6/spread-rest-operators.js 1.74 KiB {0} [built]
[13] ./src/es6/template-literals.js 238 bytes {0} [built]
Updated the .eslintrc file to include YouTube in the globals object.
Thank you, its working now.
No longer required since the service is now part of the Eslint GAS plugin. The commit d65eba575d47abfec5190dc3de40c914e25062b9 closes this.
I'm trying to use the YouTube Data API and getting this error when trying to deploy :
error 'YouTube' is not defined no-undef
I have included the following on my manifest file, but to no avail :
{ "userSymbol": "YouTube", "serviceId": "youtube", "version": "v3" }
And the line that throws the error is the following:
const results = YouTube.Search.list('id,snippet', options);
Not sure what else I should be doing, can someone help?
Here's my manifest file :
{ "timeZone": "Europe/London", "dependencies": { "enabledAdvancedServices": [{ "userSymbol": "Gmail", "serviceId": "gmail", "version": "v1" }, { "userSymbol": "Drive", "serviceId": "drive", "version": "v2" }, { "userSymbol": "YouTube", "serviceId": "youtube", "version": "v3" } ], "libraries": [{ "userSymbol": "OAuth1", "libraryId": "1CXDCY5sqT9ph64fFwSzVtXnbjpSfWdRymafDrtIZ7Z_hwysTY7IIhi7s", "version": "16" }, { "userSymbol": "OAuth2", "libraryId": "1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF", "version": "33" } ] }, "webapp": { "access": "ANYONE", "executeAs": "USER_ACCESSING" }, "exceptionLogging": "STACKDRIVER", "oauthScopes": [ "https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/youtube", "https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/script.scriptapp", "https://www.googleapis.com/auth/script.storage", "https://www.googleapis.com/auth/script.webapp.deploy", "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/script.container.ui" ] }