chore: migrate @typedefjsdoc to @import by yashtech00 · Pull Request #729 · prettier/eslint-plugin-prettier (original) (raw)

test/prettier.mjs (5)

294-294: Properly formatted JSDoc comment.

The multi-line @see comment has been condensed into a single line, improving readability while maintaining the reference link.


387-392: Well-formatted JSDoc block.

The JSDoc comment for loadInvalidFixture function has been reformatted to be more concise and readable, without changing the meaning or content.


422-424: Improved JSDoc formatting.

The JSDoc comment for getPrettierRcJsFilename function has been reformatted to be more concise and readable.


435-438: Good type annotation with @import syntax.

The addition of proper type annotation for the eslint variable using both @type and @import syntax from ESLint correctly implements the JSDoc import pattern requested in the PR.


441-447: Correctly implemented JSDoc import for function parameter.

The type annotation for the runFixture function's parameter now uses the proper @import syntax to reference the Linter type from ESLint, which aligns with the PR's goal.

eslint-plugin-prettier.js (11)

9-12: Excellent migration from @typedef to @import syntax.

The code properly consolidates multiple individual @typedef imports into grouped @import statements importing types from 'eslint', 'prettier', and 'prettier-linter-helpers'. This implementation exactly follows the requested pattern of using JSDoc @import syntax rather than converting to TypeScript files.


14-28: Well-structured Options typedef with explicit property types.

The Options typedef has been reformatted into a clean multiline JSDoc with explicit property types referencing the imported ESLint types. The PrettierFormat typedef is also reformatted to multiline style for better readability.


53-54: Proper type annotation for prettierFormat variable.

Added a JSDoc type annotation for the lazily-loaded Prettier format function, improving type safety.


67-71: Improved type safety with explicit AST.Range type.

The range variable's type annotation was changed from an inline cast to a proper JSDoc type declaration, improving code readability and type safety.


93-94: Good type annotation for the plugin object.

Added a JSDoc type annotation for the eslintPluginPrettier object, improving type safety.


142-146: Enhanced type safety for options extraction.

The option extraction in the create method was refactored to assign context.options[1] to a typed options variable, improving clarity and type safety. The fileInfoOptions variable is also properly typed.


150-152: Updated to use modern ESLint API with fallback.

The code now properly uses the newer context.sourceCode property with fallback to the deprecated context.getSourceCode() method, and includes an explicit type assertion for better type safety.


179-185: Improved type annotations for Prettier options and parser.

Added proper type annotations for eslintPrettierOptions and parser variables, increasing type safety while maintaining the same functionality.


194-195: Added missing type annotation.

Added a type annotation for the prettierSource variable that was previously missing, improving code clarity and type safety.


221-227: Enhanced error type definition for better error handling.

The error object now has a more precise type definition that includes codeFrame and loc properties, improving type safety and making the error handling more robust.


253-257: Added proper type casting for context parameter.

The reportDifference function call now explicitly casts context to Rule.RuleContext, ensuring type safety and preventing potential type errors.