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

no-classic-classes: getSourceModuleName should only be called on a CallExpression, MemberExpression or Identifier #1088

Closed
bendemboski opened this issue Feb 18, 2021 · 1 comment · Fixed by #1102
Labels

Comments

@bendemboski
Copy link

AssertionError [ERR_ASSERTION]: `getSourceModuleName` should only be called on a `CallExpression`, `MemberExpression` or `Identifier`
    at getSourceModuleName (/private/tmp/test-app/node_modules/eslint-plugin-ember/lib/utils/import.js:46:5)
    at /private/tmp/test-app/node_modules/eslint-plugin-ember/lib/utils/import.js:31:49
    at Array.some (<anonymous>)
    at /private/tmp/test-app/node_modules/eslint-plugin-ember/lib/utils/import.js:30:36
    at Array.find (<anonymous>)
    at getSourceModuleNameForIdentifier (/private/tmp/test-app/node_modules/eslint-plugin-ember/lib/utils/import.js:29:6)
    at CallExpression > MemberExpression[property.name="extend"] (/private/tmp/test-app/node_modules/eslint-plugin-ember/lib/rules/no-classic-classes.js:63:37)
    at /private/tmp/test-app/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/private/tmp/test-app/node_modules/eslint/lib/linter/safe-emitter.js:45:38)

is triggered by:

import thing from 'place';

export default class Cls {
  init() {
    this.extend();
  }
}

(without the import statement, even though it's unused, the error will not happen).

  • eslint@7.20.0
  • eslint-plugin-ember@10.2.0
  • ember-source@3.25.1
  • ember-cli@3.25.0

Looks similar to #905, but it was fixed by #906 which was released in v8.10.1 and I'm seeing this in 10.2.0.

@bendemboski
Copy link
Author

Perhaps also noteworthy that it repros with this.member.chain.extend() in place of this.extend(). My actual use case is the CKEditor schema API:

import Plugin from '@ckeditor/ckeditor5-core/src/plugin';

export default class TaggingEditing extends Plugin {
  init() {
    this.editor.model.schema.extend('$text', { allowAttributes: tagAttribute });
    // ...
  }
}

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

Successfully merging a pull request may close this issue.

2 participants