From 1d0ae2f33c696877f9bafb88652c2d252c3776dc Mon Sep 17 00:00:00 2001 From: Malachi Soord Date: Mon, 2 Sep 2024 23:24:02 +0200 Subject: [PATCH] Lint (#17) --- .github/workflows/lint.yml | 49 ++++++++ .github/workflows/resources.yml | 2 +- README.md | 8 +- index.ts | 6 +- package-lock.json | 196 ++++++++------------------------ package.json | 7 +- resources/connectors.json | 2 +- 7 files changed, 113 insertions(+), 157 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..32b4a18 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,49 @@ +name: Lint +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize] +jobs: + lint-eslint: + name: Run lint:eslint + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run lint:eslint + run: | + npm run lint:eslint + env: + CI: true + lint-prettier: + name: Run lint:prettier + runs-on: ubuntu-latest + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run lint:prettier + run: | + npm run lint:prettier + env: + CI: true diff --git a/.github/workflows/resources.yml b/.github/workflows/resources.yml index f5061ff..6b263dc 100644 --- a/.github/workflows/resources.yml +++ b/.github/workflows/resources.yml @@ -17,7 +17,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "${{ steps.get-node-version.outputs.NODE_VERSION }}" + node-version: '${{ steps.get-node-version.outputs.NODE_VERSION }}' - name: Install dependencies run: npm install diff --git a/README.md b/README.md index ecda5a7..027e513 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@ This repository contains: -- resources (a list of websites) for Web Scrobbler [website][website] -- a script file and other environment files that generate resources +- resources (a list of websites) for Web Scrobbler [website][website] +- a script file and other environment files that generate resources This repository is updated automatically. Please don't submit pull requests here. If you find an issue, or have a question, feel free to create a new issue: -- [in the extension repository][extension-issues], if it's related to the extension -- [in the website repository][website-issues], if it's related to the website +- [in the extension repository][extension-issues], if it's related to the extension +- [in the website repository][website-issues], if it's related to the website [website]: https://web-scrobbler.github.io/ [website-issues]: https://github.com/web-scrobbler/web-scrobbler.github.io/issues diff --git a/index.ts b/index.ts index 480e81f..a74b7a8 100644 --- a/index.ts +++ b/index.ts @@ -16,11 +16,11 @@ const resDir = 'resources'; const moduleFile = 'connectors.ts'; const listFile = `${resDir}/connectors.json`; -async function main(args:string[]) { +async function main(args: string[]) { const latestTag = args.at(-1); if (!latestTag) { - console.error('You must provide version as an argument') + console.error('You must provide version as an argument'); process.exit(1); } @@ -56,7 +56,7 @@ async function dumpConnectors() { const connectors = (await import(`./${moduleFile}`)).default as any[]; const labelArray = connectors.map((entry) => entry.label); - const contents = JSON.stringify(labelArray, null, 2); + const contents = JSON.stringify(labelArray, null, 2) + '\n'; if (!fs.existsSync(resDir)) { mkdir(resDir); diff --git a/package-lock.json b/package-lock.json index 8f5d475..9448053 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,15 +41,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], + "cpu": ["ppc64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "aix" - ], + "os": ["aix"], "engines": { "node": ">=18" } @@ -58,15 +54,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], + "cpu": ["arm"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -75,15 +67,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -92,15 +80,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -109,15 +93,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": ">=18" } @@ -126,15 +106,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": ">=18" } @@ -143,15 +119,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "freebsd" - ], + "os": ["freebsd"], "engines": { "node": ">=18" } @@ -160,15 +132,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "freebsd" - ], + "os": ["freebsd"], "engines": { "node": ">=18" } @@ -177,15 +145,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], + "cpu": ["arm"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -194,15 +158,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -211,15 +171,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], + "cpu": ["ia32"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -228,15 +184,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], + "cpu": ["loong64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -245,15 +197,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], + "cpu": ["mips64el"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -262,15 +210,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], + "cpu": ["ppc64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -279,15 +223,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], + "cpu": ["riscv64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -296,15 +236,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], + "cpu": ["s390x"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -313,15 +249,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -330,15 +262,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "netbsd" - ], + "os": ["netbsd"], "engines": { "node": ">=18" } @@ -347,15 +275,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "openbsd" - ], + "os": ["openbsd"], "engines": { "node": ">=18" } @@ -364,15 +288,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "openbsd" - ], + "os": ["openbsd"], "engines": { "node": ">=18" } @@ -381,15 +301,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "sunos" - ], + "os": ["sunos"], "engines": { "node": ">=18" } @@ -398,15 +314,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -415,15 +327,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], + "cpu": ["ia32"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -432,15 +340,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -2164,9 +2068,7 @@ "hasInstallScript": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } diff --git a/package.json b/package.json index f92bbcb..516ac11 100644 --- a/package.json +++ b/package.json @@ -24,5 +24,10 @@ "eslintConfig": { "extends": "web-scrobbler" }, - "prettier": "prettier-config-web-scrobbler" + "prettier": "prettier-config-web-scrobbler", + "scripts": { + "lint": "eslint .", + "lint:prettier": "prettier --check .", + "format": "prettier --write ." + } } diff --git a/resources/connectors.json b/resources/connectors.json index fe168b6..00a5577 100644 --- a/resources/connectors.json +++ b/resources/connectors.json @@ -384,4 +384,4 @@ "Bollerwagen", "МТС Музыка", "ChirpRadio" -] \ No newline at end of file +]