tslint-eslint-rules icon indicating copy to clipboard operation
tslint-eslint-rules copied to clipboard

Such rules give warnings: ter-indent, ter-arrow-parens, object-curly-spacing, array-bracket-spacing, brace-style

Open gitowiec opened this issue 6 years ago • 4 comments

My project uses tslint-config-airbnb I had to override this rules to false

  "rules": {
    "ter-indent": false,
    "ter-arrow-parens": false,
    "object-curly-spacing": false,
    "array-bracket-spacing": false,
    "brace-style": false
}

to make screen output of yarn tslint free of these warnings

TypeError: Cannot read property '1' of null
    at ObjectCurlySpacingWalker.checkSpacingInsideBraces (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:53:54)
    at ObjectCurlySpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:44:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNodes (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11911:30)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12042:21)
    at ObjectCurlySpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ObjectCurlySpacingWalker.SyntaxWalker.visitCallExpression (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:54:14)
    at ObjectCurlySpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:305:22)
    at ObjectCurlySpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:46:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
TypeError: Cannot read property '0' of undefined
    at ArrayBracketSpacingWalker.validateArraySpacing (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:135:36)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:105:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12069:21)
    at ArrayBracketSpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitBinaryExpression (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:39:14)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:293:22)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:107:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
TypeError: Cannot read property '0' of undefined
    at ArrayBracketSpacingWalker.validateArraySpacing (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:135:36)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:105:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12037:21)
    at ArrayBracketSpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitElementAccessExpression (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:96:14)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:347:22)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:107:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
TypeError: Cannot read property '0' of undefined
    at ArrayBracketSpacingWalker.validateArraySpacing (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:135:36)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:105:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12082:21)
    at ArrayBracketSpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitConditionalExpression (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:72:14)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:323:22)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:107:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
TypeError: Cannot read property '0' of undefined
    at ArrayBracketSpacingWalker.validateArraySpacing (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:135:36)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:105:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12227:24)
    at ArrayBracketSpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:530:22)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:107:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
TypeError: Cannot read property 'kind' of undefined
    at IndentWalker.getNodeIndent (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:287:18)
    at IndentWalker.checkNodeIndent (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:310:33)
    at /home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:536:54
    at Array.forEach (<anonymous>)
    at IndentWalker.checkNodesIndent (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:536:15)
    at IndentWalker.blockIndentationCheck (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:413:18)
    at IndentWalker.visitClassDeclaration (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:704:14)
    at IndentWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:314:22)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNodes (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11911:30)
TypeError: Cannot read property '1' of null
    at ObjectCurlySpacingWalker.checkSpacingInsideBraces (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:53:54)
    at ObjectCurlySpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:44:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12145:24)
    at ObjectCurlySpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ObjectCurlySpacingWalker.SyntaxWalker.visitThrowStatement (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:240:14)
    at ObjectCurlySpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:494:22)
    at ObjectCurlySpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/objectCurlySpacingRule.js:46:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
TypeError: Cannot read property '0' of undefined
    at ArrayBracketSpacingWalker.validateArraySpacing (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:135:36)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:105:18)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNode (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11902:24)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12084:24)
    at ArrayBracketSpacingWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at ArrayBracketSpacingWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:530:22)
    at ArrayBracketSpacingWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/arrayBracketSpacingRule.js:107:36)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNodes (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11911:30)
TypeError: Cannot read property 'filter' of undefined
    at IndentWalker.checkIndentInArrayOrObjectBlock (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:593:29)
    at IndentWalker.visitObjectLiteralExpression (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:735:14)
    at IndentWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:449:22)
    at /home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:63
    at visitNodes (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:11911:30)
    at Object.forEachChild (/home/foobar/workspace/web-ui/node_modules/typescript/lib/typescript.js:12029:24)
    at IndentWalker.SyntaxWalker.walkChildren (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:535:12)
    at IndentWalker.SyntaxWalker.visitArrayLiteralExpression (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:30:14)
    at IndentWalker.visitArrayLiteralExpression (/home/foobar/workspace/web-ui/node_modules/tslint-eslint-rules/dist/rules/terIndentRule.js:740:54)
    at IndentWalker.SyntaxWalker.visitNode (/home/foobar/workspace/web-ui/node_modules/tslint/lib/language/walker/syntaxWalker.js:284:22)

gitowiec avatar Apr 06 '18 12:04 gitowiec

Can you please provide some sample code that generates those errors?

jmlopez-rod avatar May 08 '18 06:05 jmlopez-rod

Getting the same errors with a sample file as simple as this:

import DummyClass from "./lambda"

/**
 * Dummy test
 */
describe("Dummy test", () => {
  it("works if true is truthy", () => {
    expect(true).toBeTruthy();
  });

  it("DummyClass is instantiable", () => {
    expect(new DummyClass()).toBeInstanceOf(DummyClass);
  });
})

hassankhan avatar Jul 10 '18 03:07 hassankhan

Upon further inspection, I've found downgrading to TSLint 5.8 seems to fix the issue for me, the issue reappears when using TSLint 5.10.

hassankhan avatar Jul 11 '18 11:07 hassankhan

I got the same error, I upgrade webpack3 to webpack4 with typescript of my vue cli project. Someone knows how to solve the problem

johnsoncheg avatar Dec 22 '18 16:12 johnsoncheg