Skip to content

Commit

Permalink
fix(create-quasar): correctly configure typescript-eslint/consistent-…
Browse files Browse the repository at this point in the history
…type-imports rule (#17760)
  • Loading branch information
Dtsiantaris authored Jan 15, 2025
1 parent 63dbc39 commit 8962133
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,23 @@ export default [
*/
...pluginVue.configs[ 'flat/essential' ],

{
files: ['**/*.ts', '**/*.vue'],
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' }
],
}
},
// https://github.com/vuejs/eslint-config-typescript
...vueTsEslintConfig({
// Optional: extend additional configurations from typescript-eslint'.
// Supports all the configurations in
// https://typescript-eslint.io/users/configs#recommended-configurations
extends: [
// By default, only the recommended rules are enabled.
'recommended'
// By default, only the 'recommendedTypeChecked' rules are enabled.
'recommendedTypeChecked'
// You can also manually enable the stylistic rules.
// "stylistic",

Expand Down Expand Up @@ -71,10 +80,6 @@ export default [
// add your custom rules here
rules: {
'prefer-promise-reject-errors': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' }
],

// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,24 @@ export default [
*/
...pluginVue.configs[ 'flat/essential' ],

// this rule needs to be above the vueTsEslintConfig to avoid error: 'You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file.'
{
files: ['**/*.ts', '**/*.vue'],
rules: {
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' }
],
}
},
// https://github.com/vuejs/eslint-config-typescript
...vueTsEslintConfig({
// Optional: extend additional configurations from typescript-eslint'.
// Supports all the configurations in
// https://typescript-eslint.io/users/configs#recommended-configurations
extends: [
// By default, only the recommended rules are enabled.
'recommended'
// By default, only the 'recommendedTypeChecked' rules are enabled.
'recommendedTypeChecked'
// You can also manually enable the stylistic rules.
// "stylistic",

Expand Down Expand Up @@ -71,10 +81,6 @@ export default [
// add your custom rules here
rules: {
'prefer-promise-reject-errors': 'off',
'@typescript-eslint/consistent-type-imports': [
'error',
{ prefer: 'type-imports' }
],

// allow debugger during development only
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
Expand Down

0 comments on commit 8962133

Please sign in to comment.