Skip to content

chore: migrate to eslint flat config #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 4, 2025
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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

127 changes: 0 additions & 127 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
run: npm run build -- --skip-nx-cache
- name: test
run: npm run test
- name: lint
run: npm run lint
- name: Release
if: github.repository == 'testing-library/angular-testing-library' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
run: npx semantic-release
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ counter.component.ts

```ts
@Component({
selector: 'app-counter',
selector: 'atl-counter',
template: `
<span>{{ hello() }}</span>
<button (click)="decrement()">-</button>
Expand Down
44 changes: 0 additions & 44 deletions apps/example-app-karma/.eslintrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions apps/example-app-karma/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check

// TODO - https://github.com/nrwl/nx/issues/22576

/** @type {import('@typescript-eslint/utils/ts-eslint').FlatConfig.ConfigPromise} */
const config = (async () => (await import('./eslint.config.mjs')).default)();
module.exports = config;
8 changes: 8 additions & 0 deletions apps/example-app-karma/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

import tseslint from "typescript-eslint";
import rootConfig from "../../eslint.config.mjs";

export default tseslint.config(
...rootConfig,
);
1 change: 0 additions & 1 deletion apps/example-app-karma/jasmine-dom.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
declare module '@testing-library/jasmine-dom' {
// eslint-disable-next-line @typescript-eslint/naming-convention
const JasmineDOM: any;
export default JasmineDOM;
}
4 changes: 2 additions & 2 deletions apps/example-app-karma/src/app/examples/login-form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ it('should display invalid message and submit button must be disabled', async ()
});

@Component({
selector: 'app-login',
selector: 'atl-login',
standalone: true,
imports: [ReactiveFormsModule, NgIf],
template: `
Expand All @@ -51,7 +51,7 @@ class LoginComponent {
});

constructor(private fb: FormBuilder) {}

get email(): FormControl {
return this.form.get('email') as FormControl;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/example-app-karma/src/app/issues/rerender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ it('can rerender component', async () => {
},
});

expect(screen.getByText('Hello Sarah')).toBeTruthy();
expect(screen.getByText('Hello Sarah')).toBeInTheDocument();

await rerender({ componentProperties: { name: 'Mark' } });

expect(screen.getByText('Hello Mark')).toBeTruthy();
expect(screen.getByText('Hello Mark')).toBeInTheDocument();
});
47 changes: 0 additions & 47 deletions apps/example-app/.eslintrc.json

This file was deleted.

7 changes: 7 additions & 0 deletions apps/example-app/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check

// TODO - https://github.com/nrwl/nx/issues/22576

/** @type {import('@typescript-eslint/utils/ts-eslint').FlatConfig.ConfigPromise} */
const config = (async () => (await import('./eslint.config.mjs')).default)();
module.exports = config;
8 changes: 8 additions & 0 deletions apps/example-app/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-check

import tseslint from "typescript-eslint";
import rootConfig from "../../eslint.config.mjs";

export default tseslint.config(
...rootConfig,
);
1 change: 0 additions & 1 deletion apps/example-app/jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable */
export default {
displayName: {
name: 'Example App',
Expand Down
2 changes: 1 addition & 1 deletion apps/example-app/src/app/examples/00-single-component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'app-fixture',
selector: 'atl-fixture',
standalone: true,
template: `
<button (click)="value = value - 1">Decrement</button>
Expand Down
12 changes: 6 additions & 6 deletions apps/example-app/src/app/examples/01-nested-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, Input, Output, EventEmitter } from '@angular/core';

@Component({
standalone: true,
selector: 'app-button',
selector: 'atl-button',
template: ' <button (click)="raise.emit()">{{ name }}</button> ',
})
export class NestedButtonComponent {
Expand All @@ -12,7 +12,7 @@ export class NestedButtonComponent {

@Component({
standalone: true,
selector: 'app-value',
selector: 'atl-value',
template: ' <span data-testid="value">{{ value }}</span> ',
})
export class NestedValueComponent {
Expand All @@ -21,11 +21,11 @@ export class NestedValueComponent {

@Component({
standalone: true,
selector: 'app-fixture',
selector: 'atl-fixture',
template: `
<app-button (raise)="value = value - 1" name="Decrement" />
<app-value [value]="value" />
<app-button (raise)="value = value + 1" name="Increment" />
<atl-button (raise)="value = value - 1" name="Decrement" />
<atl-value [value]="value" />
<atl-button (raise)="value = value + 1" name="Increment" />
`,
imports: [NestedButtonComponent, NestedValueComponent],
})
Expand Down
4 changes: 2 additions & 2 deletions apps/example-app/src/app/examples/02-input-output.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test.skip('is possible to set input and listen for output with the template synt
const user = userEvent.setup();
const sendSpy = jest.fn();

await render('<app-fixture [value]="47" (sendValue)="sendValue($event)" />', {
await render('<atl-fixture [value]="47" (sendValue)="sendValue($event)" />', {
imports: [InputOutputComponent],
on: {
sendValue: sendSpy,
Expand Down Expand Up @@ -94,7 +94,7 @@ test('is possible to set input and listen for output with the template syntax (d
const user = userEvent.setup();
const sendSpy = jest.fn();

await render('<app-fixture [value]="47" (sendValue)="sendValue($event)" />', {
await render('<atl-fixture [value]="47" (sendValue)="sendValue($event)" />', {
imports: [InputOutputComponent],
componentProperties: {
sendValue: sendSpy,
Expand Down
2 changes: 1 addition & 1 deletion apps/example-app/src/app/examples/02-input-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';

@Component({
standalone: true,
selector: 'app-fixture',
selector: 'atl-fixture',
template: `
<button (click)="value = value - 1">Decrement</button>
<span data-testid="value">{{ value }}</span>
Expand Down
2 changes: 1 addition & 1 deletion apps/example-app/src/app/examples/03-forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';

@Component({
standalone: true,
selector: 'app-fixture',
selector: 'atl-fixture',
imports: [ReactiveFormsModule, NgForOf, NgIf],
template: `
<form [formGroup]="form" name="form">
Expand Down
Loading
Loading