Skip to content

Commit

Permalink
fix/stylelint (#20)
Browse files Browse the repository at this point in the history
* chore: use stylelint at root

* fix: stylelint module

* chore: changeset
  • Loading branch information
sushichan044 authored Apr 21, 2024
1 parent d10c727 commit 335a4ab
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 60 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-pianos-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@virtual-live-lab/stylelint-config": patch
---

Fix rules, add docs for installation
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
"@virtual-live-lab/prettier-config": "workspace:^",
"@virtual-live-lab/stylelint-config": "workspace:^",
"@virtual-live-lab/tsconfig": "workspace:^",
"eslint": "^8.57.0",
"prettier": "^3.2.5",
"stylelint": "^16.3.1",
"typescript": "^5.4.5"
},
"engines": {
Expand Down
56 changes: 56 additions & 0 deletions packages/stylelint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# @virtual-live-lab/stylelint-config

![NPM Version](https://img.shields.io/npm/v/%40virtual-live-lab%2Fstylelint-config)

Stylelint configuration for Virtual Live Lab.

## Installation

### Use for css

```bash
npm install stylelint \
@virtual-live-lab/stylelint-config \
@double-great/stylelint-a11y \
stylelint-declaration-block-no-ignored-properties \
stylelint-value-no-unknown-custom-properties \
stylelint-config-recommended \
stylelint-config-standard \
stylelint-config-recess-order \
--save-dev
```

### Use for scss

```bash
npm install stylelint \
@virtual-live-lab/stylelint-config \
@double-great/stylelint-a11y \
stylelint-declaration-block-no-ignored-properties \
stylelint-value-no-unknown-custom-properties \
stylelint-config-standard \
stylelint-config-standard-scss \
stylelint-config-sass-guidelines \
stylelint-config-recess-order \
--save-dev
```

### Use for Astro

```bash
npm install stylelint \
@virtual-live-lab/stylelint-config \
@double-great/stylelint-a11y \
stylelint-declaration-block-no-ignored-properties \
stylelint-value-no-unknown-custom-properties \
stylelint-config-recommended \
stylelint-config-standard \
stylelint-config-recess-order \
stylelint-config-html \
--save-dev
```

## License

[MIT](https://choosealicense.com/licenses/mit/)
13 changes: 12 additions & 1 deletion packages/stylelint-config/src/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ import type { Config } from "stylelint"
import { baseConfig } from "./base"
import { astroExtend } from "./extend"

const { rules: baseRules, ...base } = baseConfig

const astroConfig: Config = {
...baseConfig,
...base,
extends: astroExtend,
rules: {
...baseRules,
"at-rule-no-unknown": [
true,
{
ignoreAtRules: ["tailwind"],
},
],
},
}

export default astroConfig
13 changes: 12 additions & 1 deletion packages/stylelint-config/src/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,20 @@ import type { Config } from "stylelint"
import { baseConfig } from "./base"
import { cssExtend } from "./extend"

const { rules: baseRules, ...base } = baseConfig

const cssConfig: Config = {
...baseConfig,
...base,
extends: cssExtend,
rules: {
...baseRules,
"at-rule-no-unknown": [
true,
{
ignoreAtRules: ["tailwind"],
},
],
},
}

export default cssConfig
10 changes: 4 additions & 6 deletions packages/stylelint-config/src/extend.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
const astroExtend = [
"stylelint-config-recommended",
"stylelint-config-standard",
"stylelint-config-recess-order",
"stylelint-config-html/html",
"stylelint-config-html/astro",
]

const cssExtend = [
"stylelint-config-recommended",
"stylelint-config-recess-order",
]
const cssExtend = ["stylelint-config-standard", "stylelint-config-recess-order"]

const scssExtend = [
"stylelint-config-recommended-scss",
"stylelint-config-standard-scss",
"stylelint-config-sass-guidelines",
"stylelint-config-recess-order",
]

Expand Down
19 changes: 18 additions & 1 deletion packages/stylelint-config/src/scss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,26 @@ import type { Config } from "stylelint"
import { baseConfig } from "./base"
import { scssExtend } from "./extend"

const { rules: baseRules, ...base } = baseConfig

const scssConfig: Config = {
...baseConfig,
...base,
extends: scssExtend,
rules: {
...baseRules,
"at-rule-no-unknown": [
true,
{
ignoreAtRules: ["tailwind"],
},
],
"scss/at-rule-no-unknown": [
true,
{
ignoreAtRules: ["tailwind"],
},
],
},
}

export default scssConfig
Loading

0 comments on commit 335a4ab

Please sign in to comment.