eslint-plugin-fast-import 2.2.0 → 2.2.2
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/CHANGELOG.md +8 -0
- package/README.md +29 -5
- package/dist/module/computePackageInfo.d.ts +2 -0
- package/dist/module/computePackageInfo.js +4 -0
- package/dist/module/computePackageInfo.js.map +1 -0
- package/dist/module/computeRepoInfo.d.ts +5 -0
- package/dist/module/computeRepoInfo.js +100 -0
- package/dist/module/computeRepoInfo.js.map +1 -0
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +4 -1
- package/dist/plugin.js.map +1 -1
- package/dist/rules/no-cycle/cycle.d.ts +4 -0
- package/dist/rules/no-cycle/cycle.js +140 -0
- package/dist/rules/no-cycle/cycle.js.map +1 -0
- package/dist/rules/no-cycle/rule.d.ts +4 -0
- package/dist/rules/no-cycle/rule.js +319 -0
- package/dist/rules/no-cycle/rule.js.map +1 -0
- package/dist/rules/no-empty-entry-points/rule.d.ts +3 -0
- package/dist/rules/no-empty-entry-points/rule.js +57 -0
- package/dist/rules/no-empty-entry-points/rule.js.map +1 -0
- package/dist/rules/no-entry-point-imports/entryPoint.d.ts +3 -0
- package/dist/rules/no-entry-point-imports/entryPoint.js +57 -0
- package/dist/rules/no-entry-point-imports/entryPoint.js.map +1 -0
- package/dist/rules/no-entry-point-imports/rule.d.ts +3 -0
- package/dist/rules/no-entry-point-imports/rule.js +60 -0
- package/dist/rules/no-entry-point-imports/rule.js.map +1 -0
- package/dist/rules/no-external-barrel-reexports/externalBarrelReexports.d.ts +3 -0
- package/dist/rules/no-external-barrel-reexports/externalBarrelReexports.js +42 -0
- package/dist/rules/no-external-barrel-reexports/externalBarrelReexports.js.map +1 -0
- package/dist/rules/no-external-barrel-reexports/rule.d.ts +3 -0
- package/dist/rules/no-external-barrel-reexports/rule.js +42 -0
- package/dist/rules/no-external-barrel-reexports/rule.js.map +1 -0
- package/dist/rules/no-named-as-default/namedAsDefault.d.ts +3 -0
- package/dist/rules/no-named-as-default/namedAsDefault.js +77 -0
- package/dist/rules/no-named-as-default/namedAsDefault.js.map +1 -0
- package/dist/rules/no-named-as-default/rule.d.ts +3 -0
- package/dist/rules/no-named-as-default/rule.js +79 -0
- package/dist/rules/no-named-as-default/rule.js.map +1 -0
- package/dist/rules/no-node-builtins/nodeBuiltins.d.ts +3 -0
- package/dist/rules/no-node-builtins/nodeBuiltins.js +48 -0
- package/dist/rules/no-node-builtins/nodeBuiltins.js.map +1 -0
- package/dist/rules/no-node-builtins/rule.d.ts +3 -0
- package/dist/rules/no-node-builtins/rule.js +49 -0
- package/dist/rules/no-node-builtins/rule.js.map +1 -0
- package/dist/rules/no-restricted-imports/restricted.d.ts +31 -0
- package/dist/rules/no-restricted-imports/restricted.js +196 -0
- package/dist/rules/no-restricted-imports/restricted.js.map +1 -0
- package/dist/rules/no-restricted-imports/rule.d.ts +31 -0
- package/dist/rules/no-restricted-imports/rule.js +204 -0
- package/dist/rules/no-restricted-imports/rule.js.map +1 -0
- package/dist/rules/no-test-imports-in-prod/rule.d.ts +3 -0
- package/dist/rules/no-test-imports-in-prod/rule.js +57 -0
- package/dist/rules/no-test-imports-in-prod/rule.js.map +1 -0
- package/dist/rules/no-test-imports-in-prod/testInProd.d.ts +3 -0
- package/dist/rules/no-test-imports-in-prod/testInProd.js +49 -0
- package/dist/rules/no-test-imports-in-prod/testInProd.js.map +1 -0
- package/dist/rules/no-test-only-imports/rule.d.ts +3 -0
- package/dist/rules/no-test-only-imports/rule.js +69 -0
- package/dist/rules/no-test-only-imports/rule.js.map +1 -0
- package/dist/rules/no-unnamed-entry-point-exports/rule.d.ts +3 -0
- package/dist/rules/no-unnamed-entry-point-exports/rule.js +41 -0
- package/dist/rules/no-unnamed-entry-point-exports/rule.js.map +1 -0
- package/dist/rules/no-unresolved-imports/rule.d.ts +3 -0
- package/dist/rules/no-unresolved-imports/rule.js +139 -0
- package/dist/rules/no-unresolved-imports/rule.js.map +1 -0
- package/dist/rules/no-unresolved-imports/unresolved.d.ts +3 -0
- package/dist/rules/no-unresolved-imports/unresolved.js +135 -0
- package/dist/rules/no-unresolved-imports/unresolved.js.map +1 -0
- package/dist/rules/no-unused-exports/rule.d.ts +3 -0
- package/dist/rules/no-unused-exports/rule.js +60 -0
- package/dist/rules/no-unused-exports/rule.js.map +1 -0
- package/dist/rules/no-unused-package-exports/rule.d.ts +3 -0
- package/dist/rules/no-unused-package-exports/rule.js +57 -0
- package/dist/rules/no-unused-package-exports/rule.js.map +1 -0
- package/dist/rules/prefer-alias-imports/alias.d.ts +6 -0
- package/dist/rules/prefer-alias-imports/alias.js +210 -0
- package/dist/rules/prefer-alias-imports/alias.js.map +1 -0
- package/dist/rules/prefer-alias-imports/rule.d.ts +6 -0
- package/dist/rules/prefer-alias-imports/rule.js +214 -0
- package/dist/rules/prefer-alias-imports/rule.js.map +1 -0
- package/dist/rules/require-node-prefix/nodePrefix.d.ts +3 -0
- package/dist/rules/require-node-prefix/nodePrefix.js +59 -0
- package/dist/rules/require-node-prefix/nodePrefix.js.map +1 -0
- package/dist/rules/require-node-prefix/rule.d.ts +3 -0
- package/dist/rules/require-node-prefix/rule.js +60 -0
- package/dist/rules/require-node-prefix/rule.js.map +1 -0
- package/dist/settings/framework.d.ts +3 -0
- package/dist/settings/framework.js +91 -0
- package/dist/settings/framework.js.map +1 -0
- package/dist/settings/package.d.ts +6 -0
- package/dist/settings/package.js +64 -0
- package/dist/settings/package.js.map +1 -0
- package/dist/settings/repo.d.ts +1 -0
- package/dist/settings/repo.js +6 -0
- package/dist/settings/repo.js.map +1 -0
- package/dist/util/getSubpathEntry.d.ts +4 -0
- package/dist/util/getSubpathEntry.js +22 -0
- package/dist/util/getSubpathEntry.js.map +1 -0
- package/fast-import.config.json +3 -4
- package/package.json +12 -8
- package/dist/package/package.d.ts +0 -8
- package/dist/package/package.js +0 -41
- package/dist/package/package.js.map +0 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { createRule, getESMInfo, getLocFromRange } from '../util.js';
|
|
2
|
+
export const namedAsDefault = createRule({
|
|
3
|
+
name: 'no-named-as-default',
|
|
4
|
+
meta: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'Ensures that imports of Node.js modules use the `node:` prefix',
|
|
7
|
+
},
|
|
8
|
+
schema: [],
|
|
9
|
+
fixable: undefined,
|
|
10
|
+
type: 'problem',
|
|
11
|
+
messages: {
|
|
12
|
+
noNamedAsDefault: 'Default import alias must not have the same name as a named export',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultOptions: [],
|
|
16
|
+
create(context) {
|
|
17
|
+
const esmInfo = getESMInfo(context);
|
|
18
|
+
// No project info means this file wasn't found as part of the project, e.g.
|
|
19
|
+
// because it's ignored
|
|
20
|
+
/* istanbul ignore if */
|
|
21
|
+
if (!esmInfo) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const { fileInfo } = esmInfo;
|
|
25
|
+
/* istanbul ignore if */
|
|
26
|
+
if (fileInfo.fileType !== 'code') {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
for (const importEntry of fileInfo.singleImports) {
|
|
30
|
+
if (importEntry.importName !== 'default' || !importEntry.resolvedModulePath) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const fileDetails = esmInfo.projectInfo.files.get(importEntry.resolvedModulePath);
|
|
34
|
+
/* istanbul ignore if */
|
|
35
|
+
if (!fileDetails || fileDetails.fileType !== 'code') {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
for (const exportEntry of [
|
|
39
|
+
...fileDetails.exports,
|
|
40
|
+
...fileDetails.singleReexports,
|
|
41
|
+
...fileDetails.barrelReexports,
|
|
42
|
+
]) {
|
|
43
|
+
if (exportEntry.exportName === importEntry.importAlias) {
|
|
44
|
+
context.report({
|
|
45
|
+
loc: getLocFromRange(context, importEntry.reportNodeRange),
|
|
46
|
+
messageId: 'noNamedAsDefault',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const importEntry of fileInfo.singleReexports) {
|
|
52
|
+
/* istanbul ignore else */
|
|
53
|
+
if (importEntry.importName !== 'default' || !importEntry.resolvedModulePath) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
const fileDetails = esmInfo.projectInfo.files.get(importEntry.resolvedModulePath);
|
|
57
|
+
/* istanbul ignore if */
|
|
58
|
+
if (!fileDetails || fileDetails.fileType !== 'code') {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
for (const exportEntry of [
|
|
62
|
+
...fileDetails.exports,
|
|
63
|
+
...fileDetails.singleReexports,
|
|
64
|
+
...fileDetails.barrelReexports,
|
|
65
|
+
]) {
|
|
66
|
+
if (exportEntry.exportName === importEntry.exportName) {
|
|
67
|
+
context.report({
|
|
68
|
+
loc: getLocFromRange(context, importEntry.reportNodeRange),
|
|
69
|
+
messageId: 'noNamedAsDefault',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {};
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=namedAsDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namedAsDefault.js","sourceRoot":"","sources":["../../../src/rules/no-named-as-default/namedAsDefault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,gEAAgE;SAC9E;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,gBAAgB,EAAE,oEAAoE;SACvF;KACF;IACD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AI,WAAW,CAAC,UAAU,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC;gBAC5E,SAAS;YACX,CAAC;YACD,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;YAClF,wBAAwB;YACxB,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACpD,SAAS;YACX,CAAC;YACD,KAAK,MAAM,WAAW,IAAI;gBACxB,GAAG,WAAW,CAAC,OAAO;gBACtB,GAAG,WAAW,CAAC,eAAe;gBAC9B,GAAG,WAAW,CAAC,eAAe;aAC/B,EAAE,CAAC;gBACF,IAAI,WAAW,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;oBACtD,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,eAAe,CAAC;wBAC1D,SAAS,EAAE,kBAAkB;qBAC9B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRule, getESMInfo, getLocFromRange } from '../util.js';
|
|
2
|
+
export const noNamedAsDefault = createRule({
|
|
3
|
+
name: 'no-named-as-default',
|
|
4
|
+
meta: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'Ensures that imports of Node.js modules use the `node:` prefix',
|
|
7
|
+
},
|
|
8
|
+
schema: [],
|
|
9
|
+
fixable: undefined,
|
|
10
|
+
type: 'problem',
|
|
11
|
+
messages: {
|
|
12
|
+
noNamedAsDefault: 'Default import alias must not have the same name as a named export',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultOptions: [],
|
|
16
|
+
create(context) {
|
|
17
|
+
const esmInfo = getESMInfo(context);
|
|
18
|
+
// No package info means this file wasn't found as part of the package, e.g.
|
|
19
|
+
// because it's ignored
|
|
20
|
+
/* istanbul ignore if */
|
|
21
|
+
if (!esmInfo) {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
const { fileInfo } = esmInfo;
|
|
25
|
+
/* istanbul ignore if */
|
|
26
|
+
if (fileInfo.fileType !== 'code') {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
for (const importEntry of fileInfo.singleImports) {
|
|
30
|
+
if (importEntry.importName !== 'default' ||
|
|
31
|
+
!importEntry.resolvedModulePath) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const fileDetails = esmInfo.packageInfo.files.get(importEntry.resolvedModulePath);
|
|
35
|
+
/* istanbul ignore if */
|
|
36
|
+
if (!fileDetails || fileDetails.fileType !== 'code') {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
for (const exportEntry of [
|
|
40
|
+
...fileDetails.exports,
|
|
41
|
+
...fileDetails.singleReexports,
|
|
42
|
+
...fileDetails.barrelReexports,
|
|
43
|
+
]) {
|
|
44
|
+
if (exportEntry.exportName === importEntry.importAlias) {
|
|
45
|
+
context.report({
|
|
46
|
+
loc: getLocFromRange(context, importEntry.reportNodeRange),
|
|
47
|
+
messageId: 'noNamedAsDefault',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
for (const importEntry of fileInfo.singleReexports) {
|
|
53
|
+
/* istanbul ignore if */
|
|
54
|
+
if (importEntry.importName !== 'default' ||
|
|
55
|
+
!importEntry.resolvedModulePath) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const fileDetails = esmInfo.packageInfo.files.get(importEntry.resolvedModulePath);
|
|
59
|
+
/* istanbul ignore if */
|
|
60
|
+
if (!fileDetails || fileDetails.fileType !== 'code') {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
for (const exportEntry of [
|
|
64
|
+
...fileDetails.exports,
|
|
65
|
+
...fileDetails.singleReexports,
|
|
66
|
+
...fileDetails.barrelReexports,
|
|
67
|
+
]) {
|
|
68
|
+
if (exportEntry.exportName === importEntry.exportName) {
|
|
69
|
+
context.report({
|
|
70
|
+
loc: getLocFromRange(context, importEntry.reportNodeRange),
|
|
71
|
+
messageId: 'noNamedAsDefault',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return {};
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../src/rules/no-named-as-default/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EACT,gEAAgE;SACnE;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,gBAAgB,EACd,oEAAoE;SACvE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAEpC,4EAA4E;QAC5E,uBAAuB;QACvB,wBAAwB;QACxB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC7B,wBAAwB;QACxB,IAAI,QAAQ,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,KAAK,MAAM,WAAW,IAAI,QAAQ,CAA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BAC9B,GAAG,WAAW,CAAC,eAAe;aAC/B,EAAE,CAAC;gBACF,IAAI,WAAW,CAAC,UAAU,KAAK,WAAW,CAAC,UAAU,EAAE,CAAC;oBACtD,OAAO,CAAC,MAAM,CAAC;wBACb,GAAG,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,eAAe,CAAC;wBAC1D,SAAS,EAAE,kBAAkB;qBAC9B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createRule, getESMInfo, getLocFromRange } from '../util.js';
|
|
2
|
+
export const noNodeBuiltins = createRule({
|
|
3
|
+
name: 'no-node-builtins',
|
|
4
|
+
meta: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'Disallows imports of Node.js built-in modules',
|
|
7
|
+
},
|
|
8
|
+
schema: [],
|
|
9
|
+
type: 'problem',
|
|
10
|
+
messages: {
|
|
11
|
+
noNodeBuiltins: 'Import of Node.js built-in module "{{specifier}}" is not allowed',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
const esmInfo = getESMInfo(context);
|
|
17
|
+
// No project info means this file wasn't found as part of the project, e.g.
|
|
18
|
+
// because it's ignored
|
|
19
|
+
/* istanbul ignore if */
|
|
20
|
+
if (!esmInfo) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
const { fileInfo } = esmInfo;
|
|
24
|
+
/* istanbul ignore if */
|
|
25
|
+
if (fileInfo.fileType !== 'code') {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
for (const importEntry of [
|
|
29
|
+
...fileInfo.singleImports,
|
|
30
|
+
...fileInfo.barrelImports,
|
|
31
|
+
...fileInfo.dynamicImports,
|
|
32
|
+
...fileInfo.singleReexports,
|
|
33
|
+
...fileInfo.barrelReexports,
|
|
34
|
+
]) {
|
|
35
|
+
if (importEntry.resolvedModuleType === 'builtin') {
|
|
36
|
+
context.report({
|
|
37
|
+
loc: getLocFromRange(context, importEntry.statementNodeRange),
|
|
38
|
+
messageId: 'noNodeBuiltins',
|
|
39
|
+
data: {
|
|
40
|
+
specifier: importEntry.moduleSpecifier,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {};
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=nodeBuiltins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeBuiltins.js","sourceRoot":"","sources":["../../../src/rules/no-node-builtins/nodeBuiltins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;SAC7D;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,cAAc,EAAE,kEAAkE;SACnF;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAEpC,4EAA4E;QAC5E,uBAAuB;QACvB,wBAAwB;QACxB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC7B,wBAAwB;QACxB,IAAI,QAAQ,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,KAAK,MAAM,WAAW,IAAI;YACxB,GAAG,QAAQ,CAAC,aAAa;YACzB,GAAG,QAAQ,CAAC,aAAa;YACzB,GAAG,QAAQ,CAAC,cAAc;YAC1B,GAAG,QAAQ,CAAC,eAAe;YAC3B,GAAG,QAAQ,CAAC,eAAe;SAC5B,EAAE,CAAC;YACF,IAAI,WAAW,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACjD,OAAO,CAAC,MAAM,CAAC;oBACb,GAAG,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC;oBAC7D,SAAS,EAAE,gBAAgB;oBAC3B,IAAI,EAAE;wBACJ,SAAS,EAAE,WAAW,CAAC,eAAe;qBACvC;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRule, getESMInfo, getLocFromRange } from '../util.js';
|
|
2
|
+
export const noNodeBuiltins = createRule({
|
|
3
|
+
name: 'no-node-builtins',
|
|
4
|
+
meta: {
|
|
5
|
+
docs: {
|
|
6
|
+
description: 'Disallows imports of Node.js built-in modules',
|
|
7
|
+
},
|
|
8
|
+
schema: [],
|
|
9
|
+
type: 'problem',
|
|
10
|
+
messages: {
|
|
11
|
+
noNodeBuiltins: 'Import of Node.js built-in module "{{specifier}}" is not allowed',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultOptions: [],
|
|
15
|
+
create(context) {
|
|
16
|
+
const esmInfo = getESMInfo(context);
|
|
17
|
+
// No package info means this file wasn't found as part of the package, e.g.
|
|
18
|
+
// because it's ignored
|
|
19
|
+
/* istanbul ignore if */
|
|
20
|
+
if (!esmInfo) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
const { fileInfo } = esmInfo;
|
|
24
|
+
/* istanbul ignore if */
|
|
25
|
+
if (fileInfo.fileType !== 'code') {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
for (const importEntry of [
|
|
29
|
+
...fileInfo.singleImports,
|
|
30
|
+
...fileInfo.barrelImports,
|
|
31
|
+
...fileInfo.dynamicImports,
|
|
32
|
+
...fileInfo.sideEffectImports,
|
|
33
|
+
...fileInfo.singleReexports,
|
|
34
|
+
...fileInfo.barrelReexports,
|
|
35
|
+
]) {
|
|
36
|
+
if (importEntry.resolvedModuleType === 'builtin') {
|
|
37
|
+
context.report({
|
|
38
|
+
loc: getLocFromRange(context, importEntry.statementNodeRange),
|
|
39
|
+
messageId: 'noNodeBuiltins',
|
|
40
|
+
data: {
|
|
41
|
+
specifier: importEntry.moduleSpecifier,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {};
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=rule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../src/rules/no-node-builtins/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,+CAA+C;SAC7D;QACD,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,cAAc,EACZ,kEAAkE;SACrE;KACF;IACD,cAAc,EAAE,EAAE;IAClB,MAAM,CAAC,OAAO;QACZ,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAEpC,4EAA4E;QAC5E,uBAAuB;QACvB,wBAAwB;QACxB,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QAC7B,wBAAwB;QACxB,IAAI,QAAQ,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACjC,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,KAAK,MAAM,WAAW,IAAI;YACxB,GAAG,QAAQ,CAAC,aAAa;YACzB,GAAG,QAAQ,CAAC,aAAa;YACzB,GAAG,QAAQ,CAAC,cAAc;YAC1B,GAAG,QAAQ,CAAC,iBAAiB;YAC7B,GAAG,QAAQ,CAAC,eAAe;YAC3B,GAAG,QAAQ,CAAC,eAAe;SAC5B,EAAE,CAAC;YACF,IAAI,WAAW,CAAC,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACjD,OAAO,CAAC,MAAM,CAAC;oBACb,GAAG,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC;oBAC7D,SAAS,EAAE,gBAAgB;oBAC3B,IAAI,EAAE;wBACJ,SAAS,EAAE,WAAW,CAAC,eAAe;qBACvC;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const firstPartyEntrySchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<{
|
|
4
|
+
"first-party": "first-party";
|
|
5
|
+
}>;
|
|
6
|
+
filepath: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
7
|
+
allowed: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
8
|
+
denied: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
9
|
+
excludeTypeImports: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
message: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
declare const thirdPartyEntrySchema: z.ZodObject<{
|
|
13
|
+
type: z.ZodEnum<{
|
|
14
|
+
"third-party": "third-party";
|
|
15
|
+
"built-in": "built-in";
|
|
16
|
+
}>;
|
|
17
|
+
moduleSpecifier: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
18
|
+
allowed: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
19
|
+
denied: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
20
|
+
excludeTypeImports: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
message: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
type FirstPartyEntry = z.infer<typeof firstPartyEntrySchema>;
|
|
24
|
+
type ThirdPartyEntry = z.infer<typeof thirdPartyEntrySchema>;
|
|
25
|
+
type Entry = FirstPartyEntry | ThirdPartyEntry;
|
|
26
|
+
export declare const noRestrictedImports: import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedImport", [{
|
|
27
|
+
rules: Entry[];
|
|
28
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { createRule, getESMInfo, getLocFromRange } from '../util.js';
|
|
4
|
+
const firstPartyEntrySchema = z.strictObject({
|
|
5
|
+
type: z.enum(['first-party']),
|
|
6
|
+
filepath: z.union([z.string(), z.instanceof(RegExp)]),
|
|
7
|
+
allowed: z.array(z.union([z.string(), z.instanceof(RegExp)])).optional(),
|
|
8
|
+
denied: z.array(z.union([z.string(), z.instanceof(RegExp)])).optional(),
|
|
9
|
+
excludeTypeImports: z.boolean().optional(),
|
|
10
|
+
message: z.string().optional(),
|
|
11
|
+
});
|
|
12
|
+
const thirdPartyEntrySchema = z.strictObject({
|
|
13
|
+
type: z.enum(['third-party', 'built-in']),
|
|
14
|
+
moduleSpecifier: z.union([z.string(), z.instanceof(RegExp)]),
|
|
15
|
+
allowed: z.array(z.union([z.string(), z.instanceof(RegExp)])).optional(),
|
|
16
|
+
denied: z.array(z.union([z.string(), z.instanceof(RegExp)])).optional(),
|
|
17
|
+
excludeTypeImports: z.boolean().optional(),
|
|
18
|
+
message: z.string().optional(),
|
|
19
|
+
});
|
|
20
|
+
const entrySchema = z.union([firstPartyEntrySchema, thirdPartyEntrySchema]);
|
|
21
|
+
const schema = z.strictObject({
|
|
22
|
+
rules: z.array(entrySchema),
|
|
23
|
+
});
|
|
24
|
+
function replaceMatchesInRegex(regex, matches) {
|
|
25
|
+
if (!matches) {
|
|
26
|
+
return regex;
|
|
27
|
+
}
|
|
28
|
+
let source = regex.source;
|
|
29
|
+
for (let i = 0; i < matches.length; i++) {
|
|
30
|
+
source = source.replaceAll('$' + (i + 1).toString(), matches[i]);
|
|
31
|
+
}
|
|
32
|
+
return new RegExp(source, regex.flags);
|
|
33
|
+
}
|
|
34
|
+
export const noRestrictedImports = createRule({
|
|
35
|
+
name: 'no-restricted-imports',
|
|
36
|
+
meta: {
|
|
37
|
+
docs: {
|
|
38
|
+
description: 'Esnures restricted imports are only imported by allowed consumers',
|
|
39
|
+
},
|
|
40
|
+
schema: [schema.toJSONSchema({ unrepresentable: 'any' })],
|
|
41
|
+
fixable: undefined,
|
|
42
|
+
type: 'problem',
|
|
43
|
+
messages: {
|
|
44
|
+
restrictedImport: '{{message}}',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
defaultOptions: [{ rules: [] }],
|
|
48
|
+
create(context) {
|
|
49
|
+
const esmInfo = getESMInfo(context);
|
|
50
|
+
// No project info means this file wasn't found as part of the project, e.g.
|
|
51
|
+
// because it's ignored
|
|
52
|
+
/* istanbul ignore if */
|
|
53
|
+
if (!esmInfo) {
|
|
54
|
+
return {};
|
|
55
|
+
}
|
|
56
|
+
const { fileInfo } = esmInfo;
|
|
57
|
+
/* istanbul ignore if */
|
|
58
|
+
if (fileInfo.fileType !== 'code') {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
// Normalize allowed and denied string paths to absolute
|
|
62
|
+
const entries = [];
|
|
63
|
+
for (const originalEntry of context.options[0].rules) {
|
|
64
|
+
const entry = { ...originalEntry };
|
|
65
|
+
entries.push(entry);
|
|
66
|
+
if (entry.allowed) {
|
|
67
|
+
entry.allowed = entry.allowed.map((allowed) => {
|
|
68
|
+
if (typeof allowed === 'string' && !isAbsolute(allowed)) {
|
|
69
|
+
return resolve(esmInfo.projectInfo.packageRootDir, allowed);
|
|
70
|
+
}
|
|
71
|
+
return allowed;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (entry.denied) {
|
|
75
|
+
entry.denied = entry.denied.map((denied) => {
|
|
76
|
+
if (typeof denied === 'string' && !isAbsolute(denied)) {
|
|
77
|
+
return resolve(esmInfo.projectInfo.packageRootDir, denied);
|
|
78
|
+
}
|
|
79
|
+
return denied;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (entry.type === 'first-party') {
|
|
83
|
+
// Normalize string paths to absolute
|
|
84
|
+
if (typeof entry.filepath === 'string' && !isAbsolute(entry.filepath)) {
|
|
85
|
+
entry.filepath = resolve(esmInfo.projectInfo.packageRootDir, entry.filepath);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Check each import and reexport
|
|
90
|
+
for (const importEntry of [
|
|
91
|
+
...fileInfo.singleImports,
|
|
92
|
+
...fileInfo.barrelImports,
|
|
93
|
+
...fileInfo.dynamicImports,
|
|
94
|
+
...fileInfo.singleReexports,
|
|
95
|
+
...fileInfo.barrelReexports,
|
|
96
|
+
]) {
|
|
97
|
+
const { moduleSpecifier } = importEntry;
|
|
98
|
+
/* istanbul ignore if */
|
|
99
|
+
if (!moduleSpecifier) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
if ('isTypeImport' in importEntry && importEntry.isTypeImport && entry.excludeTypeImports) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
// Check if this import applies to this entry
|
|
107
|
+
let matches = null;
|
|
108
|
+
if (entry.type === 'third-party') {
|
|
109
|
+
// Check if the module specifier matches
|
|
110
|
+
if (typeof entry.moduleSpecifier === 'string') {
|
|
111
|
+
if (entry.moduleSpecifier !== moduleSpecifier) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (!entry.moduleSpecifier.test(moduleSpecifier)) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else if (entry.type === 'first-party') {
|
|
120
|
+
// First we have to make sure we could resolve the module specifier to
|
|
121
|
+
// a file path. Otherwise we ignore it, since this is either a broken
|
|
122
|
+
// import or a dynamic import
|
|
123
|
+
if (!importEntry.resolvedModulePath) {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// Check if the resolved module path matches
|
|
127
|
+
if (typeof entry.filepath === 'string') {
|
|
128
|
+
if (entry.filepath !== importEntry.resolvedModulePath) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const match = entry.filepath.exec(importEntry.resolvedModulePath);
|
|
134
|
+
if (!match) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (match.length > 1) {
|
|
138
|
+
matches = match.slice(1);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// Check if the module specifier is allowed
|
|
143
|
+
if (entry.allowed) {
|
|
144
|
+
let isAllowed = false;
|
|
145
|
+
for (const allowed of entry.allowed) {
|
|
146
|
+
if (typeof allowed === 'string') {
|
|
147
|
+
if (allowed === context.filename) {
|
|
148
|
+
isAllowed = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else if (replaceMatchesInRegex(allowed, matches).test(context.filename)) {
|
|
152
|
+
isAllowed = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!isAllowed) {
|
|
156
|
+
context.report({
|
|
157
|
+
loc: getLocFromRange(context, importEntry.statementNodeRange),
|
|
158
|
+
messageId: 'restrictedImport',
|
|
159
|
+
data: {
|
|
160
|
+
message: entry.message ??
|
|
161
|
+
`${context.filename} is not allowed to import ${moduleSpecifier}`,
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Check if the module specifier is denied
|
|
168
|
+
if (entry.denied) {
|
|
169
|
+
let isDenied = false;
|
|
170
|
+
for (const denied of entry.denied) {
|
|
171
|
+
if (typeof denied === 'string') {
|
|
172
|
+
if (denied === context.filename) {
|
|
173
|
+
isDenied = true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else if (replaceMatchesInRegex(denied, matches).test(context.filename)) {
|
|
177
|
+
isDenied = true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (isDenied) {
|
|
181
|
+
context.report({
|
|
182
|
+
loc: getLocFromRange(context, importEntry.statementNodeRange),
|
|
183
|
+
messageId: 'restrictedImport',
|
|
184
|
+
data: {
|
|
185
|
+
message: entry.message ??
|
|
186
|
+
`${context.filename} is denied from importing ${moduleSpecifier}`,
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return {};
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
//# sourceMappingURL=restricted.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restricted.js","sourceRoot":"","sources":["../../../src/rules/no-restricted-imports/restricted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,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b,OAAO,CAAC,MAAM,CAAC;4BACb,GAAG,EAAE,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC;4BAC7D,SAAS,EAAE,kBAAkB;4BAC7B,IAAI,EAAE;gCACJ,OAAO,EACL,KAAK,CAAC,OAAO;oCACb,GAAG,OAAO,CAAC,QAAQ,6BAA6B,eAAe,EAAE;6BACpE;yBACF,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const firstPartyEntrySchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<{
|
|
4
|
+
"first-party": "first-party";
|
|
5
|
+
}>;
|
|
6
|
+
filepath: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
7
|
+
allowed: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
8
|
+
denied: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
9
|
+
excludeTypeImports: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
message: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
declare const thirdPartyEntrySchema: z.ZodObject<{
|
|
13
|
+
type: z.ZodEnum<{
|
|
14
|
+
"third-party": "third-party";
|
|
15
|
+
"built-in": "built-in";
|
|
16
|
+
}>;
|
|
17
|
+
moduleSpecifier: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
|
|
18
|
+
allowed: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
19
|
+
denied: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>]>>>;
|
|
20
|
+
excludeTypeImports: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
message: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
type FirstPartyEntry = z.infer<typeof firstPartyEntrySchema>;
|
|
24
|
+
type ThirdPartyEntry = z.infer<typeof thirdPartyEntrySchema>;
|
|
25
|
+
type Entry = FirstPartyEntry | ThirdPartyEntry;
|
|
26
|
+
export declare const noRestrictedImports: import("@typescript-eslint/utils/ts-eslint").RuleModule<"restrictedImport", [{
|
|
27
|
+
rules: Entry[];
|
|
28
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
export {};
|