Skip to content

Commit 9623e76

Browse files
Support a converter for no-reference-import rule (#368)
* Support a converter for `no-reference-import` rule ref: #367 * Quick alphabetization ;) Co-authored-by: Josh Goldberg <me@joshuakgoldberg.com>
1 parent d7057be commit 9623e76

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { RuleConverter } from "../converter";
2+
3+
export const convertNoReferenceImport: RuleConverter = () => {
4+
return {
5+
rules: [
6+
{
7+
ruleName: "@typescript-eslint/triple-slash-reference",
8+
ruleArguments: [
9+
{
10+
path: "always",
11+
types: "prefer-import",
12+
lib: "always",
13+
},
14+
],
15+
},
16+
],
17+
};
18+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { convertNoReferenceImport } from "../no-reference-import";
2+
3+
describe(convertNoReferenceImport, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertNoReferenceImport({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
rules: [
11+
{
12+
ruleName: "@typescript-eslint/triple-slash-reference",
13+
ruleArguments: [
14+
{
15+
path: "always",
16+
types: "prefer-import",
17+
lib: "always",
18+
},
19+
],
20+
},
21+
],
22+
});
23+
});
24+
});

src/rules/rulesConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import { convertNoParameterProperties } from "./converters/no-parameter-properti
7979
import { convertNoParameterReassignment } from "./converters/no-parameter-reassignment";
8080
import { convertNoRedundantJsdoc } from "./converters/no-redundant-jsdoc";
8181
import { convertNoReference } from "./converters/no-reference";
82+
import { convertNoReferenceImport } from "./converters/no-reference-import";
8283
import { convertNoRegexSpaces } from "./converters/no-regex-spaces";
8384
import { convertNoRequireImports } from "./converters/no-require-imports";
8485
import { convertNoReturnAwait } from "./converters/no-return-await";
@@ -219,6 +220,7 @@ export const rulesConverters = new Map([
219220
["no-parameter-reassignment", convertNoParameterReassignment],
220221
["no-redundant-jsdoc", convertNoRedundantJsdoc],
221222
["no-reference", convertNoReference],
223+
["no-reference-import", convertNoReferenceImport],
222224
["no-regex-spaces", convertNoRegexSpaces],
223225
["no-require-imports", convertNoRequireImports],
224226
["no-return-await", convertNoReturnAwait],

0 commit comments

Comments
 (0)