@resolid/config 1.0.3 → 2.0.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 +9 -51
- package/biome.json +36 -0
- package/biome.react.json +22 -0
- package/biome.tailwind.json +16 -0
- package/package.json +11 -26
- package/tsconfig.base.json +2 -1
- package/src/eslint.base.js +0 -41
- package/src/eslint.bowser.js +0 -12
- package/src/eslint.node.js +0 -24
- package/src/eslint.react.js +0 -74
- package/src/eslint.typescript.js +0 -10
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# @resolid/config
|
|
2
2
|
|
|
3
|
-
Resolid 通用配置, 包含了 `TypeScript`, `
|
|
3
|
+
Resolid 通用配置, 包含了 `TypeScript`, `Biome` 的基础配置
|
|
4
4
|
|
|
5
5
|
## 使用方法
|
|
6
6
|
|
|
7
7
|
### 安装
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
pnpm add -D
|
|
10
|
+
pnpm add -D @resolid/config
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
### TypeScript 配置
|
|
@@ -30,55 +30,13 @@ pnpm add -D eslint @resolid/config
|
|
|
30
30
|
}
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
###
|
|
33
|
+
### Biome 配置
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```js
|
|
42
|
-
// eslint.config.js
|
|
43
|
-
import eslintTypescript from "@resolid/config/eslint.typescript";
|
|
44
|
-
|
|
45
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
46
|
-
export default [...eslintTypescript];
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
#### React Lint 配置
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
// eslint.config.js
|
|
53
|
-
import eslintReact from "@resolid/config/eslint.react";
|
|
54
|
-
|
|
55
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
56
|
-
export default [...eslintReact];
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### ESLint 环境设置
|
|
60
|
-
|
|
61
|
-
```js
|
|
62
|
-
// eslint.config.js
|
|
63
|
-
|
|
64
|
-
// 浏览器环境
|
|
65
|
-
import eslintBowser from "@resolid/config/eslint.bowser";
|
|
66
|
-
|
|
67
|
-
// Node 环境
|
|
68
|
-
import eslintNode from "@resolid/config/eslint.node";
|
|
69
|
-
|
|
70
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
71
|
-
export default [...eslintBowser, ...eslintNode];
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### ESLint 配置查看
|
|
75
|
-
|
|
76
|
-
你可以进入拥有 `eslint.config.js` 文件的目录运行下面的命令来检查
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
npx eslint-flat-config-viewer
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"$schema": "https://biomejs.dev/schemas/1.7.1/schema.json",
|
|
38
|
+
"extends": ["@resolid/config/biome"]
|
|
39
|
+
}
|
|
80
40
|
```
|
|
81
41
|
|
|
82
|
-
##
|
|
83
|
-
|
|
84
|
-
- [eslint-flat-config-viewer](https://github.com/antfu/eslint-flat-config-viewer)
|
|
42
|
+
## 致谢
|
package/biome.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
|
3
|
+
"files": {
|
|
4
|
+
"ignore": ["tsconfig.*.json"]
|
|
5
|
+
},
|
|
6
|
+
"vcs": {
|
|
7
|
+
"enabled": true,
|
|
8
|
+
"clientKind": "git",
|
|
9
|
+
"defaultBranch": "main"
|
|
10
|
+
},
|
|
11
|
+
"organizeImports": {
|
|
12
|
+
"enabled": true
|
|
13
|
+
},
|
|
14
|
+
"formatter": {
|
|
15
|
+
"enabled": true,
|
|
16
|
+
"indentStyle": "space",
|
|
17
|
+
"indentWidth": 2,
|
|
18
|
+
"lineEnding": "lf",
|
|
19
|
+
"lineWidth": 120
|
|
20
|
+
},
|
|
21
|
+
"linter": {
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"rules": {
|
|
24
|
+
"recommended": true,
|
|
25
|
+
"style": {
|
|
26
|
+
"noNonNullAssertion": "off"
|
|
27
|
+
},
|
|
28
|
+
"suspicious": {
|
|
29
|
+
"noDoubleEquals": "off"
|
|
30
|
+
},
|
|
31
|
+
"a11y": {
|
|
32
|
+
"noSvgWithoutTitle": "off"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
package/biome.react.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
|
3
|
+
"linter": {
|
|
4
|
+
"rules": {
|
|
5
|
+
"correctness": {
|
|
6
|
+
"useExhaustiveDependencies": {
|
|
7
|
+
"level": "error",
|
|
8
|
+
"options": {
|
|
9
|
+
"hooks": [
|
|
10
|
+
{
|
|
11
|
+
"name": "useIsomorphicEffect",
|
|
12
|
+
"closureIndex": 0,
|
|
13
|
+
"dependenciesIndex": 1,
|
|
14
|
+
"stableResult": true
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
|
|
3
|
+
"linter": {
|
|
4
|
+
"rules": {
|
|
5
|
+
"nursery": {
|
|
6
|
+
"useSortedClasses": {
|
|
7
|
+
"level": "error",
|
|
8
|
+
"options": {
|
|
9
|
+
"attributes": ["textClassName", "statusClassName"],
|
|
10
|
+
"functions": ["clsx", "classed"]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resolid/config",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Resolid 通用配置",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"resolid",
|
|
11
|
-
"
|
|
11
|
+
"biome",
|
|
12
12
|
"typescript"
|
|
13
13
|
],
|
|
14
14
|
"publishConfig": {
|
|
@@ -16,44 +16,29 @@
|
|
|
16
16
|
"provenance": true
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
|
-
"
|
|
19
|
+
"biome.json",
|
|
20
|
+
"biome.react.json",
|
|
21
|
+
"biome.tailwind.json",
|
|
20
22
|
"tsconfig.base.json",
|
|
21
23
|
"tsconfig.react.json"
|
|
22
24
|
],
|
|
23
25
|
"exports": {
|
|
24
26
|
"./tsconfig.base": "./tsconfig.base.json",
|
|
25
27
|
"./tsconfig.react": "./tsconfig.react.json",
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"@eslint/js": "^8.57.0",
|
|
30
|
-
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
31
|
-
"eslint-plugin-n": "^17.2.0",
|
|
32
|
-
"eslint-plugin-react": "^7.34.1",
|
|
33
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
34
|
-
"eslint-plugin-react-refresh": "^0.4.6",
|
|
35
|
-
"globals": "^15.0.0",
|
|
36
|
-
"typescript-eslint": "^7.6.0"
|
|
28
|
+
"./biome": "./biome.json",
|
|
29
|
+
"./biome.react": "./biome.react.json",
|
|
30
|
+
"./biome.tailwind": "./biome.tailwind.json"
|
|
37
31
|
},
|
|
38
32
|
"devDependencies": {
|
|
39
|
-
"
|
|
40
|
-
"typescript": "^5.4.5"
|
|
41
|
-
},
|
|
42
|
-
"peerDependencies": {
|
|
43
|
-
"eslint": "^8.57.0",
|
|
33
|
+
"@biomejs/biome": "^1.8.0",
|
|
44
34
|
"typescript": "^5.4.5"
|
|
45
35
|
},
|
|
46
|
-
"
|
|
47
|
-
"typescript": {
|
|
48
|
-
"optional": true
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"homepage": "https://resolid.tech",
|
|
36
|
+
"homepage": "https://www.resolid.tech",
|
|
52
37
|
"repository": {
|
|
53
38
|
"type": "git",
|
|
54
39
|
"url": "https://github.com/huijiewei/resolid-config.git"
|
|
55
40
|
},
|
|
56
41
|
"scripts": {
|
|
57
|
-
"
|
|
42
|
+
"check": "biome check --write ."
|
|
58
43
|
}
|
|
59
44
|
}
|
package/tsconfig.base.json
CHANGED
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
"resolveJsonModule": true,
|
|
10
10
|
"moduleDetection": "force",
|
|
11
11
|
"isolatedModules": true,
|
|
12
|
+
"verbatimModuleSyntax": true,
|
|
12
13
|
|
|
13
14
|
/* Strictness */
|
|
14
15
|
"strict": true,
|
|
15
16
|
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noImplicitOverride": true,
|
|
16
18
|
|
|
17
19
|
/* If NOT transpiling with TypeScript: */
|
|
18
20
|
"module": "preserve",
|
|
19
21
|
"noEmit": true,
|
|
20
|
-
"verbatimModuleSyntax": true,
|
|
21
22
|
|
|
22
23
|
/* If your code runs in the DOM: */
|
|
23
24
|
"lib": ["es2022", "dom", "dom.iterable"]
|
package/src/eslint.base.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import js from "@eslint/js";
|
|
2
|
-
|
|
3
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
4
|
-
export default [
|
|
5
|
-
{
|
|
6
|
-
ignores: [
|
|
7
|
-
"**/node_modules",
|
|
8
|
-
"**/build",
|
|
9
|
-
"**/dist",
|
|
10
|
-
"**/package-lock.json",
|
|
11
|
-
"**/pnpm-lock.yaml",
|
|
12
|
-
"**/.vercel",
|
|
13
|
-
"**/.changeset",
|
|
14
|
-
"**/.idea",
|
|
15
|
-
"**/.cache",
|
|
16
|
-
"**/.output",
|
|
17
|
-
"**/.resolid",
|
|
18
|
-
"**/.vite-inspect",
|
|
19
|
-
"**/*.min.*",
|
|
20
|
-
"**/LICENSE*",
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
languageOptions: {
|
|
25
|
-
ecmaVersion: 2022,
|
|
26
|
-
sourceType: "module",
|
|
27
|
-
parserOptions: {
|
|
28
|
-
ecmaVersion: 2022,
|
|
29
|
-
sourceType: "module",
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
linterOptions: {
|
|
33
|
-
reportUnusedDisableDirectives: true,
|
|
34
|
-
},
|
|
35
|
-
rules: {
|
|
36
|
-
...js.configs.recommended.rules,
|
|
37
|
-
"no-extra-semi": "off",
|
|
38
|
-
"no-mixed-spaces-and-tabs": "off",
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
];
|
package/src/eslint.bowser.js
DELETED
package/src/eslint.node.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import n from "eslint-plugin-n";
|
|
2
|
-
import globals from "globals";
|
|
3
|
-
|
|
4
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
5
|
-
export default [
|
|
6
|
-
{
|
|
7
|
-
plugins: { n },
|
|
8
|
-
rules: {
|
|
9
|
-
"n/handle-callback-err": ["error", "^(err|error)$"],
|
|
10
|
-
"n/no-deprecated-api": "error",
|
|
11
|
-
"n/no-exports-assign": "error",
|
|
12
|
-
"n/no-new-require": "error",
|
|
13
|
-
"n/no-path-concat": "error",
|
|
14
|
-
"n/prefer-global/buffer": ["error", "never"],
|
|
15
|
-
"n/prefer-global/process": ["error", "never"],
|
|
16
|
-
"n/process-exit-as-throw": "error",
|
|
17
|
-
},
|
|
18
|
-
languageOptions: {
|
|
19
|
-
globals: {
|
|
20
|
-
...globals.node,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
];
|
package/src/eslint.react.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import jsxA11y from "eslint-plugin-jsx-a11y";
|
|
2
|
-
import react from "eslint-plugin-react";
|
|
3
|
-
import reactHooks from "eslint-plugin-react-hooks";
|
|
4
|
-
import reactRefresh from "eslint-plugin-react-refresh";
|
|
5
|
-
import eslintTypescript from "./eslint.typescript.js";
|
|
6
|
-
|
|
7
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
8
|
-
export default [
|
|
9
|
-
...eslintTypescript,
|
|
10
|
-
{
|
|
11
|
-
files: ["**/*.{jsx,tsx}"],
|
|
12
|
-
plugins: {
|
|
13
|
-
react: react,
|
|
14
|
-
"react-refresh": reactRefresh,
|
|
15
|
-
},
|
|
16
|
-
rules: {
|
|
17
|
-
...react.configs.recommended.rules,
|
|
18
|
-
...react.configs["jsx-runtime"].rules,
|
|
19
|
-
"react/prop-types": "off",
|
|
20
|
-
"react-refresh/only-export-components": [
|
|
21
|
-
"warn",
|
|
22
|
-
{
|
|
23
|
-
allowConstantExport: true,
|
|
24
|
-
allowExportNames: ["meta", "links", "loader", "action", "Layout", "HydrateFallback", "ErrorBoundary"],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
languageOptions: {
|
|
29
|
-
parserOptions: {
|
|
30
|
-
ecmaVersion: 2022,
|
|
31
|
-
sourceType: "module",
|
|
32
|
-
ecmaFeatures: {
|
|
33
|
-
jsx: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
settings: {
|
|
38
|
-
react: {
|
|
39
|
-
version: "detect",
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
files: ["**/*.{js,jsx,ts,tsx}"],
|
|
45
|
-
plugins: {
|
|
46
|
-
"react-hooks": reactHooks,
|
|
47
|
-
},
|
|
48
|
-
rules: {
|
|
49
|
-
...reactHooks.configs.recommended.rules,
|
|
50
|
-
"react-hooks/exhaustive-deps": [
|
|
51
|
-
"warn",
|
|
52
|
-
{
|
|
53
|
-
additionalHooks: "(useIsomorphicEffect)",
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
files: ["**/*.{jsx,tsx}"],
|
|
60
|
-
plugins: {
|
|
61
|
-
"jsx-a11y": jsxA11y,
|
|
62
|
-
},
|
|
63
|
-
rules: {
|
|
64
|
-
...jsxA11y.configs.recommended.rules,
|
|
65
|
-
},
|
|
66
|
-
languageOptions: {
|
|
67
|
-
parserOptions: {
|
|
68
|
-
ecmaFeatures: {
|
|
69
|
-
jsx: true,
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
];
|
package/src/eslint.typescript.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import typescript from "typescript-eslint";
|
|
2
|
-
import eslintBase from "./eslint.base.js";
|
|
3
|
-
|
|
4
|
-
/** @type {import('eslint').Linter.FlatConfig[]} */
|
|
5
|
-
export default typescript.config(...eslintBase, ...typescript.configs.recommended, {
|
|
6
|
-
rules: {
|
|
7
|
-
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
8
|
-
"@typescript-eslint/method-signature-style": ["error", "property"],
|
|
9
|
-
},
|
|
10
|
-
});
|