mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
117616: Ported alias-imports rule
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
[DSpace ESLint plugins](../../../lint/README.md) > TypeScript rules
|
||||
_______
|
||||
|
||||
- [`dspace-angular-ts/alias-imports`](./rules/alias-imports.md): Unclear imports should be aliased for clarity
|
||||
- [`dspace-angular-ts/themed-component-classes`](./rules/themed-component-classes.md): Formatting rules for themeable component classes
|
||||
- [`dspace-angular-ts/themed-component-selectors`](./rules/themed-component-selectors.md): Themeable component selectors should follow the DSpace convention
|
||||
- [`dspace-angular-ts/themed-component-usages`](./rules/themed-component-usages.md): Themeable components should be used via their `ThemedComponent` wrapper class
|
||||
|
58
docs/lint/ts/rules/alias-imports.md
Normal file
58
docs/lint/ts/rules/alias-imports.md
Normal file
@@ -0,0 +1,58 @@
|
||||
[DSpace ESLint plugins](../../../../lint/README.md) > [TypeScript rules](../index.md) > `dspace-angular-ts/alias-imports`
|
||||
_______
|
||||
|
||||
Unclear imports should be aliased for clarity
|
||||
|
||||
_______
|
||||
|
||||
[Source code](../../../../lint/src/rules/ts/alias-imports.ts)
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
#### Valid code
|
||||
|
||||
##### correctly aliased imports
|
||||
|
||||
```typescript
|
||||
import { of as observableOf } from 'rxjs';
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
#### Invalid code & automatic fixes
|
||||
|
||||
##### imports without alias
|
||||
|
||||
```typescript
|
||||
import { of } from 'rxjs';
|
||||
```
|
||||
Will produce the following error(s):
|
||||
```
|
||||
This import must be aliased
|
||||
```
|
||||
|
||||
Result of `yarn lint --fix`:
|
||||
```typescript
|
||||
import { of as observableOf } from 'rxjs';
|
||||
```
|
||||
|
||||
|
||||
##### imports under the wrong alias
|
||||
|
||||
```typescript
|
||||
import { of as ofSomething } from 'rxjs';
|
||||
```
|
||||
Will produce the following error(s):
|
||||
```
|
||||
This import uses the wrong alias (should be {{ local }})
|
||||
```
|
||||
|
||||
Result of `yarn lint --fix`:
|
||||
```typescript
|
||||
import { of as observableOf } from 'rxjs';
|
||||
```
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user