Skip to content

Commit eec5506

Browse files
authored
migrate to case-police v2, switch to ESLint plugin (#4884)
1 parent fd25cbe commit eec5506

Some content is hidden

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

48 files changed

+264
-145
lines changed

docs/boxshadowvalue.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,19 @@ The offset on the y-axis. This can be positive or negative. A positive value ind
3838

3939
### `blurRadius`
4040

41-
Represents the radius used in the [Guassian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
41+
Represents the radius used in the [Gaussian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
4242

43-
| Type | Optional |
44-
| --------------- | -------- |
45-
| numer \| string | Yes |
43+
| Type | Optional |
44+
| ---------------- | -------- |
45+
| number \| string | Yes |
4646

4747
### `spreadDistance`
4848

4949
How much larger or smaller the shadow grows or shrinks. A positive value will grow the shadow, a negative value will shrink the shadow.
5050

51-
| Type | Optional |
52-
| --------------- | -------- |
53-
| numer \| string | Yes |
51+
| Type | Optional |
52+
| ---------------- | -------- |
53+
| number \| string | Yes |
5454

5555
### `color`
5656

docs/dropshadowvalue.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ The offset on the y-axis. This can be positive or negative. A positive value ind
3636

3737
### `standardDeviation`
3838

39-
Represents the standard deviation used in the [Guassian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
39+
Represents the standard deviation used in the [Gaussian blur](https://en.wikipedia.org/wiki/Gaussian_blur) algorithm. The larger the value the blurrier the shadow is. Only non-negative values are valid. The default is 0.
4040

41-
| Type | Optional |
42-
| --------------- | -------- |
43-
| numer \| string | Yes |
41+
| Type | Optional |
42+
| ---------------- | -------- |
43+
| number \| string | Yes |
4444

4545
### `color`
4646

docs/legacy/native-modules-android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To get started, open up the Android project within your React Native application
2323
<figcaption>Image of where you can find your Android project</figcaption>
2424
</figure>
2525

26-
We recommend using Android Studio to write your native code. Android studio is an IDE built for Android development and using it will help you resolve minor issues like code syntax errors quickly.
26+
We recommend using Android Studio to write your native code. Android Studio is an IDE built for Android development and using it will help you resolve minor issues like code syntax errors quickly.
2727

2828
We also recommend enabling [Gradle Daemon](https://docs.gradle.org/2.9/userguide/gradle_daemon.html) to speed up builds as you iterate on Java/Kotlin code.
2929

docs/legacy/native-modules-ios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In the following guide you will create a native module, `CalendarModule`, that w
1919
To get started, open up the iOS project within your React Native application in Xcode. You can find your iOS project here within a React Native app:
2020

2121
<figure>
22-
<img src="/docs/assets/native-modules-ios-open-project.png" width="500" alt="Image of opening up an iOS project within a React Native app inside of xCode." />
22+
<img src="/docs/assets/native-modules-ios-open-project.png" width="500" alt="Image of opening up an iOS project within a React Native app inside of Xcode." />
2323
<figcaption>Image of where you can find your iOS project</figcaption>
2424
</figure>
2525

docs/running-on-device.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,9 @@ If this is your first time running an app on your iOS device, you may need to re
378378

379379
### 2. Configure code signing
380380

381-
Register for an [Apple developer account](https://developer.apple.com/) if you don't have one yet.
381+
Register for an [Apple Developer account](https://developer.apple.com/) if you don't have one yet.
382382

383-
Select your project in the Xcode Project Navigator, then select your main target (it should share the same name as your project). Look for the "General" tab. Go to "Signing" and make sure your Apple developer account or team is selected under the Team dropdown. Do the same for the tests target (it ends with Tests, and is below your main target).
383+
Select your project in the Xcode Project Navigator, then select your main target (it should share the same name as your project). Look for the "General" tab. Go to "Signing" and make sure your Apple Developer account or team is selected under the Team dropdown. Do the same for the tests target (it ends with Tests, and is below your main target).
384384

385385
**Repeat** this step for the **Tests** target in your project.
386386

docs/view-style-props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,9 @@ Due to issues with performance and spec compliance, these are the only two filte
369369

370370
The following filter functions work on Android only:
371371

372-
- `blur`: Blurs the `View` with a [Guassian blur](https://en.wikipedia.org/wiki/Gaussian_blur), where the specified length represents the radius used in the blurring algorithm. Any non-negative DIP value is valid (no percents). The larger the value, the blurrier the result.
372+
- `blur`: Blurs the `View` with a [Gaussian blur](https://en.wikipedia.org/wiki/Gaussian_blur), where the specified length represents the radius used in the blurring algorithm. Any non-negative DIP value is valid (no percents). The larger the value, the blurrier the result.
373373
- `contrast`: Changes the contrast of the `View`. Takes a non-negative number or percentage.
374-
- `dropShadow`: Adds a shadow around the alpha mask of the `View` (only non-zero alpha pixels in the `View` will cast a shadow). Takes an optional color representing the shadow color, and 2 or 3 lengths. If 2 lengths are specified they are interperted as `offsetX` and `offsetY` which will translate the shadow in the X and Y dimensions respectfully. If a 3rd length is given it is interpreted as the standard deviation of the Guassian blur used on the shadow - so a larger value will blur the shadow more. Read more about the arguments in [DropShadowValue](./dropshadowvalue.md).
374+
- `dropShadow`: Adds a shadow around the alpha mask of the `View` (only non-zero alpha pixels in the `View` will cast a shadow). Takes an optional color representing the shadow color, and 2 or 3 lengths. If 2 lengths are specified they are interpreted as `offsetX` and `offsetY` which will translate the shadow in the X and Y dimensions respectfully. If a 3rd length is given it is interpreted as the standard deviation of the Gaussian blur used on the shadow - so a larger value will blur the shadow more. Read more about the arguments in [DropShadowValue](./dropshadowvalue.md).
375375
- `grayscale`: Converts the `View` to [grayscale](https://en.wikipedia.org/wiki/Grayscale) by the specified amount. Takes a non-negative number or percentage, where `1` or `100%` represents complete grayscale.
376376
- `hueRotate`: Changes the [hue](https://en.wikipedia.org/wiki/Hue) of the View. The argument of this function defines the angle of a color wheel around which the hue will be rotated, so e.g., `360deg` would have no effect. This angle can have either `deg` or `rad` units.
377377
- `invert`: Inverts the colors in the `View`. Takes a non-negative number or percentage, where `1` or `100%` represents complete inversion.

eslint.config.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import globals from 'globals';
1010

1111
import eslintCss from '@eslint/css';
1212
import eslintJs from '@eslint/js';
13-
import eslintPluginYml from 'eslint-plugin-yml';
13+
import tsParser from '@typescript-eslint/parser';
14+
import eslintPluginCasePolice from 'eslint-plugin-case-police';
1415
import * as eslintPluginMdx from 'eslint-plugin-mdx';
1516
import eslintPluginPrettier from 'eslint-plugin-prettier/recommended';
17+
import eslintPluginYml from 'eslint-plugin-yml';
1618
import eslintTs from 'typescript-eslint';
17-
import tsParser from '@typescript-eslint/parser';
1819

1920
export default defineConfig([
2021
globalIgnores([
@@ -102,5 +103,28 @@ export default defineConfig([
102103
lintCodeBlocks: false,
103104
remarkConfigPath: 'website/.remarkrc.mjs',
104105
}),
106+
plugins: {
107+
'case-police': eslintPluginCasePolice,
108+
},
109+
rules: {
110+
'case-police/string-check': [
111+
'warn',
112+
{
113+
ignore: ['sdk', 'uri'],
114+
dict: {
115+
'android studio': 'Android Studio',
116+
'apple developer': 'Apple Developer',
117+
avd: 'AVD',
118+
cocoapods: 'CocoaPods',
119+
codegen: 'Codegen',
120+
facebook: 'Facebook',
121+
hermes: 'Hermes',
122+
logcat: 'Logcat',
123+
meta: 'Meta',
124+
xcode: 'Xcode',
125+
},
126+
},
127+
],
128+
},
105129
},
106130
]);

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"lint": "eslint .",
2121
"lint:packages": "eslint ./packages",
2222
"lint:plugins": "eslint ./plugins",
23-
"lint:website": "eslint ./website",
23+
"lint:website": "eslint ./website ./docs",
2424
"update-lock": "yarn dedupe",
2525
"check-dependencies": "manypkg check"
2626
},
@@ -29,8 +29,10 @@
2929
"@eslint/js": "^9.39.1",
3030
"@manypkg/cli": "^0.25.1",
3131
"@typescript-eslint/parser": "^8.46.4",
32+
"case-police": "^2.1.1",
3233
"eslint": "^9.39.1",
3334
"eslint-config-prettier": "^10.1.8",
35+
"eslint-plugin-case-police": "2.1.1",
3436
"eslint-plugin-mdx": "^3.6.2",
3537
"eslint-plugin-prettier": "^5.5.4",
3638
"eslint-plugin-yml": "^1.19.0",

website/blog/2022-06-16-resources-migrating-your-react-native-library-to-the-new-architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In this post, we will dig deeper into these resources and explain in more detail
2525

2626
### Documentation
2727

28-
In the past 6 months, we’ve added a [guide on adopting the New Architecture](https://github.com/reactwg/react-native-new-architecture#guides) and an [architecture deep-dive](/architecture/overview) on Fabric. We plan to expand this to include more guides and documentation around creating TurboModules, understanding CodeGen, and more. We plan to have updates to share by the 0.70 release.
28+
In the past 6 months, we’ve added a [guide on adopting the New Architecture](https://github.com/reactwg/react-native-new-architecture#guides) and an [architecture deep-dive](/architecture/overview) on Fabric. We plan to expand this to include more guides and documentation around creating TurboModules, understanding Codegen, and more. We plan to have updates to share by the 0.70 release.
2929

3030
Currently, the **New Architecture** guide covers how to [migrate your app](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md) and [your libraries](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-libraries-prerequisites.md) to support the New Architecture properly.
3131

website/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
"format:style": "prettier --write src/**/*.scss",
2525
"format:examples": "eslint-examples-jsx --fix && eslint-examples-tsx --fix",
2626
"prettier": "yarn format:style",
27-
"lint": "eslint .",
27+
"lint": "yarn lint:website",
2828
"lint:examples": "eslint-examples-jsx && eslint-examples-tsx && tsc-examples",
2929
"lint:markdown:images": "node ../scripts/src/image-check.ts",
3030
"lint:markdown:links": "remark ../docs --quiet -r .remarkrc.withBrokenLinks.mjs",
31-
"language:lint": "cd ../ && alex && case-police 'docs/*.md' -d ./website/react-native-dict.json --disable SDK,URI",
32-
"language:lint:versioned": "cd ../ && alex . && case-police '**/*.md' -d ./website/react-native-dict.json --disable SDK,URI",
31+
"language:lint": "cd ../ && alex",
32+
"language:lint:versioned": "cd ../ && alex .",
3333
"ci:lint": "yarn lint && yarn lint:examples && yarn language:lint:versioned && yarn lint:markdown:images && prettier --check src/**/*.scss",
3434
"pwa:generate": "npx pwa-asset-generator ./static/img/header_logo.svg ./static/img/pwa --padding '40px' --background 'rgb(32, 35, 42)' --icon-only --opaque true",
3535
"generate-llms-txt": "node ../scripts/src/generate-llms-txt.ts",
@@ -66,7 +66,6 @@
6666
"@types/google.analytics": "^0.0.46",
6767
"@types/react": "^19.1.13",
6868
"alex": "^11.0.1",
69-
"case-police": "^1.0.0",
7069
"eslint": "^9.39.1",
7170
"glob": "^11.1.0",
7271
"prettier": "^3.6.2",

0 commit comments

Comments
 (0)