Skip to content

Commit 8ecf8de

Browse files
committed
chore: language cleanup + textlint setup
1 parent b9326dc commit 8ecf8de

23 files changed

+9711
-838
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
node-version: 19
2020
cache: 'npm'
2121
- run: npm ci
22-
- run: npm run lint:check --if-present
22+
- run: npm run lint --if-present
2323
- run: npm run build --if-present
2424
env:
2525
NODE_OPTIONS: "--max_old_space_size=4096"

.textlintrc

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
"rules": {
3+
"terminology": {
4+
"severity" : "warning",
5+
"defaultTerms": false,
6+
// Some terms borrowed from https://github.com/cypress-io/cypress-documentation/blob/main/.textlintrc
7+
"terms": [
8+
// Brands and Technologies
9+
"JavaScript",
10+
"TypeScript",
11+
"NativeScript",
12+
"GitHub",
13+
["VSCode", "VS Code"],
14+
"webpack",
15+
["WebSocket(s?)", "WebSocket$1"],
16+
"WiFi",
17+
"API",
18+
["API['’]?s", "APIs"],
19+
"CLI",
20+
"CSS",
21+
22+
// Words and phrases
23+
["\\(s\\)he", "they"],
24+
["he or she", "they"],
25+
["he/she", "they"],
26+
["crazy", "complex"],
27+
["crazier", "more complex"],
28+
["craziest", "most complex"],
29+
["dumb", "unintended"],
30+
["insane", "outrageous"],
31+
["blacklist", "block"],
32+
["whitelist", "allow"],
33+
34+
// Prefer American spelling
35+
["behaviour", "behavior"],
36+
["cancelled", "canceled"],
37+
["cancelling", "canceling"],
38+
["centre", "center"],
39+
["colour", "color"],
40+
["customise", "customize"],
41+
["customisation", "customization"],
42+
["favourite", "favorite"],
43+
["labelled", "labeled"],
44+
["licence", "license"],
45+
["organise", "organize"],
46+
47+
// Common misspellings
48+
["gaurantee", "guarantee"],
49+
50+
// Words we would like to not use altogether
51+
["obviously", ""],
52+
["basically", ""],
53+
["simply", ""],
54+
["of( )?course", ""],
55+
["clearly", ""],
56+
["just", ""],
57+
["everyone knows", ""],
58+
["easy", ""],
59+
60+
// Words we would like to not use at the start of a sentence
61+
["^so", ""],
62+
["^and", ""],
63+
["^but", ""],
64+
["^however", ""],
65+
66+
// Single word
67+
["change[- ]log(s?)", "changelog$1"],
68+
["code[- ]base(es?)", "codebase$1"],
69+
["e[- ]mail(s?)", "email$1"],
70+
["end[- ]point(s?)", "endpoint$1"],
71+
["file[- ]name(s?)", "filename$1"],
72+
["can[- ]not", "cannot$1"],
73+
["back-?end(s?)", "backend$1"],
74+
["front-?end(s?)", "frontend$1"],
75+
["full-?stack(s?)", "fullstack$1"],
76+
77+
// Multiple words
78+
["open-?source(ed?)", "open source$1"],
79+
80+
// Hyphenated
81+
["end ?to ?end", "end-to-end"],
82+
["retryability", "retry-ability"],
83+
["retriability", "retry-ability"],
84+
85+
// Shortened words
86+
["repo\\b", "repository"],
87+
["repos\\b", "repositories"]
88+
]
89+
}
90+
},
91+
"filters": {
92+
"comments": true
93+
}
94+
}

content/configuration/nativescript.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ contributors:
99
The `nativescript.config.ts` is a central place to configure your project. It allows you to configure your project structure, application id, runtime related flags and more.
1010

1111
::: info Note about the `.ts` extension
12-
You can author the config file as plain `.js` file as well, however we recommend sticking with the `.ts` extension even if your project doesn't use TypeScript, because most editors will provide autocompletion in the `.ts` file.
12+
You can author the config file as plain `.js` file as well. We recommend sticking with the `.ts` extension even if your project doesn't use TypeScript, because most editors will provide autocompletion in the `.ts` file.
1313
:::
1414

1515
By default a config looks somewhat like the following
@@ -98,7 +98,7 @@ TODO: document or remove?
9898
webpackConfigPath: string = 'custom-webpack.config.js'
9999
```
100100

101-
Specifies the [webpack config](/webpack) location. The default is `webpack.config.js` in the root however you can use a custom name and place elsewhere.
101+
Specifies the [webpack config](/webpack) location. The default is `webpack.config.js` in the root.
102102

103103
### profiling
104104

@@ -126,8 +126,12 @@ ignoredNativeDependencies: string[] = ['@nativescript/imagepicker']
126126

127127
A list of npm package names to ignore when attaching native dependencies to the build.
128128

129+
<!-- textlint-disable -->
130+
129131
### cli
130132

133+
<!-- textlint-enable -->
134+
131135
```ts
132136
cli: Object = {}
133137
```
@@ -172,7 +176,7 @@ cli.packageManager: 'npm' | 'yarn' | 'pnpm' | 'yarn2' = 'yarn';
172176

173177
Sets the package manager to use for this project.
174178

175-
Defaults to the package manager set with the cli (`ns package-manager set yarn`), or `npm` if not set.
179+
Defaults to the package manager set with the CLI (`ns package-manager set yarn`), or `npm` if not set.
176180

177181
### cli.pathsToClean
178182

@@ -208,7 +212,7 @@ See also [ios.id](#ios-id).
208212
android.discardUncaughtJsExceptions: boolean = true;
209213
```
210214

211-
Discard any uncaught JS exceptions. This can be very useful in production environments where you don't want your app to crash in case an unexpected JS exception is thrown.
215+
Discard any uncaught JS exceptions. This can be useful in production environments where you don't want your app to crash in case an unexpected JS exception is thrown.
212216

213217
### android.v8Flags
214218

@@ -256,7 +260,13 @@ Trigger a gc periodically (in `ms`). Defaults to `0` (disabled).
256260
android.markingMode: 'none' | 'full';
257261
```
258262

259-
Sets the default gc marking mode, defaults to `none`. `full` has been deprecated and it's not recommended.
263+
Sets the default gc marking mode, defaults to `none`.
264+
265+
::: warning Deprecated value
266+
267+
`full` has been deprecated and it's not recommended.
268+
269+
:::
260270

261271
### android.handleTimeZoneChanges
262272

@@ -272,7 +282,7 @@ Notify the app when the timezone changes, defaults to `false`.
272282
android.maxLogcatObjectSize: number = 9999;
273283
```
274284

275-
Sets the maximum lenght of a single output string. Defaults to `1024`.
285+
Sets the max length of a single output string. Defaults to `1024`.
276286

277287
### android.forceLog
278288

@@ -336,7 +346,7 @@ See also [android.id](#android-id).
336346
ios.discardUncaughtJsExceptions: boolean = true;
337347
```
338348

339-
Discard any uncaught JS exceptions. This can be very useful in production environments where you don't want your app to crash in case an unexpected JS exception is thrown.
349+
Discard any uncaught JS exceptions. This can be useful in production environments where you don't want your app to crash in case an unexpected JS exception is thrown.
340350

341351
### ios.SPMPackages
342352

@@ -396,7 +406,7 @@ Avaialable hooks (prefix with `before-` or `after-`):
396406
- `install` - Application installed to device/emulator
397407
- `prepare` - Compiles webpack and prepares native app in platforms folder
398408
- `prepareNativeApp` - Preparing the actual native app, runs during prepare/watch hook
399-
- `resolveCommand` - Resolves command and arguments, runs before all cli commands
409+
- `resolveCommand` - Resolves command and arguments, runs before all CLI commands
400410
- `watch` - Setup watchers for live sync, runs during prepare hook
401411
- `watchPatterns` - Setup watch patterns, runs during watch hook
402412

content/configuration/webpack.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ We define a few useful globally available variables that you can use to alter lo
127127
- `__NS_WEBPACK__` - always `true` when building with webpack
128128
- `__NS_ENV_VERBOSE__` - `true` when `--env.verbose` is set
129129
- `__NS_DEV_HOST_IPS__` - an array of IP addresses of the host machine (the machine running the build) when in `development` mode, and an empty array in production mode.
130-
- `__CSS_PARSER__` - the css parser used by NativeScript Core. The value is set based on the `cssParser` value in the `nativescript.config.ts` and defaults to `css-tree`
130+
- `__CSS_PARSER__` - the CSS parser used by NativeScript Core. The value is set based on the `cssParser` value in the `nativescript.config.ts` and defaults to `css-tree`
131131
- `__UI_USE_XML_PARSER__` - a flag used by NativeScript Core to disable the XML parser when it's not used
132132
- `__UI_USE_EXTERNAL_RENDERER__` - a flag used by NativeScript Core to disable registering global modules when an external renderer is used.
133133

@@ -486,7 +486,7 @@ module.exports = (env) => {
486486

487487
In some cases, you may want to explicitly set which base config should be used.
488488

489-
For example in the NativeScript-Vue repo, the `sample` app doesn't have `nativescript-vue` listed as a dependency, so we have to specify the base config we want to use.
489+
For example in the NativeScript-Vue repository, the `sample` app doesn't have `nativescript-vue` listed as a dependency, so we have to specify the base config we want to use.
490490

491491
```js
492492
const webpack = require('@nativescript/webpack')
@@ -528,6 +528,8 @@ module.exports = (env) => {
528528

529529
### Merging options into the config
530530

531+
<!--alex ignore simple-->
532+
531533
For simple things, you can merge objects into the final config instead of using `chainWebpack`
532534

533535
```js

content/guide/code-sharing.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ JavaScript provides opportunities of immense scalability if architectured proper
1010
**The NativeScript TSC's 5 fundamental lessons about good code sharing**:
1111

1212
1. If you can share your code easily with other paradigms, other disciplines, other runtimes even, then you have a good code sharing approach that will continue to provide you and your team joy. No developer or team willingly gets into code sharing hoping to find themselves in a corner later. You always want to share now to more easily maintain and scale the code later.
13-
2. A good code sharing approach should fit naturally in with well supported community standards and not require any extra build tooling just for the sharability to support itself. It should, in other words, stand firmly on it's own in scope of the language it is written in.
13+
2. A good code sharing approach should fit naturally in with well supported community standards and not require any extra build tooling for the sharability to support itself. It should, in other words, stand firmly on it's own in scope of the language it is written in.
1414
3. A good code sharing approach should not have to introduce new file extensions purely for sake of sharability (outside of those naturally supported by the framework) to deal with. All team's organize code by folders naturally and the same should be matched with good code sharing approaches avoiding new file extensions and concepts that go beyond general code organization.
1515
4. A good code sharing approach should clearly identify deployment/distribution lines as well as distinct platform separation allowing various shared code segments to have clear designated deployment targets allowing teams to control their own sophisticated build pipelines as they desire. Further the shared code should live within a thoughtful organizational structure that supports the ability to scale and adapt to future needs aside from the deployment targets that use the shared code.
1616
5. Within the specific scope of NativeScript's viewpoint, JavaScript is the universal language which provides the opportunity to share code effectively and responsibly. An approach that is based fundamentally on the strengths of JavaScript (and inherently TypeScript) is a good code sharing approach.
@@ -32,7 +32,7 @@ Here are a few solitions to **code-sharing**, each having their pros and cons.
3232
**Pros:**
3333

3434
- It's centered around JavaScript/TypeScript (lesson 1 and 5 above)
35-
- Uses standard build tooling like typescript or webpack to build code (lesson 2 above)
35+
- Uses standard build tooling like TypeScript or webpack to build code (lesson 2 above)
3636
- No custom file extensions to deal with (lesson 3 above)
3737
- Nx splits up "apps" and "libs" clearly identifying deployment/distribution targets "apps" that consume shared code "libs" (lesson 4 above)
3838

@@ -47,7 +47,7 @@ Here are a few solitions to **code-sharing**, each having their pros and cons.
4747
**Pros:**
4848

4949
- It's centered around JavaScript/TypeScript (lesson 1 and 5 above)
50-
- Uses standard build tooling like typescript or webpack to build code (lesson 2 above)
50+
- Uses standard build tooling like TypeScript or webpack to build code (lesson 2 above)
5151
- No custom file extensions to deal with (lesson 3 above)
5252
- Nx splits up "apps" and "libs" clearly identifying deployment/distribution targets "apps" that consume shared code "libs" (lesson 4 above)
5353
- It builds upon @nativescript/nx to further scale it across more paradigms so it's a natural extension when needed if already working in Nx with @nativescript/nx
@@ -66,7 +66,7 @@ Here are a few solitions to **code-sharing**, each having their pros and cons.
6666
**Pros:**
6767

6868
- It's centered around JavaScript/TypeScript (lesson 1 and 5 above)
69-
- Uses standard build tooling like typescript or webpack to build code (lesson 2 above)
69+
- Uses standard build tooling like TypeScript or webpack to build code (lesson 2 above)
7070
- No custom file extensions to deal with (lesson 3 above)
7171
- Can link/share dependencies
7272

@@ -82,7 +82,7 @@ Here are a few solitions to **code-sharing**, each having their pros and cons.
8282
**Pros:**
8383

8484
- It's centered around JavaScript/TypeScript (lesson 1 and 5 above)
85-
- Uses standard build tooling like typescript or webpack to build code (lesson 2 above)
85+
- Uses standard build tooling like TypeScript or webpack to build code (lesson 2 above)
8686
- No custom file extensions to deal with (lesson 3 above)
8787

8888
**Cons:**

content/guide/creating-a-project.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ ns create myCoolApp --template @nativescript/template-blank
6262

6363
### Drawer Template
6464

65-
A simple template with a side drawer.
65+
A template with a side drawer.
6666

6767
<!-- TODO: make nicer images -->
6868

@@ -81,7 +81,7 @@ ns create myCoolApp --template @nativescript/template-drawer-navigation
8181

8282
### Tabs Template
8383

84-
A simple template with multiple tabs.
84+
A template with multiple tabs.
8585

8686
<!-- TODO: make nicer images -->
8787

@@ -100,7 +100,8 @@ ns create myCoolApp --template @nativescript/template-tab-navigation
100100

101101
### List & Details Template
102102

103-
A simple template with a ListView and a details screen.
103+
A template with a ListView and a details screen.
104+
104105
<DeviceFrame type="ios">
105106
<img src="https://raw.githubusercontent.com/NativeScript/nativescript-app-templates/master/packages/template-master-detail/tools/assets/appTemplate-ios.png">
106107
</DeviceFrame>

content/guide/debugging.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ If you are new to JavaScript debugging, we recommend reading the following resou
8585
| Memory Profiling | :white_check_mark: | :white_check_mark: |
8686
| Timeline and CPU Profiling | :white_check_mark: | :white_check_mark: |
8787

88-
## Debugging with VSCode
88+
## Debugging with VS Code
8989

90-
VSCode uses the same protocol as the Chrome DevTools, in order to start a debugging session in VSCode you need to install the [NativeScript extension for VS Code](https://marketplace.visualstudio.com/items?itemName=NativeScript.nativescript).
90+
VS Code uses the same protocol as the Chrome DevTools, in order to start a debugging session in VS Code you need to install the [NativeScript extension for VS Code](https://marketplace.visualstudio.com/items?itemName=NativeScript.nativescript).
9191

9292
::: warning Note
93-
The VSCode extension for NativeScript is currently outdated and may not work. We are planning on revamping the project and bring it up-to-date with all the latest features soon.
93+
The VS Code extension for NativeScript is currently outdated and may not work. We are planning on revamping the project and bring it up-to-date with all the latest features soon.
9494
:::
9595

9696
## Debugging with XCode

content/guide/multithreading.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The Workers API in NativeScript is loosely based on the [Web Workers API](https:
1515
For optimal results when using the Workers API, follow these guidelines:
1616

1717
- Always make sure you close the worker threads, using the appropriate API (`terminate()` or `close()`), when the worker's finished its job. If Worker instances become unreachable in the scope you are working in before you are able to terminate it, you will be able to close it only from inside the worker script itself by calling the `close()` function.
18-
- Workers are not a general solution for all performance-related problems. Starting a Worker has an overhead of its own, and may sometimes be slower than just processing a quick task. Optimize DB queries, or rethink complex application logic before resorting to workers.
18+
- Workers are not a general solution for all performance-related problems. Starting a Worker has an overhead of its own, and may sometimes be slower than processing a quick task. Optimize DB queries, or rethink complex application logic before resorting to workers.
1919
- Since worker threads have access to the entire native SDK, the NativeScript developer must take care of all the synchronization when calling APIs which are not guaranteed to be thread-safe from more than one thread.
2020

2121
## Using Workers

content/guide/running.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ If any of the above failed, we recommend checking out the [Android ADB documenta
7272

7373
### Preparing an iOS device for development
7474

75-
Before the NativeScript cli can run apps on a physical iOS device, the device must be set up and registered.
75+
Before the NativeScript CLI can run apps on a physical iOS device, the device must be set up and registered.
7676

7777
Use a USB cable to connect the device. Navigate to the `platforms/ios` folder in your project, then open the `.xcworkspace` file in Xcode.
7878

content/guide/shared-element-transitions.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ page.showModal('views/modal', {
8181

8282
### Independent shared elements
8383

84-
In some cases you might not have an element present on both "ends", or just need to animate additional elements during the transition. That's what "independent" shared elements solve.
84+
In some cases you might not have an element present on both "ends", or need to animate additional elements during the transition. That's what "independent" shared elements solve.
8585

8686
Consider the following example:
8787

@@ -420,7 +420,7 @@ Used internally to finish the state after a transition has completed. Provided i
420420

421421
## Troubleshooting
422422

423-
- It's easy to accidentally provide mismatching `sharedTransitionTag` values between two different pages. Always check for matching tags when encountering issues with Shared Element Transitions.
423+
- It's common to accidentally provide mismatching `sharedTransitionTag` values between two different pages. Always check for matching tags when encountering issues with Shared Element Transitions.
424424
- Try avoiding `sharedTransitionTag` on Labels since they usually won't exhibit expected behavior.
425425

426426
## Acknowledgements

content/project-structure/app-resources.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ To change the mode of the TimePicker from the default `spinner` style, change `a
203203

204204
### Enabling force Dark Mode
205205

206-
On API29+ apps can opt-in to a default Dark Mode when the system is set to use Dark Mode. This is disabled by default as it can lead to visual issues, since the automatic conversion may not display correctly in all cases.
206+
On API29+ apps can opt-in to a default Dark Mode when the system is set to use Dark Mode. This is turned off by default as it can lead to visual issues, since the automatic conversion may not display correctly in all cases.
207207

208208
To opt-in, change the `android:forceDarkAllowed` value to `true` in `App_Resources/Android/src/main/res/values-v29/styles.xml`:
209209

content/project-structure/webpack-config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ module.exports = (env) => {
2626

2727
::: tip Read More
2828

29-
:point_right: [NativeScript Webpack Reference](/configuration/webpack)
29+
:point_right: [NativeScript webpack Reference](/configuration/webpack)
3030

3131
:::

content/setup/linux.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contributors:
1010

1111
You will need Node, NativeScript CLI (command line interface), Android Studio and a JDK (java development kit).
1212

13-
**Android Studio** is not strictly necessary &mdash; however it provides an easy to use interface for installing and managing the Android SDKs.
13+
**Android Studio** is not strictly necessary &mdash; however it provides an easy-to-use interface for installing and managing the Android SDKs.
1414

1515
To install **Node** follow the [instructions specific to your Linux distribution](https://nodejs.org/en/download/package-manager/). We recommend using the latest version, however anything above **Node 12** should be fine.
1616

0 commit comments

Comments
 (0)