Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1c55766

Browse files
chore: fix linting problems (testing-library#208)
1 parent ed7fe76 commit 1c55766

25 files changed

+53
-55
lines changed

‎.eslintrc.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
],
5050
"@typescript-eslint/no-unused-expressions": "error",
5151
"@typescript-eslint/prefer-function-type": "error",
52-
"@typescript-eslint/quotes": ["error", "single"],
52+
"@typescript-eslint/quotes": "off",
5353
"@typescript-eslint/type-annotation-spacing": "error",
5454
"@typescript-eslint/no-explicit-any": "off",
5555
"arrow-body-style": "error",
@@ -107,9 +107,10 @@
107107
},
108108
{
109109
"files": ["*.spec.ts"],
110-
"extends": ["plugin:testing-library/angular", "plugin:jest-dom/recommended"],
110+
"extends": ["plugin:jest/recommended"],
111111
"rules": {
112-
"testing-library/prefer-explicit-assert": "error"
112+
"jest/no-done-callback": "off",
113+
"jest/expect-expect": "off"
113114
}
114115
},
115116
{

‎angular.json‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"lint": {
7272
"builder": "@nrwl/linter:eslint",
7373
"options": {
74-
"lintFilePatterns": ["apps/example-app/src/**/*.ts", "apps/example-app/src/**/*.html"]
74+
"lintFilePatterns": ["apps/example-app/**/*.ts", "apps/example-app/**/*.html"]
7575
}
7676
},
7777
"test": {
@@ -106,11 +106,7 @@
106106
"lint": {
107107
"builder": "@nrwl/linter:eslint",
108108
"options": {
109-
"lintFilePatterns": [
110-
"projects/testing-library/src/**/*.ts",
111-
"projects/testing-library/src/**/*.html",
112-
"projects/testing-library/src/**/*.html"
113-
]
109+
"lintFilePatterns": ["projects/testing-library/**/*.ts", "projects/testing-library/**/*.html"]
114110
}
115111
},
116112
"build": {
@@ -159,11 +155,7 @@
159155
"lint": {
160156
"builder": "@nrwl/linter:eslint",
161157
"options": {
162-
"lintFilePatterns": [
163-
"projects/jest-utils/src/**/*.ts",
164-
"projects/jest-utils/src/**/*.html",
165-
"projects/jest-utils/src/**/*.html"
166-
]
158+
"lintFilePatterns": ["projects/jest-utils/**/*.ts", "projects/jest-utils/**/*.html"]
167159
}
168160
},
169161
"build": {

‎apps/example-app/.eslintrc.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
},
2929
"plugins": ["@angular-eslint/eslint-plugin", "@typescript-eslint"]
3030
},
31+
{
32+
"files": ["*.spec.ts"],
33+
"extends": ["plugin:testing-library/angular", "plugin:jest-dom/recommended"]
34+
},
3135
{
3236
"files": ["*.html"],
3337
"extends": ["plugin:@nrwl/nx/angular-template"],

‎apps/example-app/src/app/issues/issue-106.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/angular';
66
template: `<button (click)="toggleShow()" data-testid="toggle">toggle</button>
77
<div *ngIf="show$ | async" data-testid="getme">Here I am</div>`,
88
})
9-
exportclass TestSelectComponent {
9+
class TestSelectComponent {
1010
showSubj = new BehaviorSubject(false);
1111
show$ = this.showSubj.asObservable();
1212

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@
6666
"@typescript-eslint/eslint-plugin": "4.22.0",
6767
"@typescript-eslint/parser": "4.22.0",
6868
"cpy-cli": "^3.1.1",
69-
"eslint": "7.24.0",
69+
"eslint": "^7.25.0",
7070
"eslint-config-prettier": "8.2.0",
7171
"eslint-plugin-import": "latest",
72+
"eslint-plugin-jest": "^24.3.5",
7273
"eslint-plugin-jest-dom": "3.8.0",
7374
"eslint-plugin-testing-library": "^4.0.1",
7475
"husky": "^4.2.5",

‎projects/jest-utils/.eslintrc.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"error",
1414
{
1515
"type": "attribute",
16-
"prefix": "lib",
16+
"prefix": "atl",
1717
"style": "camelCase"
1818
}
1919
],
2020
"@angular-eslint/component-selector": [
2121
"error",
2222
{
2323
"type": "element",
24-
"prefix": "lib",
24+
"prefix": "atl",
2525
"style": "kebab-case"
2626
}
2727
]

‎projects/jest-utils/tests/create-mock.spec.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Component } from '@angular/core';
22
import { TestBed } from '@angular/core/testing';
3+
import { fireEvent, render } from '@testing-library/angular';
34

45
import { createMock, provideMock, Mock } from '../src/public_api';
5-
import { render, fireEvent } from '../../testing-library/src/public_api';
66

77
class FixtureService {
88
constructor(private foo: string, public bar: string) {}
@@ -13,10 +13,10 @@ class FixtureService {
1313
}
1414

1515
@Component({
16-
selector: 'fixture',
16+
selector: 'atl-fixture',
1717
template: ` <button (click)="print()">Print</button> `,
1818
})
19-
exportclass FixtureComponent {
19+
class FixtureComponent {
2020
constructor(private service: FixtureService) {}
2121

2222
print() {
@@ -39,6 +39,7 @@ it('provides a mock service', async () => {
3939
expect(service.print).toHaveBeenCalledTimes(1);
4040
});
4141

42+
// eslint-disable-next-line jest/expect-expect
4243
it('is possible to write a mock implementation', async (done) => {
4344
const { getByText } = await render(FixtureComponent, {
4445
providers: [provideMock(FixtureService)],

‎projects/testing-library/.eslintrc.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"error",
1414
{
1515
"type": "attribute",
16-
"prefix": "lib",
16+
"prefix": ["atl"],
1717
"style": "camelCase"
1818
}
1919
],
2020
"@angular-eslint/component-selector": [
2121
"error",
2222
{
2323
"type": "element",
24-
"prefix": "lib",
24+
"prefix": ["atl"],
2525
"style": "kebab-case"
2626
}
2727
]

‎projects/testing-library/src/lib/testing-library.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ if (typeof afterEach === 'function' && !process.env.ATL_SKIP_AUTO_CLEANUP) {
358358
});
359359
}
360360

361+
// TODO: rename to `atl-wrapper-component`
361362
// eslint-disable-next-line @angular-eslint/component-selector
362363
@Component({ selector: 'wrapper-component', template: '' })
363364
class WrapperComponent {}

‎projects/testing-library/tests/auto-cleanup.spec.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Component, Input } from '@angular/core';
22
import { render } from '../src/public_api';
33

44
@Component({
5-
selector: 'fixture',
6-
template: `Hello {{ name }}!`,
5+
selector: 'atl-fixture',
6+
template: `Hello {{ name }}!`,
77
})
88
class FixtureComponent {
99
@Input() name: string;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /