Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 37f11d5

Browse files
committed
Update import rules
1 parent 06ba432 commit 37f11d5

Some content is hidden

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

46 files changed

+344
-132
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type ConsistentTypeSpecifierStyleOption =
7+
| 'prefer-inline'
8+
| 'prefer-top-level';
9+
10+
/**
11+
* Options.
12+
*/
13+
export type ConsistentTypeSpecifierStyleOptions = [
14+
ConsistentTypeSpecifierStyleOption?,
15+
];
16+
17+
/**
18+
* Enforce or ban the use of inline type-only markers for named imports.
19+
*
20+
* @see [consistent-type-specifier-style](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/consistent-type-specifier-style.md)
21+
*/
22+
export type ConsistentTypeSpecifierStyleRuleConfig =
23+
RuleConfig<ConsistentTypeSpecifierStyleOptions>;
24+
25+
/**
26+
* Enforce or ban the use of inline type-only markers for named imports.
27+
*
28+
* @see [consistent-type-specifier-style](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/consistent-type-specifier-style.md)
29+
*/
30+
export interface ConsistentTypeSpecifierStyleRule {
31+
/**
32+
* Enforce or ban the use of inline type-only markers for named imports.
33+
*
34+
* @see [consistent-type-specifier-style](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/consistent-type-specifier-style.md)
35+
*/
36+
'import/consistent-type-specifier-style': ConsistentTypeSpecifierStyleRuleConfig;
37+
}

src/rules/import/default.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { RuleConfig } from '../rule-config';
22

33
/**
4+
* Ensure a default export is present, given a default import.
45
*
5-
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/default.md)
6+
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/default.md)
67
*/
78
export type DefaultRuleConfig = RuleConfig<[]>;
89

910
/**
11+
* Ensure a default export is present, given a default import.
1012
*
11-
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/default.md)
13+
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/default.md)
1214
*/
1315
export interface DefaultRule {
1416
/**
17+
* Ensure a default export is present, given a default import.
1518
*
16-
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/default.md)
19+
* @see [default](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/default.md)
1720
*/
1821
'import/default': DefaultRuleConfig;
1922
}

src/rules/import/dynamic-import-chunkname.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ export interface DynamicImportChunknameOption {
1515
export type DynamicImportChunknameOptions = [DynamicImportChunknameOption?];
1616

1717
/**
18+
* Enforce a leading comment with the webpackChunkName for dynamic imports.
1819
*
19-
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/dynamic-import-chunkname.md)
20+
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/dynamic-import-chunkname.md)
2021
*/
2122
export type DynamicImportChunknameRuleConfig =
2223
RuleConfig<DynamicImportChunknameOptions>;
2324

2425
/**
26+
* Enforce a leading comment with the webpackChunkName for dynamic imports.
2527
*
26-
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/dynamic-import-chunkname.md)
28+
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/dynamic-import-chunkname.md)
2729
*/
2830
export interface DynamicImportChunknameRule {
2931
/**
32+
* Enforce a leading comment with the webpackChunkName for dynamic imports.
3033
*
31-
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/dynamic-import-chunkname.md)
34+
* @see [dynamic-import-chunkname](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/dynamic-import-chunkname.md)
3235
*/
3336
'import/dynamic-import-chunkname': DynamicImportChunknameRuleConfig;
3437
}

src/rules/import/export.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { RuleConfig } from '../rule-config';
22

33
/**
4+
* Forbid any invalid exports, i.e. re-export of the same name.
45
*
5-
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/export.md)
6+
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/export.md)
67
*/
78
export type ExportRuleConfig = RuleConfig<[]>;
89

910
/**
11+
* Forbid any invalid exports, i.e. re-export of the same name.
1012
*
11-
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/export.md)
13+
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/export.md)
1214
*/
1315
export interface ExportRule {
1416
/**
17+
* Forbid any invalid exports, i.e. re-export of the same name.
1518
*
16-
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/export.md)
19+
* @see [export](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/export.md)
1720
*/
1821
'import/export': ExportRuleConfig;
1922
}

src/rules/import/exports-last.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { RuleConfig } from '../rule-config';
22

33
/**
4+
* Ensure all exports appear after other statements.
45
*
5-
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/exports-last.md)
6+
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/exports-last.md)
67
*/
78
export type ExportsLastRuleConfig = RuleConfig<[]>;
89

910
/**
11+
* Ensure all exports appear after other statements.
1012
*
11-
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/exports-last.md)
13+
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/exports-last.md)
1214
*/
1315
export interface ExportsLastRule {
1416
/**
17+
* Ensure all exports appear after other statements.
1518
*
16-
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/exports-last.md)
19+
* @see [exports-last](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/exports-last.md)
1720
*/
1821
'import/exports-last': ExportsLastRuleConfig;
1922
}

src/rules/import/extensions.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,22 @@ export type ExtensionsOption =
5757
export type ExtensionsOptions = ExtensionsOption;
5858

5959
/**
60+
* Ensure consistent use of file extension within the import path.
6061
*
61-
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/extensions.md)
62+
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/extensions.md)
6263
*/
6364
export type ExtensionsRuleConfig = RuleConfig<ExtensionsOptions>;
6465

6566
/**
67+
* Ensure consistent use of file extension within the import path.
6668
*
67-
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/extensions.md)
69+
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/extensions.md)
6870
*/
6971
export interface ExtensionsRule {
7072
/**
73+
* Ensure consistent use of file extension within the import path.
7174
*
72-
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/extensions.md)
75+
* @see [extensions](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/extensions.md)
7376
*/
7477
'import/extensions': ExtensionsRuleConfig;
7578
}

src/rules/import/first.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,22 @@ export type FirstOption = 'absolute-first' | 'disable-absolute-first';
1111
export type FirstOptions = [FirstOption?];
1212

1313
/**
14+
* Ensure all imports appear before other statements.
1415
*
15-
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/first.md)
16+
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/first.md)
1617
*/
1718
export type FirstRuleConfig = RuleConfig<FirstOptions>;
1819

1920
/**
21+
* Ensure all imports appear before other statements.
2022
*
21-
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/first.md)
23+
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/first.md)
2224
*/
2325
export interface FirstRule {
2426
/**
27+
* Ensure all imports appear before other statements.
2528
*
26-
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/first.md)
29+
* @see [first](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/first.md)
2730
*/
2831
'import/first': FirstRuleConfig;
2932
}

src/rules/import/group-exports.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
import type { RuleConfig } from '../rule-config';
22

33
/**
4+
* Prefer named exports to be grouped together in a single export declaration.
45
*
5-
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/group-exports.md)
6+
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/group-exports.md)
67
*/
78
export type GroupExportsRuleConfig = RuleConfig<[]>;
89

910
/**
11+
* Prefer named exports to be grouped together in a single export declaration.
1012
*
11-
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/group-exports.md)
13+
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/group-exports.md)
1214
*/
1315
export interface GroupExportsRule {
1416
/**
17+
* Prefer named exports to be grouped together in a single export declaration.
1518
*
16-
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.26.0/docs/rules/group-exports.md)
19+
* @see [group-exports](https://github.com/import-js/eslint-plugin-import/blob/v2.27.5/docs/rules/group-exports.md)
1720
*/
1821
'import/group-exports': GroupExportsRuleConfig;
1922
}

src/rules/import/imports-first.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type ImportsFirstOption = 'absolute-first' | 'disable-absolute-first';
1111
export type ImportsFirstOptions = [ImportsFirstOption?];
1212

1313
/**
14+
* Replaced by `import/first`.
1415
*
1516
* @deprecated
1617
*
@@ -19,13 +20,15 @@ export type ImportsFirstOptions = [ImportsFirstOption?];
1920
export type ImportsFirstRuleConfig = RuleConfig<ImportsFirstOptions>;
2021

2122
/**
23+
* Replaced by `import/first`.
2224
*
2325
* @deprecated
2426
*
2527
* @see [imports-first](https://github.com/import-js/eslint-plugin-import/blob/7b25c1cb95ee18acc1531002fd343e1e6031f9ed/docs/rules/imports-first.md)
2628
*/
2729
export interface ImportsFirstRule {
2830
/**
31+
* Replaced by `import/first`.
2932
*
3033
* @deprecated
3134
*

src/rules/import/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { ConsistentTypeSpecifierStyleRule } from './consistent-type-specifier-style';
12
import type { DefaultRule } from './default';
23
import type { DynamicImportChunknameRule } from './dynamic-import-chunkname';
34
import type { ExportRule } from './export';
@@ -19,6 +20,7 @@ import type { NoDefaultExportRule } from './no-default-export';
1920
import type { NoDeprecatedRule } from './no-deprecated';
2021
import type { NoDuplicatesRule } from './no-duplicates';
2122
import type { NoDynamicRequireRule } from './no-dynamic-require';
23+
import type { NoEmptyNamedBlocksRule } from './no-empty-named-blocks';
2224
import type { NoExtraneousDependenciesRule } from './no-extraneous-dependencies';
2325
import type { NoImportModuleExportsRule } from './no-import-module-exports';
2426
import type { NoInternalModulesRule } from './no-internal-modules';
@@ -58,6 +60,7 @@ export type ImportRules = NoUnresolvedRule &
5860
GroupExportsRule &
5961
NoRelativePackagesRule &
6062
NoRelativeParentImportsRule &
63+
ConsistentTypeSpecifierStyleRule &
6164
NoSelfImportRule &
6265
NoCycleRule &
6366
NoNamedDefaultRule &
@@ -85,6 +88,7 @@ export type ImportRules = NoUnresolvedRule &
8588
NoUselessPathSegmentsRule &
8689
DynamicImportChunknameRule &
8790
NoImportModuleExportsRule &
91+
NoEmptyNamedBlocksRule &
8892
ExportsLastRule &
8993
NoDeprecatedRule &
9094
ImportsFirstRule;

0 commit comments

Comments
 (0)