1.0.1 • Published 5 months ago
@meow-double/stylelint v1.0.1
Stylelint config👔
This npm package include stylelint config for your css styles.
✅Support for css rules
✅Support for scss rules
Install
Use this command to set the stylelint configure
npm i -D @meow-double/stylelint
ℹ️INFO
Add the npm package as a dev dependency
How use
Create a file named .stylelintrc in the root of the directory
Specify the extension of your file (js, cjs)
Import the stylelint configuration and export it externally properly
Example of use
For .js files
import { stylelint } from "@meow-double/stylelint";
/** @type {import('stylelint').Config} */
export default stylelint({});
For .cjs files
const {stylelint} = require("@meow-double/stylelint");
/** @type {import('stylelint').Config} */
module.exports = stylelint({});
The stylelint config is a function that returns a finished config. This allows you to customize part of your config to your needs
Transmitted parameters
All arguments are passed as properties of the object
Argument | Available values | Description |
---|---|---|
scss | true | false | Adds a set of rules for scss using stylelint-config-standard-scss |
rules | Object | Allows you to reuse the rules for a config. Supports rules of built-in plugins |
All plugins
"stylelint-config-idiomatic-order": "^10.0.0",
"stylelint-config-standard": "^38.0.0",
"stylelint-config-standard-scss": "^15.0.0"
ℹ️INFO
These dependencies do not need to be installed, they are installed together with the configure
Example
{
scss:true,
rules:{
'selector-attribute-quotes': 'never',
'comment-whitespace-inside': 'always',
}
}
Script
You need to add script on your package.json
For Css
"lint:css": "stylelint \"**/*.css\"",
"lint:css:fix": "stylelint \"**/*.css\" --fix",
For Scss
"lint:css": "stylelint \"**/*.scss\"",
"lint:css:fix": "stylelint \"**/*.scss\" --fix",
For Scss & Css
"lint:css": "stylelint \"**/*.{scss,css}\"",
"lint:css:fix": "stylelint \"**/*.{scss,css}\" --fix",