当前位置: 首页 > news >正文

vue安装stylelint

  • 执行 npm install -D stylelint postcss-html stylelint-config-recommended-vue stylelint-config-standard stylelint-order stylelint-prettier postcss-less stylelint-config-property-sort-order-smacss
    安装依赖,这里是less,sass换成postcss-scssstylelint-config-standard-scss

  • 根目录创建.stylelintrc.json

    {
      "extends": [
        "stylelint-config-standard",
        "stylelint-config-property-sort-order-smacss"
      ],
      "plugins": ["stylelint-order", "stylelint-prettier"],
      "overrides": [
        {
          "files": ["**/*.(css|html|vue)"],
          "customSyntax": "postcss-html"
        },
        {
          "files": ["*.less", "**/*.less"],
          "customSyntax": "postcss-less",
          "extends": [
            "stylelint-config-standard",
            "stylelint-config-recommended-vue"
          ]
        }
      ],
      "rules": {
        "color-function-notation": "legacy"
      }
    }
    

    规则rules按需要自己配,规则配置文档
    如果是sacc,overrides把less换成sass

    {
      "files": ["*.scss", "**/*.scss"],
      "customSyntax": "postcss-scss",
      "extends": [
        "stylelint-config-standard-scss",
        "stylelint-config-recommended-vue/scss"
      ],
      "rule": {
        "scss/percent-placeholder-pattern": null
      }
    }
    
  • 安装stylelint插件
    在这里插入图片描述- Ctrl + Shift + p -> Settings找到用户设置在这里插入图片描述

  • 添加stylelint配置

    "stylelint.validate": ["css", "less", "postcss", "scss", "sass", "vue"],
    "editor.codeActionsOnSave": {
    "source.fixAll.stylelint": true,
    "source.fixAll": true
    },
    // stylelint配置
    "stylelint.enable": true
    

在这里插入图片描述

相关文章:

  • 在 Spring Boot 2.7.x 中引入 Kafka-0.9 的实践
  • 数学之约数个数定理-阶乘约数
  • # 深入理解RNN(一):循环神经网络的核心计算机制
  • Android15 Camera框架中的StatusTracker
  • OpenCV常用函数以及使用场景
  • Qt开发:nativeEvent事件的使用
  • STM32-I2C通信外设
  • 2025最新群智能优化算法:海市蜃楼搜索优化(Mirage Search Optimization, MSO)算法求解23个经典函数测试集,MATLAB
  • TinyWebServer项目笔记——01 线程同步机制封装类
  • 模型微调——模型性能提升方法及注意事项(自用)
  • 【微知】Centos如何迁移到Anolis系统的失败记录?(yum -y install centos2anolis、centos2anolis.py)
  • 正版Windows10/11系统盘制作详细教程
  • 基于单片机及传感器的机器人设计与实现
  • doris:SAP HANA
  • 微信小程序将markdown内容转为pdf并下载
  • VBA 列方向合并单元格,左侧范围大于右侧范围
  • python: DDD+ORM using oracle 21c
  • Ollama本地部署大模型(Mac M1 )
  • 生物电阻抗技术:精准洞察人体营养的“智能窗口”
  • 安固软件上网行为管理软件:提升企业效率与安全的双重保障
  • wordpress不能安装/武汉网络seo公司
  • 企业门户网站建设方案书/企业管理培训班
  • 做网站是什么/合肥百度快照优化排名
  • wordpress qq登录微信登录/seo关键词优化经验技巧
  • 项目设计课题研究高中综合评价/百度搜索引擎优化方式
  • 织梦可以做导航网站/seo最新技巧