TypeError: Cannot read property 'body' of null
See original GitHub issueTell us about your environment
- ESLint Version: 7.8.1
- Node Version: 12.14.1
- npm Version: 6.14.5
What parser (default, @babel/eslint-parser
, @typescript-eslint/parser
, etc.) are you using?
@typescript-eslint/parser
Please show your full configuration:
Configuration
module.exports = {
root: true,
env: {
node: true,
browser: true
},
extends: [
'plugin:vue/strongly-recommended',
'@vue/airbnb',
'@vue/typescript',
'plugin:prettier/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/vue'
],
parserOptions: {
ecmaVersion: 2020,
parser: '@typescript-eslint/parser',
sourceType: 'module'
},
rules: {
'no-console': 'off',
'no-debugger': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-non-null-asserted-optional-chain': 'off',
'class-methods-use-this': 'off',
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'vue/no-v-html': 'off',
'no-shadow': 'off',
'vue/max-attributes-per-line': [
2,
{
singleline: 20,
multiline: {
max: 1,
allowFirstLine: false
}
}
],
'prettier/prettier': 'warn'
},
overrides: [
{
files: ['**/*.test.ts'],
env: {
jest: true
}
}
]
};
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
tiptap-extensions.d.ts
declare module 'tiptap-extensions' {
import { Extension, Node, Mark } from 'tiptap';
import { Node as PromsemirrorNode } from 'prosemirror-model';
export interface PlaceholderOptions {
emptyNodeClass?: string;
emptyNodeText?: ((node: PromsemirrorNode) => string | undefined) | string;
showOnlyWhenEditable?: boolean;
showOnlyCurrent?: boolean;
emptyEditorClass: string;
}
export class Placeholder extends Extension {
constructor(options?: PlaceholderOptions);
}
export interface TrailingNodeOptions {
/**
* Node to be at the end of the document
*
* defaults to 'paragraph'
*/
node: string;
/**
* The trailing node will not be displayed after these specified nodes.
*/
notAfter: string[];
}
export class TrailingNode extends Extension {
constructor(options?: TrailingNodeOptions);
}
export interface HeadingOptions {
levels?: number[];
}
export class History extends Extension {}
export class Bold extends Mark {}
export class Code extends Mark {}
export class Italic extends Mark {}
export class Link extends Mark {}
export class Strike extends Mark {}
export class Underline extends Mark {}
export class Blockquote extends Node {}
export class BulletList extends Node {}
export class CodeBlock extends Node {}
export class HardBreak extends Node {}
export class Heading extends Node {
constructor(options?: HeadingOptions);
}
export class HorizontalRule extends Node {}
export class Image extends Node {}
export class ListItem extends Node {}
export class OrderedList extends Node {}
export class Table extends Node {}
export class TableCell extends Node {}
export class TableRow extends Node {}
export class TableHeader extends Node {}
export class TodoItem extends Node {}
export class TodoList extends Node {}
}
vue-cli-service lint
What did you expect to happen? I expect eslint to tell me there is an error with the file or not without crashing
What actually happened? Please include the actual, raw output from ESLint. ERROR TypeError: Cannot read property ‘body’ of null Occurred while linting \SkyCourt.UI\ui\src\typings\tiptap-extensions.d.ts:13 TypeError: Cannot read property ‘body’ of null Occurred while linting SkyCourt.UI\ui\src\typings\tiptap-extensions.d.ts:13 at checkForConstructor (SkyCourt.UI\ui\node_modules\eslint\lib\rules\no-useless-constructor.js:165:42) at SkyCourt.UI\ui\node_modules\eslint\lib\linter\safe-emitter.js:45:58 at Array.forEach (<anonymous>) at Object.emit (SkyCourt.UI\ui\node_modules\eslint\lib\linter\safe-emitter.js:45:38) at NodeEventGenerator.applySelector (SkyCourt.UI\ui\node_modules\eslint\lib\linter\node-event-generator.js:254:26) at NodeEventGenerator.applySelectors (SkyCourt.UI\ui\node_modules\eslint\lib\linter\node-event-generator.js:283:22) at CodePathAnalyzer.enterNode (SkyCourt.UI\ui\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:711:23) at SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:952:32 at Array.forEach (<anonymous>) at runRules (SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:947:15) at Linter._verifyWithoutProcessors (SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:1173:31) at Linter._verifyWithConfigArray (SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:1271:21) at Linter.verify (SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:1226:25) at Linter.verifyAndFix (SkyCourt.UI\ui\node_modules\eslint\lib\linter\linter.js:1416:29) at verifyText (SkyCourt.UI\ui\node_modules\eslint\lib\cli-engine\cli-engine.js:224:48) error Command failed with exit code 1.
Are you willing to submit a pull request to fix this bug? I don’t presume to understand the eslint code enough to be able to provide a fix.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
Yea, that makes sense. I had mistakenly assumed that if somebody was suggesting a config (ie a set of extend packages) that it would have worked out all those kinks and favoured the extension rules. I was wrong, but I am on the right path now. I know what to look for in the future and I have started a set of overrides for .d.ts files in my config.
Thanks again for such a quick response!
Looks like this is resolved, so closing.