@lsby/eslint-config 0.1.6 → 0.2.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.
@@ -0,0 +1,97 @@
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
+ \u57FA\u7840ts\u89C4\u5219: () => \u57FA\u7840ts\u89C4\u5219,
34
+ \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939: () => \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+ var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
38
+ var import_parser = __toESM(require("@typescript-eslint/parser"), 1);
39
+ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
40
+ var import_eslint_plugin_sort_class_members = __toESM(require("eslint-plugin-sort-class-members"), 1);
41
+ var \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939 = {
42
+ ignores: ["node_modules", "dist", "coverage", "out"]
43
+ };
44
+ var \u57FA\u7840ts\u89C4\u5219 = {
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
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ \u57FA\u7840ts\u89C4\u5219,
96
+ \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939
97
+ });
@@ -0,0 +1,6 @@
1
+ import { Linter } from 'eslint';
2
+
3
+ declare var 忽略常见文件夹: Linter.Config;
4
+ declare var 基础ts规则: Linter.Config;
5
+
6
+ export { 基础ts规则, 忽略常见文件夹 };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ declare module 'eslint-plugin-sort-class-members' {}
@@ -0,0 +1,6 @@
1
+ import { Linter } from 'eslint';
2
+
3
+ declare var 忽略常见文件夹: Linter.Config;
4
+ declare var 基础ts规则: Linter.Config;
5
+
6
+ export { 基础ts规则, 忽略常见文件夹 };
@@ -0,0 +1,61 @@
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 \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939 = {
7
+ ignores: ["node_modules", "dist", "coverage", "out"]
8
+ };
9
+ var \u57FA\u7840ts\u89C4\u5219 = {
10
+ files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
11
+ languageOptions: {
12
+ parser: typescriptEslintParser,
13
+ parserOptions: { project: true }
14
+ },
15
+ plugins: {
16
+ jsdoc,
17
+ "@typescript-eslint": typescriptEslintPlugin.configs,
18
+ "sort-class-members": sortClassMembers
19
+ },
20
+ rules: {
21
+ // jsdoc的link必须存在
22
+ "jsdoc/no-undefined-types": "error",
23
+ // 拒绝any
24
+ "@typescript-eslint/no-unsafe-assignment": "error",
25
+ // 检查无意义的比较
26
+ "@typescript-eslint/no-unnecessary-condition": ["error", { allowConstantLoopConditions: true }],
27
+ // 拒绝浮动promise
28
+ "@typescript-eslint/no-floating-promises": "error",
29
+ // 必须标注函数返回类型
30
+ "@typescript-eslint/explicit-function-return-type": ["error", {}],
31
+ // 检查没有使用的变量
32
+ "@typescript-eslint/no-unused-vars": [
33
+ "warn",
34
+ {
35
+ varsIgnorePattern: "^_",
36
+ argsIgnorePattern: "^_",
37
+ destructuredArrayIgnorePattern: "^_"
38
+ }
39
+ ],
40
+ // 排序类属性
41
+ "sort-class-members/sort-class-members": [
42
+ 2,
43
+ {
44
+ order: [
45
+ "[static-properties]",
46
+ "[static-methods]",
47
+ "[properties]",
48
+ "[conventional-private-properties]",
49
+ "constructor",
50
+ "[methods]",
51
+ "[conventional-private-methods]"
52
+ ],
53
+ accessorPairPositioning: "getThenSet"
54
+ }
55
+ ]
56
+ }
57
+ };
58
+ export {
59
+ \u57FA\u7840ts\u89C4\u5219,
60
+ \u5FFD\u7565\u5E38\u89C1\u6587\u4EF6\u5939
61
+ };
@@ -0,0 +1 @@
1
+ declare module 'eslint-plugin-sort-class-members' {}
package/package.json CHANGED
@@ -1,22 +1,39 @@
1
1
  {
2
2
  "name": "@lsby/eslint-config",
3
- "version": "0.1.6",
3
+ "version": "0.2.1",
4
+ "type": "module",
4
5
  "main": "dist/index.js",
5
6
  "files": [
6
7
  "dist"
7
8
  ],
8
9
  "scripts": {
9
- "pub:public": "bumpp && npm publish --access public"
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",
18
+ "pub:public": "npm run check:all && npm run build:all && bumpp && npm publish --access public"
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"
10
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
- "eslint-plugin-jsdoc": "^50.2.4"
36
+ "tsup": "^8.3.0"
18
37
  },
19
- "devDependencies": {
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
- };