diff --git a/.gitignore b/.gitignore index 8614987..1a4c761 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.tsbuildinfo /coverage/ /dist/ -node_modules \ No newline at end of file +node_modules +.idea diff --git a/src/__fixtures__/postprocessArguments.ts b/src/__fixtures__/postprocessArguments.ts index 34b5655..a7e34ef 100644 --- a/src/__fixtures__/postprocessArguments.ts +++ b/src/__fixtures__/postprocessArguments.ts @@ -32,6 +32,10 @@ const postprocessArguments: [ column: 1, nodeType: "IfStatement", messageId: "missingCurlyAfterCondition", + fix: { + range: [0, 3], + text: '' + } }, ], ], diff --git a/src/__snapshots__/processors.test.ts.snap b/src/__snapshots__/processors.test.ts.snap index 438ed7a..b68bef6 100644 --- a/src/__snapshots__/processors.test.ts.snap +++ b/src/__snapshots__/processors.test.ts.snap @@ -45,6 +45,13 @@ Array [ }, Object { "column": 1, + "fix": Object { + "range": Array [ + 0, + 3, + ], + "text": "", + }, "line": 3, "message": "Expected { after 'if' condition.", "messageId": "missingCurlyAfterCondition", @@ -66,5 +73,21 @@ Array [ "ruleId": "curly", "severity": 1, }, + Object { + "column": 1, + "fix": Object { + "range": Array [ + 0, + 3, + ], + "text": "", + }, + "line": 3, + "message": "Expected { after 'if' condition.", + "messageId": "missingCurlyAfterCondition", + "nodeType": "IfStatement", + "ruleId": "curly", + "severity": 1, + }, ] `; diff --git a/src/processors.ts b/src/processors.ts index 753c98a..257d13a 100644 --- a/src/processors.ts +++ b/src/processors.ts @@ -95,8 +95,8 @@ const getPostProcessor = const rangesForDiff = getRangesForDiff(getDiffForFile(filename, staged)); return messages.flatMap((message) => { - const filteredMessage = message.filter(({ fatal, line }) => { - if (fatal === true) { + const filteredMessage = message.filter(({ fatal, line, fix }) => { + if (fatal === true || fix) { return true; }