Skip to content
Open
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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ All typescript rules compatible with the AWS CDK structure have been added separ
}
```

### Setup for React tests

Rules specific to tests written in React are added separately and can be integrated by using the following configurations.

```json
{
"extends": ["eslint-config-lucideus", "eslint-config-lucideus/react-tests"]
}
```

*Note*: For the above rules to apply, make sure you have NOT added your test files in the eslint ignore patterns inside `.eslintignore` and/or `ignorePatterns` property in `.eslintrc.json`.

## Running the linter

Add the following to your `package.json` within the `scripts` section to have an easy to use command:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"eslint-plugin-react-redux": "^3.0.3",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-testing-library": "^4.6.0",
"typescript": "^3.9.7"
},
"peerDependencies": {
Expand All @@ -31,9 +32,10 @@
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-redux": "^3.0.3",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-sonarjs": "^0.5.0"
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-testing-library": "^4.6.0"
},
"scripts": {
"test": "node test/test.js"
}
}
}
16 changes: 16 additions & 0 deletions react-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
plugins: ["testing-library"],
overrides: [
{
"files": [
"**/tests/**/*.[jt]s?(x)",
"**/?(*.)+(test).[jt]s?(x)"
],
"extends": ["plugin:testing-library/react"],
"rules": {
"testing-library/consistent-data-testid": "off",
"testing-library/no-node-access": "warn",
}
}
]
};
Loading