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

Plugin does not work with autofix #58

Closed
tunnckoCore opened this issue Feb 13, 2017 · 7 comments
Closed

Plugin does not work with autofix #58

tunnckoCore opened this issue Feb 13, 2017 · 7 comments

Comments

@tunnckoCore
Copy link

tunnckoCore commented Feb 13, 2017

ref: AtomLinter/linter-eslint#815

Everything just started with AtomLinter/linter-eslint#779.

I just have a markdown file, javascript file and eslintrc.

I'm using:

% ❯ npm ls | grep eslint                                                                               February 12, 12:34:53
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]

and have this config

{
  "extends": ["standard"],
  "plugins": ["markdown"],
  "rules": {
    "semi": [
      2,
      "always"
    ]
  }
}

Intentionally makes standard to always want semicolons so it is easy to see if autofixing works.

Initially I was thinking it is Linter-ESLint bug, but seems it isn't. Because when run the following ESLint still report errors and does not fix them.

eslint --fix --ext md README.md
eslint --fix --ext md .
eslint --fix -c .eslintrc --ext md README.md

the code fences in the markdown file is both jsx and js

@platinumazure
Copy link
Member

Plugins that use processors (that is, plugins which need to extract JavaScript snippets out of non-JavaScript files) are not able to use autofix due to architectural/design limitations we haven't yet been able to overcome. So files linted using eslint-plugin-markdown won't have autofix applied to them.

As you've noted, this is a core ESLint issue and not something restricted to editor integrations.

When I'm on a PC, I'll find the relevant issues and put them in here.

@platinumazure platinumazure changed the title Seems to not work Plugin does not work with autofix Feb 13, 2017
@privatenumber
Copy link

@platinumazure Has anything changed to make this easier to add since the release of ESLint v4?

@not-an-aardvark
Copy link
Member

No. However, this might be possible soon if eslint/eslint#9090 is merged.

@KaiSchwarz-cnic
Copy link

This got merged, so +1

@BridgeAR
Copy link

BridgeAR commented Mar 7, 2018

It would be very nice if this could be worked on now.

@byzyk
Copy link
Contributor

byzyk commented Jun 5, 2018

Guys, I created PR #97 for this feature. Feel free to share the feedback if it works for your use cases.

btmills pushed a commit that referenced this issue Oct 27, 2018
* enable autofix

* add processor test cases

* add plugin test cases, add initCLI() helper function

* Additional autofix tests

* wip: cover edge cases

* add(test): with multiple rules

* fix: inside a list test pass

* remove debugger

* bump parser

* add readme note

* Autofix works with indents

* Un-flatten offset map to a list of records

* remove note about usage inside lists

* make autofix example more explicit
@tunnckoCore
Copy link
Author

tunnckoCore commented Jan 16, 2019

Seems like it works through terminal, but does not writes the fixes?

Also, it does not work in a editor, does we need some option for the eslint extension for VSCode?

Seems like adding to eslint.validate is not respected

{
  "language": "markdown",
  "autoFix": true
}

Some may have Prettier extension for VSCode too, but still it doesn't do all needed things. So, for me currently, this problem above isn't so much of a big deal.

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

9 participants