Skip to content

Commit

Permalink
Restore eslint rule to prefer import type (#4938)
Browse files Browse the repository at this point in the history
<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

Thanks to @bartlomiejbloniarz who noticed it, the rule was (iirc)
accidentally removed in #4672.

## Test plan

🧨
  • Loading branch information
tjzel committed Aug 18, 2023
1 parent 53d79b2 commit 8992a60
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,9 @@ module.exports = {
// '@typescript-eslint/no-duplicate-type-constituents': 'error', // TODO this currently breaks ESLint for VSCode in plugin
eqeqeq: 'error',
'no-unreachable': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' },
],
},
};
2 changes: 1 addition & 1 deletion plugin/build/plugin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/src/buildWorkletString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { strict as assert } from 'assert';
import * as convertSourceMap from 'convert-source-map';
import * as fs from 'fs';
import { isRelease } from './utils';
import { WorkletizableFunction } from './types';
import type { WorkletizableFunction } from './types';

const MOCK_SOURCE_MAP = 'mock source map';

Expand Down
2 changes: 1 addition & 1 deletion plugin/src/isGestureHandlerEventCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
isMemberExpression,
isExpression,
} from '@babel/types';
import { ExplicitWorklet } from './types';
import type { ExplicitWorklet } from './types';

const gestureHandlerGestureObjects = new Set([
// from https://github.com/software-mansion/react-native-gesture-handler/blob/new-api/src/handlers/gestures/gestureObjects.ts
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BabelFile } from '@babel/core';
import {
import type { BabelFile } from '@babel/core';
import type {
FunctionDeclaration,
FunctionExpression,
ObjectMethod,
Expand Down
2 changes: 1 addition & 1 deletion src/JSPropUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
findNodeHandle,
} from 'react-native';
import { nativeShouldBeMock } from './reanimated2/PlatformChecker';
import { StyleProps } from './reanimated2';
import type { StyleProps } from './reanimated2';

interface ListenerData {
viewTag: number;
Expand Down
2 changes: 1 addition & 1 deletion src/reanimated2/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

/* eslint no-bitwise: 0 */
import { StyleProps } from './commonTypes';
import type { StyleProps } from './commonTypes';
import { makeShareable } from './core';
import { isAndroid, isWeb } from './PlatformChecker';

Expand Down
2 changes: 1 addition & 1 deletion src/reanimated2/NativeMethods.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MeasuredDimensions, ShadowNodeWrapper } from './commonTypes';
import type { MeasuredDimensions, ShadowNodeWrapper } from './commonTypes';
import {
isChromeDebugger,
isJest,
Expand Down
2 changes: 1 addition & 1 deletion src/reanimated2/SetNativeProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ShadowNodeWrapper, StyleProps } from './commonTypes';
import type { ShadowNodeWrapper, StyleProps } from './commonTypes';
import {
isChromeDebugger,
isJest,
Expand Down
6 changes: 4 additions & 2 deletions src/reanimated2/animation/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { HigherOrderAnimation, StyleLayoutAnimation } from './commonTypes';
import type { HigherOrderAnimation, StyleLayoutAnimation } from './commonTypes';
import type { ParsedColorArray } from '../Colors';
import {
isColor,
Expand All @@ -17,9 +17,11 @@ import {
ReduceMotion,
} from '../commonTypes';
import NativeReanimatedModule from '../NativeReanimated';
import {
import type {
AffineMatrixFlat,
AffineMatrix,
} from './transformationMatrix/matrixUtils';
import {
flatten,
multiplyMatrices,
scaleMatrix,
Expand Down

0 comments on commit 8992a60

Please sign in to comment.