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-useless-constructor] <Still catching error> #1443

Closed
Mister-Hope opened this issue Jan 13, 2020 · 6 comments
Closed

[no-useless-constructor] <Still catching error> #1443

Mister-Hope opened this issue Jan 13, 2020 · 6 comments
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look

Comments

@Mister-Hope
Copy link

After a year, we still got problems like issue#15

Repro

extends:
  - eslint:all
  - plugin:@typescript-eslint/eslint-recommended
  - "plugin:@typescript-eslint/recommended"

parser: "vue-eslint-parser"

parserOptions:
  parser: "@typescript-eslint/parser"
// your repro code case
/* eslint-disable */

declare module 'aaa' {
  class Logger {
    options: any;
    constructor(options?: any);
  }

  const logger: Logger;
  export = logger;
}

Expected Result

No error

Actual Result

Eslint crush

Additional Info

[Error - 下午9:38:15] ESLint stack trace:
[Error - 下午9:38:15] TypeError: Cannot read property 'body' of null
Occurred while linting Z:\npm\vuepress-theme-hope\packages\theme-types\index.d.ts:24
    at checkForConstructor (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\rules\no-useless-constructor.js:161:42)
    at Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:634:23)
    at Z:\npm\vuepress-theme-hope\node_modules\eslint\lib\linter\linter.js:936:32
    at Array.forEach (<anonymous>)

Versions

package version
@typescript-eslint/eslint-plugin 2.15.0
@typescript-eslint/parser 2.15.0
TypeScript 3.7.4
ESLint 6.8.0
node 12.14.1
yarn 1.21.1
@Mister-Hope Mister-Hope added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Jan 13, 2020
@armano2
Copy link
Member

armano2 commented Jan 13, 2020

for unknown reason you are using core no-useless-constructor instead of our @typescript-eslint/no-useless-constructor rule

@armano2
Copy link
Member

armano2 commented Jan 13, 2020

@Mister-Hope
Copy link
Author

for unknown reason you are using core no-useless-constructor instead of our @typescript-eslint/no-useless-constructor rule

Sorry, do you mean I have to disable no-useless-constructor?

I did not see it in here

@Mister-Hope
Copy link
Author

looks like this rule is missing in config:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.json

Got it, hoping you can add it in the next release, I'll disable it for workaround now. 😃

@armano2
Copy link
Member

armano2 commented Jan 13, 2020

yes you should disable no-useless-constructor and enable @typescript-eslint/no-useless-constructor

cc @bradzacher
#1423

@bradzacher
Copy link
Member

looks like this rule is missing in config:
/packages/eslint-plugin/src/configs/recommended.json@master

no-useless-constructor is not a recommended eslint base rule, so it won't be included in the recommended set.

This problem is because their config is using eslint:all, which turns on this rule. We don't have an eslint-all config.

We should instead update the documentation to include information about extension rules. The FAQ would be a good spot.

Closing as there's nothing to explicitly fix here.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look
Projects
None yet
Development

No branches or pull requests

3 participants