Skip to content

Commit

Permalink
Add no-duplicate-import-type-import to eslint-config-adeira
Browse files Browse the repository at this point in the history
  • Loading branch information
tbergquist-godaddy authored and mrtnzlml committed Dec 2, 2019
1 parent fd355be commit 735d6d1
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/eslint-config-adeira/CHANGELOG.md
@@ -1,5 +1,6 @@
# Unreleased

- Add new rule `adeira/no-duplicate-import-type-import`;

# 0.4.0

Expand Down
Expand Up @@ -32,6 +32,7 @@ Object {
"setWithoutGet": true,
},
],
"adeira/no-duplicate-import-type-import": 1,
"adeira/no-internal-flow-type": 1,
"adeira/no-invalid-flow-annotations": 2,
"adeira/only-nullable-fields": 2,
Expand Down Expand Up @@ -897,7 +898,9 @@ Snapshot Diff:
@@ --- --- @@
],
- "adeira/no-duplicate-import-type-import": 1,
- "adeira/no-internal-flow-type": 1,
+ "adeira/no-duplicate-import-type-import": 2,
+ "adeira/no-internal-flow-type": 2,
"adeira/no-invalid-flow-annotations": 2,
@@ --- --- @@
Expand Down
1 change: 1 addition & 0 deletions src/eslint-config-adeira/ourRules.js
Expand Up @@ -638,4 +638,5 @@ module.exports = {
'adeira/relay-import-no-values': ERROR,
'adeira/relay-import-type-must-exist': ERROR,
'adeira/valid-test-folder': NEXT_VERSION_ERROR, // TODO: ERROR
'adeira/no-duplicate-import-type-import': NEXT_VERSION_ERROR,
};
30 changes: 30 additions & 0 deletions src/eslint-plugin-adeira/README.md
Expand Up @@ -134,3 +134,33 @@ Using `isValidTestPathRegex` setting

You can configure this rule to match your settings by passing `isValidTestPathRegex`;
- [ERROR, {isValidTestPathRegex: '__specs__'}] will match `/src/__specs__/my_feature.test.js`


## no-duplicate-import-type-import

This rule reports error for duplicated import-type-import. It does not report duplicated import, since that is covered by `imports/no-duplicate`.

- When to use this rule: When you don't want imports like:
```js
import React from 'react';
import type { Node } from 'react';
```

- When not to use this rule. When you think the import as above is ok.

Example of **incorrect** imports:

```js
import React from 'react';
import type { Node } from 'react'; // Duplicate react
import { graphql, type Environment } from '@adeira/relay';
import type { RelayRefetchProps } from '@adeira/relay'; // duplicate adeira

```

Example of **correct** filename:

```js
import React, { type Node } from 'react';
import { graphql, type Environment, type RelayRefetchProps } from '@adeira/relay';
```

0 comments on commit 735d6d1

Please sign in to comment.