@definitelytyped/eslint-plugin 0.0.177 → 0.0.179
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 +7 -0
- package/dist/rules/dt-header.d.ts +1 -1
- package/dist/rules/export-just-namespace.d.ts +1 -1
- package/dist/rules/index.d.ts +17 -38
- package/dist/rules/index.js +2 -0
- package/dist/rules/index.js.map +1 -1
- package/dist/rules/no-any-union.d.ts +1 -3
- package/dist/rules/no-bad-reference.d.ts +1 -1
- package/dist/rules/no-const-enum.d.ts +1 -3
- package/dist/rules/no-dead-reference.d.ts +1 -1
- package/dist/rules/no-declare-current-package.d.ts +1 -3
- package/dist/rules/no-import-default-of-export-equals.d.ts +1 -3
- package/dist/rules/no-outside-dependencies.d.ts +1 -1
- package/dist/rules/no-relative-import-in-test.d.ts +1 -3
- package/dist/rules/no-self-import.d.ts +1 -3
- package/dist/rules/no-single-element-tuple-type.d.ts +1 -4
- package/dist/rules/no-unnecessary-generics.d.ts +1 -7
- package/dist/rules/no-useless-files.d.ts +1 -1
- package/dist/rules/prefer-declare-function.d.ts +1 -4
- package/dist/rules/redundant-undefined.d.ts +1 -3
- package/dist/rules/strict-export-declare-modifiers.d.ts +2 -0
- package/dist/rules/strict-export-declare-modifiers.js +191 -0
- package/dist/rules/strict-export-declare-modifiers.js.map +1 -0
- package/dist/util.d.ts +3 -2
- package/dist/util.js +2 -0
- package/dist/util.js.map +1 -1
- package/package.json +10 -11
- package/src/rules/index.ts +2 -0
- package/src/rules/strict-export-declare-modifiers.ts +193 -0
- package/src/util.ts +7 -1
- package/test/strict-export-declare-modifiers.test.ts +158 -0
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
ADDED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"definitionsBy" | "minimumTypeScriptVersion" | "parseError" | "typeDefinitionsFor" | "typescriptVersion", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"definitionsBy" | "minimumTypeScriptVersion" | "parseError" | "typeDefinitionsFor" | "typescriptVersion", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useTheBody", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useTheBody", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,40 +1,19 @@
|
|
|
1
1
|
export declare const rules: {
|
|
2
|
-
"dt-header": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"definitionsBy" | "minimumTypeScriptVersion" | "parseError" | "typeDefinitionsFor" | "typescriptVersion", never[],
|
|
3
|
-
"export-just-namespace": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useTheBody", never[],
|
|
4
|
-
"no-any-union": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"anyUnion", never[],
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"no-
|
|
8
|
-
"no-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"no-
|
|
12
|
-
"no-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"no-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"no-relative-import-in-test": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useGlobalImport", never[], {} | {
|
|
20
|
-
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
21
|
-
}>;
|
|
22
|
-
"no-self-import": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useRelativeImport", never[], {
|
|
23
|
-
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
24
|
-
}>;
|
|
25
|
-
"no-single-element-tuple-type": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"singleElementTupleType", never[], {
|
|
26
|
-
"TSTupleType[elementTypes.length=1]"(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSTupleType): void;
|
|
27
|
-
}>;
|
|
28
|
-
"no-unnecessary-generics": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"never" | "sole", never[], {
|
|
29
|
-
[x: string]: (esNode: import("@typescript-eslint/types/dist/generated/ast-spec").FunctionLike & {
|
|
30
|
-
typeParameters: {};
|
|
31
|
-
}) => void;
|
|
32
|
-
}>;
|
|
33
|
-
"no-useless-files": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noContent", never[], {}>;
|
|
34
|
-
"prefer-declare-function": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"variableFunction", never[], {
|
|
35
|
-
"VariableDeclaration > VariableDeclarator"(node: import("@typescript-eslint/types/dist/generated/ast-spec").VariableDeclarator): void;
|
|
36
|
-
}>;
|
|
37
|
-
"redundant-undefined": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"redundantUndefined", never[], {
|
|
38
|
-
TSUnionType(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSUnionType): void;
|
|
39
|
-
}>;
|
|
2
|
+
"dt-header": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"definitionsBy" | "minimumTypeScriptVersion" | "parseError" | "typeDefinitionsFor" | "typescriptVersion", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
3
|
+
"export-just-namespace": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useTheBody", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
|
+
"no-any-union": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"anyUnion", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
5
|
+
"no-bad-reference": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referencePathPackage" | "referencePathTest", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
6
|
+
"no-const-enum": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"constEnum", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
7
|
+
"no-dead-reference": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referenceAtTop", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
8
|
+
"no-declare-current-package": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noDeclareCurrentPackage", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
9
|
+
"no-import-default-of-export-equals": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noImportDefaultOfExportEquals", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
10
|
+
"no-outside-dependencies": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noOutsideDependencies", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
11
|
+
"no-relative-import-in-test": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useGlobalImport", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
12
|
+
"no-self-import": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useRelativeImport", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
13
|
+
"no-single-element-tuple-type": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"singleElementTupleType", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
14
|
+
"no-unnecessary-generics": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"never" | "sole", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
15
|
+
"no-useless-files": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noContent", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
16
|
+
"prefer-declare-function": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"variableFunction", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
17
|
+
"redundant-undefined": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"redundantUndefined", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
18
|
+
"strict-export-declare-modifiers": import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"missingExplicitExport" | "redundantDeclare" | "redundantExport", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
40
19
|
};
|
package/dist/rules/index.js
CHANGED
|
@@ -40,6 +40,7 @@ const noUnnecessaryGenerics = __importStar(require("./no-unnecessary-generics"))
|
|
|
40
40
|
const noUselessFiles = __importStar(require("./no-useless-files"));
|
|
41
41
|
const preferDeclareFunction = __importStar(require("./prefer-declare-function"));
|
|
42
42
|
const redundantUndefined = __importStar(require("./redundant-undefined"));
|
|
43
|
+
const strictExportDeclareModifiers = __importStar(require("./strict-export-declare-modifiers"));
|
|
43
44
|
exports.rules = {
|
|
44
45
|
"dt-header": dtHeader,
|
|
45
46
|
"export-just-namespace": exportJustNamespace,
|
|
@@ -57,5 +58,6 @@ exports.rules = {
|
|
|
57
58
|
"no-useless-files": noUselessFiles,
|
|
58
59
|
"prefer-declare-function": preferDeclareFunction,
|
|
59
60
|
"redundant-undefined": redundantUndefined,
|
|
61
|
+
"strict-export-declare-modifiers": strictExportDeclareModifiers,
|
|
60
62
|
};
|
|
61
63
|
//# sourceMappingURL=index.js.map
|
package/dist/rules/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,6EAA+D;AAC/D,2DAA6C;AAC7C,mEAAqD;AACrD,6DAA+C;AAC/C,qEAAuD;AACvD,sFAAwE;AACxE,oGAAsF;AACtF,iFAAmE;AACnE,qFAAuE;AACvE,+DAAiD;AACjD,yFAA2E;AAC3E,iFAAmE;AACnE,mEAAqD;AACrD,iFAAmE;AACnE,0EAA4D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,6EAA+D;AAC/D,2DAA6C;AAC7C,mEAAqD;AACrD,6DAA+C;AAC/C,qEAAuD;AACvD,sFAAwE;AACxE,oGAAsF;AACtF,iFAAmE;AACnE,qFAAuE;AACvE,+DAAiD;AACjD,yFAA2E;AAC3E,iFAAmE;AACnE,mEAAqD;AACrD,iFAAmE;AACnE,0EAA4D;AAC5D,gGAAkF;AAErE,QAAA,KAAK,GAAG;IACnB,WAAW,EAAE,QAAQ;IACrB,uBAAuB,EAAE,mBAAmB;IAC5C,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,cAAc;IAClC,eAAe,EAAE,WAAW;IAC5B,mBAAmB,EAAE,eAAe;IACpC,4BAA4B,EAAE,uBAAuB;IACrD,oCAAoC,EAAE,6BAA6B;IACnE,yBAAyB,EAAE,qBAAqB;IAChD,4BAA4B,EAAE,sBAAsB;IACpD,gBAAgB,EAAE,YAAY;IAC9B,8BAA8B,EAAE,wBAAwB;IACxD,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,cAAc;IAClC,yBAAyB,EAAE,qBAAqB;IAChD,qBAAqB,EAAE,kBAAkB;IACzC,iCAAiC,EAAE,4BAA4B;CAChE,CAAC"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"anyUnion", never[],
|
|
2
|
-
TSUnionType(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSUnionType): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"anyUnion", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referencePathPackage" | "referencePathTest", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referencePathPackage" | "referencePathTest", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"constEnum", never[],
|
|
2
|
-
"TSEnumDeclaration[const]"(node: never): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"constEnum", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referenceAtTop", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"referenceAtTop", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noDeclareCurrentPackage", never[],
|
|
2
|
-
TSModuleDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSModuleDeclaration): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noDeclareCurrentPackage", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noImportDefaultOfExportEquals", never[],
|
|
2
|
-
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
3
|
-
} | {}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noImportDefaultOfExportEquals", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noOutsideDependencies", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noOutsideDependencies", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useGlobalImport", never[],
|
|
2
|
-
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useGlobalImport", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useRelativeImport", never[],
|
|
2
|
-
ImportDeclaration(node: import("@typescript-eslint/types/dist/generated/ast-spec").ImportDeclaration): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"useRelativeImport", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"singleElementTupleType", never[], {
|
|
3
|
-
"TSTupleType[elementTypes.length=1]"(node: TSESTree.TSTupleType): void;
|
|
4
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"singleElementTupleType", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
5
2
|
export = rule;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type ESTreeFunctionLikeWithTypeParameters = TSESTree.FunctionLike & {
|
|
3
|
-
typeParameters: {};
|
|
4
|
-
};
|
|
5
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"never" | "sole", never[], {
|
|
6
|
-
[x: string]: (esNode: ESTreeFunctionLikeWithTypeParameters) => void;
|
|
7
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"never" | "sole", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
8
2
|
export = rule;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noContent", never[],
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"noContent", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
2
2
|
export = rule;
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"variableFunction", never[], {
|
|
3
|
-
"VariableDeclaration > VariableDeclarator"(node: TSESTree.VariableDeclarator): void;
|
|
4
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"variableFunction", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
5
2
|
export = rule;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"redundantUndefined", never[],
|
|
2
|
-
TSUnionType(node: import("@typescript-eslint/types/dist/generated/ast-spec").TSUnionType): void;
|
|
3
|
-
}>;
|
|
1
|
+
declare const rule: import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleModule<"redundantUndefined", never[], import("@typescript-eslint/utils/dist/ts-eslint/Rule").RuleListener>;
|
|
4
2
|
export = rule;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
26
|
+
const ts = __importStar(require("typescript"));
|
|
27
|
+
const util_1 = require("../util");
|
|
28
|
+
const rule = (0, util_1.createRule)({
|
|
29
|
+
name: "strict-export-declare-modifiers",
|
|
30
|
+
defaultOptions: [],
|
|
31
|
+
meta: {
|
|
32
|
+
type: "problem",
|
|
33
|
+
docs: {
|
|
34
|
+
description: "Enforces strict rules about where the 'export' and 'declare' modifiers may appear.",
|
|
35
|
+
recommended: "error",
|
|
36
|
+
},
|
|
37
|
+
messages: {
|
|
38
|
+
missingExplicitExport: "All declarations in this module are exported automatically. " +
|
|
39
|
+
"Prefer to explicitly write 'export' for clarity. " +
|
|
40
|
+
"If you have a good reason not to export this declaration, " +
|
|
41
|
+
"add 'export {}' to the module to shut off automatic exporting.",
|
|
42
|
+
redundantDeclare: "'declare' keyword is redundant here.",
|
|
43
|
+
redundantExport: "'export' keyword is redundant here because " +
|
|
44
|
+
"all declarations in this module are exported automatically. " +
|
|
45
|
+
"If you have a good reason to export some declarations and not others, " +
|
|
46
|
+
"add 'export {}' to the module to shut off automatic exporting.",
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
},
|
|
50
|
+
// TODO: This code is a modified version of the old TSLint rule,
|
|
51
|
+
// and still primarily uses TypeScript nodes. It would be better
|
|
52
|
+
// to switch it to using TSESTree nodes like other ESLint rules.
|
|
53
|
+
create(context) {
|
|
54
|
+
const services = utils_1.ESLintUtils.getParserServices(context, true);
|
|
55
|
+
const sourceCode = context.getSourceCode();
|
|
56
|
+
const sourceFile = services.esTreeNodeToTSNodeMap.get(sourceCode.ast);
|
|
57
|
+
const isExternal = sourceFile.isDeclarationFile &&
|
|
58
|
+
!sourceFile.statements.some((s) => s.kind === ts.SyntaxKind.ExportAssignment ||
|
|
59
|
+
(s.kind === ts.SyntaxKind.ExportDeclaration && !!s.exportClause)) &&
|
|
60
|
+
ts.isExternalModule(sourceFile);
|
|
61
|
+
for (const node of sourceFile.statements) {
|
|
62
|
+
if (isExternal) {
|
|
63
|
+
checkInExternalModule(node, isAutomaticExport(sourceFile));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
checkInOther(node, sourceFile.isDeclarationFile);
|
|
67
|
+
}
|
|
68
|
+
if (isModuleDeclaration(node) && (sourceFile.isDeclarationFile || isDeclare(node))) {
|
|
69
|
+
checkModule(node);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function checkInExternalModule(node, autoExportEnabled) {
|
|
73
|
+
// Ignore certain node kinds (these can't have 'export' or 'default' modifiers)
|
|
74
|
+
switch (node.kind) {
|
|
75
|
+
case ts.SyntaxKind.ImportDeclaration:
|
|
76
|
+
case ts.SyntaxKind.ImportEqualsDeclaration:
|
|
77
|
+
case ts.SyntaxKind.ExportDeclaration:
|
|
78
|
+
case ts.SyntaxKind.NamespaceExportDeclaration:
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// `declare global` and `declare module "foo"` OK. `declare namespace N` not OK, should be `export namespace`.
|
|
82
|
+
if (!isDeclareGlobalOrExternalModuleDeclaration(node)) {
|
|
83
|
+
if (isDeclare(node)) {
|
|
84
|
+
context.report({
|
|
85
|
+
loc: getModifierLoc(node, ts.SyntaxKind.DeclareKeyword),
|
|
86
|
+
messageId: "redundantDeclare",
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (autoExportEnabled && !isExport(node)) {
|
|
90
|
+
context.report({
|
|
91
|
+
messageId: "missingExplicitExport",
|
|
92
|
+
node: services.tsNodeToESTreeNodeMap.get(node.name || node),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function checkInOther(node, inDeclarationFile) {
|
|
98
|
+
// Compiler will enforce presence of 'declare' where necessary. But types do not need 'declare'.
|
|
99
|
+
if (isDeclare(node)) {
|
|
100
|
+
if ((isExport(node) && inDeclarationFile) ||
|
|
101
|
+
ts.isInterfaceDeclaration(node) ||
|
|
102
|
+
ts.isTypeAliasDeclaration(node)) {
|
|
103
|
+
context.report({
|
|
104
|
+
loc: getModifierLoc(node, ts.SyntaxKind.DeclareKeyword),
|
|
105
|
+
messageId: "redundantDeclare",
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function getModifierLoc(node, kind) {
|
|
111
|
+
var _a;
|
|
112
|
+
const modifier = (_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.find((modifier) => modifier.kind === kind);
|
|
113
|
+
return {
|
|
114
|
+
end: sourceCode.getLocFromIndex(modifier.end),
|
|
115
|
+
start: sourceCode.getLocFromIndex(modifier.getStart(sourceFile)),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function checkModule(moduleDeclaration) {
|
|
119
|
+
const body = moduleDeclaration.body;
|
|
120
|
+
if (!body) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
switch (body.kind) {
|
|
124
|
+
case ts.SyntaxKind.ModuleDeclaration:
|
|
125
|
+
checkModule(body);
|
|
126
|
+
break;
|
|
127
|
+
case ts.SyntaxKind.ModuleBlock:
|
|
128
|
+
checkBlock(body, isAutomaticExport(moduleDeclaration));
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function checkBlock(block, autoExportEnabled) {
|
|
133
|
+
for (const statement of block.statements) {
|
|
134
|
+
// Compiler will error for 'declare' here anyway, so just check for 'export'.
|
|
135
|
+
if (isExport(statement) && autoExportEnabled && !isDefault(statement)) {
|
|
136
|
+
context.report({
|
|
137
|
+
loc: getModifierLoc(statement, ts.SyntaxKind.ExportKeyword),
|
|
138
|
+
messageId: "redundantExport",
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
if (isModuleDeclaration(statement)) {
|
|
142
|
+
checkModule(statement);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {};
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
function isDeclareGlobalOrExternalModuleDeclaration(node) {
|
|
150
|
+
return (isModuleDeclaration(node) &&
|
|
151
|
+
(node.name.kind === ts.SyntaxKind.StringLiteral ||
|
|
152
|
+
(node.name.kind === ts.SyntaxKind.Identifier && node.name.text === "global")));
|
|
153
|
+
}
|
|
154
|
+
function isModuleDeclaration(node) {
|
|
155
|
+
return node.kind === ts.SyntaxKind.ModuleDeclaration;
|
|
156
|
+
}
|
|
157
|
+
function isDeclare(node) {
|
|
158
|
+
var _a;
|
|
159
|
+
return ts.canHaveModifiers(node) && !!((_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.some((m) => m.kind === ts.SyntaxKind.DeclareKeyword));
|
|
160
|
+
}
|
|
161
|
+
function isExport(node) {
|
|
162
|
+
var _a;
|
|
163
|
+
return ts.canHaveModifiers(node) && !!((_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.some((m) => m.kind === ts.SyntaxKind.ExportKeyword));
|
|
164
|
+
}
|
|
165
|
+
function isDefault(node) {
|
|
166
|
+
var _a;
|
|
167
|
+
return ts.canHaveModifiers(node) && !!((_a = ts.getModifiers(node)) === null || _a === void 0 ? void 0 : _a.some((m) => m.kind === ts.SyntaxKind.DefaultKeyword));
|
|
168
|
+
}
|
|
169
|
+
// tslint:disable-next-line:max-line-length
|
|
170
|
+
// Copied from https://github.com/Microsoft/TypeScript/blob/dd9b8cab34a3e389e924d768eb656cf50656f582/src/compiler/binder.ts#L1571-L1581
|
|
171
|
+
function hasExportDeclarations(node) {
|
|
172
|
+
const body = node.kind === ts.SyntaxKind.SourceFile ? node : node.body;
|
|
173
|
+
if (body && (body.kind === ts.SyntaxKind.SourceFile || body.kind === ts.SyntaxKind.ModuleBlock)) {
|
|
174
|
+
for (const stat of body.statements) {
|
|
175
|
+
if (stat.kind === ts.SyntaxKind.ExportDeclaration || stat.kind === ts.SyntaxKind.ExportAssignment) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
function isAutomaticExport(node) {
|
|
183
|
+
// We'd like to just test ts.NodeFlags.ExportContext, but we don't run the
|
|
184
|
+
// binder, so that flag won't be set, so duplicate the logic instead. :(
|
|
185
|
+
//
|
|
186
|
+
// ts.NodeFlags.Ambient is @internal, but all modules that get here should
|
|
187
|
+
// be ambient.
|
|
188
|
+
return !hasExportDeclarations(node);
|
|
189
|
+
}
|
|
190
|
+
module.exports = rule;
|
|
191
|
+
//# sourceMappingURL=strict-export-declare-modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strict-export-declare-modifiers.js","sourceRoot":"","sources":["../../src/rules/strict-export-declare-modifiers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAuD;AACvD,+CAAiC;AACjC,kCAAqC;AAErC,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC;IACtB,IAAI,EAAE,iCAAiC;IACvC,cAAc,EAAE,EAAE;IAClB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,oFAAoF;YACjG,WAAW,EAAE,OAAO;SACrB;QACD,QAAQ,EAAE;YACR,qBAAqB,EACnB,8DAA8D;gBAC9D,mDAAmD;gBACnD,4DAA4D;gBAC5D,gEAAgE;YAClE,gBAAgB,EAAE,sCAAsC;YACxD,eAAe,EACb,6CAA6C;gBAC7C,8DAA8D;gBAC9D,wEAAwE;gBACxE,gEAAg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CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA,CAAC;AACpH,CAAC;AAED,2CAA2C;AAC3C,uIAAuI;AACvI,SAAS,qBAAqB,CAAC,IAA0C;IACvE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACvE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC/F,KAAK,MAAM,IAAI,IAAK,IAAqB,CAAC,UAAU,EAAE;YACpD,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,iBAAiB,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,gBAAgB,EAAE;gBACjG,OAAO,IAAI,CAAC;aACb;SACF;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,iBAAiB,CAAC,IAA0C;IACnE,0EAA0E;IAC1E,wEAAwE;IACxE,EAAE;IACF,0EAA0E;IAC1E,cAAc;IACd,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,iBAAS,IAAI,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { RuleWithMetaAndName } from "@typescript-eslint/utils/dist/eslint-utils";
|
|
2
|
+
import { RuleListener, RuleModule } from "@typescript-eslint/utils/dist/ts-eslint";
|
|
3
|
+
export declare const createRule: <TOptions extends readonly unknown[], TMessageIds extends string>(opts: Readonly<RuleWithMetaAndName<TOptions, TMessageIds, RuleListener>>) => RuleModule<TMessageIds, TOptions>;
|
|
3
4
|
export declare function getTypesPackageForDeclarationFile(file: string): string | undefined;
|
|
4
5
|
export declare function isMainFile(fileName: string, allowNested: boolean): boolean;
|
package/dist/util.js
CHANGED
|
@@ -4,6 +4,8 @@ exports.isMainFile = exports.getTypesPackageForDeclarationFile = exports.createR
|
|
|
4
4
|
const utils_1 = require("@definitelytyped/utils");
|
|
5
5
|
const utils_2 = require("@typescript-eslint/utils");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
// Possible TS bug can't figure out how to do declaration emit of created rules
|
|
8
|
+
// without an explicit type annotation here due to pnpm symlink stuff
|
|
7
9
|
exports.createRule = utils_2.ESLintUtils.RuleCreator((name) => `https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/eslint-plugin/docs/rules/${name}.md`);
|
|
8
10
|
function getTypesPackageForDeclarationFile(file) {
|
|
9
11
|
var _a, _b;
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,kDAA+D;AAC/D,oDAAuD;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";;;AAAA,kDAA+D;AAC/D,oDAAuD;AAGvD,+BAAyC;AAEzC,+EAA+E;AAC/E,qEAAqE;AACxD,QAAA,UAAU,GAEkB,mBAAW,CAAC,WAAW,CAC9D,CAAC,IAAI,EAAE,EAAE,CACP,oGAAoG,IAAI,KAAK,CAChH,CAAC;AAEF,SAAgB,iCAAiC,CAAC,IAAY;;IAC5D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QAC3B,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,KAAK,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,0CAAG,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,MAAA,IAAA,6BAAqB,EAAC,KAAK,CAAC,mCAAI,KAAK,CAAC;AAC/C,CAAC;AAXD,8EAWC;AAED,SAAgB,UAAU,CAAC,QAAgB,EAAE,WAAoB;IAC/D,2GAA2G;IAC3G,IAAI,QAAQ,KAAK,YAAY,EAAE;QAC7B,OAAO,IAAI,CAAC;KACb;IAED,IAAI,IAAA,eAAQ,EAAC,QAAQ,CAAC,KAAK,YAAY,EAAE;QACvC,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;IAC/B,sDAAsD;IACtD,oEAAoE;IACpE,IAAI,WAAW,IAAI,cAAc,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,MAAM,CAAC,CAAC,EAAE;QACxD,MAAM,GAAG,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC;KAC1B;IAED,iEAAiE;IACjE,OAAO,IAAA,eAAQ,EAAC,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC,KAAK,OAAO,CAAC;AAC/C,CAAC;AAnBD,gCAmBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@definitelytyped/eslint-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.179",
|
|
4
4
|
"description": "ESLint rules for DefinitelyTyped",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,15 +17,11 @@
|
|
|
17
17
|
"url": "https://github.com/microsoft/DefinitelyTyped-tools.git",
|
|
18
18
|
"directory": "packages/eslint-plugin"
|
|
19
19
|
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc -b .",
|
|
22
|
-
"test": "../../node_modules/.bin/jest --config ../../jest.config.js packages/dtslint"
|
|
23
|
-
},
|
|
24
20
|
"dependencies": {
|
|
25
|
-
"@definitelytyped/header-parser": "^0.0.177",
|
|
26
|
-
"@definitelytyped/utils": "^0.0.177",
|
|
27
21
|
"@typescript-eslint/types": "^5.56.0",
|
|
28
|
-
"@typescript-eslint/utils": "^5.55.0"
|
|
22
|
+
"@typescript-eslint/utils": "^5.55.0",
|
|
23
|
+
"@definitelytyped/header-parser": "0.0.178",
|
|
24
|
+
"@definitelytyped/utils": "0.0.178"
|
|
29
25
|
},
|
|
30
26
|
"peerDependencies": {
|
|
31
27
|
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
|
@@ -36,11 +32,14 @@
|
|
|
36
32
|
},
|
|
37
33
|
"devDependencies": {
|
|
38
34
|
"@types/eslint": "^8.4.2",
|
|
39
|
-
"typescript": "^5.
|
|
35
|
+
"typescript": "^5.2.2"
|
|
40
36
|
},
|
|
41
37
|
"engines": {
|
|
42
38
|
"node": ">=10.0.0"
|
|
43
39
|
},
|
|
44
40
|
"license": "MIT",
|
|
45
|
-
"
|
|
46
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc -b .",
|
|
43
|
+
"test": "../../node_modules/.bin/jest --config ../../jest.config.js packages/dtslint"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/rules/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as noUnnecessaryGenerics from "./no-unnecessary-generics";
|
|
|
14
14
|
import * as noUselessFiles from "./no-useless-files";
|
|
15
15
|
import * as preferDeclareFunction from "./prefer-declare-function";
|
|
16
16
|
import * as redundantUndefined from "./redundant-undefined";
|
|
17
|
+
import * as strictExportDeclareModifiers from "./strict-export-declare-modifiers";
|
|
17
18
|
|
|
18
19
|
export const rules = {
|
|
19
20
|
"dt-header": dtHeader,
|
|
@@ -32,4 +33,5 @@ export const rules = {
|
|
|
32
33
|
"no-useless-files": noUselessFiles,
|
|
33
34
|
"prefer-declare-function": preferDeclareFunction,
|
|
34
35
|
"redundant-undefined": redundantUndefined,
|
|
36
|
+
"strict-export-declare-modifiers": strictExportDeclareModifiers,
|
|
35
37
|
};
|