@definitelytyped/eslint-plugin 0.0.192 → 0.0.193

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/index.d.ts +10 -3
  3. package/dist/index.js +12 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/rules/no-import-of-dev-dependencies.js +17 -6
  6. package/dist/rules/no-import-of-dev-dependencies.js.map +1 -1
  7. package/dist/rules/no-relative-import-in-test.js +31 -17
  8. package/dist/rules/no-relative-import-in-test.js.map +1 -1
  9. package/dist/rules/no-self-import.js +23 -12
  10. package/dist/rules/no-self-import.js.map +1 -1
  11. package/dist/util.d.ts +1 -0
  12. package/dist/util.js +13 -1
  13. package/dist/util.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/index.ts +16 -4
  16. package/src/rules/no-import-of-dev-dependencies.ts +20 -7
  17. package/src/rules/no-relative-import-in-test.ts +37 -20
  18. package/src/rules/no-self-import.ts +26 -12
  19. package/src/util.ts +18 -0
  20. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/bad.d.ts.lint +16 -1
  21. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/index.d.ts.lint +10 -1
  22. package/test/__file_snapshots__/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts.lint +16 -1
  23. package/test/__file_snapshots__/types/no-relative-import-in-test/index.d.ts.lint +2 -7
  24. package/test/__file_snapshots__/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts.lint +10 -0
  25. package/test/__file_snapshots__/types/no-relative-references/index.d.ts.lint +7 -1
  26. package/test/__file_snapshots__/types/no-relative-references/v1/index.d.ts.lint +7 -1
  27. package/test/__file_snapshots__/types/no-self-import/bad.d.ts.lint +38 -8
  28. package/test/__file_snapshots__/types/no-self-import/index.d.ts.lint +8 -0
  29. package/test/__file_snapshots__/types/no-self-import/no-self-import-tests.ts.lint +16 -1
  30. package/test/__file_snapshots__/types/scoped__no-relative-references/index.d.ts.lint +7 -1
  31. package/test/__file_snapshots__/types/scoped__no-relative-references/v1/index.d.ts.lint +7 -1
  32. package/test/eslint.test.ts +1 -1
  33. package/test/fixtures/types/no-import-of-dev-dependencies/bad.d.ts +3 -0
  34. package/test/fixtures/types/no-import-of-dev-dependencies/index.d.ts +3 -0
  35. package/test/fixtures/types/no-import-of-dev-dependencies/no-import-of-dev-dependencies-tests.ts +6 -0
  36. package/test/fixtures/types/no-relative-import-in-test/index.d.ts +1 -0
  37. package/test/fixtures/types/no-relative-import-in-test/no-relative-import-in-test-tests3.ts +1 -0
  38. package/test/fixtures/types/no-relative-import-in-test/tsconfig.json +1 -0
  39. package/test/fixtures/types/no-self-import/bad.d.ts +9 -0
  40. package/test/fixtures/types/no-self-import/index.d.ts +8 -0
  41. package/test/fixtures/types/no-self-import/no-self-import-tests.ts +6 -0
  42. package/tsconfig.tsbuildinfo +1 -1
@@ -7,9 +7,11 @@ types/no-relative-references/index.d.ts
7
7
  6:23 error The import "./v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
8
8
  7:23 error The import "../foo/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
9
9
  9:16 error Instead of declaring a module with `declare module "no-relative-references"`, write its contents in directly in "index.d.ts" @definitelytyped/no-declare-current-package
10
+ 10:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
11
+ 11:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
10
12
  11:22 error The import "no-relative-references/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
11
13
 
12
- 9 problems (9 errors, 0 warnings)
14
+ 11 problems (11 errors, 0 warnings)
13
15
 
14
16
  ==== types/no-relative-references/index.d.ts ====
15
17
 
@@ -39,7 +41,11 @@ types/no-relative-references/index.d.ts
39
41
  ~~~~~~~~~~~~~~~~~~~~~~~~
40
42
  !!! @definitelytyped/no-declare-current-package: Instead of declaring a module with `declare module "no-relative-references"`, write its contents in directly in "index.d.ts".
41
43
  import A = require("no-relative-references/blah"); // Okay; relative
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
42
46
  import B = require("no-relative-references/v1"); // Bad; versioned subdir
47
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
43
49
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
50
  !!! @definitelytyped/no-bad-reference: The import "no-relative-references/v1" resolves outside of the package. Use a bare import to reference other packages.
45
51
  }
@@ -8,9 +8,11 @@ types/no-relative-references/v1/index.d.ts
8
8
  8:23 error The import "../../foo/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
9
9
  9:22 error The import "../index" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
10
10
  11:16 error Instead of declaring a module with `declare module "no-relative-references"`, write its contents in directly in "index.d.ts" @definitelytyped/no-declare-current-package
11
+ 12:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
12
+ 13:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
11
13
  14:22 error The import "../index" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
12
14
 
13
- 10 problems (10 errors, 0 warnings)
15
+ 12 problems (12 errors, 0 warnings)
14
16
 
15
17
  ==== types/no-relative-references/v1/index.d.ts ====
16
18
 
@@ -44,7 +46,11 @@ types/no-relative-references/v1/index.d.ts
44
46
  ~~~~~~~~~~~~~~~~~~~~~~~~
45
47
  !!! @definitelytyped/no-declare-current-package: Instead of declaring a module with `declare module "no-relative-references"`, write its contents in directly in "index.d.ts".
46
48
  import A = require("no-relative-references/blah"); // Okay; relative
49
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
47
51
  import B = require("no-relative-references/v1"); // Okay; no versioned dir here
52
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
48
54
  import C = require("../index"); // Bad; parent dir
49
55
  ~~~~~~~~~~
50
56
  !!! @definitelytyped/no-bad-reference: The import "../index" resolves outside of the package. Use a bare import to reference other packages.
@@ -1,13 +1,20 @@
1
1
  types/no-self-import/bad.d.ts
2
- 1:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
3
- 2:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
4
- 4:1 error Don't import an old version of the current package @definitelytyped/no-self-import
5
- 5:1 error Don't import an old version of the current package @definitelytyped/no-self-import
6
- 6:1 error Don't import an old version of the current package @definitelytyped/no-self-import
7
- 7:1 error Don't import an old version of the current package @definitelytyped/no-self-import
8
- 8:1 error Don't import an old version of the current package @definitelytyped/no-self-import
2
+ 1:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
3
+ 2:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
4
+ 4:1 error Don't import an old version of the current package @definitelytyped/no-self-import
5
+ 5:1 error Don't import an old version of the current package @definitelytyped/no-self-import
6
+ 6:1 error Don't import an old version of the current package @definitelytyped/no-self-import
7
+ 7:1 error Don't import an old version of the current package @definitelytyped/no-self-import
8
+ 8:1 error Don't import an old version of the current package @definitelytyped/no-self-import
9
+ 10:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
10
+ 11:1 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
11
+ 13:1 error Don't import an old version of the current package @definitelytyped/no-self-import
12
+ 14:1 error Don't import an old version of the current package @definitelytyped/no-self-import
13
+ 15:1 error Don't import an old version of the current package @definitelytyped/no-self-import
14
+ 16:1 error Don't import an old version of the current package @definitelytyped/no-self-import
15
+ 17:1 error Don't import an old version of the current package @definitelytyped/no-self-import
9
16
 
10
- 7 problems (7 errors, 0 warnings)
17
+ 14 problems (14 errors, 0 warnings)
11
18
 
12
19
  ==== types/no-self-import/bad.d.ts ====
13
20
 
@@ -33,3 +40,26 @@ types/no-self-import/bad.d.ts
33
40
  import old5 from "./v0.1/index"
34
41
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35
42
  !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
43
+
44
+ import myselfRequired = require("no-self-import");
45
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
47
+ import abcRequired = require("no-self-import/abc.d.ts");
48
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
50
+
51
+ import old1Required = require("./v11");
52
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
+ !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
54
+ import old2Required = require("./v11/index");
55
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
+ !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
57
+ import old3Required = require("./v11/subdir/file");
58
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
59
+ !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
60
+ import old4Required = require("./v0.1");
61
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62
+ !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
63
+ import old5Required = require("./v0.1/index");
64
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
+ !!! @definitelytyped/no-self-import: Don't import an old version of the current package.
@@ -9,3 +9,11 @@ No errors
9
9
  import old from "./v1gardenpath"
10
10
 
11
11
  import old from "./v1verb/other"
12
+
13
+ import otherRequired = require("other-package");
14
+
15
+ import otherRequired = require("other-package/this-package");
16
+
17
+ import oldRequired = require("./v1gardenpath");
18
+
19
+ import oldRequired = require("./v1verb/other");
@@ -1,24 +1,39 @@
1
1
  types/no-self-import/no-self-import-tests.ts
2
2
  1:1 error Do not use a triple slash reference for devdep, use `import` style instead @typescript-eslint/triple-slash-reference
3
+ 1:1 error Do not use a triple slash reference for devdep, use `import` style instead @typescript-eslint/triple-slash-reference
4
+ 2:1 error Do not use a triple slash reference for otherdevdep, use `import` style instead @typescript-eslint/triple-slash-reference
3
5
  2:1 error Do not use a triple slash reference for otherdevdep, use `import` style instead @typescript-eslint/triple-slash-reference
4
6
  3:1 error Do not use a triple slash reference for other, use `import` style instead @typescript-eslint/triple-slash-reference
7
+ 3:1 error Do not use a triple slash reference for other, use `import` style instead @typescript-eslint/triple-slash-reference
5
8
 
6
- 3 problems (3 errors, 0 warnings)
9
+ 6 problems (6 errors, 0 warnings)
7
10
 
8
11
  ==== types/no-self-import/no-self-import-tests.ts ====
9
12
 
10
13
  /// <reference types="devdep"/>
11
14
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
+ !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for devdep, use `import` style instead.
16
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12
17
  !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for devdep, use `import` style instead.
13
18
  /// <reference types="otherdevdep"/>
14
19
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
+ !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for otherdevdep, use `import` style instead.
21
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
22
  !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for otherdevdep, use `import` style instead.
16
23
  /// <reference types="other"/>
17
24
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
25
  !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for other, use `import` style instead.
26
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
+ !!! @typescript-eslint/triple-slash-reference: Do not use a triple slash reference for other, use `import` style instead.
19
28
 
20
29
  import other from "other";
21
30
  import self from "no-import-of-dev-dependencies";
22
31
 
23
32
  import devdep from "devdep";
24
33
  import * as otherdevdep from "otherdevdep";
34
+
35
+ import otherRequired = require("other");
36
+ import selfRequired = require("no-import-of-dev-dependencies");
37
+
38
+ import devdepRequired = require("devdep");
39
+ import otherdevdepRequired = require("otherdevdep");
@@ -7,9 +7,11 @@ types/scoped__no-relative-references/index.d.ts
7
7
  6:23 error The import "./v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
8
8
  7:23 error The import "../foo/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
9
9
  9:16 error Instead of declaring a module with `declare module "@scoped/no-relative-references"`, write its contents in directly in "index.d.ts" @definitelytyped/no-declare-current-package
10
+ 10:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
11
+ 11:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
10
12
  11:22 error The import "@scoped/no-relative-references/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
11
13
 
12
- 9 problems (9 errors, 0 warnings)
14
+ 11 problems (11 errors, 0 warnings)
13
15
 
14
16
  ==== types/scoped__no-relative-references/index.d.ts ====
15
17
 
@@ -39,7 +41,11 @@ types/scoped__no-relative-references/index.d.ts
39
41
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
42
  !!! @definitelytyped/no-declare-current-package: Instead of declaring a module with `declare module "@scoped/no-relative-references"`, write its contents in directly in "index.d.ts".
41
43
  import A = require("@scoped/no-relative-references/blah"); // Okay; relative
44
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
42
46
  import B = require("@scoped/no-relative-references/v1"); // Bad; versioned subdir
47
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
43
49
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
44
50
  !!! @definitelytyped/no-bad-reference: The import "@scoped/no-relative-references/v1" resolves outside of the package. Use a bare import to reference other packages.
45
51
  }
@@ -8,9 +8,11 @@ types/scoped__no-relative-references/v1/index.d.ts
8
8
  8:23 error The import "../../foo/v1" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
9
9
  9:22 error The import "../index" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
10
10
  11:16 error Instead of declaring a module with `declare module "@scoped/no-relative-references"`, write its contents in directly in "index.d.ts" @definitelytyped/no-declare-current-package
11
+ 12:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
12
+ 13:3 error Declaration file should not use a global import of itself. Use a relative import @definitelytyped/no-self-import
11
13
  14:22 error The import "../index" resolves outside of the package. Use a bare import to reference other packages @definitelytyped/no-bad-reference
12
14
 
13
- 10 problems (10 errors, 0 warnings)
15
+ 12 problems (12 errors, 0 warnings)
14
16
 
15
17
  ==== types/scoped__no-relative-references/v1/index.d.ts ====
16
18
 
@@ -44,7 +46,11 @@ types/scoped__no-relative-references/v1/index.d.ts
44
46
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
47
  !!! @definitelytyped/no-declare-current-package: Instead of declaring a module with `declare module "@scoped/no-relative-references"`, write its contents in directly in "index.d.ts".
46
48
  import A = require("@scoped/no-relative-references/blah"); // Okay; relative
49
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
47
51
  import B = require("@scoped/no-relative-references/v1"); // Okay; no versioned dir here
52
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53
+ !!! @definitelytyped/no-self-import: Declaration file should not use a global import of itself. Use a relative import.
48
54
  import C = require("../index"); // Bad; parent dir
49
55
  ~~~~~~~~~~
50
56
  !!! @definitelytyped/no-bad-reference: The import "../index" resolves outside of the package. Use a bare import to reference other packages.
@@ -29,7 +29,7 @@ let eslint: ESLint;
29
29
  beforeAll(() => {
30
30
  eslint = new ESLint({
31
31
  cwd: fixtureRoot,
32
- plugins: { "@definitelytyped/eslint-plugin": plugin as unknown as ESLint.Plugin },
32
+ plugins: { [plugin.meta.name]: plugin },
33
33
  });
34
34
  });
35
35
 
@@ -3,3 +3,6 @@
3
3
 
4
4
  import devdep from "devdep";
5
5
  import * as otherdevdep from "otherdevdep";
6
+
7
+ import devdep2 = require("devdep");
8
+ import otherdevdep2 = require("otherdevdep");
@@ -2,3 +2,6 @@
2
2
 
3
3
  import other from "other";
4
4
  import self from "no-import-of-dev-dependencies";
5
+
6
+ import other2 = require("other");
7
+ import self2 = require("no-import-of-dev-dependencies");
@@ -7,3 +7,9 @@ import self from "no-import-of-dev-dependencies";
7
7
 
8
8
  import devdep from "devdep";
9
9
  import * as otherdevdep from "otherdevdep";
10
+
11
+ import other2 = require("other");
12
+ import self2 = require("no-import-of-dev-dependencies");
13
+
14
+ import devdep2 = require("devdep");
15
+ import otherdevdep2 = require("otherdevdep");
@@ -0,0 +1 @@
1
+ export function getFoo(): "foo";
@@ -18,6 +18,7 @@
18
18
  "bad.d.ts",
19
19
  "no-relative-import-in-test-tests.ts",
20
20
  "no-relative-import-in-test-tests2.ts",
21
+ "no-relative-import-in-test-tests3.ts",
21
22
  "./abc.d.ts",
22
23
  "./no-relative-import-in-test/abc.d.ts"
23
24
  ]
@@ -6,3 +6,12 @@ import old2 from "./v11/index";
6
6
  import old3 from "./v11/subdir/file";
7
7
  import old4 from "./v0.1"
8
8
  import old5 from "./v0.1/index"
9
+
10
+ import myselfRequired = require("no-self-import");
11
+ import abcRequired = require("no-self-import/abc.d.ts");
12
+
13
+ import old1Required = require("./v11");
14
+ import old2Required = require("./v11/index");
15
+ import old3Required = require("./v11/subdir/file");
16
+ import old4Required = require("./v0.1");
17
+ import old5Required = require("./v0.1/index");
@@ -5,3 +5,11 @@ import other from "other-package/this-package";
5
5
  import old from "./v1gardenpath"
6
6
 
7
7
  import old from "./v1verb/other"
8
+
9
+ import otherRequired = require("other-package");
10
+
11
+ import otherRequired = require("other-package/this-package");
12
+
13
+ import oldRequired = require("./v1gardenpath");
14
+
15
+ import oldRequired = require("./v1verb/other");
@@ -7,3 +7,9 @@ import self from "no-import-of-dev-dependencies";
7
7
 
8
8
  import devdep from "devdep";
9
9
  import * as otherdevdep from "otherdevdep";
10
+
11
+ import otherRequired = require("other");
12
+ import selfRequired = require("no-import-of-dev-dependencies");
13
+
14
+ import devdepRequired = require("devdep");
15
+ import otherdevdepRequired = require("otherdevdep");