Skip to content

Commit 640241d

Browse files
committed
Merge remote-tracking branch 'origin/main' into alpha
# Conflicts: # README.md # lib/rules/no-debugging-utils.ts # tests/index.test.ts
2 parents b570537 + a900ada commit 640241d

35 files changed

+27839
-350
lines changed

.all-contributorsrc

+46-1
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,53 @@
574574
"contributions": [
575575
"doc"
576576
]
577+
},
578+
{
579+
"login": "patriscus",
580+
"name": "Patrick Ahmetovic",
581+
"avatar_url": "https://avatars.githubusercontent.com/u/23729362?v=4",
582+
"profile": "https://github.com/patriscus",
583+
"contributions": [
584+
"ideas",
585+
"code",
586+
"test"
587+
]
588+
},
589+
{
590+
"login": "CodingItWrong",
591+
"name": "Josh Justice",
592+
"avatar_url": "https://avatars.githubusercontent.com/u/15832198?v=4",
593+
"profile": "https://codingitwrong.com",
594+
"contributions": [
595+
"code",
596+
"test",
597+
"doc",
598+
"ideas"
599+
]
600+
},
601+
{
602+
"login": "obsoke",
603+
"name": "Dale Karp",
604+
"avatar_url": "https://avatars.githubusercontent.com/u/389851?v=4",
605+
"profile": "https://dale.io",
606+
"contributions": [
607+
"code",
608+
"test",
609+
"doc"
610+
]
611+
},
612+
{
613+
"login": "nathanmmiller",
614+
"name": "Nathan",
615+
"avatar_url": "https://avatars.githubusercontent.com/u/37555055?v=4",
616+
"profile": "https://github.com/nathanmmiller",
617+
"contributions": [
618+
"code",
619+
"test"
620+
]
577621
}
578622
],
579623
"contributorsPerLine": 7,
580-
"skipCi": true
624+
"skipCi": true,
625+
"commitType": "docs"
581626
}

.github/workflows/pipeline.yml

+6-10
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,27 @@ name: Pipeline
33
on:
44
push:
55
branches:
6-
# semantic-release valid branches
6+
# semantic-release valid branches and all-contributors branches
77
- '+([0-9])?(.{+([0-9]),x}).x'
88
- 'main'
99
- 'next'
1010
- 'next-major'
1111
- 'beta'
1212
- 'alpha'
13+
- 'all-contributors/**'
1314
pull_request:
1415
types: [opened, synchronize]
1516

17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
1621
jobs:
1722
code_validation:
1823
name: Code Validation
1924
runs-on: ubuntu-latest
2025

2126
steps:
22-
- name: Cancel Previous Runs
23-
uses: styfle/[email protected]
24-
2527
- name: Checkout
2628
uses: actions/checkout@v3
2729

@@ -58,9 +60,6 @@ jobs:
5860
eslint: [7.5, 7, 8]
5961

6062
steps:
61-
- name: Cancel Previous Runs
62-
uses: styfle/[email protected]
63-
6463
- name: Checkout
6564
uses: actions/checkout@v3
6665

@@ -90,9 +89,6 @@ jobs:
9089
github.ref) && github.event_name == 'push' }}
9190

9291
steps:
93-
- name: Cancel Previous Runs
94-
uses: styfle/[email protected]
95-
9692
- name: Checkout
9793
uses: actions/checkout@v3
9894

.github/workflows/smoke-test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- run: npm link eslint-plugin-testing-library
3030

31-
- uses: AriPerkkio/eslint-remote-tester-run-action@v3
31+
- uses: AriPerkkio/eslint-remote-tester-run-action@v4
3232
with:
3333
issue-title: 'Results of weekly scheduled smoke test'
3434
eslint-remote-tester-config: tests/eslint-remote-tester.config.js

.gitignore

+2-3
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ yarn-error.log
6767
# Yarn Integrity file
6868
.yarn-integrity
6969

70-
# these cause more harm than good
71-
# when working with contributors
72-
package-lock.json
70+
# Ignore locks other than npm
71+
pnpm-lock.yaml
7372
yarn.lock

.npmrc

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
package-lock=false
21
auto-install-peers=true
32
enable-pre-post-scripts=true

README.md

+155-146
Large diffs are not rendered by default.

docs/migration-guides/v4.md

+42-42
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ Relates to the [Aggressive Imports Reporting mechanism](#imports). This setting
182182

183183
If you pass a string other than `"off"` to this option, it will represent your custom utility file from where you re-export everything from Testing Library package.
184184

185-
```json
186-
// .eslintrc
187-
{
188-
"settings": {
189-
"testing-library/utils-module": "my-custom-test-utility-file"
190-
}
191-
}
185+
```js
186+
// .eslintrc.js
187+
module.exports = {
188+
settings: {
189+
'testing-library/utils-module': 'my-custom-test-utility-file',
190+
},
191+
};
192192
```
193193

194194
Configuring this setting like that, you'll restrict the errors reported by the plugin to only those utils being imported from this custom utility file, or some `@testing-library/*` package. The previous setting example would cause:
@@ -225,13 +225,13 @@ test('testing-library/utils-module setting example', () => {
225225

226226
You can also set this setting to `"off"` to entirely opt-out Aggressive Imports Reporting mechanism, so only utils coming from Testing Library packages are reported.
227227

228-
```json
229-
// .eslintrc
230-
{
231-
"settings": {
232-
"testing-library/utils-module": "off"
233-
}
234-
}
228+
```js
229+
// .eslintrc.js
230+
module.exports = {
231+
settings: {
232+
'testing-library/utils-module': 'off',
233+
},
234+
};
235235
```
236236

237237
### `testing-library/custom-renders`
@@ -240,13 +240,13 @@ Relates to the [Aggressive Renders Reporting mechanism](#renders). This setting
240240

241241
If you pass an array of strings to this option, it will represent a list of function names that are valid as Testing Library custom renders.
242242

243-
```json
244-
// .eslintrc
245-
{
246-
"settings": {
247-
"testing-library/custom-renders": ["display", "renderWithProviders"]
248-
}
249-
}
243+
```js
244+
// .eslintrc.js
245+
module.exports = {
246+
settings: {
247+
'testing-library/custom-renders': ['display', 'renderWithProviders'],
248+
},
249+
};
250250
```
251251

252252
Configuring this setting like that, you'll restrict the errors reported by the plugin related to `render` somehow to only those functions sharing a name with one of the elements of that list, or built-in `render`. The previous setting example would cause:
@@ -288,13 +288,13 @@ test('testing-library/custom-renders setting example', () => {
288288

289289
You can also set this setting to `"off"` to entirely opt-out Aggressive Renders Reporting mechanism, so only methods named `render` are reported as Testing Library render util.
290290

291-
```json
292-
// .eslintrc
293-
{
294-
"settings": {
295-
"testing-library/custom-renders": "off"
296-
}
297-
}
291+
```js
292+
// .eslintrc.js
293+
module.exports = {
294+
settings: {
295+
'testing-library/custom-renders': 'off',
296+
},
297+
};
298298
```
299299

300300
### `testing-library/custom-queries`
@@ -308,13 +308,13 @@ Each string passed to this list of custom queries can be:
308308
- **pattern query (recommended)**: a custom query variant (suffix starting with "By") to be reported, so all query combinations around it are reported. For instance: `"ByIcon"` would report all `getByIcon()`, `getAllByIcon()`, `queryByIcon()` and `findByIcon()`.
309309
- **strict query**: a specific custom query name to be reported, so only that very exact query would be reported but not any related variant. For instance: `"getByIcon"` would make the plugin to report `getByIcon()` but not `getAllByIcon()`, `queryByIcon()` or `findByIcon()`.
310310

311-
```json
312-
// .eslintrc
313-
{
314-
"settings": {
315-
"testing-library/custom-queries": ["ByIcon", "getByComplexText"]
316-
}
317-
}
311+
```js
312+
// .eslintrc.js
313+
module.exports = {
314+
settings: {
315+
'testing-library/custom-queries': ['ByIcon', 'getByComplexText'],
316+
},
317+
};
318318
```
319319

320320
Configuring this setting like that, you'll restrict the errors reported by the plugin related to the queries to only those custom queries matching name or pattern from that list, or [built-in queries](https://testing-library.com/docs/queries/about). The previous setting example would cause:
@@ -344,11 +344,11 @@ findBySomethingElse('foo');
344344

345345
You can also set this setting to `"off"` to entirely opt-out Aggressive Queries Reporting mechanism, so only built-in queries are reported.
346346

347-
```json
348-
// .eslintrc
349-
{
350-
"settings": {
351-
"testing-library/custom-queries": "off"
352-
}
353-
}
347+
```js
348+
// .eslintrc.js
349+
module.exports = {
350+
settings: {
351+
'testing-library/custom-queries': 'off',
352+
},
353+
};
354354
```

docs/rules/consistent-data-testid.md

+30-18
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,41 @@ const baz = (props) => <div>...</div>;
3434
| ----------------- | -------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
3535
| `testIdPattern` | Yes | None | A regex used to validate the format of the `data-testid` value. `{fileName}` can optionally be used as a placeholder and will be substituted with the name of the file OR the name of the files parent directory in the case when the file name is `index.js` OR empty string in the case of dynamically changing routes (that contain square brackets) with `Gatsby.js` or `Next.js` | `^{fileName}(\_\_([A-Z]+[a-z]_?)+)_\$` |
3636
| `testIdAttribute` | No | `data-testid` | A string (or array of strings) used to specify the attribute used for querying by ID. This is only required if data-testid has been explicitly overridden in the [RTL configuration](https://testing-library.com/docs/dom-testing-library/api-queries#overriding-data-testid) | `data-my-test-attribute`, `["data-testid", "testId"]` |
37+
| `customMessage` | No | `undefined` | A string used to display a custom message whenever warnings/errors are reported. | `A custom message` |
3738

3839
## Example
3940

40-
```json
41-
{
42-
"testing-library/consistent-data-testid": [
43-
2,
44-
{
45-
"testIdPattern": "^TestId(__[A-Z]*)?$"
46-
}
47-
]
48-
}
41+
```js
42+
module.exports = {
43+
rules: {
44+
'testing-library/consistent-data-testid': [
45+
'error',
46+
{ testIdPattern: '^TestId(__[A-Z]*)?$' },
47+
],
48+
},
49+
};
4950
```
5051

51-
```json
52-
{
53-
"testing-library/consistent-data-testid": [
54-
2,
55-
{
56-
"testIdAttribute": ["data-testid", "testId"]
57-
}
58-
]
59-
}
52+
```js
53+
module.exports = {
54+
rules: {
55+
'testing-library/consistent-data-testid': [
56+
'error',
57+
{ testIdAttribute: ['data-testid', 'testId'] },
58+
],
59+
},
60+
};
61+
```
62+
63+
```js
64+
module.exports = {
65+
rules: {
66+
'testing-library/consistent-data-testid': [
67+
'error',
68+
{ customMessage: 'A custom message' },
69+
],
70+
},
71+
};
6072
```
6173

6274
## Notes

docs/rules/no-await-sync-events.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ This option gives you more granular control of which event modules you want to r
9595

9696
Example:
9797

98-
```json
99-
{
100-
"testing-library/no-await-sync-events": [
101-
"error",
102-
{
103-
"eventModules": ["fire-event", "user-event"]
104-
}
105-
]
106-
}
98+
```js
99+
module.exports = {
100+
rules: {
101+
'testing-library/no-await-sync-events': [
102+
'error',
103+
{ eventModules: ['fire-event', 'user-event'] },
104+
],
105+
},
106+
};
107107
```
108108

109109
## Notes

docs/rules/no-debugging-utils.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,21 @@ screen.debug();
4545

4646
You can control which debugging utils are checked for with the `utilsToCheckFor` option:
4747

48-
```json
49-
{
50-
"testing-library/no-debugging-utils": [
51-
"error",
52-
{
53-
"utilsToCheckFor": {
54-
"debug": false,
55-
"logRoles": true,
56-
"logDOM": true
57-
}
58-
}
59-
]
60-
}
48+
```js
49+
module.exports = {
50+
rules: {
51+
'testing-library/no-debugging-utils': [
52+
'error',
53+
{
54+
utilsToCheckFor: {
55+
debug: false,
56+
logRoles: true,
57+
logDOM: true,
58+
},
59+
},
60+
],
61+
},
62+
};
6163
```
6264

6365
## Further Reading

docs/rules/no-dom-import.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ This rule has an option in case you want to tell the user which framework to use
7474

7575
### Example
7676

77-
```json
78-
{
79-
"testing-library/no-dom-import": ["error", "react"]
80-
}
77+
```js
78+
module.exports = {
79+
rules: {
80+
'testing-library/no-dom-import': ['error', 'react'],
81+
},
82+
};
8183
```
8284

8385
With the configuration above, if the user imports from `@testing-library/dom` or `dom-testing-library` instead of the used framework, ESLint will tell the user to import from `@testing-library/react` or `react-testing-library`.

0 commit comments

Comments
 (0)