Skip to content

Commit f333d31

Browse files
authored
chore: update ESLint configuration to use better-tailwindcss plugin (#13)
1 parent 61acfee commit f333d31

File tree

12 files changed

+2410
-2141
lines changed

12 files changed

+2410
-2141
lines changed

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm lint-staged

app/[lang]/[[...mdxPath]]/page.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { Metadata } from 'next'
22
import { generateStaticParamsFor, importPage } from 'nextra/pages'
3-
import FeedbackMessage from '@/components/feedback-message'
43
import { useMDXComponents } from '@/mdx-components'
54

65
export const generateStaticParams = generateStaticParamsFor('mdxPath')
@@ -29,17 +28,6 @@ export default async function Page(props: PageProps) {
2928
<>
3029
<Wrapper toc={toc} metadata={metadata}>
3130
<MDXContent {...props} params={params} />
32-
33-
<footer className="pt-10">
34-
<hr
35-
className={`
36-
border-gray-200
37-
dark:border-gray-600
38-
`}
39-
/>
40-
41-
<FeedbackMessage />
42-
</footer>
4331
</Wrapper>
4432
</>
4533
)

commitlint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default {
2+
extends: ['@commitlint/config-conventional'],
3+
}

components/feedback-message.tsx

Lines changed: 0 additions & 44 deletions
This file was deleted.

components/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ export function Preview(props: IPreviewProps) {
5555
</div>
5656
</header>
5757

58-
<div ref={containerRef} className="univer-flex-1 univer-overflow-hidden">
59-
<div ref={ref} className="rounded-b-2xl-lg h-[480px] overflow-hidden" />
58+
<div ref={containerRef} className="flex-1 overflow-hidden">
59+
<div ref={ref} className="h-[480px] overflow-hidden rounded-b-2xl" />
6060
</div>
6161

6262
<div

components/product-selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ export default function ProductSelector() {
102102
<a
103103
ref={btnRef}
104104
className={`
105-
dark:hover:bg-primary-100/5
106105
flex w-full cursor-pointer items-center justify-between gap-2 rounded-md p-2 transition-all duration-200
107106
ease-in-out
108107
hover:bg-gray-200
108+
dark:hover:bg-primary-100/5
109109
`}
110110
onClick={handleToggleVisible}
111111
>

eslint.config.ts

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1+
import os from 'node:os'
12
import antfu from '@antfu/eslint-config'
2-
import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind'
3+
import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss'
4+
5+
const isWindows = os.platform() === 'win32'
6+
const lineBreakStyle = isWindows ? 'windows' : 'unix'
37

48
export default antfu({
59
ignores: [
610
'**/*.js',
711
'**/.next/**/*',
8-
'packages/api/pages/**/*',
9-
'packages/api/dts/**/*.js',
10-
'packages/api/content/**/*',
11-
'packages/api/public/**/*',
12-
'packages/showcase/src/*/demo/data.ts',
1312
],
1413
formatters: true,
1514
markdown: true,
@@ -41,13 +40,14 @@ export default antfu({
4140
],
4241
},
4342
],
43+
'react-hooks/rules-of-hooks': 'off',
4444
'padding-line-between-statements': [
4545
'error',
4646
{ blankLine: 'always', prev: 'directive', next: '*' },
4747
],
4848
},
4949
}, {
50-
files: ['**/*.{jsx,tsx}'],
50+
files: ['**/*.tsx'],
5151
languageOptions: {
5252
parserOptions: {
5353
ecmaFeatures: {
@@ -56,18 +56,25 @@ export default antfu({
5656
},
5757
},
5858
plugins: {
59-
'readable-tailwind': eslintPluginReadableTailwind,
59+
'better-tailwindcss': eslintPluginBetterTailwindcss,
60+
},
61+
settings: {
62+
'better-tailwindcss': {
63+
entryPoint: 'styles/globals.css',
64+
},
6065
},
6166
rules: {
6267
// enable all recommended rules to warn
63-
...eslintPluginReadableTailwind.configs.warning.rules,
68+
...eslintPluginBetterTailwindcss.configs['recommended-warn'].rules,
6469
// enable all recommended rules to error
65-
...eslintPluginReadableTailwind.configs.error.rules,
66-
'jsonc/sort-keys': ['warn'],
70+
...eslintPluginBetterTailwindcss.configs['recommended-error'].rules,
6771

6872
// or configure rules individually
69-
'readable-tailwind/multiline': ['warn', { printWidth: 120 }],
70-
71-
'react-hooks/rules-of-hooks': 'off',
73+
'better-tailwindcss/multiline': ['warn', {
74+
printWidth: 120,
75+
group: 'newLine',
76+
lineBreakStyle,
77+
}],
78+
'better-tailwindcss/no-conflicting-classes': 'off',
7279
},
7380
})

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
{
22
"name": "@univerjs-site/docs",
33
"type": "module",
4-
"version": "0.8.0",
4+
"version": "0.8.1",
55
"private": true,
6-
"packageManager": "pnpm@10.11.0",
6+
"packageManager": "pnpm@10.12.1",
77
"scripts": {
8-
"prepare": "simple-git-hooks",
8+
"prepare": "husky",
9+
"pre-commit": "lint-staged",
910
"dev": "next",
1011
"build": "NODE_OPTIONS=\"--max-old-space-size=4096\" next build",
1112
"start": "next start",
1213
"lint": "eslint ."
1314
},
1415
"dependencies": {
16+
"@commitlint/cli": "^19.8.1",
17+
"@commitlint/config-conventional": "^19.8.1",
1518
"@docsearch/css": "^3.9.0",
1619
"@docsearch/react": "^3.9.0",
1720
"@feelback/react": "^0.3.4",
1821
"@univerjs/icons": "^0.4.4",
19-
"@univerjs/presets": "0.8.0",
20-
"@univerjs/sheets-crosshair-highlight": "0.8.0",
21-
"@univerjs/sheets-formula-ui": "0.8.0",
22-
"@univerjs/themes": "0.8.0",
23-
"@univerjs/uniscript": "0.8.0",
24-
"@univerjs/watermark": "0.8.0",
22+
"@univerjs/presets": "0.8.1",
23+
"@univerjs/sheets-crosshair-highlight": "0.8.1",
24+
"@univerjs/sheets-formula-ui": "0.8.1",
25+
"@univerjs/themes": "0.8.1",
26+
"@univerjs/uniscript": "0.8.1",
27+
"@univerjs/watermark": "0.8.1",
2528
"clsx": "^2.1.1",
2629
"next": "15.3.3",
2730
"nextra": "^4.2.17",
2831
"nextra-theme-docs": "^4.2.17",
2932
"react": "19.1.0",
3033
"react-dom": "19.1.0",
31-
"tailwind-merge": "^3.3.0"
34+
"tailwind-merge": "^3.3.1"
3235
},
3336
"devDependencies": {
34-
"@antfu/eslint-config": "^4.13.2",
35-
"@eslint-react/eslint-plugin": "^1.50.0",
36-
"@tailwindcss/postcss": "^4.1.8",
37-
"@types/react": "^19.1.6",
38-
"@types/react-dom": "^19.1.5",
37+
"@antfu/eslint-config": "^4.14.1",
38+
"@eslint-react/eslint-plugin": "^1.52.1",
39+
"@tailwindcss/postcss": "^4.1.10",
40+
"@types/react": "^19.1.8",
41+
"@types/react-dom": "^19.1.6",
3942
"eslint": "^9.28.0",
43+
"eslint-plugin-better-tailwindcss": "^3.1.0",
4044
"eslint-plugin-format": "^1.0.1",
4145
"eslint-plugin-react-hooks": "^5.2.0",
4246
"eslint-plugin-react-refresh": "^0.4.20",
43-
"eslint-plugin-readable-tailwind": "^2.1.2",
4447
"file-loader": "^6.2.0",
48+
"husky": "^9.1.7",
4549
"lint-staged": "^16.1.0",
46-
"postcss": "^8.5.4",
47-
"shiki": "^3.4.2",
48-
"simple-git-hooks": "^2.13.0",
49-
"tailwindcss": "^4.1.8",
50+
"postcss": "^8.5.5",
51+
"shiki": "^3.6.0",
52+
"tailwindcss": "^4.1.10",
5053
"tailwindcss-animate": "^1.0.7",
5154
"typescript": "^5.8.3"
5255
},
53-
"simple-git-hooks": {
54-
"pre-commit": "pnpm lint-staged"
55-
},
5656
"lint-staged": {
57-
"!submodules/*": "eslint"
57+
"*": "eslint --fix"
5858
}
5959
}

0 commit comments

Comments
 (0)