eslint-plugin-import-next 2.3.9 → 2.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/package.json +16 -12
- package/src/files/foo.js +0 -5
- package/src/files/no-default.js +0 -5
- package/src/index.d.ts +15 -2812
- package/src/index.js +5 -147
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -18
- package/src/rules/consistent-type-specifier-style.js +0 -19
- package/src/rules/default.js +0 -7
- package/src/rules/dynamic-import-chunkname.js +0 -8
- package/src/rules/enforce-dependency-direction.js +2 -39
- package/src/rules/enforce-import-order.js +3 -33
- package/src/rules/enforce-team-boundaries.js +0 -49
- package/src/rules/export.js +0 -9
- package/src/rules/exports-last.js +0 -10
- package/src/rules/extensions.js +2 -11
- package/src/rules/first.js +0 -6
- package/src/rules/group-exports.js +0 -13
- package/src/rules/max-dependencies.js +0 -16
- package/src/rules/named.js +1 -10
- package/src/rules/namespace.js +1 -11
- package/src/rules/newline-after-import.js +2 -13
- package/src/rules/no-absolute-path.js +0 -7
- package/src/rules/no-amd.js +1 -18
- package/src/rules/no-anonymous-default-export.js +0 -13
- package/src/rules/no-barrel-file.js +0 -32
- package/src/rules/no-barrel-import.js +0 -25
- package/src/rules/no-commonjs.js +0 -18
- package/src/rules/no-cross-domain-imports.js +2 -47
- package/src/rules/no-cycle.js +2 -135
- package/src/rules/no-default-export.js +0 -28
- package/src/rules/no-deprecated.js +0 -32
- package/src/rules/no-duplicates.js +2 -10
- package/src/rules/no-dynamic-require.js +0 -6
- package/src/rules/no-empty-named-blocks.js +1 -17
- package/src/rules/no-extraneous-dependencies.js +0 -38
- package/src/rules/no-full-package-import.js +0 -19
- package/src/rules/no-import-module-exports.js +0 -8
- package/src/rules/no-internal-modules.js +0 -40
- package/src/rules/no-legacy-imports.js +1 -11
- package/src/rules/no-mutable-exports.js +0 -14
- package/src/rules/no-named-as-default-member.js +0 -11
- package/src/rules/no-named-as-default.js +0 -17
- package/src/rules/no-named-default.js +0 -5
- package/src/rules/no-named-export.js +1 -22
- package/src/rules/no-namespace.js +0 -10
- package/src/rules/no-nodejs-modules.js +0 -15
- package/src/rules/no-relative-packages.js +0 -15
- package/src/rules/no-relative-parent-imports.js +0 -11
- package/src/rules/no-restricted-paths.js +0 -6
- package/src/rules/no-self-import.js +0 -22
- package/src/rules/no-unassigned-import.js +0 -14
- package/src/rules/no-unresolved.js +0 -16
- package/src/rules/no-unused-modules.js +0 -7
- package/src/rules/no-useless-path-segments.js +0 -15
- package/src/rules/prefer-default-export.js +0 -18
- package/src/rules/prefer-direct-import.js +1 -21
- package/src/rules/prefer-modern-api.js +0 -21
- package/src/rules/prefer-node-protocol.js +0 -15
- package/src/rules/prefer-tree-shakeable-imports.js +0 -14
- package/src/rules/require-import-approval.js +0 -21
- package/src/rules/unambiguous.js +0 -11
- package/src/types/index.js +0 -5
- package/AGENTS.md +0 -95
- package/CHANGELOG.md +0 -170
- package/src/files/foo.d.ts +0 -7
- package/src/files/no-default.d.ts +0 -6
- package/src/rules/consistent-type-specifier-style.d.ts +0 -13
- package/src/rules/default.d.ts +0 -9
- package/src/rules/dynamic-import-chunkname.d.ts +0 -26
- package/src/rules/enforce-dependency-direction.d.ts +0 -27
- package/src/rules/enforce-import-order.d.ts +0 -29
- package/src/rules/enforce-team-boundaries.d.ts +0 -47
- package/src/rules/export.d.ts +0 -17
- package/src/rules/exports-last.d.ts +0 -15
- package/src/rules/extensions.d.ts +0 -17
- package/src/rules/first.d.ts +0 -13
- package/src/rules/group-exports.d.ts +0 -15
- package/src/rules/max-dependencies.d.ts +0 -26
- package/src/rules/named.d.ts +0 -13
- package/src/rules/namespace.d.ts +0 -13
- package/src/rules/newline-after-import.d.ts +0 -13
- package/src/rules/no-absolute-path.d.ts +0 -25
- package/src/rules/no-amd.d.ts +0 -21
- package/src/rules/no-anonymous-default-export.d.ts +0 -24
- package/src/rules/no-barrel-file.d.ts +0 -55
- package/src/rules/no-barrel-import.d.ts +0 -48
- package/src/rules/no-commonjs.d.ts +0 -28
- package/src/rules/no-cross-domain-imports.d.ts +0 -41
- package/src/rules/no-cycle.d.ts +0 -102
- package/src/rules/no-default-export.d.ts +0 -24
- package/src/rules/no-deprecated.d.ts +0 -26
- package/src/rules/no-duplicates.d.ts +0 -13
- package/src/rules/no-dynamic-require.d.ts +0 -22
- package/src/rules/no-empty-named-blocks.d.ts +0 -17
- package/src/rules/no-extraneous-dependencies.d.ts +0 -45
- package/src/rules/no-full-package-import.d.ts +0 -42
- package/src/rules/no-import-module-exports.d.ts +0 -21
- package/src/rules/no-internal-modules.d.ts +0 -28
- package/src/rules/no-legacy-imports.d.ts +0 -47
- package/src/rules/no-mutable-exports.d.ts +0 -22
- package/src/rules/no-named-as-default-member.d.ts +0 -15
- package/src/rules/no-named-as-default.d.ts +0 -15
- package/src/rules/no-named-default.d.ts +0 -15
- package/src/rules/no-named-export.d.ts +0 -26
- package/src/rules/no-namespace.d.ts +0 -21
- package/src/rules/no-nodejs-modules.d.ts +0 -24
- package/src/rules/no-relative-packages.d.ts +0 -21
- package/src/rules/no-relative-parent-imports.d.ts +0 -22
- package/src/rules/no-restricted-paths.d.ts +0 -20
- package/src/rules/no-self-import.d.ts +0 -15
- package/src/rules/no-unassigned-import.d.ts +0 -20
- package/src/rules/no-unresolved.d.ts +0 -20
- package/src/rules/no-unused-modules.d.ts +0 -19
- package/src/rules/no-useless-path-segments.d.ts +0 -23
- package/src/rules/prefer-default-export.d.ts +0 -24
- package/src/rules/prefer-direct-import.d.ts +0 -51
- package/src/rules/prefer-modern-api.d.ts +0 -47
- package/src/rules/prefer-node-protocol.d.ts +0 -19
- package/src/rules/prefer-tree-shakeable-imports.d.ts +0 -49
- package/src/rules/require-import-approval.d.ts +0 -52
- package/src/rules/unambiguous.d.ts +0 -15
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-named-export
|
|
8
|
-
* Prevents named exports (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'namedExport' | 'suggestDefault';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** Allow named exports in specific files */
|
|
14
|
-
allowInFiles?: string[];
|
|
15
|
-
/** Allow specific named exports */
|
|
16
|
-
allowNames?: string[];
|
|
17
|
-
/** Allow named exports for specific patterns */
|
|
18
|
-
allowPatterns?: string[];
|
|
19
|
-
/** Suggest default export alternative */
|
|
20
|
-
suggestDefault?: boolean;
|
|
21
|
-
}
|
|
22
|
-
type RuleOptions = [Options?];
|
|
23
|
-
export declare const noNamedExport: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
24
|
-
name: string;
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-namespace
|
|
8
|
-
* Forbid namespace (a.k.a. "wildcard" *) imports
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-namespace.md
|
|
11
|
-
*/
|
|
12
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
13
|
-
export interface Options {
|
|
14
|
-
/** Patterns to ignore (glob patterns for the import source) */
|
|
15
|
-
ignore?: string[];
|
|
16
|
-
}
|
|
17
|
-
type RuleOptions = [Options?];
|
|
18
|
-
export declare const noNamespace: TSESLint.RuleModule<"noNamespace", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-nodejs-modules
|
|
8
|
-
* Prevents Node.js builtin imports (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'nodejsBuiltinImport' | 'nodejsBuiltinRequire' | 'nodejsBuiltinDynamic';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** Allow specific Node.js builtins */
|
|
14
|
-
allow?: string[];
|
|
15
|
-
/** Additional builtins to flag */
|
|
16
|
-
additionalBuiltins?: string[];
|
|
17
|
-
/** Try to suggest alternatives */
|
|
18
|
-
suggestAlternatives?: boolean;
|
|
19
|
-
}
|
|
20
|
-
type RuleOptions = [Options?];
|
|
21
|
-
export declare const noNodejsModules: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
22
|
-
name: string;
|
|
23
|
-
};
|
|
24
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-relative-packages
|
|
8
|
-
* Forbid importing packages through relative paths
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-relative-packages.md
|
|
11
|
-
*/
|
|
12
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
13
|
-
export interface Options {
|
|
14
|
-
/** Allow relative imports within the same package. Default: true */
|
|
15
|
-
allowSamePackage?: boolean;
|
|
16
|
-
}
|
|
17
|
-
type RuleOptions = [Options?];
|
|
18
|
-
export declare const noRelativePackages: TSESLint.RuleModule<"relativePackage", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
19
|
-
name: string;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-relative-parent-imports
|
|
8
|
-
* Prevents ../ imports (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'relativeParentImport' | 'preferAbsoluteImport' | 'suggestAlias';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** CommonJS require() calls should also be checked */
|
|
14
|
-
commonjs?: boolean;
|
|
15
|
-
/** AMD define/require calls should also be checked */
|
|
16
|
-
amd?: boolean;
|
|
17
|
-
}
|
|
18
|
-
type RuleOptions = [Options?];
|
|
19
|
-
export declare const noRelativeParentImports: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-restricted-paths
|
|
8
|
-
* Enforce which files can be imported in a given folder (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'restrictedPath' | 'pathViolation' | 'zoneViolation';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** Array of restricted path patterns */
|
|
14
|
-
restricted: string[];
|
|
15
|
-
}
|
|
16
|
-
type RuleOptions = [Options?];
|
|
17
|
-
export declare const noRestrictedPaths: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
18
|
-
name: string;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
7
|
-
export interface Options {
|
|
8
|
-
/** Allow self-import in test files */
|
|
9
|
-
allowInTests?: boolean;
|
|
10
|
-
}
|
|
11
|
-
type RuleOptions = [Options?];
|
|
12
|
-
export declare const noSelfImport: TSESLint.RuleModule<"selfImport", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
13
|
-
name: string;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-unassigned-import
|
|
8
|
-
* Prevents unassigned imports (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'unassignedImport' | 'sideEffectOnly' | 'missingAssignment';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** Allow specific modules to be imported without assignment */
|
|
14
|
-
allowModules?: string[];
|
|
15
|
-
}
|
|
16
|
-
type RuleOptions = [Options?];
|
|
17
|
-
export declare const noUnassignedImport: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
18
|
-
name: string;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
7
|
-
type MessageIds = 'unresolvedImport' | 'moduleNotFound' | 'invalidExtension' | 'addIgnoreComment';
|
|
8
|
-
export interface Options {
|
|
9
|
-
/** File extensions to consider when resolving imports */
|
|
10
|
-
extensions?: string[];
|
|
11
|
-
/** Ignore certain modules/patterns */
|
|
12
|
-
ignore?: string[];
|
|
13
|
-
/** Allow unresolved imports in certain contexts */
|
|
14
|
-
allowUnresolved?: boolean;
|
|
15
|
-
}
|
|
16
|
-
type RuleOptions = [Options?];
|
|
17
|
-
export declare const noUnresolved: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
18
|
-
name: string;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-unused-modules
|
|
8
|
-
* Forbid modules without exports
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
export interface Options {
|
|
12
|
-
/** Allow modules that only contain imports */
|
|
13
|
-
allowImportOnly?: boolean;
|
|
14
|
-
}
|
|
15
|
-
type RuleOptions = [Options?];
|
|
16
|
-
export declare const noUnusedModules: TSESLint.RuleModule<"missingExports", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
17
|
-
name: string;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: no-useless-path-segments
|
|
8
|
-
* Forbid unnecessary path segments in import and require statements
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-useless-path-segments.md
|
|
11
|
-
*/
|
|
12
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
13
|
-
export interface Options {
|
|
14
|
-
/** Don't report on direct parent: imports (../) */
|
|
15
|
-
noUselessIndex?: boolean;
|
|
16
|
-
/** Check CommonJS require(). Default: true */
|
|
17
|
-
commonjs?: boolean;
|
|
18
|
-
}
|
|
19
|
-
type RuleOptions = [Options?];
|
|
20
|
-
export declare const noUselessPathSegments: TSESLint.RuleModule<"uselessPathSegments", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
21
|
-
name: string;
|
|
22
|
-
};
|
|
23
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: prefer-default-export
|
|
8
|
-
* Prefer a default export if module exports a single name (eslint-plugin-import inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
type MessageIds = 'preferDefaultExport' | 'singleNamedExport' | 'multipleNamedToDefault';
|
|
12
|
-
export interface Options {
|
|
13
|
-
/** Target file types to check */
|
|
14
|
-
target?: 'always' | 'single' | 'as-needed';
|
|
15
|
-
/** Ignore files matching patterns */
|
|
16
|
-
ignoreFiles?: string[];
|
|
17
|
-
/** Allow named exports in specific contexts */
|
|
18
|
-
allowNamedExports?: boolean;
|
|
19
|
-
}
|
|
20
|
-
type RuleOptions = [Options?];
|
|
21
|
-
export declare const preferDefaultExport: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
22
|
-
name: string;
|
|
23
|
-
};
|
|
24
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: prefer-direct-import
|
|
8
|
-
* Suggests direct imports instead of importing from barrel files/directories
|
|
9
|
-
*
|
|
10
|
-
* This rule provides autofix capabilities to convert:
|
|
11
|
-
* import { Button } from '@/components';
|
|
12
|
-
* To:
|
|
13
|
-
* import { Button } from '@/components/Button';
|
|
14
|
-
*
|
|
15
|
-
* Why This Matters:
|
|
16
|
-
* - Direct imports enable optimal tree-shaking
|
|
17
|
-
* - Faster build times (bundler doesn't parse unused modules)
|
|
18
|
-
* - Clearer dependency graph
|
|
19
|
-
*
|
|
20
|
-
* @see https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
|
|
21
|
-
*/
|
|
22
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
23
|
-
/**
|
|
24
|
-
* Mapping configuration for known barrel paths to direct import paths
|
|
25
|
-
*/
|
|
26
|
-
interface DirectImportMapping {
|
|
27
|
-
/** Pattern to match barrel imports (regex string) */
|
|
28
|
-
barrel: string;
|
|
29
|
-
/** Template for direct import path. Use {name} for the imported identifier */
|
|
30
|
-
directPath: string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Configuration options for prefer-direct-import rule
|
|
34
|
-
*/
|
|
35
|
-
export interface PreferDirectImportOptions {
|
|
36
|
-
/**
|
|
37
|
-
* Mapping of barrel paths to direct import patterns.
|
|
38
|
-
* Example: [{ barrel: '^@/components$', directPath: '@/components/{name}' }]
|
|
39
|
-
*/
|
|
40
|
-
mappings?: DirectImportMapping[];
|
|
41
|
-
/**
|
|
42
|
-
* Auto-fix the imports when possible.
|
|
43
|
-
* Default: true
|
|
44
|
-
*/
|
|
45
|
-
autoFix?: boolean;
|
|
46
|
-
}
|
|
47
|
-
type RuleOptions = [PreferDirectImportOptions?];
|
|
48
|
-
export declare const preferDirectImport: TSESLint.RuleModule<"preferDirectImport", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
49
|
-
name: string;
|
|
50
|
-
};
|
|
51
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: prefer-modern-api
|
|
8
|
-
* Suggests modern replacements for deprecated or outdated library imports
|
|
9
|
-
*
|
|
10
|
-
* Why This Matters:
|
|
11
|
-
* - Keeps codebase up-to-date with modern best practices
|
|
12
|
-
* - Avoids security vulnerabilities in outdated libraries
|
|
13
|
-
* - Reduces bundle size with modern tree-shakeable alternatives
|
|
14
|
-
* - Prevents tech debt from accumulating
|
|
15
|
-
*
|
|
16
|
-
* @see https://github.com/sindresorhus/meta/discussions/15
|
|
17
|
-
*/
|
|
18
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
19
|
-
/**
|
|
20
|
-
* Modern API recommendation
|
|
21
|
-
*/
|
|
22
|
-
interface ModernApiMapping {
|
|
23
|
-
/** Deprecated/outdated package */
|
|
24
|
-
deprecated: string;
|
|
25
|
-
/** Modern replacement */
|
|
26
|
-
modern: string;
|
|
27
|
-
/** Reason for migration */
|
|
28
|
-
reason: string;
|
|
29
|
-
/** Migration difficulty: easy, medium, hard */
|
|
30
|
-
difficulty?: 'easy' | 'medium' | 'hard';
|
|
31
|
-
/** Link to migration guide */
|
|
32
|
-
migrationGuide?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Configuration options for prefer-modern-api rule
|
|
36
|
-
*/
|
|
37
|
-
export interface PreferModernApiOptions {
|
|
38
|
-
/** Custom mappings (in addition to built-in) */
|
|
39
|
-
customMappings?: ModernApiMapping[];
|
|
40
|
-
/** Disable built-in mappings */
|
|
41
|
-
disableBuiltIn?: boolean;
|
|
42
|
-
}
|
|
43
|
-
type RuleOptions = [PreferModernApiOptions?];
|
|
44
|
-
export declare const preferModernApi: TSESLint.RuleModule<"preferModernApi", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
45
|
-
name: string;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: prefer-node-protocol
|
|
8
|
-
* Enforce using the node: protocol for Node.js built-in modules (unicorn-inspired)
|
|
9
|
-
*/
|
|
10
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
11
|
-
export interface Options {
|
|
12
|
-
/** Additional modules to check beyond built-ins */
|
|
13
|
-
additionalModules?: string[];
|
|
14
|
-
}
|
|
15
|
-
type RuleOptions = [Options?];
|
|
16
|
-
export declare const preferNodeProtocol: TSESLint.RuleModule<"preferNodeProtocol", RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
17
|
-
name: string;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: prefer-tree-shakeable-imports
|
|
8
|
-
* Detects import patterns that prevent effective tree-shaking
|
|
9
|
-
*
|
|
10
|
-
* Why This Matters:
|
|
11
|
-
* - Namespace imports (import * as) prevent tree-shaking
|
|
12
|
-
* - Default imports from large packages include entire library
|
|
13
|
-
* - Direct/named imports enable optimal dead code elimination
|
|
14
|
-
*
|
|
15
|
-
* @see https://webpack.js.org/guides/tree-shaking/
|
|
16
|
-
* @see https://rollupjs.org/faqs/#why-do-additional-imports-turn-up-in-my-entry-chunks-when-code-splitting
|
|
17
|
-
*/
|
|
18
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
19
|
-
type MessageIds = 'namespaceImport' | 'defaultImportFromLargePackage';
|
|
20
|
-
/**
|
|
21
|
-
* Configuration for packages that should use tree-shakeable imports
|
|
22
|
-
*/
|
|
23
|
-
interface PackageConfig {
|
|
24
|
-
/** Package name or pattern */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Preferred import pattern (if subpath) */
|
|
27
|
-
subpathPattern?: string;
|
|
28
|
-
/** Prefer named imports */
|
|
29
|
-
preferNamed?: boolean;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Configuration options for prefer-tree-shakeable-imports rule
|
|
33
|
-
*/
|
|
34
|
-
export interface PreferTreeShakeableOptions {
|
|
35
|
-
/**
|
|
36
|
-
* Packages to enforce tree-shakeable imports on.
|
|
37
|
-
*/
|
|
38
|
-
targetPackages?: PackageConfig[];
|
|
39
|
-
/**
|
|
40
|
-
* Block all namespace imports from any package.
|
|
41
|
-
* Default: false
|
|
42
|
-
*/
|
|
43
|
-
blockAllNamespaceImports?: boolean;
|
|
44
|
-
}
|
|
45
|
-
type RuleOptions = [PreferTreeShakeableOptions?];
|
|
46
|
-
export declare const preferTreeShakeableImports: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
47
|
-
name: string;
|
|
48
|
-
};
|
|
49
|
-
export {};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: require-import-approval
|
|
8
|
-
* Enforces that certain high-risk packages require explicit approval in config
|
|
9
|
-
*
|
|
10
|
-
* Why This Matters:
|
|
11
|
-
* - Prevents accidental introduction of packages with known vulnerabilities
|
|
12
|
-
* - Enforces organizational policies on package selection
|
|
13
|
-
* - Provides visibility into third-party dependency usage
|
|
14
|
-
* - Supports supply chain security initiatives
|
|
15
|
-
*
|
|
16
|
-
* @see https://owasp.org/Top10/A06_2021-Vulnerable_and_Outdated_Components/
|
|
17
|
-
*/
|
|
18
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
19
|
-
type MessageIds = 'unapprovedPackage' | 'blockedPackage';
|
|
20
|
-
/**
|
|
21
|
-
* Package approval status
|
|
22
|
-
*/
|
|
23
|
-
interface PackagePolicy {
|
|
24
|
-
/** Package name or pattern */
|
|
25
|
-
package: string;
|
|
26
|
-
/** Status: 'approved', 'pending', 'blocked' */
|
|
27
|
-
status: 'approved' | 'pending' | 'blocked';
|
|
28
|
-
/** Reason for blocking or pending status */
|
|
29
|
-
reason?: string;
|
|
30
|
-
/** Approved alternative package */
|
|
31
|
-
alternative?: string;
|
|
32
|
-
/** Who approved (for audit trail) */
|
|
33
|
-
approvedBy?: string;
|
|
34
|
-
/** Approval date */
|
|
35
|
-
approvedDate?: string;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Configuration options for require-import-approval rule
|
|
39
|
-
*/
|
|
40
|
-
export interface RequireImportApprovalOptions {
|
|
41
|
-
/** List of package policies */
|
|
42
|
-
packages: PackagePolicy[];
|
|
43
|
-
/** Default policy for unlisted packages: 'allow' | 'deny' */
|
|
44
|
-
defaultPolicy?: 'allow' | 'deny';
|
|
45
|
-
/** Patterns to ignore (e.g., devDependencies) */
|
|
46
|
-
ignorePatterns?: string[];
|
|
47
|
-
}
|
|
48
|
-
type RuleOptions = [RequireImportApprovalOptions];
|
|
49
|
-
export declare const requireImportApproval: TSESLint.RuleModule<MessageIds, RuleOptions, unknown, TSESLint.RuleListener> & {
|
|
50
|
-
name: string;
|
|
51
|
-
};
|
|
52
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
-
* MIT license that can be found in the LICENSE file.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* ESLint Rule: unambiguous
|
|
8
|
-
* Forbid potentially ambiguous parse goal (script vs. module)
|
|
9
|
-
*
|
|
10
|
-
* @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/unambiguous.md
|
|
11
|
-
*/
|
|
12
|
-
import type { TSESLint } from '@interlace/eslint-devkit';
|
|
13
|
-
export declare const unambiguous: TSESLint.RuleModule<"ambiguous", [], unknown, TSESLint.RuleListener> & {
|
|
14
|
-
name: string;
|
|
15
|
-
};
|