@kazupon/eslint-plugin 0.1.0 → 0.1.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.
package/lib/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import { ESLint } from "eslint";
2
2
 
3
- //#region lib/.tsdown-types-es/index.d.ts
4
- /** @alias */
3
+ //#region src/index.d.ts
5
4
  declare const plugin: ESLint.Plugin;
6
- /** @alias */
7
5
  declare const configs: ESLint.Plugin["configs"];
8
6
 
9
7
  //#endregion
package/lib/index.js CHANGED
@@ -15,54 +15,33 @@ const namespace = pkg.name.split("/")[0];
15
15
 
16
16
  //#endregion
17
17
  //#region src/utils/rule.ts
18
- const blobUrl = "https://github.com/kazupon/eslint-plugin/tree/main/src/rules";
19
- /**
20
- * Creates reusable function to create rules with default options and docs URLs.
21
- *
22
- * @param urlCreator Creates a documentation URL for a given rule name.
23
- * @returns Function to create a rule with the docs URL format.
24
- */
18
+ const BLOB_URL = "https://github.com/kazupon/eslint-plugin/tree/main/src/rules";
25
19
  function RuleCreator(urlCreator, namespace$1 = "") {
26
20
  return function createNamedRule({ meta, name: name$1,...rule$1 }) {
27
21
  const ruleId = namespace$1 ? `${namespace$1}/${name$1}` : name$1;
28
- return _createRule({
22
+ return {
29
23
  meta: {
30
24
  ...meta,
31
25
  docs: {
32
- ...meta.docs,
26
+ ...meta?.docs,
33
27
  url: urlCreator(name$1),
34
- ruleId,
35
- ruleName: name$1
28
+ ruleName: name$1,
29
+ ruleId
36
30
  }
37
31
  },
38
32
  ...rule$1
39
- });
40
- };
41
- }
42
- function _createRule({ create, defaultOptions, meta }) {
43
- return {
44
- create: (context) => {
45
- const optionsWithDefault = context.options.map((options, index) => {
46
- return {
47
- ...defaultOptions[index],
48
- ...options
49
- };
50
- });
51
- return create(context, optionsWithDefault);
52
- },
53
- defaultOptions,
54
- meta
33
+ };
55
34
  };
56
35
  }
57
36
  const createRule = RuleCreator((ruleName) => {
58
- return `${blobUrl}/${ruleName}.ts`;
37
+ return `${BLOB_URL}/${ruleName}.ts`;
59
38
  }, namespace);
60
39
 
61
40
  //#endregion
62
41
  //#region src/rules/enforce-header-comment.ts
63
42
  const ENFORCED_TAGS = ["author", "license"];
64
43
  function initializeTagDiagnosis(tags) {
65
- const tagDiagnosis = {};
44
+ const tagDiagnosis = Object.create(null);
66
45
  for (const tag of tags) tagDiagnosis[tag] = "require";
67
46
  return tagDiagnosis;
68
47
  }
@@ -87,7 +66,6 @@ const rule = createRule({
87
66
  },
88
67
  schema: []
89
68
  },
90
- defaultOptions: [{}],
91
69
  create(ctx) {
92
70
  /**
93
71
  * Report the tag diagnosis
@@ -199,8 +177,8 @@ const commentConfig = [{
199
177
  ignores: ["**/*.md", "**/*.md/**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
200
178
  plugins: { [namespace]: plugin },
201
179
  rules: Object.entries(rules).reduce((rules$1, [ruleName, rule$1]) => {
202
- const ruleId = rule$1.meta.docs?.ruleId || (namespace ? `${namespace}/${ruleName}` : ruleName);
203
- rules$1[ruleId] = rule$1.meta.docs?.defaultSeverity || "warn";
180
+ const ruleId = rule$1.meta?.docs?.ruleId || (namespace ? `${namespace}/${ruleName}` : ruleName);
181
+ rules$1[ruleId] = rule$1.meta?.docs?.defaultSeverity || "warn";
204
182
  return rules$1;
205
183
  }, Object.create(null))
206
184
  }];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kazupon/eslint-plugin",
3
3
  "description": "ESLint plugin for @kazupon",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "license": "MIT",
6
6
  "funding": "https://github.com/sponsors/kazupon",
7
7
  "bugs": {
@@ -47,11 +47,11 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@es-joy/jsdoccomment": "^0.50.0"
50
+ "@es-joy/jsdoccomment": "^0.50.0",
51
+ "@eslint/core": "^0.13.0"
51
52
  },
52
53
  "peerDependencies": {
53
- "eslint": "^9.0.0",
54
- "typescript-eslint": "^8.29.1"
54
+ "eslint": "^9.0.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@eslint/markdown": "^6.3.0",
@@ -59,7 +59,6 @@
59
59
  "@kazupon/prettier-config": "^0.1.1",
60
60
  "@shikijs/vitepress-twoslash": "^3.2.2",
61
61
  "@types/node": "^22.14.1",
62
- "@typescript-eslint/utils": "^8.29.1",
63
62
  "@vitest/eslint-plugin": "^1.1.42",
64
63
  "bumpp": "^10.1.0",
65
64
  "eslint": "^9.24.0",
@@ -79,7 +78,7 @@
79
78
  "pkg-pr-new": "^0.0.42",
80
79
  "prettier": "^3.5.3",
81
80
  "publint": "^0.3.11",
82
- "tsdown": "^0.7.5",
81
+ "tsdown": "^0.8.0-beta.2",
83
82
  "tsx": "^4.19.3",
84
83
  "twoslash-eslint": "^0.3.1",
85
84
  "typescript": "^5.8.3",