Skip to content

Commit bed17ff

Browse files
committed
chore: lint the projects manually
Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
1 parent 4430f01 commit bed17ff

24 files changed

+65
-100
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
node-version: ${{ matrix.node-version }}
2020
- name: install package
2121
run: |
22-
npm install -g @angular/cli@17
22+
npm install -g @angular/cli@19
2323
npm ci
2424
- name: run tests
2525
run: |

eslint.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ module.exports = tseslint.config(
1010
processor: angular.processInlineTemplates,
1111
rules: {
1212
'@angular-eslint/prefer-standalone': 'off',
13+
'@typescript-eslint/no-explicit-any': 'warn',
14+
'@typescript-eslint/no-unused-vars': 'warn',
15+
'@angular-eslint/component-class-suffix': 'warn',
16+
'@angular-eslint/no-output-on-prefix': 'warn',
17+
'@angular-eslint/no-output-native': 'warn',
18+
'@typescript-eslint/no-unsafe-function-type': 'warn',
1319
'@angular-eslint/directive-selector': [
1420
'error',
1521
{
@@ -30,6 +36,9 @@ module.exports = tseslint.config(
3036
{
3137
files: ['**/*.html'],
3238
extends: [...angular.configs.templateRecommended, ...angular.configs.templateAccessibility],
33-
rules: {},
39+
rules: {
40+
'@angular-eslint/template/click-events-have-key-events': 'warn',
41+
'@angular-eslint/template/interactive-supports-focus': 'warn',
42+
},
3443
}
3544
);

projects/ng-core-tester/tsconfig.eslint.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

projects/rero/ng-core/.eslintrc.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

projects/rero/ng-core/src/lib/directive/katex.directive.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ import { KatexDirective } from './katex.directive';
2525
`,
2626
standalone: false
2727
})
28-
export class KatexComponentTest {
28+
export class KatexComponent {
2929
katexData = 'Infinitesimal Hilbertianity of Locally $$\\mathrm{CAT}(\\kappa )$$-Spaces';
3030
}
3131

3232
describe('KatexDirective', () => {
33-
let component: KatexComponentTest;
34-
let fixture: ComponentFixture<KatexComponentTest>;
33+
let component: KatexComponent;
34+
let fixture: ComponentFixture<KatexComponent>;
3535

3636
beforeEach(async() => {
3737
TestBed.configureTestingModule({
38-
declarations: [ KatexComponentTest, KatexDirective ],
38+
declarations: [ KatexComponent, KatexDirective ],
3939
}).compileComponents();
4040
});
4141

4242
beforeEach(() => {
43-
fixture = TestBed.createComponent(KatexComponentTest);
43+
fixture = TestBed.createComponent(KatexComponent);
4444
component = fixture.componentInstance;
4545
fixture.detectChanges();
4646
});

projects/rero/ng-core/src/lib/read-more/read-more.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('ReadMoreComponent', () => {
2626
let component: ReadMoreComponent;
2727
let fixture: ComponentFixture<ReadMoreComponent>;
2828

29-
const text = 'We show that, given a metric space $$(\\mathrm{Y},\\textsf {d} )$$of curvature bounded from above in the sense of Alexandrov, and a positive Radon measure $$\\mu $$on $$\\mathrm{Y}$$giving finite mass to bounded sets, the resulting metric measure space $$(\\mathrm{Y},\\textsf {d} ,\\mu )$$is infinitesimally Hilbertian, i.e. the Sobolev space $$W^{1,2}(\\mathrm{Y},\\textsf {d} ,\mu )$$is a Hilbert space. The result is obtained by constructing an isometric embedding of the ‘abstract and analytical’ space of derivations into the ‘concrete and geometrical’ bundle whose fibre at $$x\\in \\mathrm{Y}$$is the tangent cone at x of $$\\mathrm{Y}$$. The conclusion then follows from the fact that for every $$x\\in \\mathrm{Y}$$such a cone is a $$\\mathrm{CAT}(0)$$space and, as such, has a Hilbert-like structure.';
29+
const text = 'We show that, given a metric space $$(\\mathrm{Y},\\textsf {d} )$$of curvature bounded from above in the sense of Alexandrov, and a positive Radon measure $$\\mu $$on $$\\mathrm{Y}$$giving finite mass to bounded sets, the resulting metric measure space $$(\\mathrm{Y},\\textsf {d} ,\\mu )$$is infinitesimally Hilbertian, i.e. the Sobolev space $$W^{1,2}(\\mathrm{Y},\\textsf {d} ,\\mu )$$is a Hilbert space. The result is obtained by constructing an isometric embedding of the ‘abstract and analytical’ space of derivations into the ‘concrete and geometrical’ bundle whose fibre at $$x\\in \\mathrm{Y}$$is the tangent cone at x of $$\\mathrm{Y}$$. The conclusion then follows from the fact that for every $$x\\in \\mathrm{Y}$$such a cone is a $$\\mathrm{CAT}(0)$$space and, as such, has a Hilbert-like structure.';
3030

3131
beforeEach(waitForAsync(() => {
3232
TestBed.configureTestingModule({

projects/rero/ng-core/src/lib/record/detail/detail-button/detail-button.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class DetailButtonComponent {
7474
if (this.deleteStatus().can) {
7575
this.recordEvent.emit({ action: 'delete', record });
7676
} else {
77-
this.deleteMessageEvent.emit(this.deleteStatus().message.replace(new RegExp('\n', 'g'), '<br>'));
77+
this.deleteMessageEvent.emit(this.deleteStatus().message.replace(new RegExp('\\n', 'g'), '<br>'));
7878
}
7979
}
8080

projects/rero/ng-core/src/lib/record/detail/detail.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class ActivatedRouteStub {
4545
return this._testParamMap;
4646
}
4747

48-
set testParamMap(params: {}) {
48+
set testParamMap(params: object) {
4949
this._testParamMap = convertToParamMap(params);
5050
}
5151

@@ -125,7 +125,7 @@ describe('DetailComponent', () => {
125125
const routeSpy = TestBed.inject(ActivatedRoute) as any;
126126
routeSpy.testParamMap = { type: 'test', pid: '1' };
127127
expect(() => {
128-
component['loadViewComponentRef']();
128+
component['loadViewComponentRef']();
129129
}).toThrowError('Configuration not found for type "test"');
130130
});
131131

@@ -138,13 +138,13 @@ describe('DetailComponent', () => {
138138
};
139139

140140
expect(() => {
141-
component['loadViewComponentRef']();
141+
component['loadViewComponentRef']();
142142
}).toThrowError('Configuration types not passed to component');
143143

144144
delete routeSpy.snapshot.data.types;
145145

146146
expect(() => {
147-
component['loadViewComponentRef']();
147+
component['loadViewComponentRef']();
148148
}).toThrowError('Configuration types not passed to component');
149149
});
150150

@@ -157,7 +157,7 @@ describe('DetailComponent', () => {
157157
}
158158
];
159159

160-
component['loadViewComponentRef']();
160+
component['loadViewComponentRef']();
161161
expect(component.viewComponent).toEqual(JsonComponent);
162162
});
163163

projects/rero/ng-core/src/lib/record/editor/editor.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ export class EditorComponent extends AbstractCanDeactivateComponent implements O
235235
if (this.editorSettings.template.recordType !== undefined) {
236236
const tmplResource = this.routeCollectionService.getRoute(this.editorSettings.template.recordType);
237237
const tmplConfiguration = tmplResource.getConfiguration();
238-
if (tmplConfiguration.hasOwnProperty('data')
239-
&& tmplConfiguration.data.hasOwnProperty('types')) {
238+
if (Object.hasOwn(tmplConfiguration, 'data')
239+
&& Object.hasOwn(tmplConfiguration.data, 'types')) {
240240
this.recordUiService.types = this.recordUiService.types.concat(tmplConfiguration.data.types);
241241
}
242242
}
@@ -732,7 +732,7 @@ export class EditorComponent extends AbstractCanDeactivateComponent implements O
732732
return (
733733
!field.props.required &&
734734
!field.hide &&
735-
!('hide' in field?.expressions)
735+
!(field?.expressions?.hide)
736736
);
737737
}
738738

projects/rero/ng-core/src/lib/record/editor/extensions.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class NgCoreFormlyExtension {
180180
private _modelIsEmpty(field): boolean {
181181
let model = field?.model;
182182
// for simple object the model is the parent dict
183-
if (field.model != null && !field.hasOwnProperty('fieldGroup')) {
183+
if (field.model != null && !Object.hasOwn(field, 'fieldGroup')) {
184184
// New from ngx-formly v5.9.0
185185
model = field.model[Array.isArray(field.key) ? field.key[0] : field.key];
186186
}
@@ -196,7 +196,8 @@ export class NgCoreFormlyExtension {
196196
if (!field.props?.editorConfig) {
197197
return;
198198
}
199-
const { pid, longMode } = field.props?.editorConfig;
199+
const longMode = field?.props?.editorConfig?.longMode;
200+
const pid = field?.props?.editorConfig?.pid;
200201
if (
201202
// only in longMode else it will not be possible to unhide a field
202203
!longMode ||
@@ -206,7 +207,7 @@ export class NgCoreFormlyExtension {
206207
// TODO: find a better way to identify this case
207208
!isNaN(Number(field.key)) ||
208209
// ignore field that has hide expression
209-
'hide' in field?.expressions ||
210+
field?.expressions?.hide ||
210211
// do not hide a field containing a 'hide' wrapper
211212
this._hasHideWrapper(field) ||
212213
// do not hide a field that has a parent marked as hidden and a model is empty
@@ -233,7 +234,11 @@ export class NgCoreFormlyExtension {
233234
// only during the editor initialization
234235
!field?.props?.getRoot()?.formControl?.touched)
235236
) {
236-
field.props.setHide ? field.props.setHide(field, true) : (field.hide = true);
237+
if (field.props.setHide) {
238+
field.props.setHide(field, true);
239+
} else {
240+
field.hide = true;
241+
}
237242
}
238243
}
239244
}

0 commit comments

Comments
 (0)