@sonsu-lee/stylelint-config 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -3
- package/dist/index.mjs +7 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @sonsu-lee/stylelint-config
|
|
2
2
|
|
|
3
|
-
Shared Stylelint config for CSS, CSS Modules,
|
|
3
|
+
Shared Stylelint config for CSS, CSS Modules, Tailwind CSS v4, and Astro components. Use oxfmt, and Prettier for Astro files, for formatting.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ In `stylelint.config.mjs`:
|
|
|
14
14
|
export default { extends: ['@sonsu-lee/stylelint-config'] };
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Run `pnpm exec stylelint '**/*.css'`.
|
|
17
|
+
Run `pnpm exec stylelint '**/*.{css,astro}'`.
|
|
18
18
|
|
|
19
19
|
## What it catches
|
|
20
20
|
|
|
@@ -22,6 +22,14 @@ Run `pnpm exec stylelint '**/*.css'`.
|
|
|
22
22
|
- A later `margin: 0` resets an earlier `margin-top: 8px` in the same block. Stylelint reports the shorthand override.
|
|
23
23
|
- A misspelled `@tailwnd` is reported, while Tailwind CSS v4 directives such as `@theme` and `@apply` are allowed.
|
|
24
24
|
|
|
25
|
+
## Astro
|
|
26
|
+
|
|
27
|
+
`.astro` files are linted through `stylelint-config-html/astro`, which parses the `<style>` block with `postcss-html`. The preset installs `postcss-html`; include `.astro` in the glob:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm exec stylelint '**/*.{css,astro}'
|
|
31
|
+
```
|
|
32
|
+
|
|
25
33
|
## Tailwind CSS v4
|
|
26
34
|
|
|
27
35
|
- Nested selectors and media queries are allowed inside `@utility` and `@custom-variant`. A top-level `&` is still reported.
|
|
@@ -31,8 +39,16 @@ Run `pnpm exec stylelint '**/*.css'`.
|
|
|
31
39
|
|
|
32
40
|
## CSS Modules
|
|
33
41
|
|
|
34
|
-
The preset allows `:global`, `:local`, `:export`, `:import()`, `composes`, and `@value`
|
|
42
|
+
The preset allows `:global`, `:local`, `:export`, `:import()`, `composes`, and `@value` in `*.module.css`. Of these, only `:global` is also allowed in `*.astro` files. Properties in `:export` and `:import()` blocks may be arbitrary token names. If a token name is also a CSS property, Stylelint still validates its value against that property's CSS syntax.
|
|
35
43
|
|
|
36
44
|
Stylelint does not substitute local or imported `@value` tokens when it validates CSS declarations. For example, `@value accent: #246` is allowed, but `color: accent` is reported by `declaration-property-value-no-unknown`. The rule stays on so it can still catch typos in CSS values.
|
|
37
45
|
|
|
38
46
|
The preset extends `stylelint-config-recommended`. It does not configure property ordering or support SCSS.
|
|
47
|
+
|
|
48
|
+
## AI agents
|
|
49
|
+
|
|
50
|
+
The setup skill, which covers this package too, ships with `@sonsu-lee/oxlint-config`. Its README has the prompt.
|
|
51
|
+
|
|
52
|
+
## Related
|
|
53
|
+
|
|
54
|
+
See the [architecture guide](../../ARCHITECTURE.md) for how the packages fit together.
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
// src/index.ts
|
|
3
|
+
const postcssHtml = createRequire(import.meta.url).resolve("postcss-html");
|
|
2
4
|
const tailwindAtRules = [
|
|
3
5
|
"theme",
|
|
4
6
|
"source",
|
|
@@ -12,7 +14,7 @@ const tailwindAtRules = [
|
|
|
12
14
|
];
|
|
13
15
|
const tailwindNestingAtRules = ["utility", "custom-variant"];
|
|
14
16
|
const config = {
|
|
15
|
-
extends: ["stylelint-config-recommended"],
|
|
17
|
+
extends: ["stylelint-config-recommended", "stylelint-config-html/astro"],
|
|
16
18
|
rules: {
|
|
17
19
|
"at-rule-prelude-no-invalid": [true, { ignoreAtRules: [
|
|
18
20
|
"media",
|
|
@@ -40,6 +42,10 @@ const config = {
|
|
|
40
42
|
}],
|
|
41
43
|
"at-rule-no-unknown": [true, { ignoreAtRules: [...tailwindAtRules, "value"] }]
|
|
42
44
|
}
|
|
45
|
+
}, {
|
|
46
|
+
files: ["*.astro", "**/*.astro"],
|
|
47
|
+
customSyntax: postcssHtml,
|
|
48
|
+
rules: { "selector-pseudo-class-no-unknown": [true, { ignorePseudoClasses: ["global"] }] }
|
|
43
49
|
}]
|
|
44
50
|
};
|
|
45
51
|
export { config as default };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonsu-lee/stylelint-config",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Stylelint preset for CSS, CSS Modules,
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Stylelint preset for CSS, CSS Modules, Tailwind CSS v4, and Astro components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -22,11 +22,13 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"postcss-html": "2.0.1",
|
|
26
|
+
"stylelint-config-html": "2.0.0",
|
|
25
27
|
"stylelint-config-recommended": "19.1.0"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
|
-
"@sonsu-lee/oxlint-config": "^0.
|
|
29
|
-
"@types/node": "
|
|
30
|
+
"@sonsu-lee/oxlint-config": "^0.3.0",
|
|
31
|
+
"@types/node": "26.6.11",
|
|
30
32
|
"oxlint": "1.90.0",
|
|
31
33
|
"oxlint-tsgolint": "7.0.2005",
|
|
32
34
|
"stylelint": "18.1.0",
|