@pawover/eslint-rules 0.0.2 → 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/index.js CHANGED
@@ -63,7 +63,7 @@ const rules = {
63
63
  };
64
64
  function createRules(rule, prefix) {
65
65
  const result = {};
66
- if (rule && typeof rule === "string" && rules[rule]) {
66
+ if (typeof rule === "string" && rule in rules) {
67
67
  if (prefix) {
68
68
  return Object.entries(rules[rule]).reduce((acc, [key, value]) => {
69
69
  const oldPrefix = key.split("/")[0];
@@ -1,14 +1,72 @@
1
1
  declare const _default: {
2
+ /**
3
+ * @desc 强制链式成员访问的换行风格保持一致
4
+ * @descEN Enforce consistent line breaks for chaining member access
5
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-chaining.md
6
+ */
2
7
  "antfu/consistent-chaining": number;
8
+ /**
9
+ * @desc 强制括号和圆括号内部的换行风格保持一致
10
+ * @descEN Enforce consistent line breaks inside braces and parentheses
11
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/consistent-list-newline.md
12
+ */
3
13
  "antfu/consistent-list-newline": number;
14
+ /**
15
+ * @desc 个人偏好的花括号规则,允许单行同时使用两种风格
16
+ * @descEN Opinionated curly bracket enforcement that allows both styles on one-liners
17
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/curly.md
18
+ */
4
19
  "antfu/curly": number;
20
+ /**
21
+ * @desc 强制 if 语句与其后续表达式之间换行
22
+ * @descEN Enforce a newline between `if` and its consequent
23
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/if-newline.md
24
+ */
5
25
  "antfu/if-newline": number;
26
+ /**
27
+ * @desc 自动去重来自同一来源的具名导入
28
+ * @descEN Auto-fix duplicate named imports from the same source
29
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/import-dedupe.md
30
+ */
6
31
  "antfu/import-dedupe": number;
7
- "antfu/indent-unindent": number;
32
+ /**
33
+ * @desc 强制 `unindent` 模板字符串标签内的缩进风格保持一致
34
+ * @descEN Enforce consistent indentation inside `unindent` tagged template strings
35
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/indent-unindent.md
36
+ */
37
+ "antfu/indent-unindent": (number | {
38
+ indent: number;
39
+ tags: string[];
40
+ })[];
41
+ /**
42
+ * @desc 禁止从本地 dist 文件夹导入
43
+ * @descEN Prevent importing from a local `dist` folder
44
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-dist.md
45
+ */
8
46
  "antfu/no-import-dist": number;
47
+ /**
48
+ * @desc 禁止通过相对或绝对路径从 node_modules 导入
49
+ * @descEN Prevent importing from `node_modules` by relative or absolute path
50
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-import-node-modules-by-path.md
51
+ */
9
52
  "antfu/no-import-node-modules-by-path": number;
53
+ /**
54
+ * @desc 禁止顶层 await
55
+ * @descEN Prevent top-level `await`
56
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-top-level-await.md
57
+ */
10
58
  "antfu/no-top-level-await": number;
59
+ /**
60
+ * @desc 禁止使用 TypeScript 的 export = 语法
61
+ * @descEN Disallow TypeScript's `export =` syntax
62
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/no-ts-export-equal.md
63
+ */
11
64
  "antfu/no-ts-export-equal": number;
65
+ /**
66
+ * @desc 强制顶层函数使用 function 关键字声明
67
+ * @descEN Enforce top-level functions to be declared with the `function` keyword
68
+ * @see https://github.com/antfu/eslint-plugin-antfu/blob/main/src/rules/top-level-function.md
69
+ */
12
70
  "antfu/top-level-function": number;
13
71
  };
14
72
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"core.antfu.d.ts","sourceRoot":"","sources":["../../src/core.antfu.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,wBAYE"}
1
+ {"version":3,"file":"core.antfu.d.ts","sourceRoot":"","sources":["../../src/core.antfu.ts"],"names":[],"mappings":";IAGE;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;;;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;;AAjEL,wBAmEE"}
@@ -1,14 +1,59 @@
1
1
  declare const _default: {
2
+ /**
3
+ * @desc 强制类型导入的标记风格保持一致(顶级或内联)
4
+ * @descEN Enforce consistent style for type-only import specifiers (top-level vs inline)
5
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/consistent-type-specifier-style/README.md
6
+ */
2
7
  "imports/consistent-type-specifier-style": (string | number)[];
8
+ /**
9
+ * @desc 确保所有导出语句都在文件末尾
10
+ * @descEN Ensure all exports are declared at the bottom of the file
11
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/exports-last/README.md
12
+ */
3
13
  "imports/exports-last": number;
14
+ /**
15
+ * @desc 确保所有 import 语句在文件顶部
16
+ * @descEN Ensure all imports are at the top of the file
17
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/first/README.md
18
+ */
4
19
  "imports/first": number;
20
+ /**
21
+ * @desc 强制在最后一个 import 或 require 语句后留有空行
22
+ * @descEN Enforce one or more empty lines after the last top-level import or require
23
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/newline-after-import/README.md
24
+ */
5
25
  "imports/newline-after-import": (number | {
6
26
  count: number;
7
27
  })[];
28
+ /**
29
+ * @desc 禁止使用默认导出
30
+ * @descEN Disallow default exports
31
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-default-export/README.md
32
+ */
8
33
  "imports/no-default-export": number;
34
+ /**
35
+ * @desc 禁止重复导入同一模块
36
+ * @descEN Disallow duplicate imports from the same module
37
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-duplicates/README.md
38
+ */
9
39
  "imports/no-duplicates": number;
40
+ /**
41
+ * @desc 禁止使用 var 或 let 导出可变绑定
42
+ * @descEN Forbid mutable exports using `var` or `let`
43
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-mutable-exports/README.md
44
+ */
10
45
  "imports/no-mutable-exports": number;
46
+ /**
47
+ * @desc 禁止将默认导入作为具名导入使用
48
+ * @descEN Disallow named import of default exports
49
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/no-named-default/README.md
50
+ */
11
51
  "imports/no-named-default": number;
52
+ /**
53
+ * @desc 优先使用默认导出而非具名导出
54
+ * @descEN Prefer default export over named export
55
+ * @see https://github.com/9romise/eslint-plugin-import-lite/blob/main/src/rules/prefer-default-export/README.md
56
+ */
12
57
  "imports/prefer-default-export": number;
13
58
  };
14
59
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"core.imports.d.ts","sourceRoot":"","sources":["../../src/core.imports.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,wBAUE"}
1
+ {"version":3,"file":"core.imports.d.ts","sourceRoot":"","sources":["../../src/core.imports.ts"],"names":[],"mappings":";IACE;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;;AArDL,wBAuDE"}