From 903ca18b75a18921a34c90971313f1f7cf6d85d9 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Tue, 29 Aug 2023 17:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9code=20lint=E7=9A=84=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=97=B6=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/beta-pack.yml | 34 +++ .github/workflows/release.yml | 34 +++ .../renderer-lyric/webpack.config.base.js | 10 +- .../renderer-scripts/webpack.config.base.js | 10 +- build-config/renderer/webpack.config.base.js | 10 +- package-lock.json | 223 ------------------ package.json | 1 - 7 files changed, 83 insertions(+), 239 deletions(-) diff --git a/.github/workflows/beta-pack.yml b/.github/workflows/beta-pack.yml index 375a11463d..b71fc1c072 100644 --- a/.github/workflows/beta-pack.yml +++ b/.github/workflows/beta-pack.yml @@ -6,9 +6,41 @@ on: - beta jobs: + CheckCode: + name: Lint Code + runs-on: ubuntu-latest + steps: + - name: Check out git repository + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Cache file + uses: actions/cache@v3 + with: + path: | + node_modules + $HOME/.cache/electron + $HOME/.cache/electron-builder + $HOME/.npm/_prebuilds + key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build- + + - name: Install Dependencies + run: | + npm ci + + - name: Lint src code + run: npm run lint + Windows: name: Windows runs-on: windows-latest + needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v3 @@ -101,6 +133,7 @@ jobs: Mac: name: Mac runs-on: macos-latest + needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v3 @@ -158,6 +191,7 @@ jobs: Linux: name: Linux runs-on: ubuntu-latest + needs: CheckCode steps: - name: Install package run: sudo apt-get update && sudo apt-get install -y rpm libarchive-tools diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c2cff28947..46970524ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,9 +6,41 @@ on: - master jobs: + CheckCode: + name: Lint Code + runs-on: ubuntu-latest + steps: + - name: Check out git repository + uses: actions/checkout@v3 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Cache file + uses: actions/cache@v3 + with: + path: | + node_modules + $HOME/.cache/electron + $HOME/.cache/electron-builder + $HOME/.npm/_prebuilds + key: ${{ runner.os }}-build-caches-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build- + + - name: Install Dependencies + run: | + npm ci + + - name: Lint src code + run: npm run lint + Windows: name: Windows runs-on: windows-latest + needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v3 @@ -58,6 +90,7 @@ jobs: Mac: name: Mac runs-on: macos-latest + needs: CheckCode steps: - name: Check out git repository uses: actions/checkout@v3 @@ -104,6 +137,7 @@ jobs: Linux: name: Linux runs-on: ubuntu-latest + needs: CheckCode steps: - name: Install package run: sudo apt-get update && sudo apt-get install -y rpm libarchive-tools diff --git a/build-config/renderer-lyric/webpack.config.base.js b/build-config/renderer-lyric/webpack.config.base.js index ccaa86be63..68ad146c1b 100644 --- a/build-config/renderer-lyric/webpack.config.base.js +++ b/build-config/renderer-lyric/webpack.config.base.js @@ -35,11 +35,11 @@ module.exports = { }, module: { rules: [ - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules/, - }, + // { + // test: /\.js$/, + // loader: 'babel-loader', + // exclude: /node_modules/, + // }, { test: /\.tsx?$/, exclude: /node_modules/, diff --git a/build-config/renderer-scripts/webpack.config.base.js b/build-config/renderer-scripts/webpack.config.base.js index 50ad2b1d31..6a83f5cefb 100644 --- a/build-config/renderer-scripts/webpack.config.base.js +++ b/build-config/renderer-scripts/webpack.config.base.js @@ -27,11 +27,11 @@ module.exports = { }, module: { rules: [ - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules/, - }, + // { + // test: /\.js$/, + // loader: 'babel-loader', + // exclude: /node_modules/, + // }, { test: /\.tsx?$/, exclude: /node_modules/, diff --git a/build-config/renderer/webpack.config.base.js b/build-config/renderer/webpack.config.base.js index 7e45bbc926..9d9f6c5528 100644 --- a/build-config/renderer/webpack.config.base.js +++ b/build-config/renderer/webpack.config.base.js @@ -35,11 +35,11 @@ module.exports = { }, module: { rules: [ - { - test: /\.js$/, - loader: 'babel-loader', - exclude: /node_modules/, - }, + // { + // test: /\.js$/, + // loader: 'babel-loader', + // exclude: /node_modules/, + // }, { test: /\.tsx?$/, exclude: /node_modules/, diff --git a/package-lock.json b/package-lock.json index 10b5583f71..b80a16aed0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,7 +50,6 @@ "@types/ws": "8.5.4", "@volar/vue-language-plugin-pug": "^1.6.5", "@vue/language-plugin-pug": "^1.8.8", - "babel-loader": "^9.1.3", "browserslist": "^4.21.10", "chalk": "^4.1.2", "changelog-parser": "^3.0.1", @@ -4548,23 +4547,6 @@ "node": ">=0.8.0" } }, - "node_modules/babel-loader": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", - "dev": true, - "dependencies": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" - }, - "engines": { - "node": ">= 14.15.0" - }, - "peerDependencies": { - "@babel/core": "^7.12.0", - "webpack": ">=5" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", @@ -5612,12 +5594,6 @@ "node": ">= 6" } }, - "node_modules/common-path-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", - "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", - "dev": true - }, "node_modules/compare-version": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", @@ -8535,119 +8511,6 @@ "node": ">= 0.8" } }, - "node_modules/find-cache-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", - "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", - "dev": true, - "dependencies": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "dependencies": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "dependencies": { - "p-locate": "^6.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^1.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "dependencies": { - "p-limit": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - } - }, - "node_modules/find-cache-dir/node_modules/pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", - "dev": true, - "dependencies": { - "find-up": "^6.3.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-cache-dir/node_modules/yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true, - "engines": { - "node": ">=12.20" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -21002,16 +20865,6 @@ } } }, - "babel-loader": { - "version": "9.1.3", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.3.tgz", - "integrity": "sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==", - "dev": true, - "requires": { - "find-cache-dir": "^4.0.0", - "schema-utils": "^4.0.0" - } - }, "babel-plugin-polyfill-corejs2": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", @@ -21816,12 +21669,6 @@ "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "dev": true }, - "common-path-prefix": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/common-path-prefix/-/common-path-prefix-3.0.0.tgz", - "integrity": "sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==", - "dev": true - }, "compare-version": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/compare-version/-/compare-version-0.1.2.tgz", @@ -24039,76 +23886,6 @@ } } }, - "find-cache-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-4.0.0.tgz", - "integrity": "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==", - "dev": true, - "requires": { - "common-path-prefix": "^3.0.0", - "pkg-dir": "^7.0.0" - }, - "dependencies": { - "find-up": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz", - "integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==", - "dev": true, - "requires": { - "locate-path": "^7.1.0", - "path-exists": "^5.0.0" - } - }, - "locate-path": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz", - "integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==", - "dev": true, - "requires": { - "p-locate": "^6.0.0" - } - }, - "p-limit": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", - "integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==", - "dev": true, - "requires": { - "yocto-queue": "^1.0.0" - } - }, - "p-locate": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz", - "integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==", - "dev": true, - "requires": { - "p-limit": "^4.0.0" - } - }, - "path-exists": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz", - "integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==", - "dev": true - }, - "pkg-dir": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-7.0.0.tgz", - "integrity": "sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==", - "dev": true, - "requires": { - "find-up": "^6.3.0" - } - }, - "yocto-queue": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", - "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", - "dev": true - } - } - }, "find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", diff --git a/package.json b/package.json index 64f1ea1360..334cb5741a 100644 --- a/package.json +++ b/package.json @@ -220,7 +220,6 @@ "@types/ws": "8.5.4", "@volar/vue-language-plugin-pug": "^1.6.5", "@vue/language-plugin-pug": "^1.8.8", - "babel-loader": "^9.1.3", "browserslist": "^4.21.10", "chalk": "^4.1.2", "changelog-parser": "^3.0.1",