发布于2021-03-13 18:24 阅读(1393) 评论(0) 点赞(14) 收藏(4)
package.json
eslint, prettier,husky,stylelint相关的安装一下
- {
- "scripts": {
- "start": "roadhog server",
- "build": "roadhog build",
- "lint": "eslint --ext .js src test",
- "lint:fix": "eslint --fix --cache --ext .js,.jsx ./src && npm run lint:style",
- "lint:js": "eslint --cache --ext .js,.jsx ./src",
- "lint:prettier": "prettier --check \"src/**/*\" --end-of-line auto",
- "lint:style": "stylelint --fix \"src/**/*.less\" --syntax less",
- "prettier": "prettier -c --write \"src/**/*\"",
- "precommit": "lint-staged",
- "precommit:fix": "npm run lint:fix && npm run prettier && npm run lint:prettier && npm run lint:style"
- },
- "devDependencies": {
- "babel-eslint": "^9.0.0",
- "babel-plugin-dva-hmr": "^0.3.2",
- "eslint": "^4.14.0",
- "eslint-config-umi": "^0.1.1",
- "eslint-plugin-flowtype": "^2.34.1",
- "eslint-plugin-import": "^2.6.0",
- "eslint-plugin-jsx-a11y": "^5.1.1",
- "eslint-plugin-react": "^7.1.0",
- "husky": "^0.12.0",
- "less": "^4.1.1",
- "less-loader": "^8.0.0",
- "lint-staged": "^7.2.2",
- "prettier": "^2.2.1",
- "react-router-dom": "^5.2.0",
- "redbox-react": "^1.4.3",
- "roadhog": "^2.5.0-beta.4",
- "stylelint": "^13.12.0",
- "stylelint-config-css-modules": "^2.2.0",
- "stylelint-config-prettier": "^8.0.2",
- "stylelint-config-rational-order": "^0.1.2",
- "stylelint-config-standard": "^21.0.0",
- "stylelint-declaration-block-no-ignored-properties": "^2.3.0",
- "stylelint-order": "^4.1.0"
- },
- "lint-staged": {
- "**/*.less": "stylelint --syntax less",
- "**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
- "*.{ts,tsx}": "npm run lint-staged:js",
- "*.{js,jsx}": "npm run lint-staged:js"
- }
- }
.stylintrc.js
如果用了umi
- const fabric = require('@umijs/fabric');
-
- module.exports = {
- ...fabric.stylelint,
- };
如果不用umi(其实就是拷贝出来了)
npm install stylelint-config-standard stylelint-config-css-modules stylelint-config-rational-order stylelint-config-prettier stylelint-order stylelint-declaration-block-no-ignored-properties -D
- "use strict";
- module.exports = {
- extends: [
- 'stylelint-config-standard',
- 'stylelint-config-css-modules',
- 'stylelint-config-rational-order',
- 'stylelint-config-prettier',
- ].map(function (key) { return require.resolve(key); }),
- plugins: ['stylelint-order', 'stylelint-declaration-block-no-ignored-properties'].map(function (key) {
- return require.resolve(key);
- }),
- rules: {
- 'no-descending-specificity': null,
- 'plugin/declaration-block-no-ignored-properties': true,
- },
- };
原文链接:https://blog.csdn.net/u012765966/article/details/114661663
作者:程序员的人生
链接:http://www.qianduanheidong.com/blog/article/35835/7dc6bce608ea0d214077/
来源:前端黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 前端黑洞网 All Rights Reserved 版权所有,并保留所有权利。 京ICP备18063182号-3
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!