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

feat: generate lint on new project and run lint on update project #149

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mtperesvx
Copy link
Contributor

No description provided.

@mtperesvx
Copy link
Contributor Author

@dalssoft can you check this PR please?

@jhomarolo
Copy link
Contributor

@mtperesvx I think the idea here is to add several lints with one as the default, not just add 1, right?

@dalssoft
Copy link
Member

actually we should run the lint (1) standard and (2) always (new and update) without asking. the only option should be deactivate it.

@mtperesvx
Copy link
Contributor Author

mtperesvx commented Jul 28, 2022

@dalssoft so do these changes cover the requirements, right?

In this PR:

  • Added .eslintrc.ejs file (StandardJS only)
  • Added Eslint dependencies
  • Added function to run lint on Herbs Update
  • Added function to run lint on Herbs new

@@ -136,6 +142,7 @@ const cmd = {

if (npmOptions.npmInstall === 'Yeah, please' || npmOptions.npmInstall === 'yes') {
await exec('npm install')
await exec('npx eslint \"**/*.{js,jsx}\" --fix')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we run it without an eslint file configured, it will ask to install it.
so, if I said before (line 69) that i don't want to use eslint on my project and it(npx eslint) installs the eslint when I generate the project, we will provide a bad DX for programmer

We need to run it only if the project use eslint (when generated or after it)

@@ -6,6 +6,7 @@ const cmd = {
alias: ['u'],
run: async toolbox => {
const generators = (await generator(toolbox)).update
await exec('npx eslint \"**/*.{js,jsx}\" --fix')
Copy link
Member

@italojs italojs Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to check if exists an eslint file, if we run it without an eslint file, the npx eslit will ask to install and configure it.
it could generate a bad DX for the programmer
Screen Shot 2022-08-01 at 22 07 44

@@ -7,6 +7,7 @@ const optionalPackages = {
mysql: ['"@herbsjs/herbs2knex": "^1.5.2"', '"mysql2": "^2.3.3"'],
rest: ['"express": "^4.18.1"', '"cors": "^2.8.5"', '"@herbsjs/herbs2rest": "^3.0.1"'],
graphql: ['"graphql": "^16.5.0"', '"@herbsjs/herbs2gql": "^2.2.0"', '"apollo-server": "^3.8.2"','"apollo-server-express": "^3.8.2"', '"graphql-tools": "^8.2.12"', '"graphql-scalars": "^1.17.0"',]
eslint: ['"eslint": "^8.20.0"', '"eslint-config-standard": "^17.0.0"', '"eslint-plugin-import": "^2.26.0","eslint-plugin-n": "^15.2.4"','"eslint-plugin-promise": "^6.0.0"']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't generate code using import, are you sure we need the eslint-plugin-import pkg?

env: {
es2021: true,
node: true
},
Copy link
Member

@italojs italojs Aug 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just call the npx eslint after creating the project? so the developer could use the eslint CLI to generate it as they need/want to, we don't need to generate/manage it, just pass this job for eslint CLI
Screen Shot 2022-08-01 at 22 07 44

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to keep the lint --fix command as the responsibility of the herbs update command in this case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the lint, so we will warn the developer about the problems, run the lint --fix could be so much invasive for the developer, for some reason they may want to maintain the code with the "lint problems"

@@ -136,6 +142,7 @@ const cmd = {

if (npmOptions.npmInstall === 'Yeah, please' || npmOptions.npmInstall === 'yes') {
await exec('npm install')
await exec('npx eslint \"**/*.{js,jsx}\" --fix')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since herbs update will run the lint command, this line is not necessary for when the user chooses Yeap. However, it is necessary when the user chooses No.

@italojs
Copy link
Member

italojs commented Nov 16, 2022

Is this PR still active?

@dalssoft
Copy link
Member

dalssoft commented Dec 3, 2022

@mtperesvx are you still working on it?

@matnperes
Copy link

@dalssoft Yes, I will go back to work on it.

@jhomarolo
Copy link
Contributor

@matnperes your PR is under conflict

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

Successfully merging this pull request may close these issues.

5 participants