Skip to content

Commit 00fefea

Browse files
committed
migrate to case-lint v2, switch to ESLint plugin
1 parent 5b3e823 commit 00fefea

27 files changed

+124
-42
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/dist/index.cjs b/dist/index.cjs
2+
index 989e2607b3ecc6c6ad4dd3b20d7e7d38eca92430..d084863c588156a023cb154310e32d366cccc93c 100644
3+
--- a/dist/index.cjs
4+
+++ b/dist/index.cjs
5+
@@ -115,6 +115,8 @@ const stringCheck = createEslintRule({
6+
};
7+
const dict = loadDict(options);
8+
const code = context.sourceCode.text;
9+
+ const extension = node_path.extname(context.getFilename());
10+
+ const isMarkdown = extension === '.md' || extension === '.mdx';
11+
const checkText = (node) => {
12+
const start = node.range[0];
13+
const end = node.range[1];
14+
@@ -162,7 +164,11 @@ const stringCheck = createEslintRule({
15+
},
16+
TemplateElement: (node) => {
17+
checkText(node);
18+
- }
19+
+ },
20+
+ Program: (node) => {
21+
+ if (isMarkdown)
22+
+ checkText(node);
23+
+ },
24+
};
25+
const templateBodyVisitor = {
26+
VText(node) {

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

eslint.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import {defineConfig, globalIgnores} from 'eslint/config';
99
import globals from 'globals';
1010

11+
import eslintPluginCasePolice from 'eslint-plugin-case-police';
1112
import eslintCss from '@eslint/css';
1213
import eslintJs from '@eslint/js';
1314
import eslintPluginYml from 'eslint-plugin-yml';
@@ -102,5 +103,26 @@ 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+
facebook: 'Facebook',
120+
hermes: 'Hermes',
121+
meta: 'Meta',
122+
xcode: 'Xcode',
123+
},
124+
},
125+
],
126+
},
105127
},
106128
]);

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.0.0",
3233
"eslint": "^9.39.1",
3334
"eslint-config-prettier": "^10.1.8",
35+
"eslint-plugin-case-police": "patch:eslint-plugin-case-police@npm%3A2.0.0#~/.yarn/patches/eslint-plugin-case-police-npm-2.0.0-7acbdb1f19.patch",
3436
"eslint-plugin-mdx": "^3.6.2",
3537
"eslint-plugin-prettier": "^5.5.4",
3638
"eslint-plugin-yml": "^1.19.0",

website/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
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.0.3",
7271
"prettier": "^3.6.2",

website/react-native-dict.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

website/versioned_docs/version-0.77/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

website/versioned_docs/version-0.77/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

0 commit comments

Comments
 (0)