Skip to content

Commit 55749de

Browse files
authored
feat: add a Testing documentation to the project (#92)
* feat: add a Testing documentation to the project * feat: Take into account PR comments
1 parent 7c14bbb commit 55749de

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Here are some useful commands:
3030
- rename the directory of a package: `mv package-my-config new-directory-name && yarn lerna bootstrap`,
3131
- run a script `do-something` that exists in at least one package: `yarn lerna run do-something` (this will try to run the script in all packages in which it is defined).
3232

33+
- [Testing ESLint plugin](https://github.com/bamlab/react-native-project-config/blob/main/packages/eslint-plugin/docs/Testing.md)
34+
3335
## Conventional commits
3436

3537
We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to automate the release process.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Testing
2+
3+
## Introduction
4+
5+
This document provides information about how to test the eslint-plugin after adding or removing rules.
6+
7+
## Example-app
8+
9+
The example-app folder is located at the root of `react-native-project-config`.
10+
The goal of each file of example-app is to simulate the behavior of a rule or a set of rules, so that you can visually check it or by running the `yarn lint` command.
11+
When you add or remove a rule from the recommended config, please modify (or add/remove) the corresponding file in the example-app folder.
12+
13+
## Real example testing
14+
15+
In order to test that your rule will be properly deployed, use another project, in which you install the eslint-plugin from your local files.
16+
Use the command `yarn remove @bam.tech/eslint-plugin; yarn add --dev file:/project_address/react-native-project-config/packages/eslint-plugin; yarn; yarn lint` to remove the plugin from installed dependencies, and add it again.
17+
If not done already, add the plugin to your `.eslintrc` configuration :
18+
19+
```json
20+
// .eslintrc
21+
{
22+
"extends": "plugin:@bam.tech/recommended",
23+
"overrides": [
24+
{
25+
"files": ["*.test.tsx", "*.test.ts"],
26+
"extends": "plugin:@bam.tech/tests"
27+
}
28+
]
29+
}
30+
```
31+
32+
You should be able to test your rules from the plugin.

0 commit comments

Comments
 (0)