本文介绍了Stylelint VScode不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的VScode文本编辑器上使用css linter" stylelint ".我下载并安装了插件,然后将其设置为"css.validate":false.但是我没有在我的CSS文件上显示错误的框.我该怎么办?

I want to use the css linter "stylelint" on my VScode text editor.I downloaded the plugin and install it, then I make the "css.validate": false. But i don't have any box that show me error on my CSS files. What can I do ?

推荐答案

如果您是初次使用stylelint ,则有两个关键步骤可在Visual Studio Code中启用它:

If you're getting started with stylelint for the first time, there are two key steps to enable it in Visual Studio Code:

  1. 关闭Visual Studio Code的内置CSS linter并打开stylelint扩展
  2. 创建一个stylelint 配置对象并启用一些规则
  1. turn off Visual Studio Code's built-in CSS linter and turn on the stylelint extension
  2. create a stylelint configuration object and turn on some rules

您可以按照扩展使用说明来完成第一步,主要是将您的 Visual Studio代码设置更改为:

You can complete the first step by following the extension usage instructions, mainly changing your Visual Studio Code settings to:

{
  "stylelint.enable": true,
  "css.validate": false,
  "scss.validate": false
}

第二步,按照stylelint网站上的配置文档进行操作.我相信最快的入门方法是:

And the second step by following the configuration documentation on the stylelint website. I believe the quickest means to get started is:

  1. 使用npm将推荐的配置安装到您的项目中:

npm install --save-dev stylelint-config-recommended

  1. 创建一个.stylelintrc文件,以在项目的根目录中扩展建议的配置:
  1. Create a .stylelintrc file that extends the recommended config in the root of your project:

{ "extends": "stylelint-config-recommended" }

此配置仅打开可能的错误规则.开始并以此为基础是明智的配置. stylelint内置有超过150条规则.您可以选择打开并配置任意数量的以满足您的棉绒需求.

This config turns on just the possible error rules. It is a sensible config to start with and build upon. There are over 150 rules built-in to stylelint. You can choose to turn on and configure as many, or as few, as you like to meet your linting needs.

这篇关于Stylelint VScode不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 08:08