Skip to content

ignores .eslintrc.json #19

Open
Open

Description

@fbacker

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

Activity

  1. jesperbjensen commented on May 23, 2018

    @jesperbjensen
    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.

  2. tommck commented on Jul 15, 2018

    @tommck
    Contributor

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

  3. tommck commented on Jul 15, 2018

    @tommck
    Contributor

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

  4. tommck commented on Jul 15, 2018

    @tommck
    Contributor

    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?

  5. tommck commented on Sep 4, 2018

    @tommck
    Contributor

    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)

  6. tommck commented on Sep 4, 2018

    @tommck
    Contributor

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

  7. tommck commented on Sep 9, 2018

    @tommck
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions