Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Enable TSDoc and JSDoc formatting #6484

Merged
merged 4 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module.exports = {
'import',
'jest',
'@typescript-eslint',
'eslint-plugin-tsdoc',
'tsdoc',
],
env: {
'react-native/react-native': true,
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
2 changes: 1 addition & 1 deletion apps/common-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"eslint": "^8.57.0",
"eslint-plugin-reanimated": "workspace:*",
"patch-package": "^8.0.0",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react": "18.3.1",
"react-native": "0.75.2",
"react-native-gesture-handler": "2.18.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useEvent, useHandler } from 'react-native-reanimated';
import type { ReanimatedEvent } from 'react-native-reanimated';

export function useAnimatedPagerScrollHandler<
TContext extends Record<string, unknown>
TContext extends Record<string, unknown>,
>(
handlers: {
onPageScroll: (
Expand Down Expand Up @@ -37,7 +37,7 @@ export function useAnimatedPagerScrollHandler<
}

export function useAnimatedPagerScrollStateHandler<
TContext extends Record<string, unknown>
TContext extends Record<string, unknown>,
>(
handlers: {
onPageScrollStateChanged: (
Expand Down Expand Up @@ -70,7 +70,7 @@ export function useAnimatedPagerScrollStateHandler<
}

export function useAnimatedPagerSelectedPageHandler<
TContext extends Record<string, unknown>
TContext extends Record<string, unknown>,
>(
handlers: {
onPageSelected: (
Expand Down
20 changes: 10 additions & 10 deletions apps/common-app/src/examples/LayoutAnimations/ChangeTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ function List() {
layout: undefined,
}
: theme
? {
entering: RotateInUpRight,
exiting: RotateOutUpLeft,
layout: Layout.easing(Easing.exp).delay(200),
}
: {
entering: SlideInRight,
exiting: SlideOutLeft,
layout: Layout.springify().delay(200),
},
? {
entering: RotateInUpRight,
exiting: RotateOutUpLeft,
layout: Layout.easing(Easing.exp).delay(200),
}
: {
entering: SlideInRight,
exiting: SlideOutLeft,
layout: Layout.springify().delay(200),
},
[disabled, theme]
);

Expand Down
104 changes: 52 additions & 52 deletions apps/common-app/src/examples/LiquidSwipe/Weave.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,84 +99,84 @@ export default function Weave({
L${maskWidth} ${curveStartY}
C${maskWidth} ${curveStartY - horRadius.value * 0.1346194756}
${maskWidth - horRadius.value * 0.05341339583} ${
curveStartY - vertRadius.value * 0.2412779634
}
curveStartY - vertRadius.value * 0.2412779634
}
${maskWidth - horRadius.value * 0.1561501458} ${
curveStartY - vertRadius.value * 0.3322374268
}
curveStartY - vertRadius.value * 0.3322374268
}
C${maskWidth - horRadius.value * 0.2361659167} ${
curveStartY - vertRadius.value * 0.4030805244
}
curveStartY - vertRadius.value * 0.4030805244
}
${maskWidth - horRadius.value * 0.3305285625} ${
curveStartY - vertRadius.value * 0.4561193293
}
curveStartY - vertRadius.value * 0.4561193293
}
${maskWidth - horRadius.value * 0.5012484792} ${
curveStartY - vertRadius.value * 0.5350576951
}
curveStartY - vertRadius.value * 0.5350576951
}
C${maskWidth - horRadius.value * 0.515878125} ${
curveStartY - vertRadius.value * 0.5418222317
}
curveStartY - vertRadius.value * 0.5418222317
}
${maskWidth - horRadius.value * 0.5664134792} ${
curveStartY - vertRadius.value * 0.5650349878
}
curveStartY - vertRadius.value * 0.5650349878
}
${maskWidth - horRadius.value * 0.574934875} ${
curveStartY - vertRadius.value * 0.5689655122
}
curveStartY - vertRadius.value * 0.5689655122
}
C${maskWidth - horRadius.value * 0.7283715208} ${
curveStartY - vertRadius.value * 0.6397387195
}
curveStartY - vertRadius.value * 0.6397387195
}
${maskWidth - horRadius.value * 0.8086618958} ${
curveStartY - vertRadius.value * 0.6833456585
}
curveStartY - vertRadius.value * 0.6833456585
}
${maskWidth - horRadius.value * 0.8774032292} ${
curveStartY - vertRadius.value * 0.7399037439
}
curveStartY - vertRadius.value * 0.7399037439
}
C${maskWidth - horRadius.value * 0.9653464583} ${
curveStartY - vertRadius.value * 0.8122605122
}
curveStartY - vertRadius.value * 0.8122605122
}
${maskWidth - horRadius.value} ${
curveStartY - vertRadius.value * 0.8936183659
}
curveStartY - vertRadius.value * 0.8936183659
}
${maskWidth - horRadius.value} ${curveStartY - vertRadius.value}
C${maskWidth - horRadius.value} ${
curveStartY - vertRadius.value * 1.100142878
}
curveStartY - vertRadius.value * 1.100142878
}
${maskWidth - horRadius.value * 0.9595746667} ${
curveStartY - vertRadius.value * 1.1887991951
}
curveStartY - vertRadius.value * 1.1887991951
}
${maskWidth - horRadius.value * 0.8608411667} ${
curveStartY - vertRadius.value * 1.270484439
}
curveStartY - vertRadius.value * 1.270484439
}
C${maskWidth - horRadius.value * 0.7852123333} ${
curveStartY - vertRadius.value * 1.3330544756
}
curveStartY - vertRadius.value * 1.3330544756
}
${maskWidth - horRadius.value * 0.703382125} ${
curveStartY - vertRadius.value * 1.3795848049
}
curveStartY - vertRadius.value * 1.3795848049
}
${maskWidth - horRadius.value * 0.5291125625} ${
curveStartY - vertRadius.value * 1.4665102805
}
curveStartY - vertRadius.value * 1.4665102805
}
C${maskWidth - horRadius.value * 0.5241858333} ${
curveStartY - vertRadius.value * 1.4689677195
}
curveStartY - vertRadius.value * 1.4689677195
}
${maskWidth - horRadius.value * 0.505739125} ${
curveStartY - vertRadius.value * 1.4781625854
}
curveStartY - vertRadius.value * 1.4781625854
}
${maskWidth - horRadius.value * 0.5015305417} ${
curveStartY - vertRadius.value * 1.4802616098
}
curveStartY - vertRadius.value * 1.4802616098
}
C${maskWidth - horRadius.value * 0.3187486042} ${
curveStartY - vertRadius.value * 1.5714239024
}
curveStartY - vertRadius.value * 1.5714239024
}
${maskWidth - horRadius.value * 0.2332057083} ${
curveStartY - vertRadius.value * 1.6204116463
}
curveStartY - vertRadius.value * 1.6204116463
}
${maskWidth - horRadius.value * 0.1541165417} ${
curveStartY - vertRadius.value * 1.687403
}
curveStartY - vertRadius.value * 1.687403
}
C${maskWidth - horRadius.value * 0.0509933125} ${
curveStartY - vertRadius.value * 1.774752061
}
curveStartY - vertRadius.value * 1.774752061
}
${maskWidth} ${curveStartY - vertRadius.value * 1.8709256829}
${maskWidth} ${curveStartY - vertRadius.value * 2}
L${maskWidth} ${0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import type { SingleViewSnapshot } from '../TestRunner/UpdatesContainer';
export class Matchers {
private _negation = false;
// eslint-disable-next-line no-useless-constructor
constructor(private _currentValue: TestValue, private _testCase: TestCase) {}
constructor(
private _currentValue: TestValue,
private _testCase: TestCase,
) {}

get not() {
this._negation = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ function getTheme(theme: boolean, disabled: boolean) {
const transition = disabled
? undefined
: theme
? customTransition
: new SharedTransition();
? customTransition
: new SharedTransition();

return { style, transition };
}
Expand Down
5 changes: 3 additions & 2 deletions apps/common-app/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
import React from 'react';

/**
* We need to augment react types because rn for web provides non-standard way of measuring components by injecting `measure` method to the ref.
* We need to augment react types because rn for web provides non-standard way
* of measuring components by injecting `measure` method to the ref.
*
* Reference:
* https://github.com/necolas/react-native-web/blob/c47bec7b93d6a3b7c31bbc8bb2e4acd117b79bfc/packages/react-native-web/src/modules/usePlatformMethods/index.js#L69
* https://github.com/necolas/react-native-web/blob/c47bec7b93d6a3b7c31bbc8bb2e4acd117b79bfc/packages/react-native-web/src/exports/UIManager/index.js#L63
* */
*/

declare module 'react' {
interface Component {
Expand Down
2 changes: 1 addition & 1 deletion apps/fabric-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"eslint": "^8.57.0",
"jest": "^29.6.3",
"patch-package": "^8.0.0",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react-test-renderer": "18.3.1",
"typescript": "~5.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/macos-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"babel-jest": "^29.6.3",
"eslint": "^8.57.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/next-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"cypress": "^13.2.0",
"eslint": "^8.57.0",
"next-compose-plugins": "^2.2.1",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"start-server-and-test": "^2.0.1"
}
}
2 changes: 1 addition & 1 deletion apps/paper-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"eslint": "^8.57.0",
"jest": "^29.6.3",
"patch-package": "^8.0.0",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react-test-renderer": "18.3.1",
"typescript": "~5.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/tvos-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"babel-jest": "^29.6.3",
"eslint": "^8.57.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/web-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@expo/metro-runtime": "^3.2.1",
"@types/eslint": "^8",
"eslint": "^8.57.0",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"serve": "^14.2.3",
"typescript": "~5.3.0"
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"eslint": "^8.57.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"prettier-plugin-jsdoc": "^1.3.0",
"typescript": "~5.3.0"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-reanimated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"esbuild": "^0.20.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"ts-jest": "^29.1.2",
"typescript": "~5.3.0"
}
Expand Down
13 changes: 9 additions & 4 deletions packages/react-native-reanimated/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
module.exports = {
extends: ['../../.eslintrc.js'],
plugins: ['eslint-plugin-reanimated'],
overrides: [
{
files: ['./src/**/*.ts', './src/**/*.tsx'],
plugins: ['reanimated'],
rules: {
'reanimated/use-reanimated-error': 'error',
},
},
],
ignorePatterns: ['lib'],
rules: {
'reanimated/use-reanimated-error': 'error',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function UseAnimatedPropsTest() {

function UseAnimatedPropsTestView1() {
const animatedProps = useAnimatedProps(
() => ({ pointerEvents: 'none' } as const)
() => ({ pointerEvents: 'none' }) as const
);
return <Animated.View animatedProps={animatedProps} />;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-reanimated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
"eslint-plugin-tsdoc": "^0.2.17",
"jest": "^29.0.0",
"madge": "^5.0.1",
"prettier": "2.8.8",
"prettier": "^3.3.3",
"react": "18.3.1",
"react-native": "0.75.2",
"react-native-builder-bob": "^0.18.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-reanimated/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"esbuild": "^0.17.11",
"eslint": "^8.0.0-0",
"eslint-plugin-standard": "^5.0.0",
"prettier": "^2.5.1",
"prettier": "^3.3.3",
"tsc-watch": "^6.0.0",
"typescript": "^4.1.3"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ const functionArgsToWorkletize = new Map([
['executeOnUIRuntimeSync', [0]],
]);

/**
*
* @returns `true` if the function was workletized, `false` otherwise.
*/
/** @returns `true` if the function was workletized, `false` otherwise. */
export function processIfAutoworkletizableCallback(
path: NodePath<WorkletizableFunction>,
state: ReanimatedPluginPass
Expand All @@ -87,8 +84,8 @@ export function processCalleesAutoworkletizableCallbacks(
'name' in callee
? callee.name
: 'property' in callee && 'name' in callee.property
? callee.property.name
: undefined;
? callee.property.name
: undefined;
if (name === undefined) {
return;
}
Expand Down
Loading
Loading