Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions packages/core/docs/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,17 @@ npm install @react-native-ama/core

### Config File

When you install the `@react-native-ama/core` package, the ama.rules.json file should be generated automatically. In cases it doesn't generate automatically, run the following from the root of your project:
When you install the `@react-native-ama/core` package, the `ama.rules.json` file should be generated automatically in your project's root folder. If it didn't generate automatically when you installed the package, you can create it manually with the default config:

```bash
# Create ama.rules.json with an empty JSON object if it doesn't exist
echo "{}" >> ama.rules.json

# Navigate to the internal directory
cd node_modules/@react-native-ama/internal

# Create symlinks in src and dist directories
ln -s ../../../ama.rules.json src/ama.rules.json
ln -s ../../../ama.rules.json dist/ama.rules.json

# Go back to the root directory
cd -
```json title="ama.rules.json"
{
rules: {},
accessibilityLabelExceptions: [],
};
```

If you are running a monorepo setup your config file may not be configured correctly, be sure to check the [options for customizing AMA's config](/docs/config-file#monorepo-options).

For more detailed information about the config file, please refer to [this documentation](/docs/config-file).

## Usage
Expand Down
9 changes: 6 additions & 3 deletions website/docs/ama/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Rules marked with <No /> are considered bad practices and cannot be turned off!

A JSON file called `ama.config.json` should have been automatically generated in the project's root folder (If it didn't simply create it). This file is used to customize the log rules, then specify the custom log level for the wanted key. `accessibilityLabelExceptions` can also be specified in this file. Any changes to this file will automatically be picked up by AMA's config and applied to the applications warnings and errors in Dev mode. (You will need to restart your application to see the changes applied)

<p id="monorepo-options">
:::warning
If you are running a monorepo setup this file won't automatically generate and you will have two options customize AMA's config.

Expand Down Expand Up @@ -102,11 +103,13 @@ cp ama.rules.json node_modules/@react-native-ama/internal/ama.rules.json

:::

</p>

### Example

The JSON file does not need to contain all log keys. **AMA** uses the default rule if a key is not present:

```json
```json title="ama.rules.json"
{
rules: {
"CONTRAST_FAILED": "warn",
Expand All @@ -124,7 +127,7 @@ Elements that perform a contrast check do it on all the children up to the level
| -------------------------- | ------------- |
| CONTRAST_CHECKER_MAX_DEPTH | 5 |

```json
```json title="ama.rules.json"
{
"rules": {
"CONTRAST_CHECKER_MAX_DEPTH": 0
Expand All @@ -140,7 +143,7 @@ This can be turned off by specifying a level of **0**

**AMA** performs various checks, including one for [uppercase](/guidelines/uppercase). This rule allows specifying a list of approved all-caps accessibility labels.

```json
```json title="ama.rules.json"
{
"accessibilityLabelExceptions": ["FAQ"]
}
Expand Down
Loading