Skip to content

Commit bed7e62

Browse files
committed
[add] tailwindcss, eslint config
[update] package [polish] layout
1 parent 837d50e commit bed7e62

File tree

11 files changed

+3598
-671
lines changed

11 files changed

+3598
-671
lines changed

.postcssrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"plugins": {"@tailwindcss/postcss": {}
3+
}
4+
}

eslint.config.ts

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import cspellPlugin from '@cspell/eslint-plugin';
2+
import eslint from '@eslint/js';
3+
import stylistic from '@stylistic/eslint-plugin';
4+
import eslintConfigPrettier from 'eslint-config-prettier';
5+
import react from 'eslint-plugin-react';
6+
import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
7+
import globals from 'globals';
8+
import tsEslint from 'typescript-eslint';
9+
import { fileURLToPath } from 'url';
10+
11+
/**
12+
* @see{@link https://github.com/typescript-eslint/typescript-eslint/blob/main/eslint.config.mjs}
13+
* @see{@link https://github.com/vercel/next.js/issues/71763#issuecomment-2476838298}
14+
*/
15+
16+
const tsconfigRootDir = fileURLToPath(new URL('.', import.meta.url));
17+
18+
export default tsEslint.config(
19+
// register all of the plugins up-front
20+
{
21+
plugins: {
22+
'@typescript-eslint': tsEslint.plugin,
23+
react,
24+
'@stylistic': stylistic,
25+
'simple-import-sort': simpleImportSortPlugin,
26+
'@cspell': cspellPlugin
27+
}
28+
},
29+
{
30+
// config with just ignores is the replacement for `.eslintignore`
31+
ignores: ['**/node_modules/**', 'dist/**', '.parcel-cache/**']
32+
},
33+
34+
// extends ...
35+
eslint.configs.recommended,
36+
...tsEslint.configs.recommended,
37+
38+
// base config
39+
{
40+
languageOptions: {
41+
globals: { ...globals.es2020, ...globals.browser, ...globals.node },
42+
parserOptions: {
43+
projectService: true,
44+
tsconfigRootDir,
45+
warnOnUnsupportedTypeScriptVersion: false
46+
}
47+
},
48+
rules: {
49+
'arrow-body-style': ['error', 'as-needed'],
50+
'no-empty-pattern': 'warn',
51+
'no-console': ['error', { allow: ['warn', 'error', 'info'] }],
52+
'consistent-return': 'warn',
53+
'prefer-destructuring': ['error', { object: true, array: true }],
54+
// react
55+
'react/no-unescaped-entities': 'off',
56+
'react/self-closing-comp': [
57+
'error',
58+
{ component: true, html: true }
59+
],
60+
'react/jsx-curly-brace-presence': [
61+
'error',
62+
{ props: 'never', children: 'never' }
63+
],
64+
'react/jsx-no-target-blank': 'warn',
65+
'react/jsx-sort-props': [
66+
'error',
67+
{
68+
reservedFirst: true,
69+
callbacksLast: true,
70+
noSortAlphabetically: true
71+
}
72+
],
73+
// typescript
74+
'@typescript-eslint/no-unused-vars': 'warn',
75+
'@typescript-eslint/no-explicit-any': 'warn',
76+
'@typescript-eslint/no-empty-object-type': 'off',
77+
'@typescript-eslint/no-unsafe-declaration-merging': 'warn',
78+
79+
// @typescript-eslint + eslint, works together
80+
'@typescript-eslint/consistent-type-definitions': [
81+
'error',
82+
'interface'
83+
],
84+
'no-restricted-syntax': [
85+
'error',
86+
{
87+
selector: "TSPropertySignature[key.name='children']",
88+
message:
89+
'Please use PropsWithChildren<T> instead of defining children manually'
90+
}
91+
],
92+
// stylistic
93+
'@stylistic/padding-line-between-statements': [
94+
'error',
95+
{ blankLine: 'always', prev: '*', next: 'return' },
96+
{ blankLine: 'always', prev: 'directive', next: '*' },
97+
{ blankLine: 'any', prev: 'directive', next: 'directive' },
98+
{
99+
blankLine: 'always',
100+
prev: '*',
101+
next: ['enum', 'interface', 'type']
102+
}
103+
],
104+
105+
// simple-import-sort
106+
'simple-import-sort/exports': 'error',
107+
'simple-import-sort/imports': 'error',
108+
// spellchecker
109+
'@cspell/spellchecker': [
110+
'warn',
111+
{
112+
cspell: {
113+
language: 'en',
114+
dictionaries: [
115+
'typescript',
116+
'node',
117+
'html',
118+
'css',
119+
'bash',
120+
'npm'
121+
]
122+
}
123+
}
124+
]
125+
}
126+
},
127+
eslintConfigPrettier
128+
);

package.json

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webcell-mobile",
3-
"version": "0.4.0",
3+
"version": "0.5.0",
44
"description": "Mobile App scaffold of WebCell v3, which is a PWA scaffold based on Material Design Web components, with Anti-996 sample data.",
55
"author": "[email protected]",
66
"homepage": "https://web-cell.dev/WebCell-mobile/",
@@ -12,29 +12,42 @@
1212
"url": "https://github.com/EasyWebApp/WebCell-mobile/issues"
1313
},
1414
"dependencies": {
15+
"@tailwindcss/postcss": "^4.0.14",
1516
"browser-unhandled-rejection": "^1.0.2",
16-
"cell-router": "^3.0.1",
17-
"dom-renderer": "^2.6.1",
17+
"cell-router": "^3.0.3",
18+
"dom-renderer": "^2.6.2",
1819
"koajax": "^3.1.1",
1920
"mdui": "^2.1.3",
20-
"mobx": "^6.13.5",
21+
"mobx": "^6.13.6",
22+
"tailwindcss": "^4.0.14",
2123
"web-cell": "^3.0.3",
22-
"web-utility": "^4.4.2"
24+
"web-utility": "^4.4.3"
2325
},
2426
"devDependencies": {
25-
"@parcel/config-default": "~2.13.2",
26-
"@parcel/packager-raw-url": "~2.13.2",
27-
"@parcel/transformer-typescript-tsc": "~2.13.2",
28-
"@parcel/transformer-webmanifest": "~2.13.2",
29-
"@softonus/prettier-plugin-duplicate-remover": "^1.1.2",
30-
"@types/node": "^20.17.9",
27+
"@cspell/eslint-plugin": "^8.17.5",
28+
"@eslint/js": "^9.22.0",
29+
"@parcel/config-default": "~2.13.3",
30+
"@parcel/packager-raw-url": "~2.13.3",
31+
"@parcel/transformer-typescript-tsc": "~2.13.3",
32+
"@parcel/transformer-webmanifest": "~2.13.3",
33+
"@types/node": "^22.13.10",
34+
"eslint": "^9.22.0",
35+
"eslint-config-prettier": "^10.1.1",
36+
"@types/eslint-config-prettier": "^6.11.3",
37+
"eslint-plugin-react": "^7.37.4",
38+
"eslint-plugin-simple-import-sort": "^12.1.1",
39+
"@stylistic/eslint-plugin": "^4.2.0",
40+
"globals": "^16.0.0",
3141
"husky": "^9.1.7",
32-
"lint-staged": "^15.2.11",
33-
"parcel": "~2.13.2",
34-
"postcss": "^8.4.49",
35-
"prettier": "^3.4.2",
42+
"jiti": "^2.4.2",
43+
"lint-staged": "^15.5.0",
44+
"parcel": "~2.13.3",
45+
"postcss": "^8.5.3",
46+
"prettier": "^3.5.3",
3647
"prettier-plugin-css-order": "^2.1.2",
37-
"typescript": "~5.7.2",
48+
"prettier-plugin-tailwindcss": "^0.6.11",
49+
"typescript": "~5.8.2",
50+
"typescript-eslint": "^8.26.1",
3851
"workbox-cli": "^7.3.0"
3952
},
4053
"prettier": {
@@ -44,11 +57,12 @@
4457
"tabWidth": 4,
4558
"plugins": [
4659
"prettier-plugin-css-order",
47-
"@softonus/prettier-plugin-duplicate-remover"
60+
"prettier-plugin-tailwindcss"
4861
]
4962
},
5063
"lint-staged": {
51-
"*.{html,md,css,less,json,yml,js,ts,tsx}": "prettier --write"
64+
"*.{html,md,css,less,json,yml,js,ts,tsx}": "prettier --write",
65+
"*.{css,js,mjs,ts,tsx}": "eslint --fix"
5266
},
5367
"scripts": {
5468
"prepare": "husky",

0 commit comments

Comments
 (0)