Skip to content

Conversation

azu
Copy link
Member

@azu azu commented Jul 1, 2025

  • reduce ESLint warning

azu and others added 5 commits July 2, 2025 00:10
- Replace 'any' with 'unknown' for better type safety
- Add proper type imports and interfaces where needed
- Fix type assertions and property access patterns
- Maintain existing behavior while improving type safety
- Reduce ESLint @typescript-eslint/no-explicit-any warnings from 209 to 136

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Change DiffPart interface to type in diff.ts
- Change Visitor interface to type in ast-traverse index.ts
- Maintain consistency with project's preference for type over interface

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add type guard functions to safely check object properties before access
- Replace `as Record<string, unknown>` with proper type guards
- Improve type safety while maintaining functionality
- Reduce reliance on `as` type assertions for better runtime safety

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix AnyTxtNode to Record<string, unknown> casting in ast-traverse
- Add null coalescing for plugin options in textlint-tester
- Add helper function for creating test TextlintMessage objects
- Remove unused @ts-expect-error directive
- Improve type safety while maintaining functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
azu and others added 2 commits July 2, 2025 08:48
- Add outDir and declarationDir to tsconfig.json for organized build output
- Update .gitignore to exclude dist/ directory instead of individual files
- Prevent future commits of generated TypeScript compilation artifacts

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix all TypeScript compilation errors from type-check
- Add createTestMessage helper functions for test type safety
- Replace unsafe type assertions with double assertions
- Improve type guards in config-loader for unknown values
- Fix import path for ES modules compatibility
- Support both TextlintPluginOptions and boolean in TestPluginSet
- Remove unused imports and add proper type annotations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

github-actions bot commented Jul 2, 2025

PR Preview Action v1.6.1
Preview removed because the pull request was closed.
2025-07-02 14:00 UTC

azu

This comment was marked as outdated.

azu

This comment was marked as outdated.

…patibility

Replace this.skip() with context.skip() according to Vitest API:
https://vitest.dev/api/#test-skip

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Comment on lines -142 to +159
options?: any;
options?: TextlintRuleOptions;
description?: string;
errors: TesterErrorDefinition[];
};

export type TestRuleSet = {
rules: { [index: string]: TextlintRuleModule };
rulesOptions: any;
rulesOptions: Record<string, TextlintRuleOptions>;
};

export type TestPluginSet = {
plugins: { [index: string]: TextlintPluginCreator };
pluginOptions: any;
pluginOptions: Record<string, TextlintPluginOptions | boolean>;
Copy link
Member Author

@azu azu Jul 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed pluginOptions type from any to Record<string, TextlintPluginOptions | boolean>

Reason: Plugin options can be either configuration objects or boolean values for enable/disable. The TestConfigPlugin type already supports options?: TextlintPluginOptions | boolean, but TestPluginSet was not aligned with this. This change ensures type consistency between the plugin configuration types and resolves TypeScript compilation errors when boolean values are passed as plugin options.

Impact: Enables proper type checking for both object and boolean plugin configurations without breaking existing functionality.

Set line and column to undefined for test cases that expect line 0, col 0 output.
This matches the junit formatter behavior where missing line/column defaults to 0.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@azu azu added the Type: Refactoring A code change that neither fixes a bug nor adds a feature label Jul 2, 2025
@azu azu marked this pull request as ready for review July 2, 2025 13:55
@azu azu merged commit da70632 into master Jul 2, 2025
18 checks passed
@azu azu deleted the eslint branch July 2, 2025 14:00
@github-actions github-actions bot mentioned this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Refactoring A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant