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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ There is also an example app under `packages/example-app` whose goal is to demon

- clone the project: `git clone https://github.com/bamlab/react-native-project-config`,
- install the dependencies: `yarn install`,
- build the eslint-plugin: `yarn workspace @bam.tech/eslint-plugin build`

✅ Check : in the example-app in eslint-breaking-examples you should see the eslint errors.

## Modifying the project

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Save without formatting: [⌘ + K] > [S]

// This should trigger one error breaking eslint-plugin-react-native:
// @typescript-eslint/no-unnecessary-condition

export const bar = (arg: string) => {
// arg can never be nullish, so ?. is unnecessary
return arg?.length;
};
8 changes: 8 additions & 0 deletions packages/eslint-plugin/docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ The example-app folder is located at the root of `react-native-project-config`.
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.
When you add or remove a rule from the recommended config, please modify (or add/remove) the corresponding file in the example-app folder.

## Adding a new rule

In order to add a new rule, you must add it to the packages eslint-plugin, and then build it (it is in typescript) before seeing the changes in the example-app with the command:

```bash
yarn workspace @bam.tech/eslint-plugin build
```

## Real example testing

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.
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/lib/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const recommendedConfig = defineConfig({
"no-return-await": "off", // Disable the base rule as it can report incorrect errors
"@typescript-eslint/return-await": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
},
},
],
Expand Down