diff --git a/.eslintrc.json b/.eslintrc.json index 49c61b9..a72bd7d 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -44,6 +44,7 @@ "dot-location": ["error", "property"], "dot-notation": "error", "eqeqeq": "error", + "no-console": "error", "no-empty-function": "error", "no-floating-decimal": "error", "no-implied-eval": "error", diff --git a/.github/workflows/publish_npm.yml b/.github/workflows/publish_npm.yml index dfb642e..e5f9863 100755 --- a/.github/workflows/publish_npm.yml +++ b/.github/workflows/publish_npm.yml @@ -17,6 +17,9 @@ jobs: node-version: 20 registry-url: 'https://registry.npmjs.org' + - name: Lint + run: npm ci && npm run lint + - name: Publish run: npm publish env: diff --git a/lib/main.js b/lib/main.js index 9e68fde..cc6ae89 100755 --- a/lib/main.js +++ b/lib/main.js @@ -50,7 +50,6 @@ const main = (module.exports = async (searchString, options, rt = 3) => { saveCache(parsed, opts); if (opts.type === 'playlist') { const params = CACHE.get('playlistParams'); - console.log(parsed.context); parsed.json = await UTIL.doPost( BASE_API_URL, Object.assign({}, opts.requestOptions, { diff --git a/lib/util.js b/lib/util.js index d6a2359..709795b 100755 --- a/lib/util.js +++ b/lib/util.js @@ -283,10 +283,12 @@ exports.logger = content => { if (!FS.existsSync(dumpDir)) FS.mkdirSync(dumpDir); FS.writeFileSync(file, JSON.stringify(content)); + /* eslint-disable no-console */ console.error('*'.repeat(200)); console.error('Unsupported YouTube Search response.'); console.error(`Please post the the file "${file}" to ${bugsRef} or DisTube support server. Thanks!`); console.error('*'.repeat(200)); + /* eslint-enable no-console */ return null; }; @@ -307,13 +309,16 @@ exports.checkForUpdates = async () => { const buf = Buffer.from(data.content, data.encoding); const pkgFile = JSON.parse(buf.toString('ascii')); if (pkgFile.version !== pkg.version && updateWarnTimes++ < 5) { + // eslint-disable-next-line no-console console.warn( '\x1b[33mWARNING:\x1B[0m @distube/ytsr is out of date! Update with "npm install @distube/ytsr@latest".', ); } } catch (err) { + /* eslint-disable no-console */ console.warn('Error checking for updates:', err.message); console.warn('You can disable this check by setting the `YTSR_NO_UPDATE` env variable.'); + /* eslint-enable no-console */ } }; diff --git a/package.json b/package.json index 321f6cd..fcd159c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@distube/ytsr", - "version": "2.0.3", + "version": "2.0.4", "description": "A ytsr fork. Made for DisTube.js.org.", "keywords": [ "youtube",