From dd7446984ba94eb32ae8ab2a1bd1bbe6b2252f44 Mon Sep 17 00:00:00 2001 From: Vivi Date: Sat, 1 Jul 2023 14:46:24 +0200 Subject: [PATCH] feat: add linter in ci --- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ package.json | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..31588c8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,24 @@ +# This is a basic workflow to help you get started with Actionsname: front-linter# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ]# Allows you to run this workflow manually from the Actions tab + workflow_dispatch:# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest# Steps represent a sequence of tasks that will be executed as part of the job + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '16' + - name: install + run: yarn install + - name: ESLint + run: yarn run fix . + - name: Prettier + run: yarn prettier --write . diff --git a/package.json b/package.json index 706ef06..0d371a2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,12 @@ "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", - "lint": "vue-cli-service lint" + "lint": "vue-cli-service lint", + "fix": "yarn format && yarn lint:fix", + "format": "prettier --write 'src/**/*.{js,jsx,ts,tsx}'", + "lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx}'", + "fix:eslint": "eslint src --ext .js,.ts,.jsx,.tsx --fix", + "fix:prettier": "prettier --write ." }, "dependencies": { "axios": "^1.4.0",