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

npm run lint throws an error #136

Closed
avxkim opened this issue Sep 30, 2019 · 14 comments
Closed

npm run lint throws an error #136

avxkim opened this issue Sep 30, 2019 · 14 comments

Comments

@avxkim
Copy link

avxkim commented Sep 30, 2019

Describe the bug
Added eslint typescript config, as per guide: https://typescript.nuxtjs.org/guide/lint.html
But now, when i run npm run lint i'm getting the following error:

 1 error and 0 warnings potentially fixable with the `--fix` option.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: `eslint --ext .ts,.js,.vue .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

To Reproduce
Steps to reproduce the behavior:
All the steps i did, is from this guide: https://typescript.nuxtjs.org/guide/lint.html

Expected behavior
It shouldn't throw ELIFECYCLE error

Additional context
Created project using npx create-nuxt-app <project-name> command.

@kevinmarrec
Copy link
Contributor

Seems you don't have eslint installed, it may not be clear in the documentation as it assumes you have eslint installed only if you were using @nuxtjs/eslint-config

@kevinmarrec
Copy link
Contributor

If it's not this problem, please a provide a repository of your current project, so I can quickly see where is the problem.

@avxkim
Copy link
Author

avxkim commented Oct 1, 2019

@kevinmarrec eslint is actually installed. Here's the repo: https://gitlab.com/heihachi88/webcoder

@kevinmarrec
Copy link
Contributor

kevinmarrec commented Oct 1, 2019

@webcoderkz You need to remove https://gitlab.com/heihachi88/webcoder/blob/master/.eslintrc.js#L7
I need to tell it in documentation cause it's not trivial but : @nuxtjs/eslint-config-typescript set a TypeScript parser which is different from babel-eslint. If babel-eslint is kept here it overrides the TypeScript one, leading to bugs 😁. I guess you can in the same way remove https://gitlab.com/heihachi88/webcoder/blob/master/package.json#L23

@kevinmarrec
Copy link
Contributor

You may also need to remove https://gitlab.com/heihachi88/webcoder/blob/master/package.json#L22

And you can safely remove https://gitlab.com/heihachi88/webcoder/blob/master/package.json#L20 cause it's shipped by @nuxtjs/eslint-config-typescript

@avxkim
Copy link
Author

avxkim commented Oct 1, 2019

Thank, would try it now.

@avxkim
Copy link
Author

avxkim commented Oct 1, 2019

I've removed all the references you mentioned above, and now when i run npm run dev, i get the following error:

 ✖ Nuxt Fatal Error                                                                │
   │                                                                                     │
   │   Error: Cannot find module '@nuxtjs/eslint-module'                                 │
   │   Require stack:                                                                    │
   │   - /Users/username/Sites/webcoder/node_modules/@nuxt/core/dist/core.js         │
   │   - /Users/username/Sites/webcoder/node_modules/@nuxt/cli/dist/cli-command.js   │
   │   - /Users/username/Sites/webcoder/node_modules/@nuxt/cli/dist/cli.js           │
   │   - /Users/username/Sites/webcoder/node_modules/nuxt/bin/nuxt.js  

Tried to remove this module @nuxtjs/eslint-module but it throws the following error:

TypeError: Module should export a function: @nuxtjs/eslint-config-typescript  

@kevinmarrec
Copy link
Contributor

Commit and push your changes I'll take a look

@avxkim
Copy link
Author

avxkim commented Oct 1, 2019

Pushed rn.

@avxkim
Copy link
Author

avxkim commented Oct 1, 2019

@kevinmarrec did you watch my repo?

@avxkim
Copy link
Author

avxkim commented Oct 2, 2019

Seems like eslint typescript:

✖ 3 problems (3 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] lint: `eslint --ext .ts,.js,.vue .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

By throwing these errors works as intended, because if i have no errors it finishes OK. Could you update documentation: https://typescript.nuxtjs.org/guide/lint.html

With the information regards removing:

parserOptions: {
  parser: 'babel-eslint'
},

@kevinmarrec
Copy link
Contributor

@webcoderkz So you don't have issue anymore ? I'm gonna update docs right now

@kevinmarrec
Copy link
Contributor

It's now live : https://typescript.nuxtjs.org/guide/lint.html

@avxkim
Copy link
Author

avxkim commented Oct 3, 2019

@kevinmarrec yeah, seems like it's working as intended. Thanks.

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

2 participants