|
| 1 | +name: Linters |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +env: |
| 6 | + FORCE_COLOR: 1 |
| 7 | + |
| 8 | +jobs: |
| 9 | + lighthouse: |
| 10 | + name: Lighthouse |
| 11 | + runs-on: ubuntu-22.04 |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + - uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: "18.x" |
| 17 | + - name: Setup Lighthouse |
| 18 | + run: npm install -g @lhci/cli@0.11.x |
| 19 | + - name: Lighthouse Report |
| 20 | + run: lhci autorun --upload.target=temporary-public-storage --collect.staticDistDir=. |
| 21 | + webhint: |
| 22 | + name: Webhint |
| 23 | + runs-on: ubuntu-22.04 |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v3 |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: "18.x" |
| 29 | + - name: Setup Webhint |
| 30 | + run: | |
| 31 | + npm install --save-dev hint@7.x |
| 32 | + [ -f .hintrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.hintrc |
| 33 | + - name: Webhint Report |
| 34 | + run: npx hint . |
| 35 | + stylelint: |
| 36 | + name: Stylelint |
| 37 | + runs-on: ubuntu-22.04 |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + - uses: actions/setup-node@v3 |
| 41 | + with: |
| 42 | + node-version: "18.x" |
| 43 | + - name: Setup Stylelint |
| 44 | + run: | |
| 45 | + npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x |
| 46 | + [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.stylelintrc.json |
| 47 | + - name: Stylelint Report |
| 48 | + run: npx stylelint "**/*.{css,scss}" |
| 49 | + eslint: |
| 50 | + name: ESLint |
| 51 | + runs-on: ubuntu-22.04 |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v3 |
| 54 | + - uses: actions/setup-node@v3 |
| 55 | + with: |
| 56 | + node-version: "18.x" |
| 57 | + - name: Setup ESLint |
| 58 | + run: | |
| 59 | + npm install --save-dev eslint@7.x eslint-config-airbnb-base@14.x eslint-plugin-import@2.x babel-eslint@10.x |
| 60 | + [ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/html-css-js/.eslintrc.json |
| 61 | + - name: ESLint Report |
| 62 | + run: npx eslint . |
| 63 | + nodechecker: |
| 64 | + name: node_modules checker |
| 65 | + runs-on: ubuntu-22.04 |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v3 |
| 68 | + - name: Check node_modules existence |
| 69 | + run: | |
| 70 | + if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi |
0 commit comments