@sushichan044/eslint-todo 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -44,13 +44,6 @@ Requires:
44
44
  npx eslint-todo
45
45
  ```
46
46
 
47
- 3. Ignore generated `.eslint-todo.js` in some tools if you needed.
48
-
49
- ```diff
50
- // example: .prettierignore
51
- + .eslint-todo.js
52
- ```
53
-
54
47
  ## Usage
55
48
 
56
49
  ### Generate ESLint Todo file
@@ -1,10 +1,10 @@
1
1
  import { defineCommand, runMain } from 'citty';
2
2
  import { createConsola } from 'consola';
3
3
  import { colorize } from 'consola/utils';
4
- import { L as LATEST_MODULE_HANDLER, i as isNonEmptyString, T as TodoModuleV1Handler, E as ESLintTodoCore } from '../shared/eslint-todo.8Db_Vus_.mjs';
4
+ import { L as LATEST_TODO_MODULE_HANDLER, i as isNonEmptyString, T as TodoModuleV1Handler, D as DEFAULT_OPTIONS, E as ESLintTodoCore } from '../shared/eslint-todo.CfTCWctB.mjs';
5
+ import defu from 'defu';
5
6
  import { launchRemoteESLintTodoCore } from '../remote/client.mjs';
6
7
  import { klona } from 'klona/json';
7
- import defu from 'defu';
8
8
  import { relative } from 'pathe';
9
9
  import * as v from 'valibot';
10
10
  import 'eslint';
@@ -18,7 +18,16 @@ import 'comlink/dist/esm/node-adapter.mjs';
18
18
  import 'node:url';
19
19
  import 'node:worker_threads';
20
20
 
21
- const version = "0.0.4";
21
+ const version = "0.0.5";
22
+
23
+ const operationOptionsWithDefault = (options = {}) => {
24
+ return defu(options, getDefaultOperationOptions());
25
+ };
26
+ const getDefaultOperationOptions = () => ({ ...DEFAULT_OPERATION_OPTIONS });
27
+ const DEFAULT_OPERATION_OPTIONS = {
28
+ allowPartialSelection: false,
29
+ autoFixableOnly: true
30
+ };
22
31
 
23
32
  const defineAction = (action) => action;
24
33
  const NO_INPUT = Symbol("NO_INPUT");
@@ -74,7 +83,7 @@ const deleteRule = (currentModule, ruleSelection) => {
74
83
 
75
84
  const deleteRuleAction = defineAction(async ({ core }, input) => {
76
85
  const currentModule = await core.readTodoModule();
77
- if (!LATEST_MODULE_HANDLER.isVersion(currentModule)) {
86
+ if (!LATEST_TODO_MODULE_HANDLER.isVersion(currentModule)) {
78
87
  throw new Error(
79
88
  "This action requires the latest version of the todo file."
80
89
  );
@@ -93,14 +102,6 @@ const genAction = defineAction(async ({ core, logger }) => {
93
102
  await core.writeTodoModule(todo);
94
103
  });
95
104
 
96
- const operationOptionsWithDefault = (options = {}) => {
97
- return defu(options, getDefaultOperationOptions());
98
- };
99
- const getDefaultOperationOptions = () => ({
100
- allowPartialSelection: false,
101
- autoFixableOnly: true
102
- });
103
-
104
105
  const selectRuleBasedOnLimit = (todoModule, limit, options = {}) => {
105
106
  const resolvedOptions = operationOptionsWithDefault(options);
106
107
  switch (limit.type) {
@@ -154,7 +155,7 @@ const selectRuleBasedOnFilesLimit = (todoModule, limit, options) => {
154
155
  success: true
155
156
  };
156
157
  }
157
- if (allowPartialSelection && isKeyOfTodo(todoModule.todo, partialSelectableRule)) {
158
+ if (allowPartialSelection && isKeyOfTodoModuleV2(todoModule, partialSelectableRule)) {
158
159
  const rule = todoModule.todo[partialSelectableRule];
159
160
  const selectedPaths = Object.keys(rule.violations).slice(0, limitCount);
160
161
  const selectedViolations = {};
@@ -209,7 +210,7 @@ const selectRuleBasedOnViolationsLimit = (todoModule, limit, options) => {
209
210
  success: true
210
211
  };
211
212
  }
212
- if (allowPartialSelection && isKeyOfTodo(todoModule.todo, partialSelectableRule)) {
213
+ if (allowPartialSelection && isKeyOfTodoModuleV2(todoModule, partialSelectableRule)) {
213
214
  const rule = todoModule.todo[partialSelectableRule];
214
215
  let selectedCount = 0;
215
216
  const selectedViolations = {};
@@ -234,15 +235,15 @@ const selectRuleBasedOnViolationsLimit = (todoModule, limit, options) => {
234
235
  }
235
236
  return { success: false };
236
237
  };
237
- const isKeyOfTodo = (todoModule, ruleId) => {
238
- return isNonEmptyString(ruleId) && Object.hasOwn(todoModule, ruleId);
238
+ const isKeyOfTodoModuleV2 = (todoModule, ruleId) => {
239
+ return isNonEmptyString(ruleId) && Object.hasOwn(todoModule.todo, ruleId);
239
240
  };
240
241
 
241
242
  const selectRulesToFixAction = defineAction(
242
243
  async ({ core, logger }, input) => {
243
244
  const { limit, options } = input;
244
245
  const currentModule = await core.readTodoModule();
245
- if (!LATEST_MODULE_HANDLER.isVersion(currentModule)) {
246
+ if (!LATEST_TODO_MODULE_HANDLER.isVersion(currentModule)) {
246
247
  throw new Error(
247
248
  "This action requires the latest version of the todo file."
248
249
  );
@@ -274,7 +275,7 @@ const safeTryNumber = (value) => {
274
275
  return Number.isNaN(parsed) ? null : parsed;
275
276
  };
276
277
 
277
- const resolveCLIContext = (input) => {
278
+ const structureCLIInput = (input) => {
278
279
  const todoFilePath = relative(input.cwd, input.todoFileAbsolutePath);
279
280
  return {
280
281
  mode: input.mode.correct ? "correct" : "generate",
@@ -324,7 +325,7 @@ const cli = defineCommand({
324
325
  },
325
326
  "todo-file": {
326
327
  alias: "f",
327
- description: "ESLint todo file name (default: .eslint-todo.js)",
328
+ description: `ESLint todo file name (default: ${DEFAULT_OPTIONS.todoFile})`,
328
329
  required: false,
329
330
  type: "string",
330
331
  valueHint: "filename"
@@ -338,13 +339,13 @@ const cli = defineCommand({
338
339
  },
339
340
  // operation options
340
341
  "allow-partial-selection": {
341
- description: "Allow partial selection of violations. Only works with --correct. (default: false)",
342
+ description: `Allow partial selection of violations. Only works with --correct. (default: ${DEFAULT_OPERATION_OPTIONS.allowPartialSelection})`,
342
343
  required: false,
343
344
  type: "boolean",
344
345
  valueHint: "boolean"
345
346
  },
346
347
  "auto-fixable-only": {
347
- description: "Only handle auto-fixable violations. (default: true)",
348
+ description: `Only handle auto-fixable violations. (default: ${DEFAULT_OPERATION_OPTIONS.autoFixableOnly})`,
348
349
  required: false,
349
350
  type: "boolean",
350
351
  valueHint: "boolean"
@@ -392,7 +393,7 @@ const cli = defineCommand({
392
393
  todoFile: args["todo-file"]
393
394
  };
394
395
  const eslintTodoCore = new ESLintTodoCore(options);
395
- const context = resolveCLIContext({
396
+ const input = structureCLIInput({
396
397
  cwd: cliCwd,
397
398
  mode: {
398
399
  correct: args.correct
@@ -406,16 +407,16 @@ const cli = defineCommand({
406
407
  todoFileAbsolutePath: eslintTodoCore.getTodoModulePath().absolute
407
408
  });
408
409
  await runAction(updateAction, { consola, options });
409
- if (context.mode === "generate") {
410
+ if (input.mode === "generate") {
410
411
  await runAction(genAction, { consola, options });
411
- consola.success(`ESLint todo file generated at ${context.todoFilePath}!`);
412
+ consola.success(`ESLint todo file generated at ${input.todoFilePath}!`);
412
413
  return;
413
414
  }
414
- if (context.mode === "correct") {
415
+ if (input.mode === "correct") {
415
416
  const result = await runAction(
416
417
  selectRulesToFixAction,
417
418
  { consola, options },
418
- context.operation
419
+ input.operation
419
420
  );
420
421
  if (!result.success) {
421
422
  consola.warn(
@@ -450,7 +451,7 @@ const cli = defineCommand({
450
451
  `Unknown selection type: ${JSON.stringify(_exhaustiveCheck)}`
451
452
  );
452
453
  }
453
- throw new Error(`Unknown mode: ${JSON.stringify(context.mode)}`);
454
+ throw new Error(`Unknown mode: ${JSON.stringify(input.mode)}`);
454
455
  },
455
456
  setup({ args }) {
456
457
  consola.info(`eslint-todo CLI ${version}`);
@@ -1,4 +1,4 @@
1
- import { E as ESLintTodoCore, T as TodoModuleV1Handler, a as TodoModuleV2Handler } from '../shared/eslint-todo.8Db_Vus_.mjs';
1
+ import { E as ESLintTodoCore, T as TodoModuleV1Handler, a as TodoModuleV2Handler } from '../shared/eslint-todo.CfTCWctB.mjs';
2
2
  import 'eslint';
3
3
  import 'node:fs';
4
4
  import 'node:fs/promises';
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import 'eslint';
2
2
  import './shared/eslint-todo.BijUMnSZ.mjs';
3
- export { E as ESLintTodoCore } from './shared/eslint-todo.By90M93X.mjs';
3
+ export { E as ESLintTodoCore } from './shared/eslint-todo.Bj71T6ke.mjs';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import 'eslint';
2
2
  import './shared/eslint-todo.BijUMnSZ.js';
3
- export { E as ESLintTodoCore } from './shared/eslint-todo.BErv4TJ9.js';
3
+ export { E as ESLintTodoCore } from './shared/eslint-todo.COiTIKtF.js';
package/dist/index.mjs CHANGED
@@ -2,7 +2,7 @@ import 'eslint';
2
2
  import 'node:fs';
3
3
  import 'node:fs/promises';
4
4
  import 'pathe';
5
- export { E as ESLintTodoCore } from './shared/eslint-todo.8Db_Vus_.mjs';
5
+ export { E as ESLintTodoCore } from './shared/eslint-todo.CfTCWctB.mjs';
6
6
  import 'magicast';
7
7
  import 'defu';
8
8
  import 'node:process';
@@ -1,7 +1,7 @@
1
1
  import * as Comlink from 'comlink';
2
2
  import { RemoteESLintTodoCore } from './core.mjs';
3
3
  import '../shared/eslint-todo.BijUMnSZ.mjs';
4
- import '../shared/eslint-todo.By90M93X.mjs';
4
+ import '../shared/eslint-todo.Bj71T6ke.mjs';
5
5
  import 'eslint';
6
6
 
7
7
  type RemoteCore = {
@@ -1,7 +1,7 @@
1
1
  import * as Comlink from 'comlink';
2
2
  import { RemoteESLintTodoCore } from './core.js';
3
3
  import '../shared/eslint-todo.BijUMnSZ.js';
4
- import '../shared/eslint-todo.BErv4TJ9.js';
4
+ import '../shared/eslint-todo.COiTIKtF.js';
5
5
  import 'eslint';
6
6
 
7
7
  type RemoteCore = {
@@ -1,11 +1,11 @@
1
1
  import { U as UserOptions } from '../shared/eslint-todo.BijUMnSZ.mjs';
2
- import { I as IESLintTodoCoreLike, S as SupportedModules, R as RuleSeverity, E as ESLintTodoCore } from '../shared/eslint-todo.By90M93X.mjs';
2
+ import { I as IESLintTodoCoreLike, S as SupportedTodoModules, R as RuleSeverity, E as ESLintTodoCore } from '../shared/eslint-todo.Bj71T6ke.mjs';
3
3
  import 'eslint';
4
4
 
5
5
  declare class RemoteESLintTodoCore implements IESLintTodoCoreLike {
6
6
  #private;
7
7
  constructor(userOptions: UserOptions);
8
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): ReturnType<ESLintTodoCore["buildESLintConfig"]>;
8
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): ReturnType<ESLintTodoCore["buildESLintConfig"]>;
9
9
  buildTodoFromLintResults(...parameters: Parameters<ESLintTodoCore["buildTodoFromLintResults"]>): ReturnType<ESLintTodoCore["buildTodoFromLintResults"]>;
10
10
  getTodoModulePath(...parameters: Parameters<ESLintTodoCore["getTodoModulePath"]>): ReturnType<ESLintTodoCore["getTodoModulePath"]>;
11
11
  initializeESLint(...parameters: Parameters<ESLintTodoCore["initializeESLint"]>): ReturnType<ESLintTodoCore["initializeESLint"]>;
@@ -1,11 +1,11 @@
1
1
  import { U as UserOptions } from '../shared/eslint-todo.BijUMnSZ.js';
2
- import { I as IESLintTodoCoreLike, S as SupportedModules, R as RuleSeverity, E as ESLintTodoCore } from '../shared/eslint-todo.BErv4TJ9.js';
2
+ import { I as IESLintTodoCoreLike, S as SupportedTodoModules, R as RuleSeverity, E as ESLintTodoCore } from '../shared/eslint-todo.COiTIKtF.js';
3
3
  import 'eslint';
4
4
 
5
5
  declare class RemoteESLintTodoCore implements IESLintTodoCoreLike {
6
6
  #private;
7
7
  constructor(userOptions: UserOptions);
8
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): ReturnType<ESLintTodoCore["buildESLintConfig"]>;
8
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): ReturnType<ESLintTodoCore["buildESLintConfig"]>;
9
9
  buildTodoFromLintResults(...parameters: Parameters<ESLintTodoCore["buildTodoFromLintResults"]>): ReturnType<ESLintTodoCore["buildTodoFromLintResults"]>;
10
10
  getTodoModulePath(...parameters: Parameters<ESLintTodoCore["getTodoModulePath"]>): ReturnType<ESLintTodoCore["getTodoModulePath"]>;
11
11
  initializeESLint(...parameters: Parameters<ESLintTodoCore["initializeESLint"]>): ReturnType<ESLintTodoCore["initializeESLint"]>;
@@ -1,7 +1,7 @@
1
1
  import * as Comlink from 'comlink';
2
2
  import nodeEndPoint from 'comlink/dist/esm/node-adapter.mjs';
3
3
  import { parentPort } from 'node:worker_threads';
4
- import { E as ESLintTodoCore } from '../shared/eslint-todo.8Db_Vus_.mjs';
4
+ import { E as ESLintTodoCore } from '../shared/eslint-todo.CfTCWctB.mjs';
5
5
  import 'eslint';
6
6
  import 'node:fs';
7
7
  import 'node:fs/promises';
@@ -1,8 +1,18 @@
1
1
  import { Linter, ESLint } from 'eslint';
2
2
  import { U as UserOptions } from './eslint-todo.BijUMnSZ.mjs';
3
3
 
4
+ type TodoFilePath = {
5
+ /**
6
+ * todo file's absolute path.
7
+ */
8
+ absolute: string;
9
+ /**
10
+ * todo file's relative path from directory you specified as `cwd`.
11
+ */
12
+ relative: string;
13
+ };
14
+
4
15
  type TodoModuleLike = Record<string, unknown>;
5
- type ESLintRuleId = string;
6
16
  type RuleSeverity = Extract<Linter.RuleSeverity, "error" | "off">;
7
17
 
8
18
  type ESLintTodoEntryV2 = {
@@ -40,7 +50,7 @@ type TodoModuleV2 = {
40
50
  meta: {
41
51
  version: 2;
42
52
  };
43
- todo: Record<ESLintRuleId, ESLintTodoEntryV2>;
53
+ todo: Record<string, ESLintTodoEntryV2>;
44
54
  };
45
55
 
46
56
  type ESLintTodoEntryV1 = {
@@ -66,19 +76,14 @@ type ESLintTodoEntryV1 = {
66
76
  * }
67
77
  * ```
68
78
  */
69
- type TodoModuleV1 = Record<ESLintRuleId, ESLintTodoEntryV1>;
79
+ type TodoModuleV1 = Record<string, ESLintTodoEntryV1>;
70
80
 
71
81
  type SupportedTodoModulesArray = [
72
82
  TodoModuleV2,
73
83
  TodoModuleV1
74
84
  ];
75
- type SupportedModules = SupportedTodoModulesArray[number];
76
- type LatestModule = SupportedTodoModulesArray[0];
77
-
78
- type TodoFilePath = {
79
- absolute: string;
80
- relative: string;
81
- };
85
+ type SupportedTodoModules = SupportedTodoModulesArray[number];
86
+ type LatestTodoModule = SupportedTodoModulesArray[0];
82
87
 
83
88
  type MaybePromise<T> = Promise<T> | T;
84
89
  type MaybePromisifyAllMethods<T> = {
@@ -86,6 +91,7 @@ type MaybePromisifyAllMethods<T> = {
86
91
  };
87
92
 
88
93
  type ESLintInitializeOptions = Pick<ESLint.Options, "overrideConfig">;
94
+ type IESLintTodoCoreLike = MaybePromisifyAllMethods<ESLintTodoCoreLike>;
89
95
  interface ESLintTodoCoreLike {
90
96
  /**
91
97
  * Build ESLint configs for the todo file.
@@ -97,12 +103,12 @@ interface ESLintTodoCoreLike {
97
103
  * - ESLint configs to disable todo rules.
98
104
  * - `null` if unsupported todo module passed.
99
105
  */
100
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): Linter.Config[];
106
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): Linter.Config[];
101
107
  /**
102
108
  * Build a todo object from the lint results.
103
109
  * @param lintResults LintResults from ESLint
104
110
  */
105
- buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestModule;
111
+ buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestTodoModule;
106
112
  /**
107
113
  * Get the path of current todo module.
108
114
  */
@@ -122,7 +128,6 @@ interface ESLintTodoCoreLike {
122
128
  resetTodoModule(): Promise<void>;
123
129
  writeTodoModule(todo: TodoModuleLike): Promise<void>;
124
130
  }
125
- type IESLintTodoCoreLike = MaybePromisifyAllMethods<ESLintTodoCoreLike>;
126
131
 
127
132
  /**
128
133
  * ESLintTodo API Entrypoint.
@@ -136,8 +141,8 @@ declare class ESLintTodoCore implements IESLintTodoCoreLike {
136
141
  * You should use `launchRemoteCore()` to create a remote worker and use `RemoteESLintTodoCore.readTodoModule()` instead.
137
142
  */
138
143
  _DO_NOT_USE_DIRECTLY_unsafeReadTodoModule(): Promise<TodoModuleLike>;
139
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): Linter.Config[];
140
- buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestModule;
144
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): Linter.Config[];
145
+ buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestTodoModule;
141
146
  getTodoModulePath(): TodoFilePath;
142
147
  initializeESLint(options?: ESLintInitializeOptions): void;
143
148
  lint(): Promise<ESLint.LintResult[]>;
@@ -145,4 +150,4 @@ declare class ESLintTodoCore implements IESLintTodoCoreLike {
145
150
  writeTodoModule(todo: TodoModuleLike): Promise<void>;
146
151
  }
147
152
 
148
- export { ESLintTodoCore as E, type IESLintTodoCoreLike as I, type RuleSeverity as R, type SupportedModules as S };
153
+ export { ESLintTodoCore as E, type IESLintTodoCoreLike as I, type RuleSeverity as R, type SupportedTodoModules as S };
@@ -1,8 +1,18 @@
1
1
  import { Linter, ESLint } from 'eslint';
2
2
  import { U as UserOptions } from './eslint-todo.BijUMnSZ.js';
3
3
 
4
+ type TodoFilePath = {
5
+ /**
6
+ * todo file's absolute path.
7
+ */
8
+ absolute: string;
9
+ /**
10
+ * todo file's relative path from directory you specified as `cwd`.
11
+ */
12
+ relative: string;
13
+ };
14
+
4
15
  type TodoModuleLike = Record<string, unknown>;
5
- type ESLintRuleId = string;
6
16
  type RuleSeverity = Extract<Linter.RuleSeverity, "error" | "off">;
7
17
 
8
18
  type ESLintTodoEntryV2 = {
@@ -40,7 +50,7 @@ type TodoModuleV2 = {
40
50
  meta: {
41
51
  version: 2;
42
52
  };
43
- todo: Record<ESLintRuleId, ESLintTodoEntryV2>;
53
+ todo: Record<string, ESLintTodoEntryV2>;
44
54
  };
45
55
 
46
56
  type ESLintTodoEntryV1 = {
@@ -66,19 +76,14 @@ type ESLintTodoEntryV1 = {
66
76
  * }
67
77
  * ```
68
78
  */
69
- type TodoModuleV1 = Record<ESLintRuleId, ESLintTodoEntryV1>;
79
+ type TodoModuleV1 = Record<string, ESLintTodoEntryV1>;
70
80
 
71
81
  type SupportedTodoModulesArray = [
72
82
  TodoModuleV2,
73
83
  TodoModuleV1
74
84
  ];
75
- type SupportedModules = SupportedTodoModulesArray[number];
76
- type LatestModule = SupportedTodoModulesArray[0];
77
-
78
- type TodoFilePath = {
79
- absolute: string;
80
- relative: string;
81
- };
85
+ type SupportedTodoModules = SupportedTodoModulesArray[number];
86
+ type LatestTodoModule = SupportedTodoModulesArray[0];
82
87
 
83
88
  type MaybePromise<T> = Promise<T> | T;
84
89
  type MaybePromisifyAllMethods<T> = {
@@ -86,6 +91,7 @@ type MaybePromisifyAllMethods<T> = {
86
91
  };
87
92
 
88
93
  type ESLintInitializeOptions = Pick<ESLint.Options, "overrideConfig">;
94
+ type IESLintTodoCoreLike = MaybePromisifyAllMethods<ESLintTodoCoreLike>;
89
95
  interface ESLintTodoCoreLike {
90
96
  /**
91
97
  * Build ESLint configs for the todo file.
@@ -97,12 +103,12 @@ interface ESLintTodoCoreLike {
97
103
  * - ESLint configs to disable todo rules.
98
104
  * - `null` if unsupported todo module passed.
99
105
  */
100
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): Linter.Config[];
106
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): Linter.Config[];
101
107
  /**
102
108
  * Build a todo object from the lint results.
103
109
  * @param lintResults LintResults from ESLint
104
110
  */
105
- buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestModule;
111
+ buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestTodoModule;
106
112
  /**
107
113
  * Get the path of current todo module.
108
114
  */
@@ -122,7 +128,6 @@ interface ESLintTodoCoreLike {
122
128
  resetTodoModule(): Promise<void>;
123
129
  writeTodoModule(todo: TodoModuleLike): Promise<void>;
124
130
  }
125
- type IESLintTodoCoreLike = MaybePromisifyAllMethods<ESLintTodoCoreLike>;
126
131
 
127
132
  /**
128
133
  * ESLintTodo API Entrypoint.
@@ -136,8 +141,8 @@ declare class ESLintTodoCore implements IESLintTodoCoreLike {
136
141
  * You should use `launchRemoteCore()` to create a remote worker and use `RemoteESLintTodoCore.readTodoModule()` instead.
137
142
  */
138
143
  _DO_NOT_USE_DIRECTLY_unsafeReadTodoModule(): Promise<TodoModuleLike>;
139
- buildESLintConfig(todoModule: SupportedModules, severity: RuleSeverity): Linter.Config[];
140
- buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestModule;
144
+ buildESLintConfig(todoModule: SupportedTodoModules, severity: RuleSeverity): Linter.Config[];
145
+ buildTodoFromLintResults(lintResults: ESLint.LintResult[]): LatestTodoModule;
141
146
  getTodoModulePath(): TodoFilePath;
142
147
  initializeESLint(options?: ESLintInitializeOptions): void;
143
148
  lint(): Promise<ESLint.LintResult[]>;
@@ -145,4 +150,4 @@ declare class ESLintTodoCore implements IESLintTodoCoreLike {
145
150
  writeTodoModule(todo: TodoModuleLike): Promise<void>;
146
151
  }
147
152
 
148
- export { ESLintTodoCore as E, type IESLintTodoCoreLike as I, type RuleSeverity as R, type SupportedModules as S };
153
+ export { ESLintTodoCore as E, type IESLintTodoCoreLike as I, type RuleSeverity as R, type SupportedTodoModules as S };
@@ -1,7 +1,7 @@
1
1
  import { ESLint } from 'eslint';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { writeFile } from 'node:fs/promises';
4
- import { relative, resolve } from 'pathe';
4
+ import { resolve, relative } from 'pathe';
5
5
  import { parseModule, generateCode } from 'magicast';
6
6
  import { defu } from 'defu';
7
7
  import { cwd } from 'node:process';
@@ -15,6 +15,8 @@ const generateTodoModuleCode = (eslintTodo) => {
15
15
  " * Auto generated file by eslint-todo. DO NOT EDIT MANUALLY.",
16
16
  " */",
17
17
  "",
18
+ "/* prettier-ignore */",
19
+ "// biome-ignore format: this is an auto-generated file",
18
20
  "export default {};"
19
21
  ].join("\n");
20
22
  const module_ = parseModule(js);
@@ -29,10 +31,21 @@ const generateTodoModuleCode = (eslintTodo) => {
29
31
  const optionsWithDefault = (options = {}) => {
30
32
  return defu(options, getDefaultOptions());
31
33
  };
32
- const getDefaultOptions = () => ({
34
+ const getDefaultOptions = () => ({ ...DEFAULT_OPTIONS });
35
+ const DEFAULT_OPTIONS = {
33
36
  cwd: cwd(),
34
37
  todoFile: ".eslint-todo.js"
35
- });
38
+ };
39
+
40
+ const resolveTodoModulePath = (options) => {
41
+ const { cwd, todoFile } = options;
42
+ const absolutePath = resolve(cwd, todoFile);
43
+ const relativePath = relative(cwd, absolutePath);
44
+ return {
45
+ absolute: absolutePath,
46
+ relative: relativePath
47
+ };
48
+ };
36
49
 
37
50
  const escapeGlobCharacters = (glob) => {
38
51
  return glob.replaceAll("\\", "\\\\").replaceAll("*", String.raw`\*`).replaceAll("?", String.raw`\?`).replaceAll("[", String.raw`\[`).replaceAll("]", String.raw`\]`).replaceAll("{", String.raw`\{`).replaceAll("}", String.raw`\}`).replaceAll(")", String.raw`\)`).replaceAll("(", String.raw`\(`).replaceAll("!", String.raw`\!`);
@@ -93,18 +106,6 @@ const TodoModuleV2Handler = {
93
106
  upgradeToNextVersion: () => false
94
107
  };
95
108
 
96
- const LATEST_MODULE_HANDLER = TodoModuleV2Handler;
97
-
98
- const resolveTodoModulePath = (options) => {
99
- const { cwd, todoFile } = options;
100
- const absolutePath = resolve(cwd, todoFile);
101
- const relativePath = relative(cwd, absolutePath);
102
- return {
103
- absolute: absolutePath,
104
- relative: relativePath
105
- };
106
- };
107
-
108
109
  const TodoModuleV1Handler = {
109
110
  version: 1,
110
111
  buildConfigsForESLint: (todo, severity) => {
@@ -158,6 +159,8 @@ const TodoModuleV1Handler = {
158
159
  }
159
160
  };
160
161
 
162
+ const LATEST_TODO_MODULE_HANDLER = TodoModuleV2Handler;
163
+
161
164
  const jiti = createJiti(import.meta.url, {
162
165
  interopDefault: true,
163
166
  moduleCache: false
@@ -197,7 +200,7 @@ class ESLintTodoCore {
197
200
  return [];
198
201
  }
199
202
  buildTodoFromLintResults(lintResults) {
200
- return LATEST_MODULE_HANDLER.buildTodoFromLintResults(
203
+ return LATEST_TODO_MODULE_HANDLER.buildTodoFromLintResults(
201
204
  lintResults,
202
205
  this.#options
203
206
  );
@@ -226,7 +229,7 @@ class ESLintTodoCore {
226
229
  }
227
230
  await writeFile(
228
231
  this.#todoFilePath.absolute,
229
- generateTodoModuleCode(LATEST_MODULE_HANDLER.getDefaultTodo())
232
+ generateTodoModuleCode(LATEST_TODO_MODULE_HANDLER.getDefaultTodo())
230
233
  );
231
234
  }
232
235
  async writeTodoModule(todo) {
@@ -235,4 +238,4 @@ class ESLintTodoCore {
235
238
  }
236
239
  }
237
240
 
238
- export { ESLintTodoCore as E, LATEST_MODULE_HANDLER as L, TodoModuleV1Handler as T, TodoModuleV2Handler as a, isNonEmptyString as i };
241
+ export { DEFAULT_OPTIONS as D, ESLintTodoCore as E, LATEST_TODO_MODULE_HANDLER as L, TodoModuleV1Handler as T, TodoModuleV2Handler as a, isNonEmptyString as i };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sushichan044/eslint-todo",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "module": "./dist/index.mjs",
6
6
  "files": [
@@ -42,28 +42,28 @@
42
42
  "valibot": "1.0.0-rc.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@eslint/config-inspector": "1.0.1",
46
- "@types/node": "22.13.8",
45
+ "@eslint/config-inspector": "1.0.2",
46
+ "@types/node": "22.13.10",
47
47
  "@virtual-live-lab/eslint-config": "2.2.17",
48
48
  "@virtual-live-lab/prettier-config": "2.0.16",
49
49
  "@virtual-live-lab/tsconfig": "2.1.17",
50
- "@vitest/coverage-v8": "3.0.7",
50
+ "@vitest/coverage-v8": "3.0.8",
51
51
  "@vitest/eslint-plugin": "1.1.36",
52
- "eslint": "9.21.0",
52
+ "eslint": "9.22.0",
53
53
  "eslint-flat-config-utils": "2.0.1",
54
54
  "eslint-plugin-import-access": "2.2.2",
55
55
  "eslint-plugin-unicorn": "57.0.0",
56
56
  "eslint-typegen": "2.0.0",
57
57
  "globals": "16.0.0",
58
58
  "pkg-pr-new": "0.0.40",
59
- "pnpm": "10.5.2",
59
+ "pnpm": "10.6.2",
60
60
  "prettier": "3.5.3",
61
61
  "release-it": "18.1.2",
62
62
  "release-it-pnpm": "4.6.4",
63
- "typescript": "5.7.3",
64
- "typescript-eslint": "8.25.0",
63
+ "typescript": "5.8.2",
64
+ "typescript-eslint": "8.26.1",
65
65
  "unbuild": "3.5.0",
66
- "vitest": "3.0.7"
66
+ "vitest": "3.0.8"
67
67
  },
68
68
  "engines": {
69
69
  "node": "^20.0.0 || ^22.0.0 || ^23.0.0"