Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--fix does not work #4

Open
captbaritone opened this issue Feb 1, 2016 · 3 comments
Open

--fix does not work #4

captbaritone opened this issue Feb 1, 2016 · 3 comments

Comments

@captbaritone
Copy link
Contributor

Using -- fix does not currently work. Not sure if that's within the scope of this project, but I thought I'd document that it does not currently work.

The error I tried to fix was space-before-function-paren.

It did not error or cause problems, but simply did nothing.

@platinumazure
Copy link
Owner

I don't know if auto-fix is supported for plugins within ESLint at this point (I'm thinking not, given that --fix did nothing instead of fixed the wrong area).

If ESLint were to support fix in plugins, I would need to adjust post-processing to take the fix output (from the error message object) and adjust its range, not unlike how line and column get adjusted.

@platinumazure
Copy link
Owner

Blocked by eslint/eslint#5121.

@platinumazure
Copy link
Owner

Update: I've opened eslint/eslint#5588 which is about halfway towards implementing plugin auto-fix in ESLint. The issue I've run into now, though, is that the auto-fix logic takes in a SourceCode object which is constructed from the code blocks returned by preprocess(). Unfortunately, the fixer really needs to be applied on the raw file text.

I'm exploring how we might be able to make that work-- I'm currently thinking SourceCodeFixer.applyFixes() should be split into two methods: one which processes the text, and one which takes in a SourceCode object and calls the text-processing method while taking advantage of some of the information available in SourceCode.

If I can figure out a way to make that work, then auto-fix for plugins should basically be in the bag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants