@lsby/eslint-config 0.0.1

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.
Files changed (2) hide show
  1. package/dist/index.js +79 -0
  2. package/package.json +21 -0
package/dist/index.js ADDED
@@ -0,0 +1,79 @@
1
+ module.exports = {
2
+ extends: [
3
+ // 避免和prettier冲突
4
+ "prettier",
5
+ ],
6
+
7
+ // 插件
8
+ plugins: [
9
+ // 基础ts支持
10
+ "@typescript-eslint",
11
+ // 检查没有使用的引入, 并自动修复
12
+ "unused-imports",
13
+ // 排序类属性
14
+ "sort-class-members",
15
+ ],
16
+
17
+ // 解析器
18
+ parser: "@typescript-eslint/parser",
19
+
20
+ // 忽略文件和文件夹
21
+ ignorePatterns: ["node_modules", "dist", "coverage", "out"],
22
+
23
+ // 指定ts项目
24
+ root: true,
25
+ parserOptions: { project: true },
26
+
27
+ // 规则
28
+ overrides: [
29
+ {
30
+ // 包含的文件
31
+ files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
32
+
33
+ // 规则
34
+ rules: {
35
+ // 检查无意义的比较
36
+ "@typescript-eslint/no-unnecessary-condition": [
37
+ "error",
38
+ { allowConstantLoopConditions: true },
39
+ ],
40
+
41
+ // 拒绝浮动promise
42
+ "@typescript-eslint/no-floating-promises": "error",
43
+
44
+ // 必须标注函数返回类型
45
+ "@typescript-eslint/explicit-function-return-type": ["error", {}],
46
+
47
+ // 检查没有使用的变量
48
+ "@typescript-eslint/no-unused-vars": [
49
+ "warn",
50
+ {
51
+ varsIgnorePattern: "^_",
52
+ argsIgnorePattern: "^_",
53
+ destructuredArrayIgnorePattern: "^_",
54
+ },
55
+ ],
56
+
57
+ // 检查没有使用的引入, 并自动修复
58
+ "unused-imports/no-unused-imports": "error",
59
+
60
+ // 排序类属性
61
+ "sort-class-members/sort-class-members": [
62
+ 2,
63
+ {
64
+ order: [
65
+ "[static-properties]",
66
+ "[static-methods]",
67
+ "[properties]",
68
+ "[conventional-private-properties]",
69
+ "constructor",
70
+ "[methods]",
71
+ "[conventional-private-methods]",
72
+ ],
73
+ accessorPairPositioning: "getThenSet",
74
+ },
75
+ ],
76
+ },
77
+ },
78
+ ],
79
+ };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@lsby/eslint-config",
3
+ "version": "0.0.1",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "scripts": {
8
+ "pub:public": "bumpp && npm publish --access public"
9
+ },
10
+ "peerDependencies": {
11
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
12
+ "@typescript-eslint/parser": "^7.8.0",
13
+ "eslint": "^8.56.0",
14
+ "eslint-config-prettier": "^9.1.0",
15
+ "eslint-plugin-sort-class-members": "^1.20.0",
16
+ "eslint-plugin-unused-imports": "^3.2.0"
17
+ },
18
+ "devDependencies": {
19
+ "bumpp": "^9.4.1"
20
+ }
21
+ }