Skip to content

Commit

Permalink
Update prettier and prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 11, 2023
1 parent 2bf1378 commit bd05faa
Show file tree
Hide file tree
Showing 65 changed files with 508 additions and 508 deletions.
4 changes: 2 additions & 2 deletions benchmark/static/static.tsx
Expand Up @@ -20,8 +20,8 @@ function App() {
setItems(previousItems => [
...previousItems,
{
id: previousItems.length
}
id: previousItems.length,
},
]);

timer = setTimeout(run, 10);
Expand Down
18 changes: 9 additions & 9 deletions examples/jest/jest.tsx
Expand Up @@ -16,7 +16,7 @@ const paths = [
'tests/delete-profile.js',
'tests/posts.js',
'tests/post.js',
'tests/comments.js'
'tests/comments.js',
];

type State = {
Expand All @@ -38,7 +38,7 @@ class Jest extends React.Component<Record<string, unknown>, State> {
this.state = {
startTime: Date.now(),
completedTests: [],
runningTests: []
runningTests: [],
};
}

Expand Down Expand Up @@ -85,24 +85,24 @@ class Jest extends React.Component<Record<string, unknown>, State> {
...previousState.runningTests,
{
status: 'runs',
path
}
]
path,
},
],
}));

await delay(1000 * Math.random());

this.setState(previousState => ({
runningTests: previousState.runningTests.filter(
test => test.path !== path
test => test.path !== path,
),
completedTests: [
...previousState.completedTests,
{
status: Math.random() < 0.5 ? 'pass' : 'fail',
path
}
]
path,
},
],
}));
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/static/static.tsx
Expand Up @@ -19,8 +19,8 @@ function Example() {
...previousTests,
{
id: previousTests.length,
title: `Test #${previousTests.length + 1}`
}
title: `Test #${previousTests.length + 1}`,
},
]);

timer = setTimeout(run, 100);
Expand Down
2 changes: 1 addition & 1 deletion examples/subprocess-output/subprocess-output.tsx
Expand Up @@ -11,7 +11,7 @@ function SubprocessOutput() {
const subProcess = childProcess.spawn('npm', [
'run',
'example',
'examples/jest'
'examples/jest',
]);

subProcess.stdout.on('data', (newOutput: Buffer) => {
Expand Down
2 changes: 1 addition & 1 deletion examples/suspense/suspense.tsx
Expand Up @@ -41,5 +41,5 @@ function Fallback() {
render(
<React.Suspense fallback={<Fallback />}>
<Example />
</React.Suspense>
</React.Suspense>,
);
2 changes: 1 addition & 1 deletion examples/table/table.tsx
Expand Up @@ -7,7 +7,7 @@ const users = Array.from({length: 10})
.map((_, index) => ({
id: index,
name: faker.internet.userName(),
email: faker.internet.email()
email: faker.internet.email(),
}));

function Table() {
Expand Down
2 changes: 1 addition & 1 deletion examples/use-focus-with-id/use-focus-with-id.tsx
Expand Up @@ -5,7 +5,7 @@ import {
Text,
useFocus,
useInput,
useFocusManager
useFocusManager,
} from '../../src/index.js';

function Focus() {
Expand Down
12 changes: 6 additions & 6 deletions media/demo.js
Expand Up @@ -7,7 +7,7 @@ class Counter extends React.PureComponent {
super();

this.state = {
i: 0
i: 0,
};
}

Expand All @@ -18,20 +18,20 @@ class Counter extends React.PureComponent {
React.createElement(
Box,
{},
React.createElement(Text, {color: 'blue'}, '~/Projects/ink ')
React.createElement(Text, {color: 'blue'}, '~/Projects/ink '),
),
React.createElement(
Box,
{},
React.createElement(Text, {color: 'magenta'}, '❯ '),
React.createElement(Text, {color: 'green'}, 'node '),
React.createElement(Text, {}, 'media/example')
React.createElement(Text, {}, 'media/example'),
),
React.createElement(
Text,
{color: 'green'},
`${this.state.i} tests passed`
)
`${this.state.i} tests passed`,
),
);
}

Expand All @@ -42,7 +42,7 @@ class Counter extends React.PureComponent {
}

this.setState(previousState => ({
i: previousState.i + 1
i: previousState.i + 1,
}));
}, 100);
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -82,7 +82,7 @@
"@types/sinon": "^10.0.20",
"@types/stack-utils": "^2.0.2",
"@types/ws": "^8.5.10",
"@vdemedes/prettier-config": "^1.0.1",
"@vdemedes/prettier-config": "^2.0.1",
"ava": "^5.1.1",
"boxen": "^7.0.1",
"delay": "^6.0.0",
Expand All @@ -92,7 +92,7 @@
"ms": "^2.1.3",
"node-pty": "^1.0.0",
"p-queue": "^8.0.0",
"prettier": "^2.0.4",
"prettier": "^3.1.1",
"react": "^18.0.0",
"react-devtools-core": "^5.0.0",
"sinon": "^17.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/colorize.ts
Expand Up @@ -12,7 +12,7 @@ const isNamedColor = (color: string): color is ForegroundColorName => {
const colorize = (
str: string,
color: string | undefined,
type: ColorType
type: ColorType,
): string => {
if (!color) {
return str;
Expand Down
44 changes: 22 additions & 22 deletions src/components/App.tsx
Expand Up @@ -50,7 +50,7 @@ export default class App extends PureComponent<Props, State> {
isFocusEnabled: true,
activeFocusId: undefined,
focusables: [],
error: undefined
error: undefined,
};

// Count how many components enabled raw mode to avoid disabling
Expand All @@ -69,7 +69,7 @@ export default class App extends PureComponent<Props, State> {
<AppContext.Provider
// eslint-disable-next-line react/jsx-no-constructed-context-values
value={{
exit: this.handleExit
exit: this.handleExit,
}}
>
<StdinContext.Provider
Expand All @@ -81,21 +81,21 @@ export default class App extends PureComponent<Props, State> {
// eslint-disable-next-line @typescript-eslint/naming-convention
internal_exitOnCtrlC: this.props.exitOnCtrlC,
// eslint-disable-next-line @typescript-eslint/naming-convention
internal_eventEmitter: this.internal_eventEmitter
internal_eventEmitter: this.internal_eventEmitter,
}}
>
<StdoutContext.Provider
// eslint-disable-next-line react/jsx-no-constructed-context-values
value={{
stdout: this.props.stdout,
write: this.props.writeToStdout
write: this.props.writeToStdout,
}}
>
<StderrContext.Provider
// eslint-disable-next-line react/jsx-no-constructed-context-values
value={{
stderr: this.props.stderr,
write: this.props.writeToStderr
write: this.props.writeToStderr,
}}
>
<FocusContext.Provider
Expand All @@ -110,7 +110,7 @@ export default class App extends PureComponent<Props, State> {
disableFocus: this.disableFocus,
focusNext: this.focusNext,
focusPrevious: this.focusPrevious,
focus: this.focus
focus: this.focus,
}}
>
{this.state.error ? (
Expand Down Expand Up @@ -149,11 +149,11 @@ export default class App extends PureComponent<Props, State> {
if (!this.isRawModeSupported()) {
if (stdin === process.stdin) {
throw new Error(
'Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported'
'Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported',
);
} else {
throw new Error(
'Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported'
'Raw mode is not supported on the stdin provided to Ink.\nRead about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported',
);
}
}
Expand Down Expand Up @@ -199,7 +199,7 @@ export default class App extends PureComponent<Props, State> {
// Reset focus when there's an active focused component on Esc
if (input === escape && this.state.activeFocusId) {
this.setState({
activeFocusId: undefined
activeFocusId: undefined,
});
}

Expand All @@ -224,20 +224,20 @@ export default class App extends PureComponent<Props, State> {

enableFocus = (): void => {
this.setState({
isFocusEnabled: true
isFocusEnabled: true,
});
};

disableFocus = (): void => {
this.setState({
isFocusEnabled: false
isFocusEnabled: false,
});
};

focus = (id: string): void => {
this.setState(previousState => {
const hasFocusableId = previousState.focusables.some(
focusable => focusable?.id === id
focusable => focusable?.id === id,
);

if (!hasFocusableId) {
Expand All @@ -254,7 +254,7 @@ export default class App extends PureComponent<Props, State> {
const nextFocusableId = this.findNextFocusable(previousState);

return {
activeFocusId: nextFocusableId ?? firstFocusableId
activeFocusId: nextFocusableId ?? firstFocusableId,
};
});
};
Expand All @@ -266,7 +266,7 @@ export default class App extends PureComponent<Props, State> {
const previousFocusableId = this.findPreviousFocusable(previousState);

return {
activeFocusId: previousFocusableId ?? lastFocusableId
activeFocusId: previousFocusableId ?? lastFocusableId,
};
});
};
Expand All @@ -285,9 +285,9 @@ export default class App extends PureComponent<Props, State> {
...previousState.focusables,
{
id,
isActive: true
}
]
isActive: true,
},
],
};
});
};
Expand All @@ -300,7 +300,7 @@ export default class App extends PureComponent<Props, State> {
: previousState.activeFocusId,
focusables: previousState.focusables.filter(focusable => {
return focusable.id !== id;
})
}),
}));
};

Expand All @@ -313,9 +313,9 @@ export default class App extends PureComponent<Props, State> {

return {
id,
isActive: true
isActive: true,
};
})
}),
}));
};

Expand All @@ -332,9 +332,9 @@ export default class App extends PureComponent<Props, State> {

return {
id,
isActive: false
isActive: false,
};
})
}),
}));
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/AppContext.ts
Expand Up @@ -12,7 +12,7 @@ export type Props = {
*/
// eslint-disable-next-line @typescript-eslint/naming-convention
const AppContext = createContext<Props>({
exit() {}
exit() {},
});

AppContext.displayName = 'InternalAppContext';
Expand Down
6 changes: 3 additions & 3 deletions src/components/Box.tsx
Expand Up @@ -16,13 +16,13 @@ const Box = forwardRef<DOMElement, PropsWithChildren<Props>>(
style={{
...style,
overflowX: style.overflowX ?? style.overflow ?? 'visible',
overflowY: style.overflowY ?? style.overflow ?? 'visible'
overflowY: style.overflowY ?? style.overflow ?? 'visible',
}}
>
{children}
</ink-box>
);
}
},
);

Box.displayName = 'Box';
Expand All @@ -31,7 +31,7 @@ Box.defaultProps = {
flexWrap: 'nowrap',
flexDirection: 'row',
flexGrow: 0,
flexShrink: 1
flexShrink: 1,
};

export default Box;
2 changes: 1 addition & 1 deletion src/components/ErrorOverview.tsx
Expand Up @@ -14,7 +14,7 @@ const cleanupPath = (path: string | undefined): string | undefined => {

const stackUtils = new StackUtils({
cwd: cwd(),
internals: StackUtils.nodeInternals()
internals: StackUtils.nodeInternals(),
});

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/FocusContext.ts
Expand Up @@ -24,7 +24,7 @@ const FocusContext = createContext<Props>({
disableFocus() {},
focusNext() {},
focusPrevious() {},
focus() {}
focus() {},
});

FocusContext.displayName = 'InternalFocusContext';
Expand Down

0 comments on commit bd05faa

Please sign in to comment.