0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00
posthog/.stylelintrc.js
Michael Matloka 74c0309735
test(frontend): Add stylelint (#18627)
* test(frontend): Add stylelint

* Remove ordering from the first step

* Further specify a few rules

* Fix a bunch of simple issues

* Add stylelint to pre-commit hooks and CI

* Remove orphaned package-lock.json

* Update UI snapshots for `webkit` (2)

* Update UI snapshots for `webkit` (2)

* Retain `currentColor`

* Revert media queries change, and enforce modern colors

* Add TODOs to the config

* Fix a few more colors

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-15 15:11:27 +01:00

49 lines
2.1 KiB
JavaScript

module.exports = {
extends: 'stylelint-config-standard-scss', // TODO: Enable separately, as the diff will be significant
// TODO: Enable separately, as the diff will be significant "plugins": ["stylelint-order"],
rules: {
'no-descending-specificity': null,
'number-max-precision': 5,
'value-keyword-case': [
'lower',
{
// CSS Color Module Level 3 says currentColor, Level 4 candidate says currentcolor
// Sticking to Level 3 for now
camelCaseSvgKeywords: true,
},
],
// Sadly Safari only started supporting the range syntax of media queries in 2023, so let's switch to that
// ('context' value) in 2024, once support is better https://caniuse.com/?search=range%20context
'media-feature-range-notation': 'prefix',
'selector-class-pattern': [
'^[A-Za-z0-9_-]+(__[A-Za-z0-9_-]+)?(--[A-Za-z0-9-]+)?$',
{
message: 'Expected class selector to match Block__Element--Modifier or plain snake-case',
},
],
'selector-id-pattern': [
'^[A-Za-z0-9_-]+(__[A-Za-z0-9_-]+)?(--[A-Za-z0-9_-]+)?$',
{
message: 'Expected id selector to match Block__Element--Modifier or plain kebak-case',
},
],
'keyframes-name-pattern': [
'^[A-Za-z0-9_-]+__[A-Za-z0-9_-]+$',
{
message: 'Expected keyframe name to match Block__Animation',
},
],
'scss/dollar-variable-pattern': [
'^[A-Za-z_]+[A-Za-z0-9_-]+$',
{
message: 'Expected variable to match kebab-case or snake_case',
},
],
'scss/operator-no-newline-after': null, // Doesn't always play well with prettier
'scss/at-extend-no-missing-placeholder': null,
'scss/comment-no-empty': null,
// "order/order": ["dollar-variables", "custom-properties", "declarations", "rules", "at-rules"],
// "order/properties-order": ["width", "height"],
},
}