Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

needed modules to run lint #14

Merged
merged 2 commits into from Apr 14, 2019
Merged

needed modules to run lint #14

merged 2 commits into from Apr 14, 2019

Conversation

gluneau
Copy link
Contributor

@gluneau gluneau commented Apr 13, 2019

To run lint below, I needed to install all these modules.
./node_modules/eslint/bin/eslint.js --fix --ext .js .

Here is the end of the report for reference:

/home/gluneau/GitHub/kure/server/server.js
  10:9   error  'combine' is assigned a value but never used    no-unused-vars
  10:18  error  'timestamp' is assigned a value but never used  no-unused-vars
  10:29  error  'label' is assigned a value but never used      no-unused-vars
  10:36  error  'printf' is assigned a value but never used     no-unused-vars
  10:44  error  'json' is assigned a value but never used       no-unused-vars
  83:2   error  Unexpected console statement                    no-console
  95:15  error  'req' is defined but never used                 no-unused-vars
  95:20  error  'res' is defined but never used                 no-unused-vars

✖ 310 problems (310 errors, 0 warnings)

@gluneau
Copy link
Contributor Author

gluneau commented Apr 13, 2019

You can checkout my branch and run npm i

Then try running this lint command:
./node_modules/eslint/bin/eslint.js --fix --ext .js .

All of the 310 messages will show up.
Lint is not necessarily about getting code running (although it will help), it's about keeping code clean and to standard.

I'll add a npm run command to help.
So that you only need to do npm run lint to make sure you're code is up to standards before committing it to the repo.

@KrNel
Copy link
Owner

KrNel commented Apr 14, 2019

Thanks fr the tips.

I added some of the packages and a run command on my side, and got (after I deleted the unused vars from winston):

C:\node-projects\kure\kure>npm run lint

> kure@0.1.0 lint C:\node-projects\kure\kure
> eslint ./server


C:\node-projects\kure\kure\server\routes\api\auth\auth.js
  44:21  error  Unexpected console statement        no-console
  57:27  error  'result' is defined but never used  no-unused-vars

C:\node-projects\kure\kure\server\routes\api\groups.js
  111:9  error  'listlimit' is assigned a value but never used  no-unused-vars

? 3 problems (3 errors, 0 warnings)

(node:8948) [ESLINT_LEGACY_ECMAFEATURES] DeprecationWarning: The 'ecmaFeatures'
config file property is deprecated, and has no effect. (found in ".eslintrc.json

This is for the server side only, which doesn't use react.

On the client React side, I got 116.

116 problems (116 errors, 0 warnings)

I'll clean things up. Thanks for the help. Then I'll see about merging this PR. I'll check out your branch to see where the 300 errors are coming from...

@KrNel
Copy link
Owner

KrNel commented Apr 14, 2019

I got the same on your side, with eslint for server (11 errors because of the unused vars) and for client/src (113 errors). I don't see where the 300+ are from. I can't run your eslint command on Windows, but this works for npm run lint: "lint": "eslint ./server",, "lint": "eslint ./src"

In the future if you run lint, use the setup I will include in the next PR (indicated above) which is run from the root for server, and from client for src.

Can you tell me where the other close to 200 errors are? Or what they are related to? In my setup for airbnb on the server, and airbnb with react on the client, I get the errors I have indicated. Thanks.

@KrNel KrNel merged commit d700000 into KrNel:master Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants