Skip to content

Docs: Add linters usage commands #91

Docs: Add linters usage commands

Docs: Add linters usage commands #91

Workflow file for this run

name: Linters
on:
push:
env:
FORCE_COLOR: 1
jobs:
eslint:
name: ESLint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18.x"
- name: Setup ESLint
run: |
npm install --save-dev eslint@7 eslint-config-airbnb@18 eslint-plugin-import@2 eslint-plugin-jsx-a11y@6 eslint-plugin-react@7 eslint-plugin-react-hooks@4 @babel/eslint-parser@7 @babel/core@7 @babel/plugin-syntax-jsx@7 @babel/preset-env@7 @babel/preset-react@7
[ -f .eslintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/react-redux/.eslintrc.json
[ -f .babelrc ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/react-redux/.babelrc
- name: ESLint Report
run: npx eslint "**/*.{ts,tsx}"
stylelint:
name: Stylelint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18.x"
- name: Setup Stylelint
run: |
npm install --save-dev stylelint@13 stylelint-scss@3 stylelint-config-standard@21 stylelint-csstree-validator@1
[ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/react-redux/.stylelintrc.json
- name: Stylelint Report
run: npx stylelint "**/*.{css,scss}"
nodechecker:
name: node_modules checker
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Check node_modules existence
run: |
if [ -d "node_modules/" ] || [ -f "yarn.lock" ]; then
echo -e "\e[1;31mThe node_modules/ folder or yarn.lock file was pushed to the repo. Please remove them from the GitHub repository and try again."
echo -e "\e[1;32mYou can set up a .gitignore file with these files included to prevent this from happening in the future."
exit 1
fi