vue-cli-plugin-nativescript-vue icon indicating copy to clipboard operation
vue-cli-plugin-nativescript-vue copied to clipboard

.eslintrc.js is overwritten on install

Open vpiskunov opened this issue 5 years ago • 4 comments

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

vpiskunov avatar May 30 '19 12:05 vpiskunov

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.

jawa-the-hutt avatar May 30 '19 19:05 jawa-the-hutt

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.

vpiskunov avatar May 30 '19 20:05 vpiskunov

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

edit: or both?

jawa-the-hutt avatar May 30 '19 21:05 jawa-the-hutt

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.

vpiskunov avatar May 31 '19 12:05 vpiskunov