Questions tagged [stylelint]

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

Links

284 questions
9
votes
3 answers

Can I stop stylelint extension from validating JavaScript file?

Good day, In above picture, stylelint prompt a CSS error in a JS file. Is there a way to stop stylelint from validating javascript file, I coundn't find such option in their official configuration guide. Thanks a lot.
Paris Qian Sen
  • 1,020
  • 10
  • 21
9
votes
1 answer

Restrict stylelint to only css and scss files

I'm trying to configure stylelint to only lint my CSS and/or SCSS files. I'm extending stylelint-config-recommended but by default it seems to be processing loads of other files as well as the .css and .scss ones I want to lint. Examples of files I…
goofballLogic
  • 37,883
  • 8
  • 44
  • 62
7
votes
2 answers

stylelint gives error "Class extends value undefined is not a constructor or null" when introducing stylelint-config-standard-scss

I'm at at a bit of a loss today. I wanted to add Stylelint to my Angular project, so I ran npm install stylelint stylelint-config-standard --save-dev to install stylelint and the standard config plug in. I then created a .stylelintrc file and added…
NewToAngular
  • 975
  • 2
  • 13
  • 23
7
votes
0 answers

How to get warnings on undefined CSS variables

Trying to use CSS variables for the first time. Doing it in a react (create-react-app) application, and works great. Only issue is that there's no warnings if I mistype a variable name or just simply forget to define it. Is there a way to, for…
Svish
  • 152,914
  • 173
  • 462
  • 620
7
votes
2 answers

Angualar2 & Stylelint: Unexpected unknown pseudo-class selector ":host"

How can I teach Stylelint Angular's selector ":host" ? E.g. Angular2-Seed by MGechev shows in its build-process ":host" as error: src/client/app/+home/home.component.css 1:1 ‼ Unexpected unknown pseudo-class selector ":host"…
user2227400
6
votes
2 answers

Running stylelint over custom styled-components template string

On a project we have custom templates string to abstract styled-components functions. For example, we have templates string for the media-queries that look like this one: // Definition const for1080p = (...args) => css` @media (min-height: 1080px)…
tzi
  • 8,719
  • 2
  • 25
  • 45
6
votes
1 answer

Supress Lint Warnings : StyleLint SCSS

I new to linting in scss file, I have a angular project with following scss file p { margin-left: 10px; margin-top: 9px; } ::ng-deep .expandButton { margin: 10px; color: teal; border: none; background:…
NewBie
  • 123
  • 1
  • 4
6
votes
1 answer

How to use VSCode Prettier 3 formatting with stylelint

To be honest I can't understand the documentation or i miss something. It drives me crazy Steps that i did: Installed VSCode Installed Prettier plugin Opened simply project with couple files (html, css) Installed stylelint with npm install…
kanlukasz
  • 1,103
  • 19
  • 34
6
votes
0 answers

How to solve `Unknown word (CssSyntaxError)` of a variable name in `styled-jsx` (stylelint)

I use Next.js with styled-jsx together with stylelint and everything goes well until when I start to use variables in styled-jsx because stylelint throw stylelint(CssSyntaxError) on those variables. For example const Button = ({ color }) => ( <> …
Lpaydat
  • 406
  • 5
  • 8
6
votes
1 answer

Get stylelint fix to work with styled-components in VSCode

Anyone know of any plugin or any way of getting VSCode stylelint autofix when using styled-components?
Fjandin
  • 99
  • 1
  • 5
6
votes
2 answers

Stylelint failing silently as npm script

I'm setting up stylelint for a project, everything works as expected when run from the cli: $ stylelint 'css/**/*.css' --fix css/style.css 20:18 × Expected newline after ":" with a multi-line declaration…
Vinnie James
  • 5,763
  • 6
  • 43
  • 52
6
votes
3 answers

VS Code style-lint ignore directories

Is it possible to ignore my CSS path, beacuse I only use stylelint for SCSS validation? e.g. - I have the following structure: assets/ css/ scss/ How can I disable the css/ folder from being indexed, trough the settings.json file of…
Tanasos
  • 3,928
  • 4
  • 33
  • 63
6
votes
2 answers

How to make to lint BEM-style using stylelint and stylelint-selector-bem-pattern?

I'm trying to lint BEM-style using stylelint and stylelint-selector-bem-pattern plugin but can't get it work. My config is the following: node: 5.11.0 gulp-stylelint: ^2.0.2 stylelint-selector-bem-pattern: ^0.2.3 .stylelintrc { "plugins": [ …
alienlebarge
  • 3,008
  • 5
  • 24
  • 26
5
votes
3 answers

Stylelint wont mark errors in VSCode

VScode doesn't show me any stylint errors. package.json: ... "postcss": "^8.4.12", "postcss-scss": "^4.0.3", "stylelint": "^14.7.1", "stylelint-config-sass-guidelines": "^9.0.1", .stylelintrc.json: { "extends":…
EKnot
  • 151
  • 1
  • 9
5
votes
0 answers

How to run "stylelint --fix" with husky and lint-staged without blocking the commit

I'm using husky and lint-staged to run "stylelint --fix" on my sass files with this configuration "husky": { "hooks": { "pre-commit": "lint-staged", "post-commit": "git update-index --again" } }, "lint-staged": { …
1
2
3
18 19