✨ timely update
use bunjs instead of pnpm remove mocha and use bun test import my latest eslint config
This commit is contained in:
parent
1053ccc036
commit
d4d6fa1662
|
|
@ -3,5 +3,5 @@ indent_size = 4
|
|||
indent_style = tab
|
||||
|
||||
[{*.yml, *.yaml}]
|
||||
indent_size = 2
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
|
@ -4,34 +4,33 @@
|
|||
"es2021": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
// "next/core-web-vitals",
|
||||
"eslint:recommended",
|
||||
// "plugin:react/recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
|
||||
"overrides": [],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
// "react",
|
||||
"@typescript-eslint",
|
||||
"simple-import-sort"
|
||||
],
|
||||
"plugins": ["@typescript-eslint", "simple-import-sort"],
|
||||
"rules": {
|
||||
"@typescript-eslint/ban-ts-comment": "off",
|
||||
"@typescript-eslint/ban-types": "warn",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrorsIgnorePattern": "^_"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"no-empty": "warn",
|
||||
"no-empty-function": "off",
|
||||
"no-empty-pattern": "warn",
|
||||
// "react/react-in-jsx-scope": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"simple-import-sort/imports": [
|
||||
"warn",
|
||||
{
|
||||
|
|
|
|||
18
package.json
18
package.json
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"name": "ytmusic-api",
|
||||
"version": "4.4.0",
|
||||
"version": "4.5.0",
|
||||
"description": "YouTube Music API",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"author": "zS1L3NT <zechariahtan144@gmail.com> (http://www.zectan.com)",
|
||||
"author": "zS1L3NT <dev@zectan.com> (http://www.zectan.com)",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
@ -12,14 +12,9 @@
|
|||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "ts-mocha --timeout 30000 src/__tests__/**/*.spec.ts",
|
||||
"docs:dev": "vuepress dev docs",
|
||||
"docs:build": "vuepress build docs",
|
||||
"lint": "eslint src",
|
||||
"lint:fix": "eslint src --fix",
|
||||
"prettier": "prettier src --check",
|
||||
"prettier:fix": "prettier src --write",
|
||||
"clean": "tsc --noEmit && eslint src --fix && prettier src --write"
|
||||
"clean": "tsc --noEmit && eslint src --fix && prettier src --write && rm tsconfig.tsbuildinfo"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
|
|
@ -29,20 +24,15 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/json-schema": "^7.0.11",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@types/node": "^18.11.17",
|
||||
"@types/tough-cookie": "^4.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "latest",
|
||||
"@typescript-eslint/parser": "latest",
|
||||
"@vuepress/plugin-search": "^2.0.0-beta.46",
|
||||
"bun-types": "^1.0.18-1",
|
||||
"eslint": "latest",
|
||||
"eslint-config-prettier": "latest",
|
||||
"eslint-plugin-simple-import-sort": "latest",
|
||||
"mocha": "^10.2.0",
|
||||
"mocha.parallel": "^0.15.6",
|
||||
"prettier": "latest",
|
||||
"ts-mocha": "^10.0.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "latest",
|
||||
"vuepress": "^2.0.0-beta.46"
|
||||
},
|
||||
|
|
|
|||
2855
pnpm-lock.yaml
2855
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
|
@ -1 +0,0 @@
|
|||
declare module "mocha.parallel"
|
||||
|
|
@ -3,9 +3,9 @@ import checkType from "../utils/checkType"
|
|||
import traverseList from "../utils/traverseList"
|
||||
import traverseString from "../utils/traverseString"
|
||||
import AlbumParser from "./AlbumParser"
|
||||
import PlaylistParser from "./PlaylistParser"
|
||||
import SongParser from "./SongParser"
|
||||
import VideoParser from "./VideoParser"
|
||||
import PlaylistParser from "./PlaylistParser";
|
||||
|
||||
export default class ArtistParser {
|
||||
public static parse(data: any, artistId: string): ArtistFull {
|
||||
|
|
@ -46,15 +46,12 @@ export default class ArtistParser {
|
|||
featuredOn:
|
||||
traverseList(data, "musicCarouselShelfRenderer")
|
||||
?.at(3)
|
||||
?.contents.map((item: any) =>
|
||||
PlaylistParser.parseArtistFeaturedOn(item),
|
||||
) ?? [],
|
||||
?.contents.map((item: any) => PlaylistParser.parseArtistFeaturedOn(item)) ??
|
||||
[],
|
||||
similarArtists:
|
||||
traverseList(data, "musicCarouselShelfRenderer")
|
||||
?.at(4)
|
||||
?.contents.map((item: any) =>
|
||||
this.parseSimilarArtists(item),
|
||||
) ?? [],
|
||||
?.contents.map((item: any) => this.parseSimilarArtists(item)) ?? [],
|
||||
},
|
||||
ArtistFull,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { equal } from "assert"
|
||||
import describeParallel from "mocha.parallel"
|
||||
import { afterAll, beforeAll, describe, it } from "bun:test"
|
||||
import { z } from "zod"
|
||||
|
||||
import {
|
||||
|
|
@ -27,10 +27,10 @@ const expect = (data: any, schema: z.Schema) => {
|
|||
}
|
||||
|
||||
const ytmusic = new YTMusic()
|
||||
before(() => ytmusic.initialize())
|
||||
beforeAll(() => ytmusic.initialize())
|
||||
|
||||
queries.forEach(query => {
|
||||
describeParallel("Query: " + query, () => {
|
||||
describe("Query: " + query, () => {
|
||||
it("Search suggestions", async () => {
|
||||
const suggestions = await ytmusic.getSearchSuggestions(query)
|
||||
expect(suggestions, z.array(z.string()))
|
||||
|
|
@ -124,4 +124,4 @@ queries.forEach(query => {
|
|||
})
|
||||
})
|
||||
|
||||
after(() => console.log("Issues:", errors))
|
||||
afterAll(() => console.log("Issues:", errors))
|
||||
|
|
@ -2,16 +2,16 @@
|
|||
"compilerOptions": {
|
||||
/** Transpiler */
|
||||
"target": "esnext",
|
||||
"lib": ["esnext"], // "dom", "dom.iterable", "esnext"
|
||||
"module": "commonjs", // esnext
|
||||
"moduleResolution": "node",
|
||||
"lib": ["esnext"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
|
||||
/** Project */
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"typeRoots": ["./node_modules/@types", "./src/@types"],
|
||||
"types": ["bun-types"],
|
||||
"declaration": true,
|
||||
|
||||
/** Type Checking */
|
||||
|
|
@ -28,16 +28,15 @@
|
|||
"noImplicitOverride": true,
|
||||
"allowUnusedLabels": true,
|
||||
"resolveJsonModule": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
|
||||
/** Other */
|
||||
// "noEmit": true,
|
||||
// "allowJs": true,
|
||||
// "jsx": "react-jsx",
|
||||
// "skipLibCheck": true,
|
||||
// "isolatedModules": true,
|
||||
// "incremental": true
|
||||
"noEmit": true,
|
||||
"allowJs": true,
|
||||
"jsx": "react-jsx",
|
||||
"skipLibCheck": true,
|
||||
"isolatedModules": true,
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["src/__tests__"]
|
||||
"include": ["src", "src/tests"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue