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

Cannot override 'avoid-leaking-state-in-ember-objects' plugin on specific ember-cli-mirage folder #214

Open
hakilebara opened this issue Jan 14, 2018 · 1 comment · May be fixed by #1004

Comments

@hakilebara
Copy link

This ember-cli-mirage code documented here will raise an eslint ember/avoid-leaking-state-in-ember-objects flag:

// mirage/serializers/blog-post.js
import ApplicationSerializer from './application';

export default ApplicationSerializer.extend({
  include: ['comments']
});

I tried adding an additional entry to overrides in .eslintrc.js to add include as an ignored property of ember/avoid-leaking-state-in-ember-objects:

module.exports = {
  globals: {
    server: true,
  },
  root: true,
  parserOptions: {
    ecmaVersion: 2017,
    sourceType: 'module',
  },
  plugins: ['ember'],
  extends: ['eslint:recommended', 'plugin:ember/recommended'],
  env: {
    browser: true,
  },
  rules: {},
  overrides: [
    // node files
    {
      files: ['testem.js', 'ember-cli-build.js', 'config/**/*.js'],
      parserOptions: {
        sourceType: 'script',
        ecmaVersion: 2015,
      },
      env: {
        browser: false,
        node: true,
      },
    },

    // test files
    {
      files: ['tests/**/*.js'],
      excludedFiles: ['tests/dummy/**/*.js'],
      env: {
        embertest: true,
      },
    },
    // mirage files
    {
      files: ['mirage/serializers/**'],
      rules: {
        'ember/avoid-leaking-state-in-ember-objects': [1, ['include']],
      },
    },
  ],
};

This doesn't work, the linter flag is still raised.

However if the override is defined on mirage/**

    // mirage files
    {
      files: ['mirage/**'],
      rules: {
        'ember/avoid-leaking-state-in-ember-objects': [1, ['include']],
      },
    },

include is properly added to the ignored list and the eslint test passes. Is there something wrong in the way in define files?

Here is a demo app of the issue

@hakilebara
Copy link
Author

referencing #202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant