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

Error when adding to project. #5

Closed
Ionut-Milas opened this issue Nov 9, 2017 · 8 comments
Closed

Error when adding to project. #5

Ionut-Milas opened this issue Nov 9, 2017 · 8 comments

Comments

@Ionut-Milas
Copy link

I get this error:

SyntaxError: Unexpected token )

/Users/....../node_modules/eslint-plugin-jest/rules/prefer_to_have_length.js:27
            );
            ^
SyntaxError: Unexpected token )
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:545:28)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/..../node_modules/eslint-plugin-jest/index.js:6:28)
    at Module._compile (module.js:573:32)
Process finished with exit code -1

@SimenB
Copy link
Member

SimenB commented Nov 9, 2017

Oh, there's a trailing comma, there! Sorry

@SimenB SimenB closed this as completed in 527704f Nov 9, 2017
@SimenB
Copy link
Member

SimenB commented Nov 9, 2017

Fix published as 21.3.1

@thymikee
Copy link
Member

thymikee commented Nov 9, 2017

Moving fast! 🚀

@Ionut-Milas
Copy link
Author

Yes, sadly there is a new error now.

TypeError: Cannot read property 'name' of undefined
/eslint-plugin-jest/rules/prefer_to_have_length.js:20:56)

@SimenB
Copy link
Member

SimenB commented Nov 9, 2017

Interesting, do you have a repro?

@Ionut-Milas
Copy link
Author

Ionut-Milas commented Nov 9, 2017

this is what I test:

import reducer from "./reducers";
import actions from "./actions";

describe( "quack", () => {
    const quack = actions.quack( );
    const initialState = false;

    const result = reducer( initialState, quack );

    it( "should quack", () => {
        expect( result ).toBe( true );
    } );
} );

Basically a reducer that returns true.

This is the .eslintrc

{
    "extends": ["fortech"],
    "env": {
      "jest/globals": true
    },
    "plugins": [
        "fp",
        "compat",
        "jest"
    ],
    "rules": {
        // code complexity: http://www.tutorialspoint.com/software_testing_dictionary/cyclomatic_complexity.htm
        "complexity": [ 1, 4 ],
        "comma-dangle": [ 2, "never" ],
        "no-param-reassign": 1,
        "no-mixed-operators": 1,
        "no-plusplus": 1,
        "no-restricted-properties": 1,
        "no-script-url": 1,

        "react/prop-types": 1,
        "react/require-default-props": 1,
        "react/forbid-prop-types": 1,
        "react/no-unused-prop-types": 1,
        "react/no-unescaped-entities": 1,
        "react/no-array-index-key": 1,

        "jsx-a11y/no-static-element-interactions": 1,

        "import/extensions": 0,
        "import/first": 1,

        //immutable
        "fp/no-mutating-assign": [ 0 ],
        "fp/no-mutating-methods": [ 0 ],
        "fp/no-mutation": [ 0, { "exceptions": [ { "property": "propTypes" }, { "property": "prefetch" } ] } ],

        //compatibility
        "compat/compat": 1,

        // jest
        "jest/no-disabled-tests": "warn",
        "jest/no-focused-tests": "error",
        "jest/no-identical-title": "error",
        "jest/prefer-to-have-length": "warn",
        "jest/valid-expect": "error"
    }
}

@SimenB
Copy link
Member

SimenB commented Nov 9, 2017

@Ionut-Milas 21.3.2 out

@Ionut-Milas
Copy link
Author

@SimenB Works now. Thank you !!!

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

No branches or pull requests

3 participants