web-dev-qa-db-fra.com

Les retraits plus jolis et effilés ne fonctionnent pas ensemble

Je configure mon environnement de développement TypeScript basé sur vim, mais j'ai un problème avec la gestion des retraits.

enter image description here

Probablement 'eslint' dit: indent: Expected indentation of 2 spaces but found 4. après prettier reformater.

Ma .eslintrc.js:

module.exports = { 
  parser: '@TypeScript-eslint/parser', // Specifies the ESLint parser
  extends: [ 
    'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
    'plugin:@TypeScript-eslint/recommended', // Uses the recommended rules from @TypeScript-eslint/eslint-plugin
    'prettier/@TypeScript-eslint',
    'plugin:prettier/recommended',
  ],
  parserOptions: { 
    ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
    sourceType: 'module', // Allows for the use of imports
    ecmaFeatures: { 
      jsx: true, // Allows for the parsing of JSX
      tsx: true, // Allows for the parsing of TSX ???
    },
  },
  rules: { 
    indent: ['error', 2],
    quotes: ['error', 'single'],
    semi: ['error', 'never'],
    'sort-keys': ['error', 'asc', { caseSensitive: true, natural: false }],
  },
}

Ma .prettierc:

 module.exports = { 
  semi: false,
  trailingComma: 'all',
  singleQuote: true,
  printWidth: 80, 
  tabWidth: 2,
};
5
Edgaras Karka

Cela devrait le corriger https://github.com/prettier/eslint-config-prettier

Il désactive les règles en eslint qui entrent en conflit avec plus joli

1
Sam Banks