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
Improve prettier / eslint configuration #2909
Improve prettier / eslint configuration #2909
Conversation
@@ -2,13 +2,14 @@ module.exports = { | |||
env: { | |||
node: true, | |||
}, | |||
extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', '@vue/eslint-config-typescript', 'prettier'], | |||
extends: ['eslint:recommended', 'plugin:vue/vue3-recommended', '@vue/eslint-config-typescript', '@vue/prettier'], |
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.
prettier
does not seem to hint prettier errors in ts files in IDEs (at least IntelliJ)
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.
tried in vscode, I think this was not working either
parserOptions: { | ||
parser: '@typescript-eslint/parser', | ||
}, | ||
rules: { | ||
quotes: ['error', 'single', { avoidEscape: true }], | ||
'@typescript-eslint/no-unused-vars': ['error'], | ||
'vue/multi-word-component-names': 'off', | ||
'prettier/prettier': ['error'], |
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.
to show prettier's errors as errors in IDEs
@@ -1,3 +1,4 @@ | |||
module.exports = { | |||
'{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java,xml}': ['prettier --write'], | |||
'{,src/**/}*.{js,ts,tsx,vue}': ['eslint --fix'], |
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.
- eslint will do both lint + format (with calling prettier)
- webpack is not used
@@ -11,15 +11,5 @@ arrowParens: avoid | |||
# jsx and tsx rules: | |||
bracketSameLine: false | |||
|
|||
# search additional plugin, following prettier 2.6.0 | |||
pluginSearchDirs: |
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.
this is the default configuration, not sure this is still necessary (I checked and noticed nothing wrong, was able to format XML files)
- . | ||
|
||
# java rules: | ||
overrides: |
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.
as we only overrides with same values, not sure this is useful
package.json
Outdated
@@ -45,11 +45,11 @@ | |||
"@types/sinon": "10.0.13", | |||
"@typescript-eslint/parser": "5.32.0", | |||
"@vitejs/plugin-vue": "3.0.1", | |||
"@vue/eslint-config-prettier": "^7.0.0", |
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.
to use @vue/prettier
extension in .eslintrc.js
instead of prettier
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.
@hdurix We use normally fixed version by default
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.
good catch, changed!
@@ -36,9 +36,9 @@ public JHipsterModule buildVueModule(JHipsterModuleProperties properties) { | |||
.addDevDependency(packageName("@typescript-eslint/parser"), VUE) | |||
.addDevDependency(packageName("@vitejs/plugin-vue"), VUE) | |||
.addDevDependency(packageName("@vue/eslint-config-typescript"), VUE) | |||
.addDevDependency(packageName("@vue/eslint-config-prettier"), VUE) |
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.
same changes for generated apps
Codecov Report
@@ Coverage Diff @@
## main #2909 +/- ##
============================================
Coverage 100.00% 100.00%
+ Complexity 2078 2004 -74
============================================
Files 482 475 -7
Lines 8215 8046 -169
Branches 164 156 -8
============================================
- Hits 8215 8046 -169
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -17,10 +17,10 @@ | |||
"@types/sinon": "10.0.13", | |||
"@typescript-eslint/parser": "5.32.0", | |||
"@vitejs/plugin-vue": "3.0.1", | |||
"@vue/eslint-config-prettier": "^7.0.0", |
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.
@hdurix We use normally fixed version by default
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.
changed in latest version
Thanks @hdurix : just need to check if there is no conflict between the eslint config and prettier config Plz can you use the fixed version and we could merge it |
Fix #2908