Skip to content

.eslintrc.js is overwritten on install #17

Open
@vpiskunov

Description

@vpiskunov
Contributor

Think this didn't happen before, but even if it did - doesn't seem the best way to scrap the project's original .eslintrc. Perhaps we can append to it instead of writing over?

image

Activity

jawa-the-hutt

jawa-the-hutt commented on May 30, 2019

@jawa-the-hutt
Collaborator

Not sure what's going on here at the moment. Below is all we are doing to adjust the eslint config...we're using the built-in CLI-Generator methods to do so. Nothing fancy as far as I know:

  // if the project is using eslint, add some global variables
  // to the eslintConfig in order to avoid no-def errors
  if (api.hasPlugin('eslint')) {
    api.extendPackage({
      eslintConfig: {
        globals: {
          TNS_APP_MODE: true,
          TNS_APP_PLATFORM: true
        }
      }
    });
  }

Here's a screenshot of the changes for a Typescript/Eslint/Prettier setup:
image

It's essentially the same for a Javascript/Eslint/Airbnb setup.

Now, I'm using vscode on MacOS. What editor are you using and which OS? I'm wondering if the git client and/or IDE makes a difference in terms of what it's detecting as changes.

vpiskunov

vpiskunov commented on May 30, 2019

@vpiskunov
ContributorAuthor

Using Sourcetree(Atlassian) for my git client, though this doesn't impact it. As you can see in my screenshot, all lines that were there before plugin install, were removed, and not re-added.

To confirm this, when looking at the file itself, after install - it only contains this:

module.exports = {
  globals: {
    TNS_APP_MODE: true,
    TNS_APP_PLATFORM: true
  }
}

It's literally only that inside, so seems to not be working as intended, if you say it appends in your case.

I had issues with the @vue/airbnb inside the extends, so switched to airbnb-base. Perhaps this could be related - if the prettier & @vue/airbnb are hardcoded somewhere?

See my in-file note regarding @vue/airbnb issue:

  "plugin:vue/essential",
        // "@vue/airbnb" is default in Vue CLI 3 (UI), however it requires-in eslint-config-airbnb-base, which contains an error
        // triggering "import/no-cycle" was not defined. Weirdly, it is listed in eslint-config-airbnb-base as added/fixed
        // in current version (4.1.0). For now, use airbnb-base instead
        // "@vue/airbnb",
        "airbnb-base",

Unrelated, but to help you understand the full picture.

jawa-the-hutt

jawa-the-hutt commented on May 30, 2019

@jawa-the-hutt
Collaborator

Just to double-check is this happening in a UI or CLI only created project?

edit: or both?

vpiskunov

vpiskunov commented on May 31, 2019

@vpiskunov
ContributorAuthor

Happened on UI created - haven't tested on CLI. I mean... UI created the project, but installed the plugin via npm/dev-branch & invoked. Can't remember if this was happening on master/release.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jawa-the-hutt@vpiskunov

        Issue actions

          .eslintrc.js is overwritten on install · Issue #17 · nativescript-vue/vue-cli-plugin-nativescript-vue