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

8.2.0 -> 9.0.0 null lint rule errors #526

Closed
pashariger opened this issue Feb 20, 2016 · 7 comments
Closed

8.2.0 -> 9.0.0 null lint rule errors #526

pashariger opened this issue Feb 20, 2016 · 7 comments
Labels
non issue Issue is not a problem or requires changes

Comments

@pashariger
Copy link

After upgrading lab to latest version, all of my lab-linted files throw the following error:

Line 3: null - Parsing error: The keyword 'const' is reserved

Tried to clear and reinstall npms, same behavior. Running default lab linter. Seems like the upgrade of the eslint-config-hapi package to 9.1.0 and eslint to 2.0 has something to do with it. Reverting to lab@8.2.0 worked.

@cjihrig
Copy link
Contributor

cjihrig commented Feb 20, 2016

I just verified that the new linting works with hapi, lab, code, pez, catbox-memory, and poop. There is a chance that something in the upgrade to eslint@2.x.x broke you. Can you provide a minimal reproducible example?

@pashariger
Copy link
Author

Yep. https://github.com/pashariger/lab-eslint-test
The culprit here seems to be the presence of the .eslintrc file. (actually starting with v8.4.0)

Side note:

My actual project contains the eslint-config-airbnb npm and extends it in .eslintrc like so:

{
    "extends": "airbnb",
    "rules": {
        "semi": [2, "never"],
        "strict": [0, "global"],
        "indent": [2, 2, {"SwitchCase": 1}],
        "curly": [2, "multi-line"],
        "space-before-function-paren": [2, "never"],
        "comma-dangle": 0,
        "no-console": 0,
        "max-len": [2, 120, 4],
    }
}

In 8.2.0 this properly applied the linting. Is that still the expected behavior in 9.x.x or will I need to use the new option: --linter?

@cjihrig
Copy link
Contributor

cjihrig commented Feb 20, 2016

I can't reproduce with your example. I cloned your repo, bumped the lab dependency to 9.x.x, npm installed and ran npm test:

$ npm test

> test-lab@1.0.0 test /private/tmp/lab-eslint-test
> NODE_ENV=test node node_modules/lab/bin/lab --verbose --lint --colors --debug --timeout 10000 --coverage --threshold 88



0 tests complete
Test duration: 1 ms
No global variable leaks detected
Coverage: 0.00% (0/0)
Code coverage below threshold: 0.00 < 88
Linting results:
    /private/tmp/lab-eslint-test/app.js:
        Line 3: no-unused-vars - 'fs' is defined but never used
npm ERR! Test failed.  See above for more details.

Next, I added the line module.exports = fs to your app.js to fix the linting problem. Ran npm test again:

$ npm test

> test-lab@1.0.0 test /private/tmp/lab-eslint-test
> NODE_ENV=test node node_modules/lab/bin/lab --verbose --lint --colors --debug --timeout 10000 --coverage --threshold 88



0 tests complete
Test duration: 0 ms
No global variable leaks detected
Coverage: 0.00% (0/0)
Code coverage below threshold: 0.00 < 88
Linting results: No issues

npm ERR! Test failed.  See above for more details.

@pashariger
Copy link
Author

Interesting. Must be due to something in my environment, since I get the following via those steps:

$ npm test

> test-lab@1.0.0 test /Users/pasha/apps/lab-eslint-test
> NODE_ENV=test node node_modules/lab/bin/lab --verbose --lint --colors --debug --timeout 10000 --coverage --threshold 88



0 tests complete
Test duration: 0 ms
No global variable leaks detected
Coverage: 0.00% (0/0)
Code coverage below threshold: 0.00 < 88
Linting results:
    /Users/pasha/apps/lab-eslint-test/app.js:
        Line 3: null - Parsing error: The keyword 'const' is reserved
npm ERR! Test failed.  See above for more details.

Will try to replicate with other developers on my project and check back in.

@gergoerdosi
Copy link
Contributor

I can reproduce it with your test code. It happens because you overwrite the default configuration in .eslintrc. If you do that, you need to enable ES6 manually:

{
  "env": {
    "node": true,
    "es6": true
  },
  "rules": {
    "semi": [2, "never"],
    "strict": [0, "global"],
    "indent": [2, 2, {"SwitchCase": 1}],
    "curly": [2, "multi-line"],
    "space-before-function-paren": [2, "never"],
    "comma-dangle": 0,
    "no-console": 0,
    "max-len": [2, 120, 4]
  }
}

@pashariger
Copy link
Author

Ah, that solves it. Thanks @gergoerdosi. Thanks @cjihrig, I'll let you close in case you want to add a note for this in the docs, or investigate why you couldn't reproduce. Cheers.

@geek geek added the non issue Issue is not a problem or requires changes label Feb 22, 2016
@geek geek closed this as completed Feb 22, 2016
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

4 participants