@BarabanObivan

Не форматирует код eslint?

Всем привет. В проекте использую Vite + Vue3 + TypeScript

решил настроить eslint

module.exports = {
  root: true,
  parser: 'vue-eslint-parser',
  parserOptions: {
    ecmaVersion: 'latest',
    parser: '@typescript-eslint/parser',
    sourceType: 'module',
  },
  plugins: ['@typescript-eslint'],
  extends: [
    'plugin:@typescript-eslint/recommended',
    'plugin:prettier/recommended',
  ],
  rules: {
    'vue/html-self-closing': 'off',
    'import/extensions': 'off',
    'no-explicit-any': 'off',
    '@typescript-eslint/no-explicit-any': 'off',
    quotes: ['error', 'single', { avoidEscape: true }],
    semi: ['error', 'always'],
    'no-unused-expressions': [
      'error',
      {
        allowShortCircuit: true,
        allowTernary: true,
      },
    ],
    'no-use-before-define': ['error', { functions: false }],
    'no-underscore-dangle': [0, { allowAfterThis: false }],
    'prefer-destructuring': [
      'error',
      {
        object: true,
        array: false,
      },
    ],
    'no-useless-constructor': 'off',
    'prefer-rest-params': 'off',
    'no-plusplus': 'off',
    'no-param-reassign': 'off',
    'no-new': 'off',
    'import/no-unresolved': 'off',
    'import/no-extraneous-dependencies': 'off',
    'import/prefer-default-export': 'off',
    'class-methods-use-this': 'off',
    'global-require': 'off',
    'consistent-return': 'off',
    'guard-for-in': 'off',
    'no-restricted-syntax': 'off',
    'no-unused-vars': [
      'error',
      {
        vars: 'all',
        args: 'after-used',
        ignoreRestSiblings: false,
      },
    ],
    'no-continue': 'off',
    'linebreak-style': 'off',
    'arrow-parens': 'off',
    curly: 'error',
    'object-curly-newline': 'off',
    'no-mixed-operators': 'off',
    'arrow-body-style': 'off',
    'function-paren-newline': 'off',
    'space-before-function-paren': 0,
    'max-len': [
      'error',
      120,
      2,
      {
        ignoreUrls: true,
        ignoreStrings: true,
      },
    ],
    'no-alert': 'error',
    radix: 'off',
    'no-undef': 'off',
    'one-var': 'off',
    'one-var-declaration-per-line': 'off',
    'newline-after-var': ['off', 'never'],
    'no-prototype-builtins': 'off',
    'no-nested-ternary': 'off',
    'default-case': 'off',
    'func-names': 0,
    'vue/require-default-prop': ['off'],
    'vue/no-v-html': 'off',
    'vue/this-in-template': 'off',
    'vue/component-tags-order': 'off',
    'vue/component-definition-name-casing': 'off',
    'lines-between-class-members': [
      'error',
      'always',
      { exceptAfterSingleLine: true },
    ],
  },
};

но теперь он ругается на

9:1  error  This line has a length of 151. Maximum allowed is 120  max-len

но не фиксит эти проблемы при сохранении
  • Вопрос задан
  • 219 просмотров
Пригласить эксперта
Ответы на вопрос 1
Fragster
@Fragster
помогло? отметь решением!
Придется понажимать кнопки самому
s6rATkV.png
https://eslint.org/docs/latest/rules/
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы