Skip to content

Commit 91cc3ca

Browse files
134770: Fixed lint issues & rules
(cherry picked from commit b50bc4f)
1 parent a89899b commit 91cc3ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1045
-1334
lines changed

.eslintrc.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"eslint-plugin-rxjs",
1313
"eslint-plugin-simple-import-sort",
1414
"eslint-plugin-import-newlines",
15+
"@stylistic",
1516
"dspace-angular-ts",
1617
"dspace-angular-html"
1718
],
@@ -176,15 +177,15 @@
176177
}
177178
],
178179
"@angular-eslint/prefer-inject": "off",
179-
"@typescript-eslint/quotes": [
180+
"@stylistic/quotes": [
180181
"error",
181182
"single",
182183
{
183184
"avoidEscape": true,
184185
"allowTemplateLiterals": true
185186
}
186187
],
187-
"@typescript-eslint/semi": "error",
188+
"@stylistic/semi": "error",
188189
"@typescript-eslint/no-shadow": "error",
189190
"@typescript-eslint/dot-notation": "error",
190191
"@typescript-eslint/consistent-type-definitions": "error",
@@ -207,9 +208,9 @@
207208
]
208209
}
209210
],
210-
"@typescript-eslint/type-annotation-spacing": "error",
211+
"@stylistic/type-annotation-spacing": "error",
211212
"@typescript-eslint/unified-signatures": "error",
212-
"@typescript-eslint/ban-types": "error",
213+
"@typescript-eslint/no-restricted-types": "error",
213214
"@typescript-eslint/no-floating-promises": "warn",
214215
"@typescript-eslint/no-misused-promises": "warn",
215216
"@typescript-eslint/restrict-plus-operands": "warn",
@@ -280,7 +281,7 @@
280281
]
281282
}
282283
],
283-
"dspace-angular-ts/themed-component-classes": "error",
284+
"dspace-angular-ts/no-default-standalone-value": "error",
284285
"dspace-angular-ts/themed-component-selectors": "error",
285286
"dspace-angular-ts/themed-component-usages": "error",
286287
"dspace-angular-ts/themed-decorators": [

cypress/plugins/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('node:fs');
1+
import fs from 'node:fs';
22

33
// These two global variables are used to store information about the REST API used
44
// by these e2e tests. They are filled out prior to running any tests in the before()

docs/lint/html/rules/themed-component-usages.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ _______
3030
##### use no-prefix selectors in TypeScript templates
3131
3232
```html
33-
@Component({
34-
template: '<ds-test-themeable></ds-test-themeable>'
35-
})
36-
class Test {
37-
}
33+
<ds-test-themeable></ds-test-themeable>
3834
```
3935
4036

@@ -43,11 +39,7 @@ class Test {
4339
Filename: `lint/test/fixture/src/test.spec.ts`
4440

4541
```html
46-
@Component({
47-
template: '<ds-test-themeable></ds-test-themeable>'
48-
})
49-
class Test {
50-
}
42+
<ds-test-themeable></ds-test-themeable>
5143
```
5244
5345

@@ -56,11 +48,7 @@ class Test {
5648
Filename: `lint/test/fixture/src/test.spec.ts`
5749

5850
```html
59-
@Component({
60-
template: '<ds-base-test-themeable></ds-base-test-themeable>'
61-
})
62-
class Test {
63-
}
51+
<ds-base-test-themeable></ds-base-test-themeable>
6452
```
6553
6654

docs/lint/ts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
_______
33

44
- [`dspace-angular-ts/alias-imports`](./rules/alias-imports.md): Unclear imports should be aliased for clarity
5+
- [`dspace-angular-ts/no-default-standalone-value`](./rules/no-default-standalone-value.md): Removes unnecessary explicit standalone declarations of the @Component decorators. Starting from Angular 19 this is now the default value.
56
- [`dspace-angular-ts/sort-standalone-imports`](./rules/sort-standalone-imports.md): Sorts the standalone `@Component` imports alphabetically
6-
- [`dspace-angular-ts/themed-component-classes`](./rules/themed-component-classes.md): Formatting rules for themeable component classes
77
- [`dspace-angular-ts/themed-component-selectors`](./rules/themed-component-selectors.md): Themeable component selectors should follow the DSpace convention
88
- [`dspace-angular-ts/themed-component-usages`](./rules/themed-component-usages.md): Themeable components should be used via their `ThemedComponent` wrapper class
99
- [`dspace-angular-ts/themed-decorators`](./rules/themed-decorators.md): Entry components with theme support should declare the correct theme
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
[DSpace ESLint plugins](../../../../lint/README.md) > [TypeScript rules](../index.md) > `dspace-angular-ts/no-default-standalone-value`
2+
_______
3+
4+
Removes unnecessary explicit standalone declarations of the @Component decorators. Starting from Angular 19 this is now the default value.
5+
6+
_______
7+
8+
[Source code](../../../../lint/src/rules/ts/no-default-standalone-value.ts)
9+
10+
11+
12+
### Examples
13+
14+
15+
#### Valid code
16+
17+
##### Not setting the standalone value is valid
18+
19+
```typescript
20+
@Component({
21+
selector: 'ds-test',
22+
})
23+
class TestComponent {}
24+
```
25+
26+
27+
##### Setting the standalone value to false is valid
28+
29+
```typescript
30+
@Component({
31+
selector: 'ds-test',
32+
standalone: false,
33+
})
34+
class TestComponent {}
35+
```
36+
37+
38+
39+
40+
41+
#### Invalid code &amp; automatic fixes
42+
43+
##### Should not have explicit standalone declaration
44+
45+
```typescript
46+
@Component({
47+
selector: 'ds-test',
48+
standalone: true,
49+
})
50+
class TestComponent {}
51+
52+
53+
54+
```
55+
Will produce the following error(s):
56+
```
57+
Unnecessary explicit standalone declaration of the @Component decorator should be removed.
58+
```
59+
60+
Result of `yarn lint --fix`:
61+
```typescript
62+
@Component({
63+
selector: 'ds-test',
64+
})
65+
class TestComponent {}
66+
```
67+
68+
69+

0 commit comments

Comments
 (0)