How to add a .stylelintrc.json file to the root directory
This article mainly introduces the root directory how to add .stylelintrc.json file related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this root directory how to add .stylelintrc.json file article will have a harvest, let's take a look.
Configuration method:
The stylelint attribute in package.json specifies the rule
Specify in the .stylelintrc file that the file format can be JSON or YAML. You can also suffix the file, like: .stylelintrc.json, .stylelintrc.yaml, .stylelintrc.yml, .stylelintrc.js
Stylelint.config.js file, which exports a configuration object span >
Search in order. If any of the above three ways has a value, the search will end.
Create a new .stylelintrc.json file in the project root and copy the following
Module.exports = {"extends": ["stylelint-config-standard", "stylelint-config-recess-order"], "rules": {"at-rule-no-unknown": [true, {"ignoreAtRules": ["mixin", "extend", "content", "include"]}], "indentation": 4 "no-descending-specificity": null / / prohibits selector with less specificity from rewriting after selector with higher specificity}}
The priority of rules is higher than that of extends. It is recommended that extends be used for unified management.
At-rule-no-unknown is configured separately in the configuration file to enable Stylelint to support mixin, extend, and content syntax in SCSS syntax.
Fragment disable rule
/ * stylelint-disable * / / * (please state the reason for prohibiting detection) Front-end component restriction class name * / .cropper _ topContainer. Img-preview {border: 0 none;} / * stylelint-enable * /
Fix mode
Stylelint-- fix can handle it.
Webstorm can configure external tools to implement autofix and add keymap shortcut keys
This is the end of the article on "how to add a .stylelintrc.json file to the root directory". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to add .stylelintrc.json file to the root directory". If you want to learn more, you are welcome to follow the industry information channel.