Skip to content

Commit

Permalink
feat: 🎸 add stylelint
Browse files Browse the repository at this point in the history
add stylelint
  • Loading branch information
lgf-136 committed Sep 27, 2022
1 parent d40bee0 commit 12c97f2
Show file tree
Hide file tree
Showing 11 changed files with 506 additions and 31 deletions.
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"./**/*.{ts,js,tsx,jsx,vue}": [
"eslint --fix",
"git add ."
],
"./**/*.{css,postcss,less,scss,sass,vue,html}": [
"stylelint --fix",
"git add ."
]
}
40 changes: 40 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# .stylelintignore
# 旧的不需打包的样式库
*.min.css

# 其他类型文件
*.js
*.ts
*.jpg
*.png
*.eot
*.ttf
*.woff
*.json
*.jsonc

# 测试和打包目录
**/test/
**/dist/
**/node_modules/
**/dist-ssr
*.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*


# Editor directories and files
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
12 changes: 12 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

module.exports = {
extends: [ './config/stylelint/base.config' ],
rules: {

},
// settings: {},
plugins: [],
overrides: [],
// ignorePatterns: [ 'src/**/*.d.ts' ],
};

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pnpm install -D -w eslint typescript @typescript-eslint/eslint-plugin @typescri
## stylelint

```
pnpm add -D -w stylelint
pnpm add -D -w stylelint stylelint-config-standard stylelint-config-recess-order stylelint-config-standard-scss postcss-html postcss-less postcss-scss
```

## git-cz + husky + commitlint + release log
Expand Down
2 changes: 1 addition & 1 deletion config
5 changes: 4 additions & 1 deletion examples/react/src/App.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
margin: 0 auto;
text-align: center;
}

Expand All @@ -10,9 +10,11 @@
padding: 1.5em;
will-change: filter;
}

.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}

.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
Expand All @@ -21,6 +23,7 @@
from {
transform: rotate(0deg);
}

to {
transform: rotate(360deg);
}
Expand Down
29 changes: 16 additions & 13 deletions examples/react/src/index.css
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
:root {
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
line-height: 24px;
color: rgb(255 255 255 / 87%);
background-color: #242424;

color-scheme: light dark;
font-synthesis: none;
text-rendering: optimizeLegibility;
text-rendering: optimizelegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}

a:hover {
color: #535bf2;
}

body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
margin: 0;
}

h1 {
Expand All @@ -38,19 +37,21 @@ h1 {
}

button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-family: inherit;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
background-color: #1a1a1a;
border: 1px solid transparent;
border-radius: 8px;
transition: border-color 0.25s;
}

button:hover {
border-color: #646cff;
}

button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
Expand All @@ -59,11 +60,13 @@ button:focus-visible {
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
background-color: #fff;
}

a:hover {
color: #747bff;
}

button {
background-color: #f9f9f9;
}
Expand Down
6 changes: 5 additions & 1 deletion examples/react/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"compilerOptions": {
"strict": true,
"forceConsistentCasingInFileNames": true,
"composite": true,
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
"include": [
"vite.config.ts"
]
}
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"commit": "git-cz",
"cz": "git-cz",
"eslint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue",
"eslint:fix": "eslint . --ext .js,.jsx,.ts,.tsx,.vue --fix",
"stylelint": "stylelint ./**/*.{vue,css,less,scss}",
"stylelint:fix": "stylelint ./**/*.{vue,css,less,scss} --fix",
"dev:demo1": "cd projects/vite-project && pnpm install && pnpm dev",
"pull": "git pull && cd .vscode && git pull && cd .. && cd config && git pull && cd ..",
"release": "standard-version"
Expand All @@ -29,8 +32,15 @@
"git-cz": "^4.9.0",
"husky": "^8.0.1",
"lint-staged": "^13.0.3",
"postcss-html": "^1.5.0",
"postcss-less": "^6.0.0",
"postcss-scss": "^4.0.5",
"react": "^18.2.0",
"standard-version": "^9.5.0",
"stylelint": "^14.12.1",
"stylelint-config-recess-order": "^3.0.0",
"stylelint-config-standard": "^28.0.0",
"stylelint-config-standard-scss": "^5.0.0",
"typescript": "^4.6.4",
"vite": "^3.1.3",
"vue-eslint-parser": "^9.1.0"
Expand Down
Loading

0 comments on commit 12c97f2

Please sign in to comment.