From be7c484f61fc9f855a10a5d0ca18db104157f302 Mon Sep 17 00:00:00 2001 From: SeanHsieh Date: Sat, 15 Jul 2023 22:51:15 +0800 Subject: [PATCH] chore: update eslint and test and ci --- .eslintrc.js | 13 +- .github/workflows/ci.yml | 29 +- .../bulletins/BulletinCardCollection.vue | 2 +- components/core/buttons/TextButton.vue | 6 +- components/core/footer/FooterHistory.vue | 2 +- components/core/header/nav-bar/NavBar.vue | 4 +- .../core/header/nav-bar/NavBarHamburger.vue | 4 +- components/core/links/LocaleLink.vue | 2 +- components/core/markdown/MarkdownRenderer.vue | 6 +- components/events/RelatedCardCollection.vue | 2 +- jest.config.js | 3 +- nuxt.config.js | 2 + package.json | 20 +- tailwind.config.js | 2 +- yarn.lock | 2062 +++++++++++++++-- 15 files changed, 1991 insertions(+), 168 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e89bf9e03a..4ea7dcd668 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,18 +3,21 @@ module.exports = { env: { browser: true, node: true, + 'jest/globals': true, }, parserOptions: { - parser: 'babel-eslint', + requireConfigFile: false, + parser: '@babel/eslint-parser', }, extends: [ - '@nuxtjs', + '@nuxtjs/eslint-config', 'prettier', - 'prettier/vue', 'plugin:prettier/recommended', 'plugin:nuxt/recommended', ], - plugins: ['prettier'], + plugins: ['prettier', 'jest'], // add your custom rules here - rules: {}, + rules: { + 'vue/multi-word-component-names': 'off', + }, } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8dc1943d5c..2e0e434b46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,30 +17,35 @@ jobs: strategy: matrix: os: [ ubuntu-latest ] - node: [ 14 ] steps: - name: Checkout ๐Ÿ›Ž uses: actions/checkout@master - - name: Setup node env ๐Ÿ— - uses: actions/setup-node@v2.1.2 + - name: โŽ” Setup node ๐Ÿ— + uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node }} + node-version-file: ".nvmrc" + cache: "yarn" + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Cache node_modules ๐Ÿ“ฆ - uses: actions/cache@v2 + - uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-yarn-e- - - name: Install dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป - run: npm ci + - name: Install deps ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป + run: yarn --frozen-lockfile - name: Run linter ๐Ÿ‘€ - run: npm run lint + run: yarn lint - name: Run tests ๐Ÿงช - run: npm run test + run: yarn test diff --git a/components/bulletins/BulletinCardCollection.vue b/components/bulletins/BulletinCardCollection.vue index bae9e808a6..2db7935602 100644 --- a/components/bulletins/BulletinCardCollection.vue +++ b/components/bulletins/BulletinCardCollection.vue @@ -19,9 +19,9 @@