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

ignores .eslintrc.json #19

Open
fbacker opened this issue May 22, 2018 · 7 comments
Open

ignores .eslintrc.json #19

fbacker opened this issue May 22, 2018 · 7 comments

Comments

@fbacker
Copy link

fbacker commented May 22, 2018

Installed product versions

  • Visual Studio 2017
  • This extension: 2.0.33

Description

Able to use .eslintrc.json instead of .prettierrc. Other Prettier formatters e.g. for Visual Studio Code uses this. Often eslint is already used and having 2 files specifying same things is not a good thing.

Steps to recreate

  1. Install extension
  2. place .eslintrc.json
  3. format a js file

Current behavior

Ignores rules set by eslint

Expected behavior

Look for configuration files by order

.prettierrc > .eslintrc > .eslintrc.json

@jesperbjensen
Copy link
Collaborator

Hi @fbacker

I have looked into the VSCode extensions source-code - and in my understanding the support for eslint is not part of "native" prettier - and we use that to locate the configuration file. It may be part of the prettier-eslint package..

That said - if someone is willing to implement the feature they are welcome - I like the VSCode extension - and I'm sure that there is alot of wisdom in that plugin.

If it should be implemented I think it should be part of the #16's solution - as we can then "probe" if you have prettier-eslint or prettier-tslint installed, and then use their commands instead.

@tommck
Copy link
Contributor

tommck commented Jul 15, 2018

Hmm. I didn't see this before. I could possibly make more mods to my fix for #16 to make this work too.

@tommck
Copy link
Contributor

tommck commented Jul 15, 2018

If someone has both prettier-eslint and prettier-tslint, I guess we'd have to use the right one for the file extension. Right?

@tommck
Copy link
Contributor

tommck commented Jul 15, 2018

Hey @jesperbjensen,

you think we should have a dictionary mapping an extension regex to command path to search like this?

        // TODO: better name
        private static readonly IDictionary<string, string> _specificExtensionCommandMap = new Dictionary<string, string>
        {
            { ".jsx?", "node_modules\\.bin\\prettier-eslint.cmd" },
            { ".tsx?", "node_modules\\.bin\\prettier-tslint.cmd" }
        };

Then, we could search for the more specific extension-related formatter first, then fall back to the default prettier.cmd search?

If so, we can find the local prettier.cmd, yet we should probably keep searching up the directory tree for the specific ones?

@tommck
Copy link
Contributor

tommck commented Sep 4, 2018

I just realized today that prettier-eslint works on strings, which is very useful to us.
prettier-tslint, however, only works on files, which is much less useful (we want to modify the file before save)

I can definitely implement adding prettier-eslint though (and lay the groundwork for future integrations)

@tommck
Copy link
Contributor

tommck commented Sep 4, 2018

@jesperbjensen @madskristensen - should we also be installing our own copy of prettier-eslint or just support a local copy of that?

@tommck
Copy link
Contributor

tommck commented Sep 9, 2018

All, I have a functioning version that runs prettier-eslint if it's present. Was going to add it as part of the additional extension support I'm adding too.

Just wanted to put this here in case someone else tried to start working on this

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

3 participants