Skip to content

Commit f007b3f

Browse files
authored
Migrate codebase to TypeScript and update configurations (facebook#4381)
* refactor: migrate JavaScript files to TypeScript and update configurations * refactor: update import statements to use single quotes and enhance linting configurations * refactor: update ESLint configuration to use TypeScript parser and convert PrismTheme to ES module export * refactor: update lint:format script to include JSX and TypeScript file extensions * refactor: update prettier script to include JSX and TypeScript file extensions * refactor: update TypeScript configurations and improve type annotations in blog components * refactor: remove broken hover effect from clean button in custom theme styles * refactor: fix metadata usage in DocsRating and improve TypeScript types in various components * refactor: adjust TypeScript type declaration for global `ga` function in DocsRating * refactor: simplify Section component props using React.PropsWithChildren * refactor: add TypeScript types for Google Analytics and clean up global declaration in DocsRating * refactor: enhance TypeScript types for user authentication and streamline related components * refactor: update Prettier commands in package.json for improved file matching * refactor: update Prettier command in package.json for improved TypeScript file matching * refactor: update Prettier commands in package.json for improved file matching * refactor: update Prettier command for improved file matching and standardize package versions * set json extension on prettier config file
1 parent 7f6f2ee commit f007b3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1463
-830
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"extends": ["plugin:mdx/recommended"]
1313
}
1414
],
15+
"parser": "@typescript-eslint/parser",
1516
"parserOptions": {
1617
"sourceType": "module",
1718
"ecmaVersion": "latest",

.prettierrc renamed to .prettierrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"overrides": [
33
{
4-
"files": "*.js",
4+
"files": ["*.js", "*.jsx", "*.ts", "*.tsx"],
55
"options": {
66
"arrowParens": "avoid",
77
"bracketSpacing": false,

docs/_fabric-native-components.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import IOSContent from "./fabric-native-components-ios.md";
3-
import AndroidContent from "./fabric-native-components-android.md";
1+
import React from 'react';
2+
import IOSContent from './fabric-native-components-ios.md';
3+
import AndroidContent from './fabric-native-components-android.md';
44

55
export function FabricNativeComponentsIOS() {
66
return <IOSContent />;

docs/_turbo-native-modules-components.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React from "react";
2-
import IOSContent from "./turbo-native-modules-ios.md";
3-
import AndroidContent from "./turbo-native-modules-android.md";
1+
import React from 'react';
2+
import IOSContent from './turbo-native-modules-ios.md';
3+
import AndroidContent from './turbo-native-modules-android.md';
44

55
export function TurboNativeModulesIOS() {
66
return <IOSContent />;

plugins/remark-lint-no-dead-urls/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"src/*"
1515
],
1616
"scripts": {
17-
"prettier": "prettier --write \"{src/**/*.js,tests/**/*.js,*.md}\"",
17+
"prettier": "prettier --write '{src,tests}/**/*.{md,js,jsx,ts,tsx}'",
1818
"test": "yarn node --experimental-vm-modules $(yarn bin jest)"
1919
},
2020
"dependencies": {

plugins/remark-snackplayer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"src"
1616
],
1717
"scripts": {
18-
"prettier": "prettier --write \"{src/**/*.js,tests/**/*.js,*.md}\"",
18+
"prettier": "prettier --write '{src,tests}/**/*.{md,js,jsx,ts,tsx}'",
1919
"test": "yarn tape tests/index.js"
2020
},
2121
"dependencies": {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ const DocsRating = ({label}) => {
3737
Is this page useful?
3838
<svg
3939
className="i_thumbsup"
40-
alt="Like"
40+
aria-label="Like"
4141
onClick={() => giveFeedback(1)}
4242
xmlns="http://www.w3.org/2000/svg"
4343
viewBox="0 0 81.13 89.76">
4444
<path d="M22.9 6a18.57 18.57 0 002.67 8.4 25.72 25.72 0 008.65 7.66c3.86 2 8.67 7.13 13.51 11 3.86 3.11 8.57 7.11 11.54 8.45s13.59.26 14.64 1.17c1.88 1.63 1.55 9-.11 15.25-1.61 5.86-5.96 10.55-6.48 16.86-.4 4.83-2.7 4.88-10.93 4.88h-1.35c-3.82 0-8.24 2.93-12.92 3.62a68 68 0 01-9.73.5c-3.57 0-7.86-.08-13.25-.08-3.56 0-4.71-1.83-4.71-4.48h8.42a3.51 3.51 0 000-7H12.28a2.89 2.89 0 01-2.88-2.88 1.91 1.91 0 01.77-1.78h16.46a3.51 3.51 0 000-7H12.29c-3.21 0-4.84-1.83-4.84-4a6.41 6.41 0 011.17-3.78h19.06a3.5 3.5 0 100-7H9.75A3.51 3.51 0 016 42.27a3.45 3.45 0 013.75-3.48h13.11c5.61 0 7.71-3 5.71-5.52-4.43-4.74-10.84-12.62-11-18.71-.15-6.51 2.6-7.83 5.36-8.56m0-6a6.18 6.18 0 00-1.53.2c-6.69 1.77-10 6.65-9.82 14.5.08 5.09 2.99 11.18 8.52 18.09H9.74a9.52 9.52 0 00-6.23 16.9 12.52 12.52 0 00-2.07 6.84 9.64 9.64 0 003.65 7.7 7.85 7.85 0 00-1.7 5.13 8.9 8.9 0 005.3 8.13 6 6 0 00-.26 1.76c0 6.37 4.2 10.48 10.71 10.48h13.25a73.75 73.75 0 0010.6-.56 35.89 35.89 0 007.58-2.18 17.83 17.83 0 014.48-1.34h1.35c4.69 0 7.79 0 10.5-1 3.85-1.44 6-4.59 6.41-9.38.2-2.46 1.42-4.85 2.84-7.62a41.3 41.3 0 003.42-8.13 48 48 0 001.59-10.79c.1-5.13-1-8.48-3.35-10.55-2.16-1.87-4.64-1.87-9.6-1.88a46.86 46.86 0 01-6.64-.29c-1.92-.94-5.72-4-8.51-6.3l-1.58-1.28c-1.6-1.3-3.27-2.79-4.87-4.23-3.33-3-6.47-5.79-9.61-7.45a20.2 20.2 0 01-6.43-5.53 12.44 12.44 0 01-1.72-5.36 6 6 0 00-6-5.86z" />
4545
</svg>
4646
<svg
4747
className="i_thumbsdown"
48-
alt="Dislike"
48+
aria-label="Dislike"
4949
onClick={() => giveFeedback(0)}
5050
xmlns="http://www.w3.org/2000/svg"
5151
viewBox="0 0 81.13 89.76">
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
const theme = {
8+
import type {ThemeConfig} from '@docusaurus/preset-classic';
9+
10+
const theme: ThemeConfig['prism']['theme'] = {
911
plain: {
1012
color: '#FFFFFF',
1113
backgroundColor: '#282C34',
@@ -123,4 +125,4 @@ const theme = {
123125
],
124126
};
125127

126-
module.exports = theme;
128+
export default theme;

0 commit comments

Comments
 (0)