Skip to content

[no-extraneous-class] Rule always throws an AssertionError #170

@sebald

Description

@sebald

Repro

{
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "extends": ["plugin:@typescript-eslint/recommended"],
  "rules": {
    "@typescript-eslint/no-extraneous-class": "error"
  }
}

Note: the error occurs by just turning the rule on. So the below is not necessary

export default class Foo {
  hello() {
    return 'I am foo!';
  }

  waitFor(it: string) {
    return Promise.resolve(it);
  }
}

Expected Result
No exception.

Actual Result

Stack trace:

AssertionError [ERR_ASSERTION]: Node must be provided when reporting error if location is not provided
    at assertValidNodeInfo (<path>/node_modules/eslint/lib/util/report-translator.js:96:9)
    at args (<path>/node_modules/eslint/lib/util/report-translator.js:246:9)
    at Object.report (<path>/node_modules/eslint/lib/linter.js:720:41)
    at ClassBody (<path>/node_modules/@typescript-eslint/eslint-plugin/lib/rules/no-extraneous-class.js:71:19)
    at listeners.(anonymous function).forEach.listener (<path>/node_modules/eslint/lib/util/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (<path>/node_modules/eslint/lib/util/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (<path>/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (<path>/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (<path>/node_modules/eslint/lib/util/node-event-generator.js:294:14)

Additional Info

If I turn the rule everything works fine.

Versions

package version
@typescript-eslint/eslint-plugin 1.1.1
@typescript-eslint/parser 1.1.1
TypeScript 3.2.4
ESLint 5.12.1
node 10.15.1
npm 6.5.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions