-
Notifications
You must be signed in to change notification settings - Fork 30
feat: generate lint on new project and run lint on update project #149
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,6 +66,12 @@ const questions = [ | |
| return val.toLowerCase() | ||
| }, | ||
| }, | ||
| { | ||
| type: 'confirm', | ||
| name: 'ESlint', | ||
| message: 'Do you want to initialize a ESlint on this project', | ||
| default: true, | ||
| }, | ||
| { | ||
| type: 'confirm', | ||
| name: 'git', | ||
|
|
@@ -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') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since |
||
| await exec('herbs update') | ||
| } | ||
| await checkNewVersion() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ const cmd = { | |
| alias: ['u'], | ||
| run: async toolbox => { | ||
| const generators = (await generator(toolbox)).update | ||
| await exec('npx eslint \"**/*.{js,jsx}\" --fix') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| for (const layer of Object.keys(generators)) { await generators[layer]() } | ||
| toolbox.print.success('Project updated! 🤩') | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"'] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't generate code using |
||
| } | ||
|
|
||
| const defaultOptions = (options) => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| module.exports = { | ||
| env: { | ||
| es2021: true, | ||
| node: true | ||
| }, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to keep the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only the |
||
| extends: [ | ||
| 'standard' | ||
| ], | ||
| parserOptions: { | ||
| ecmaVersion: 'latest', | ||
| sourceType: 'module' | ||
| }, | ||
| rules: { | ||
| } | ||
| } | ||


There was a problem hiding this comment.
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)