@lsby/eslint-config 0.1.5 → 0.2.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/dist/cjs/index.cjs +94 -0
- package/dist/cjs/index.d.cts +5 -0
- package/dist/cjs/types/eslint-plugin-sort-class-members.d.cjs +1 -0
- package/dist/cjs/types/eslint-plugin-sort-class-members.d.d.cts +1 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +63 -0
- package/dist/esm/types/eslint-plugin-sort-class-members.d.d.ts +1 -0
- package/dist/esm/types/eslint-plugin-sort-class-members.d.js +0 -0
- package/package.json +22 -5
- package/dist/index.js +0 -82
@@ -0,0 +1,94 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __create = Object.create;
|
3
|
+
var __defProp = Object.defineProperty;
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __export = (target, all) => {
|
9
|
+
for (var name in all)
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
+
};
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
+
for (let key of __getOwnPropNames(from))
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
+
}
|
18
|
+
return to;
|
19
|
+
};
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
+
mod
|
27
|
+
));
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
+
|
30
|
+
// src/index.ts
|
31
|
+
var src_exports = {};
|
32
|
+
__export(src_exports, {
|
33
|
+
default: () => src_default
|
34
|
+
});
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
36
|
+
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
37
|
+
var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
|
38
|
+
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
39
|
+
var import_eslint_plugin_sort_class_members = __toESM(require("eslint-plugin-sort-class-members"), 1);
|
40
|
+
var config = [
|
41
|
+
{
|
42
|
+
ignores: ["node_modules", "dist", "coverage", "out"]
|
43
|
+
},
|
44
|
+
{
|
45
|
+
files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
|
46
|
+
languageOptions: {
|
47
|
+
parser: import_parser.default,
|
48
|
+
parserOptions: { project: true }
|
49
|
+
},
|
50
|
+
plugins: {
|
51
|
+
jsdoc: import_eslint_plugin_jsdoc.default,
|
52
|
+
"@typescript-eslint": import_eslint_plugin.default.configs,
|
53
|
+
"sort-class-members": import_eslint_plugin_sort_class_members.default
|
54
|
+
},
|
55
|
+
rules: {
|
56
|
+
// jsdoc的link必须存在
|
57
|
+
"jsdoc/no-undefined-types": "error",
|
58
|
+
// 拒绝any
|
59
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
60
|
+
// 检查无意义的比较
|
61
|
+
"@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
|
62
|
+
// 拒绝浮动promise
|
63
|
+
"@typescript-eslint/no-floating-promises": "error",
|
64
|
+
// 必须标注函数返回类型
|
65
|
+
"@typescript-eslint/explicit-function-return-type": ["error", {}],
|
66
|
+
// 检查没有使用的变量
|
67
|
+
"@typescript-eslint/no-unused-vars": [
|
68
|
+
"warn",
|
69
|
+
{
|
70
|
+
varsIgnorePattern: "^_",
|
71
|
+
argsIgnorePattern: "^_",
|
72
|
+
destructuredArrayIgnorePattern: "^_"
|
73
|
+
}
|
74
|
+
],
|
75
|
+
// 排序类属性
|
76
|
+
"sort-class-members/sort-class-members": [
|
77
|
+
2,
|
78
|
+
{
|
79
|
+
order: [
|
80
|
+
"[static-properties]",
|
81
|
+
"[static-methods]",
|
82
|
+
"[properties]",
|
83
|
+
"[conventional-private-properties]",
|
84
|
+
"constructor",
|
85
|
+
"[methods]",
|
86
|
+
"[conventional-private-methods]"
|
87
|
+
],
|
88
|
+
accessorPairPositioning: "getThenSet"
|
89
|
+
}
|
90
|
+
]
|
91
|
+
}
|
92
|
+
}
|
93
|
+
];
|
94
|
+
var src_default = config;
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'eslint-plugin-sort-class-members' {}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
// src/index.ts
|
2
|
+
import typescriptEslintPlugin from "@typescript-eslint/eslint-plugin";
|
3
|
+
import typescriptEslintParser from "@typescript-eslint/parser";
|
4
|
+
import jsdoc from "eslint-plugin-jsdoc";
|
5
|
+
import sortClassMembers from "eslint-plugin-sort-class-members";
|
6
|
+
var config = [
|
7
|
+
{
|
8
|
+
ignores: ["node_modules", "dist", "coverage", "out"]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
|
12
|
+
languageOptions: {
|
13
|
+
parser: typescriptEslintParser,
|
14
|
+
parserOptions: { project: true }
|
15
|
+
},
|
16
|
+
plugins: {
|
17
|
+
jsdoc,
|
18
|
+
"@typescript-eslint": typescriptEslintPlugin.configs,
|
19
|
+
"sort-class-members": sortClassMembers
|
20
|
+
},
|
21
|
+
rules: {
|
22
|
+
// jsdoc的link必须存在
|
23
|
+
"jsdoc/no-undefined-types": "error",
|
24
|
+
// 拒绝any
|
25
|
+
"@typescript-eslint/no-unsafe-assignment": "error",
|
26
|
+
// 检查无意义的比较
|
27
|
+
"@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
|
28
|
+
// 拒绝浮动promise
|
29
|
+
"@typescript-eslint/no-floating-promises": "error",
|
30
|
+
// 必须标注函数返回类型
|
31
|
+
"@typescript-eslint/explicit-function-return-type": ["error", {}],
|
32
|
+
// 检查没有使用的变量
|
33
|
+
"@typescript-eslint/no-unused-vars": [
|
34
|
+
"warn",
|
35
|
+
{
|
36
|
+
varsIgnorePattern: "^_",
|
37
|
+
argsIgnorePattern: "^_",
|
38
|
+
destructuredArrayIgnorePattern: "^_"
|
39
|
+
}
|
40
|
+
],
|
41
|
+
// 排序类属性
|
42
|
+
"sort-class-members/sort-class-members": [
|
43
|
+
2,
|
44
|
+
{
|
45
|
+
order: [
|
46
|
+
"[static-properties]",
|
47
|
+
"[static-methods]",
|
48
|
+
"[properties]",
|
49
|
+
"[conventional-private-properties]",
|
50
|
+
"constructor",
|
51
|
+
"[methods]",
|
52
|
+
"[conventional-private-methods]"
|
53
|
+
],
|
54
|
+
accessorPairPositioning: "getThenSet"
|
55
|
+
}
|
56
|
+
]
|
57
|
+
}
|
58
|
+
}
|
59
|
+
];
|
60
|
+
var src_default = config;
|
61
|
+
export {
|
62
|
+
src_default as default
|
63
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module 'eslint-plugin-sort-class-members' {}
|
File without changes
|
package/package.json
CHANGED
@@ -1,22 +1,39 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lsby/eslint-config",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.2.0",
|
4
|
+
"type": "module",
|
4
5
|
"main": "dist/index.js",
|
5
6
|
"files": [
|
6
7
|
"dist"
|
7
8
|
],
|
8
9
|
"scripts": {
|
10
|
+
"build:all": "npm run build:cjs && npm run build:esm",
|
11
|
+
"build:cjs": "tsup src/**/*.ts --format cjs --clean --dts -d dist/cjs",
|
12
|
+
"build:esm": "tsup src/**/*.ts --format esm --clean --dts -d dist/esm",
|
13
|
+
"check:all": "npm run check:format && npm run check:type",
|
14
|
+
"check:format": "prettier --write .",
|
15
|
+
"check:type": "tsc --noEmit",
|
16
|
+
"check:type:watch": "tsc --noEmit -w",
|
17
|
+
"prepare": "husky",
|
9
18
|
"pub:public": "bumpp && npm publish --access public"
|
10
19
|
},
|
20
|
+
"dependencies": {},
|
21
|
+
"devDependencies": {
|
22
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
23
|
+
"bumpp": "^9.5.2",
|
24
|
+
"husky": "^9.1.6",
|
25
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
26
|
+
"prettier-plugin-packagejson": "^2.5.2"
|
27
|
+
},
|
11
28
|
"peerDependencies": {
|
29
|
+
"@types/eslint": "^9.6.1",
|
12
30
|
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
13
31
|
"@typescript-eslint/parser": "^8.6.0",
|
14
32
|
"eslint": "^8.56.0",
|
15
33
|
"eslint-config-prettier": "^9.1.0",
|
34
|
+
"eslint-plugin-jsdoc": "^50.2.4",
|
16
35
|
"eslint-plugin-sort-class-members": "^1.20.0",
|
17
|
-
"
|
36
|
+
"tsup": "^8.3.0"
|
18
37
|
},
|
19
|
-
"
|
20
|
-
"bumpp": "^9.4.1"
|
21
|
-
}
|
38
|
+
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
|
22
39
|
}
|
package/dist/index.js
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
extends: [
|
3
|
-
// 避免和prettier冲突
|
4
|
-
"prettier",
|
5
|
-
],
|
6
|
-
|
7
|
-
// 插件
|
8
|
-
plugins: [
|
9
|
-
// 基础ts支持
|
10
|
-
"@typescript-eslint",
|
11
|
-
// 排序类属性
|
12
|
-
"sort-class-members",
|
13
|
-
// jsdoc相关
|
14
|
-
"jsdoc",
|
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
|
-
// jsdoc的link必须存在
|
36
|
-
"jsdoc/no-undefined-types": "error",
|
37
|
-
|
38
|
-
// 拒绝any
|
39
|
-
"@typescript-eslint/no-unsafe-assignment": "error",
|
40
|
-
|
41
|
-
// 检查无意义的比较
|
42
|
-
"@typescript-eslint/no-unnecessary-condition": [
|
43
|
-
"error",
|
44
|
-
{ allowConstantLoopConditions: true },
|
45
|
-
],
|
46
|
-
|
47
|
-
// 拒绝浮动promise
|
48
|
-
"@typescript-eslint/no-floating-promises": "error",
|
49
|
-
|
50
|
-
// 必须标注函数返回类型
|
51
|
-
"@typescript-eslint/explicit-function-return-type": ["error", {}],
|
52
|
-
|
53
|
-
// 检查没有使用的变量
|
54
|
-
"@typescript-eslint/no-unused-vars": [
|
55
|
-
"warn",
|
56
|
-
{
|
57
|
-
varsIgnorePattern: "^_",
|
58
|
-
argsIgnorePattern: "^_",
|
59
|
-
destructuredArrayIgnorePattern: "^_",
|
60
|
-
},
|
61
|
-
],
|
62
|
-
|
63
|
-
// 排序类属性
|
64
|
-
"sort-class-members/sort-class-members": [
|
65
|
-
2,
|
66
|
-
{
|
67
|
-
order: [
|
68
|
-
"[static-properties]",
|
69
|
-
"[static-methods]",
|
70
|
-
"[properties]",
|
71
|
-
"[conventional-private-properties]",
|
72
|
-
"constructor",
|
73
|
-
"[methods]",
|
74
|
-
"[conventional-private-methods]",
|
75
|
-
],
|
76
|
-
accessorPairPositioning: "getThenSet",
|
77
|
-
},
|
78
|
-
],
|
79
|
-
},
|
80
|
-
},
|
81
|
-
],
|
82
|
-
};
|