QED_obj
@QED_obj

Как настроить lint-staged?

Помогите настроить lint-staged, нужно перед сохранением комита проверил на ошибки файлы из команды yarn format

{
  "name": "Prod",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "antd": "^5.8.1",
    "babel-loader": "^9.1.2",
    "classnames": "^2.3.2",
    "dayjs": "^1.11.9",
    "http-proxy-middleware": "^1.0.6",
    "postcss-loader": "^7.3.3",
    "react": "^18.2.0",
    "react-animate-height": "^3.2.2",
    "react-device-detect": "^2.2.3",
    "react-dom": "^18.2.0",
    "react-helmet": "^6.1.0",
    "react-hook-form": "^7.45.4",
    "react-inlinesvg": "^3.0.2",
    "react-intl-tel-input": "^8.2.0",
    "react-lazy-load-image-component": "^1.6.0",
    "react-lazyload": "^3.2.0",
    "react-loading-skeleton": "^3.3.1",
    "react-redux": "^8.1.1",
    "react-router-dom": "^6.14.2",
    "react-scripts": "5.0.1",
    "react-uuid": "^2.0.0",
    "redux": "^4.2.1",
    "redux-thunk": "^2.4.2",
    "reselect": "^4.1.8",
    "sass": "^1.63.6",
    "styled-components": "^6.0.2",
    "swiper": "^10.0.0",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "prettier": "prettier --write './**/*.{js,jsx}' --config ./.prettierrc.json",
    "format": "yarn prettier && eslint src --ext .js,.jsx --fix && stylelint \"src/**/*.scss\" --fix",
    "precommit": "lint-staged",
    "lint": "eslint --debug src/",
    "lint:write": "eslint --debug src/ --fix"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged --allow-empty --with-staged",
      "pre-push": "lint-staged --allow-empty --with-staged"
    }
  },
  "lint-staged": {
    "*.{js,jsx}": [
      "yarn format",
      "git add"
    ],
    "*.scss": [
      "yarn format --max-warnings 0",
      "git add"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@babel/plugin-proposal-private-property-in-object": "^7.21.11",
    "@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
    "autoprefixer": "^10.4.14",
    "enzyme": "^3.11.0",
    "enzyme-to-json": "^3.6.2",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-prettier": "^5.0.0",
    "husky": "^8.0.3",
    "lint-staged": "^13.2.3",
    "prettier": "^3.0.1",
    "react-app-rewire-postcss": "^3.0.2",
    "redux-mock-store": "^1.5.4",
    "resolve-url-loader": "^5.0.0",
    "sass-loader": "^13.3.2",
    "stylelint": "^15.9.0",
    "stylelint-config-prettier": "^9.0.5",
    "stylelint-config-recommended-scss": "^12.0.0",
    "stylelint-config-standard": "^33.0.0",
    "stylelint-order": "^6.0.3",
    "stylelint-order-config-standard": "^0.1.3",
    "stylelint-scss": "^5.0.1",
    "stylelint-webpack-plugin": "^4.1.1"
  }
}
  • Вопрос задан
  • 335 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы