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: Cannot read property 'body' of null #13830
Comments
Hi @AriPerkkio, thanks for the issue! You should use @typescript-eslint/no-useless-constructor rule instead of the core {
"no-useless-constructor": "off",
"@typescript-eslint/no-useless-constructor": ["error"]
} |
The This is not really blocking my development or anything. I'm just running a tool I've created and checking stability of well-known ESLint plugins. I'm reporting all findings to plugin developers, if possible. How about that JS case with Flow typings, https://github.com/FormidableLabs/react-music/blob/HEAD/interfaces/tunajs.js#L13? |
Thanks for doing that! eslint-remote-tester looks awesome.
Did you run the rule with |
This was indeed spotted with It seems that turning off this rule is common when using I think it is safe to close this issue without taking action. But on the other hand - this was the only rule of |
- Do not crash on parsers which do not require class constructor to have a body
no-useless-constructor
rule crashes on typescript's declaration files where class constructor has no body. There's also one error included which I believe comes from Flow setup. I'm not that familiar with Flow, but fixing the TS issue should cover Flow as well.Tell us about your environment
What parser (default,
@babel/eslint-parser
,@typescript-eslint/parser
, etc.) are you using?'@typescript-eslint/parser'
Please show your full configuration:
Configuration
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
17 crash reports from various repositories
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:138
captbaritone/winamp2-js/packages/webamp/index.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:28
elastic/eui/src/components/text_diff/text-diff.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:21
elastic/kibana/packages/kbn-interpreter/src/common/lib/registry.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:96
elastic/kibana/src/legacy/server/kbn_server.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:39
elastic/kibana/src/plugins/vis_type_timelion/server/lib/classes/timelion_function.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:36
elastic/kibana/src/plugins/vis_type_vega/public/vega_view/vega_base_view.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:17
elastic/kibana/x-pack/plugins/maps/public/classes/joins/inner_join.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:18
elastic/kibana/x-pack/plugins/maps/public/classes/layers/tile_layer/tile_layer.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:29
elastic/kibana/x-pack/plugins/ml/public/application/util/time_buckets.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:13
FormidableLabs/react-music/interfaces/tunajs.js
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:26
microsoft/fluentui/packages/monaco-editor/monaco-typescript.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:5
mui-org/material-ui/packages/material-ui-styles/src/ServerStyleSheets/ServerStyleSheets.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:2
mui-org/material-ui/packages/material-ui-utils/macros/MuiError.macro.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:103
pmndrs/react-spring/packages/core/src/SpringValue.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:12
reakit/reakit/packages/website/types/rehype-react.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:687
text-mask/text-mask/angular2/typings/globals/node/index.d.ts
Rule: no-useless-constructor
Cannot read property 'body' of null Occurred while linting <text>:39
withspectrum/spectrum/flow-typed/npm/common-tags_v1.4.x.js
Command used to run ESLint:
https://github.com/AriPerkkio/eslint-remote-tester/blob/dd0af730f136ef0fd7be34eb227887f1afa1b7cb/lib/engine/worker-task.ts#L185
What did you expect to happen?
ESlint rule should not crash.
What actually happened? Please include the actual, raw output from ESLint.
TypeError: Cannot read property 'body' of null
eslint/lib/rules/no-useless-constructor.js
Line 165 in 4255f36
Are you willing to submit a pull request to fix this bug?
Yes, I've already started to debug this. Could someone verify this bug before I go any further?
The text was updated successfully, but these errors were encountered: