]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Upgrade stylelint config (#42223)
authorMark Otto <markd.otto@gmail.com>
Fri, 3 Apr 2026 22:36:10 +0000 (15:36 -0700)
committerGitHub <noreply@github.com>
Fri, 3 Apr 2026 22:36:10 +0000 (15:36 -0700)
* Upgrade stylelint config

* fix

.stylelintrc.json [deleted file]
site/src/content/docs/guides/npm.mdx
stylelint.config.mjs [new file with mode: 0644]

diff --git a/.stylelintrc.json b/.stylelintrc.json
deleted file mode 100644 (file)
index 8335461..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "extends": [
-    "stylelint-config-twbs-bootstrap"
-  ],
-  "plugins": [
-    "stylelint-order"
-  ],
-  "reportInvalidScopeDisables": true,
-  "reportNeedlessDisables": true,
-  "rules": {
-    "selector-class-pattern": [
-      "^([a-z][a-z0-9]*(-[a-z0-9]+)*:)?([a-z][a-z0-9]*)(-[a-z0-9]+)*$",
-      { "message": "Expected class selector \"%s\" to be kebab-case (with optional breakpoint prefix)" }
-    ],
-    "order/order": [
-      [
-        { "type": "at-rule", "name": "use" },
-        { "type": "at-rule", "name": "forward" },
-        "dollar-variables",
-        "custom-properties",
-        "declarations",
-        "rules"
-      ]
-    ]
-  },
-  "overrides": [
-    {
-      "files": "**/*.scss",
-      "rules": {
-        "declaration-property-value-disallowed-list": {
-          "border": "none",
-          "outline": "none"
-        },
-        "function-disallowed-list": [
-          "lighten",
-          "darken"
-        ],
-        "property-disallowed-list": [
-          "border-radius",
-          "border-top-left-radius",
-          "border-top-right-radius",
-          "border-bottom-right-radius",
-          "border-bottom-left-radius",
-          "transition"
-        ],
-        "scss/dollar-variable-default": [
-          true,
-          {
-            "ignore": "local"
-          }
-        ],
-        "scss/selector-no-union-class-name": true
-      }
-    },
-    {
-      "files": "scss/**/*.{test,spec}.scss",
-      "rules": {
-        "scss/dollar-variable-default": null,
-        "declaration-no-important": null
-      }
-    },
-    {
-      "files": "site/**/*.scss",
-      "rules": {
-        "scss/dollar-variable-default": null
-      }
-    },
-    {
-      "files": "site/**/examples/**/*.css",
-      "rules": {
-        "comment-empty-line-before": null,
-        "property-no-vendor-prefix": null,
-        "selector-no-qualifying-type": null,
-        "value-no-vendor-prefix": null
-      }
-    }
-  ]
-}
index e9edabcc238bc2738daffc0127c7ab03e8a71678..12b81d9cec0205f07cadae7d5bc3f4808e706c6b 100644 (file)
@@ -54,7 +54,7 @@ We’ve already created the `my-project` folder and initialized npm. Now we’ll
 
 ```sh
 mkdir {css,scss}
-touch index.html scss/styles.scss postcss.config.js .stylelintrc.json
+touch index.html scss/styles.scss postcss.config.js stylelint.config.mjs
 ```
 
 When you’re done, your project should look like this:
@@ -64,7 +64,7 @@ my-project/
 ├── css/
 ├── scss/
 │   └── styles.scss
-├── .stylelintrc.json
+├── stylelint.config.mjs
 ├── index.html
 ├── package-lock.json
 ├── package.json
@@ -132,11 +132,12 @@ With dependencies installed and our project folder ready for us to start coding,
    }
    ```
 
-4. **Configure `.stylelintrc.json`.** We’re using `stylelint-config-twbs-bootstrap` to keep our Sass linting consistent with Bootstrap’s own code style.
+4. **Configure `stylelint.config.mjs`.** We’re using `stylelint-config-twbs-bootstrap` to keep our Sass linting consistent with Bootstrap’s own code style.
 
-   ```json
-   {
-     "extends": "stylelint-config-twbs-bootstrap"
+   ```js
+   /** @type {import('stylelint').Config} */
+   export default {
+     extends: 'stylelint-config-twbs-bootstrap',
    }
    ```
 
diff --git a/stylelint.config.mjs b/stylelint.config.mjs
new file mode 100644 (file)
index 0000000..7aa3e04
--- /dev/null
@@ -0,0 +1,79 @@
+/** @type {import('stylelint').Config} */
+export default {
+  extends: [
+    'stylelint-config-twbs-bootstrap'
+  ],
+  plugins: [
+    'stylelint-order'
+  ],
+  reportInvalidScopeDisables: true,
+  reportNeedlessDisables: true,
+  rules: {
+    'selector-class-pattern': [
+      '^([a-z][a-z0-9]*(-[a-z0-9]+)*:)?([a-z][a-z0-9]*)(-[a-z0-9]+)*$',
+      { message: 'Expected class selector "%s" to be kebab-case (with optional breakpoint prefix)' }
+    ],
+    'order/order': [
+      [
+        { type: 'at-rule', name: 'use' },
+        { type: 'at-rule', name: 'forward' },
+        'dollar-variables',
+        'custom-properties',
+        'declarations',
+        'rules'
+      ]
+    ]
+  },
+  overrides: [
+    {
+      files: '**/*.scss',
+      rules: {
+        'declaration-property-value-disallowed-list': {
+          border: 'none',
+          outline: 'none'
+        },
+        'function-disallowed-list': [
+          'lighten',
+          'darken'
+        ],
+        'property-disallowed-list': [
+          'border-radius',
+          'border-top-left-radius',
+          'border-top-right-radius',
+          'border-bottom-right-radius',
+          'border-bottom-left-radius',
+          'transition'
+        ],
+        'scss/dollar-variable-default': [
+          true,
+          {
+            ignore: 'local'
+          }
+        ],
+        'scss/selector-no-union-class-name': true
+      }
+    },
+    {
+      files: 'scss/**/*.{test,spec}.scss',
+      rules: {
+        'scss/dollar-variable-default': null,
+        'declaration-no-important': null
+      }
+    },
+    {
+      files: 'site/**/*.scss',
+      rules: {
+        'scss/dollar-variable-default': null
+      }
+    },
+    {
+      files: 'site/**/examples/**/*.css',
+      rules: {
+        'comment-empty-line-before': null,
+        'property-no-vendor-prefix': null,
+        'selector-no-qualifying-type': null,
+        'value-no-vendor-prefix': null
+      }
+    }
+  ]
+}