Questions tagged [stylelint]

A modern CSS linter that helps you enforce consistent conventions and avoid errors in your stylesheets.

Links

284 questions
4
votes
1 answer

Stylelint rule to enforce selector and attribute on same line

Is there a stylelint rule that can enforce a selector and attribute to be on the same line if there is only one attribute. For example, this would error: .foo{ color: #111; } Because we want it to look like this: .foo{ color: #111; } Note, if…
SeanPlusPlus
  • 8,663
  • 18
  • 59
  • 84
4
votes
1 answer

While committing get error by Eslint in css

I'm getting error while committing the code on GIT. I'm setting with ESLINT and Stylelint. I have written simple css but I'm getting error. In the first line and first column getting issue 2:1 error Parsing error: Unexpected token 1 | /* Form…
vijayaganth
  • 179
  • 2
  • 14
4
votes
2 answers

Stylelint error in PhpStorm IDE : no configuration provided

I cannot make stylelint to work in PhpStorm "C:\Program Files\nodejs\node.exe" "K:/dev/npm packages/node_modules/stylelint/bin/stylelint.js" -f json --stdin-filename…
Matoeil
  • 6,851
  • 11
  • 54
  • 77
4
votes
1 answer

Regex for stylelint selector-class-pattern rule

I'm trying to figure out the correct regex expression for the selector-class-pattern's I want to allow with stylelint https://stylelint.io/user-guide/rules/selector-class-pattern/ I would only like to allow lowercase letters and numbers seperated…
Holly
  • 7,462
  • 23
  • 86
  • 140
4
votes
1 answer

How to specify a format or pattern for SCSS variable names using stylelint?

I use postcss-scss with stylelint on my .scss files and I'm trying to figure out how to enforce a rule so that all my variables follow the same naming convention throughout my project. Is there a way to specify a format or pattern (i.e. a regex) for…
Arnaud Valle
  • 1,673
  • 1
  • 16
  • 25
3
votes
1 answer

How to allow // comments in scss within Stylelint (Unknown Word)

I'm new to Stylelint. I tried to understand docs and searched GitHub, but all explanations are full of double negatives and I'm confused! The problem is that when I use // for comments, it throws Unknown word…
Shahriar
  • 1,855
  • 2
  • 21
  • 45
3
votes
1 answer

How config Stylelint in vue3 app(vscode) to lint on save

I want to lint my scss files and scss scope in .vue components. my config in stylelint.config: module.exports = { extends: [ 'stylelint-config-standard', 'stylelint-config-recess-order', 'stylelint-config-prettier', …
Ehsan
  • 766
  • 10
  • 17
3
votes
4 answers

Why the stylelint vscode extension is not working on my computer?

I follow the guide to install stylelint vscode extension, but it does not work on my computer. I'm pretty sure that I follow all the necessary steps. Install Extensions. Disable the built-in linters in User setting. Use npm to install stylelint and…
hustnzj
  • 525
  • 6
  • 13
3
votes
0 answers

Stylelint error - Leading decorators must be attached to a class declaration

Stylelint gives me this error when in iconfont.css, I'm importing it like this. How can i make it work?
ZowWeb
  • 69
  • 7
3
votes
0 answers

Use stylelint to check if vendor prefixes exist

I am looking for a way to prevent a Webpack/SCSS/Postcss/CSS pipeline to create css files without vendor prefixes. We use autoprefixer to apply vendor prefixes. In the past this build had been accidently disabled and the IE 11 build was broken. I…
madflow
  • 7,718
  • 3
  • 39
  • 54
3
votes
1 answer

How to RegEx match double underscore, but not single ( __ not _)

I'm working on a stylelint rule for modified BEM, which is essentially saying that a single underscore is not allowed, but a double underscore is. match case: foo__bar non-match cases: foo_bar foo_bar__baz I would (ideally) like not just a…
Dan Green-Leipciger
  • 3,776
  • 1
  • 19
  • 29
3
votes
1 answer

How to disable stylelint for all non-string values

Is it possible to turn off stylelint linting in interpolations globally with the styled-components processor enabled? My eslint config should apply for this cases and I don't want my stylelint config to interfere with it. Are there any ways to…
user5520186
3
votes
1 answer

config stylelint file in Nuxt js project

I'm new using Nuxt js therefore same with nuxt.config.js file . I'm trying to get how can I set stylelint file on my Nuxt js project and run it everytime I press save, so the stylelint rules will be apply it. I mean same behaviour like with…
Kaiser91
  • 333
  • 6
  • 17
3
votes
1 answer

Is there a rule to prevent empty lines at the beginning of the block?

Is there a stylelint rule to obtain the following? I've read the documentation but I wasn't unable to find one /* bad */ a { color: pink; } /* good */ a { color: pink; }
tagliala
  • 169
  • 1
  • 11
3
votes
2 answers

stylelint rule blacklist specific selector

This is regarding stylelint. I am looking for a solution to blacklist use of specific selectors like html[dir="rtl"] { //some css } There is a rule to block specific property Link. But there is no rule to block use of particular selector. Is…
ankitd
  • 1,967
  • 3
  • 26
  • 44