From 2657c6555287d75486e725862f2cbaf81d75c65b Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 8 Aug 2017 14:48:11 +0100 Subject: [PATCH] add no-useless-path-segments fixer --- src/rules/no-useless-path-segments.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rules/no-useless-path-segments.js b/src/rules/no-useless-path-segments.js index 2aee5c772a..1d863c5b8f 100644 --- a/src/rules/no-useless-path-segments.js +++ b/src/rules/no-useless-path-segments.js @@ -24,7 +24,7 @@ function normalize(fn, sep) { const countRelParent = x => sumBy(x, v => v === '..') module.exports = { - meta: {}, + meta: { fixable: 'code' }, create: function (context) { const currentDir = path.dirname(context.getFilename()) @@ -36,6 +36,7 @@ module.exports = { context.report({ node: source, message: `Useless path segments for "${value}", should be "${proposed}"`, + fix: fixer => fixer.replaceText(source, JSON.stringify(proposed)), }) }