Skip to content

Commit a142452

Browse files
author
Josh Goldberg
authored
Added converter for non-literal-fs-path (#1075)
1 parent e226652 commit a142452

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

src/converters/lintConfigs/rules/ruleConverters.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ import { convertNoMagicNumbers } from "./ruleConverters/no-magic-numbers";
194194
import { convertNoMisusedNew } from "./ruleConverters/no-misused-new";
195195
import { convertNoMultilineString } from "./ruleConverters/no-multiline-string";
196196
import { convertNoNamespace } from "./ruleConverters/no-namespace";
197+
import { convertNonLiteralFsPath } from "./ruleConverters/non-literal-fs-path";
197198
import { convertNoNonNullAssertion } from "./ruleConverters/no-non-null-assertion";
198199
import { convertNoNullKeyword } from "./ruleConverters/no-null-keyword";
199200
import { convertNoObjectLiteralTypeAssertion } from "./ruleConverters/no-object-literal-type-assertion";
@@ -403,6 +404,7 @@ export const ruleConverters = new Map([
403404
["no-multiline-string-literals", convertNoMultilineStringLiterals],
404405
["no-multiline-string", convertNoMultilineString],
405406
["no-namespace", convertNoNamespace],
407+
["non-literal-fs-path", convertNonLiteralFsPath],
406408
["no-non-null-assertion", convertNoNonNullAssertion],
407409
["no-null-keyword", convertNoNullKeyword],
408410
["no-object-literal-type-assertion", convertNoObjectLiteralTypeAssertion],
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { RuleConverter } from "../ruleConverter";
2+
3+
export const convertNonLiteralFsPath: RuleConverter = () => {
4+
return {
5+
plugins: ["eslint-plugin-security"],
6+
rules: [
7+
{
8+
ruleName: "security/detect-non-literal-fs-filename",
9+
},
10+
],
11+
};
12+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { convertNonLiteralFsPath } from "../non-literal-fs-path";
2+
3+
describe(convertNonLiteralFsPath, () => {
4+
test("conversion without arguments", () => {
5+
const result = convertNonLiteralFsPath({
6+
ruleArguments: [],
7+
});
8+
9+
expect(result).toEqual({
10+
plugins: ["eslint-plugin-security"],
11+
rules: [
12+
{
13+
ruleName: "security/detect-non-literal-fs-filename",
14+
},
15+
],
16+
});
17+
});
18+
});

0 commit comments

Comments
 (0)