Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Error when typeCheck is true #18

Open
samwx opened this issue Jan 9, 2019 · 2 comments
Open

Error when typeCheck is true #18

samwx opened this issue Jan 9, 2019 · 2 comments

Comments

@samwx
Copy link

samwx commented Jan 9, 2019

Hi everyone!

I'm getting this error when I set the typeCheck property as true.

undefined:1
Error at app\modules\application\detail\templates\master\applicationItem\ApplicationItemController.ts:50:14: An expression of type 'void' cannot be tested for truthiness
^
SyntaxError: Unexpected token E in JSON at position 0
    at JSON.parse (<anonymous>)
    at Socket.linterProcess.stdout.on (D:\projects\BlipPortal\src\node_modules\tslint-webpack-plugin\src\plugin.js:50:39)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:597:20)

When I run npm start, I get this error and the webpack process is terminated.

I have the following in webpack.config.js:

new TSLintPlugin({
    files: ['./app/**/*.ts'],
    config: './tslint.json',
    project: './tsconfig.json',
    format: 'json',
    typeCheck: true,
}),

And my tslint.json is:

{
    "linterOptions": {
        "exclude": [
            "node_modules",
            "**/*.d.ts"
        ],
        "format": "json"
    },
    "defaultSeverity": "error",
    "rules": {
        "class-name": true,
        "comment-format": [true],
        "curly": true,
        "eofline": true,
        "forin": true,
        "indent": [true, "spaces"],
        "label-position": true,
        "member-access": false,
        "member-ordering": [
            true,
            {
                "order": ["static-field", "instance-field", "constructor"],
                "alphabetize": false
            }
        ],
        "no-arg": true,
        "no-bitwise": false,
        "no-console": false,
        "no-construct": true,
        "no-consecutive-blank-lines": true,
        "no-debugger": true,
        "no-duplicate-variable": true,
        "no-empty": false,
        "no-eval": false,
        "no-inferrable-types": false,
        "no-shadowed-variable": false,
        "no-string-literal": true,
        "no-switch-case-fall-through": true,
        "no-trailing-whitespace": true,
        "no-unused-expression": [true, "allow-fast-null-checks"],
        "no-use-before-declare": false,
        "no-var-keyword": true,
        "no-empty-interface": true,
        "no-var-requires": true,
        "no-null-keyword": true,
        "no-default-export": false,
        "no-require-imports": false,
        "no-unnecessary-callback-wrapper": true,
        "prefer-conditional-expression": false,
        "arrow-return-shorthand": true,
        "prefer-object-spread": true,
        "use-isnan": true,
        "only-arrow-functions": true,
        "promise-function-async": false,
        "object-literal-sort-keys": false,
        "newline-before-return": false,
        "import-spacing": true,
        "new-parens": true,
        "one-line": [
            true,
            "check-open-brace",
            "check-whitespace",
            "check-else",
            "check-finally",
            "check-catch"
        ],
        "quotemark": [true, "single", "avoid-escape", "avoid-template"],
        "radix": false,
        "semicolon": [true, "always"],
        "typedef-whitespace": [
            true,
            {
                "call-signature": "nospace",
                "index-signature": "nospace",
                "parameter": "nospace",
                "property-declaration": "nospace",
                "variable-declaration": "nospace"
            }
        ],
        "variable-name": [
            true,
            "ban-keywords",
            "check-format",
            "allow-leading-underscore",
            "allow-trailing-underscore",
            "allow-pascal-case"
        ],
        "whitespace": [
            true,
            "check-branch",
            "check-decl",
            "check-operator",
            "check-separator",
            "check-type"
        ],
        "space-before-function-paren": [
            true,
            {
                "asyncArrow": "always",
                "named": "never",
                "anonymous": "never",
                "method": "never",
                "constructor": "never"
            }
        ]
    }
}

Has anyone had this problem?

@samwx
Copy link
Author

samwx commented Jan 9, 2019

I also have the follow dependencies:

{
    "tslint-webpack-plugin": "^2.0.1",
    "typescript": "3.2.2",
    "typescript-tslint-plugin": "^0.2.1",
    "tslint": "5.12.0"
}

@jrparish
Copy link
Owner

Looks like it has something to do with the project and/or config properties. Can you try removing them and seeing if that works?

I'll have to look closer into why it doesn't like custom config locations.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants