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 mode not fixing anything with eslint-plugin-script-tags. #9142

Closed
trusktr opened this issue Aug 22, 2017 · 7 comments
Closed

--fix mode not fixing anything with eslint-plugin-script-tags. #9142

trusktr opened this issue Aug 22, 2017 · 7 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly

Comments

@trusktr
Copy link

trusktr commented Aug 22, 2017

Tell us about your environment

  • ESLint Version: 3.19.0
  • Node Version: 8.1.2
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Configuration
{
  "extends": [
    "airbnb",
    "prettier",
  ],
  "plugins": [
    "prettier",
    "script-tags",
  ],
  "env": {
    "browser": true,
    "node": true,
    "mocha": true,
  },
  "settings": {
    "import/resolver": "node",
  },
  "rules": {
    "eol-last": 0,
    "prettier/prettier": ["error", {
      "printWidth": 80,
      "tabWidth": 2,
      "useTabs": false,
      "semi": false,
      "singleQuote": true,
      "trailingComma": "all",
      "bracketSpacing": true,
      "jsxBracketSameLine": false,
    }],
    "arrow-parens": 0,
    "no-unused-vars": [
      "error",
      {
        "argsIgnorePattern": "^_",
      },
    ],
    "jsx-a11y/href-no-hash": 0,
    "comma-dangle": [
      "error",
      {
        "arrays": "always-multiline",
        "objects": "always-multiline",
        "imports": "always-multiline",
        "exports": "always-multiline",
        "functions": "never",
      },
    ],
  },
}

What did you do? Please include the actual source code causing the issue.

I made a reproduction here: https://github.com/trusktr/gulp-eslint/tree/issue-204

Also see adametry/gulp-eslint#204 for more description of the issue.

What did you expect to happen?

Basically I expect --fix mode to also modify the content of my <script> tags because I'm using eslint-plugin-script-tags to lint those parts of .hbs or .html files, etc.

What actually happened? Please include the actual, raw output from ESLint.

No fixing happens in .hbs file, for example, only in .js files.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Aug 22, 2017
@trusktr
Copy link
Author

trusktr commented Aug 22, 2017

After running eslint, I get this in my repo:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   foo.js
        modified:   blah.js
        modified:   bar/index.js

but just not .hbs files. Still playing with it, trying to figure out why.

@trusktr
Copy link
Author

trusktr commented Aug 22, 2017

I'm using prettier, and I am getting prettier errors for the .hbs files, just fixes are not being applied to them.

@not-an-aardvark
Copy link
Member

Thanks for the report. This is working as intended because eslint-plugin-script-tags uses processors, and autofixing is currently not supported when using processors (see the documentation).

It's possible that this will be supported soon (see #9090), although it's likely that some changes will be required in eslint-plugin-script-tags after that for autofixing to work correctly.

@not-an-aardvark not-an-aardvark added works as intended The behavior described in this issue is working correctly and removed triage An ESLint team member will look at this issue soon labels Aug 23, 2017
@trusktr
Copy link
Author

trusktr commented Aug 23, 2017

@not-an-aardvark Ah, thanks! So, for people that make processors, what's the way in which they should handle it (so --fix mode works) so I can relay the message back to them?

@trusktr
Copy link
Author

trusktr commented Aug 23, 2017

Here's the related issue on eslint-plugin-script-tags.

@not-an-aardvark
Copy link
Member

My recommendation to processor developers would be to wait until #9090 is hopefully merged sometime in the near future, and then update their processors to also transform autofix ranges (as described in #9090) to make autofixing work properly.

That said, it would also be useful for the ESLint team to get some implementation feedback earlier -- if anyone wants to update a processor to implement the experimental API in #9090 before it's merged, we'd like to hear about any implementation difficulties/inconveniences you encounter, so that we can modify the API appropriately. However, it's not guaranteed that the current form of the API is the final version that will be shipped (or that this enhancement will be shipped at all), so I would only do this if you're okay with the possibility of needing to change the implementation later on.

@not-an-aardvark
Copy link
Member

Closing because this is working as intended.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Mar 2, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Mar 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion works as intended The behavior described in this issue is working correctly
Projects
None yet
Development

No branches or pull requests

3 participants