eslint некоторые правила не отображаются в редакторе, но отображаются на консоли - PullRequest
1 голос
/ 06 августа 2020

Я использую eslint с @typescript-eslint, и его рабочие ошибки отображаются в редакторе, как и ожидалось, но конкретное c правило @typescript-eslint/consistent-type-assertions отображается только на консоли, но не в редакторе.

Расширение eslint настроено, отображаются ошибки редактора: enter image description here

But for some reason this specific rule don't show on editor: enter image description here

What kind of config I need to add to allow editor error for this (and maybe other rules) that don't work?

EDIT: .eslintrc.js

module.exports = {
  env: {
    browser: true,
    es6: true,
    jest: true,
  },
  extends: [
    'react-app',
    'airbnb',
    'plugin:@typescript-eslint/recommended',
  ],
  globals: {
    Atomics: 'readonly',
    SharedArrayBuffer: 'readonly',
  },
  parserOptions: {
    ecmaFeatures: {
      jsx: true,
    },
    ecmaVersion: 2018,
    sourceType: 'module',
  },
  plugins: ['react', 'import', 'jsx-a11y', 'es'],
  rules: {
    'semi': 'off',
    'multiline-ternary': ['error', 'never'],

    'react/jsx-filename-extension': ['error',
      { extensions: ['.tsx'] },
    ],

    'import/prefer-default-export': 'off',
    'import/no-namespace': ['error'],
    'import/no-dynamic-require': ['error'],
    'import/no-extraneous-dependencies': ['error', { packageDir: './' }],
    'import/extensions': ['error', {
      ts: 'never',
      tsx: 'never',
    }],

    'es/no-destructuring': 'error',
    
    '@typescript-eslint/explicit-member-accessibility': 'off',
    '@typescript-eslint/explicit-function-return-type': 'off',
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/semi': 'error',
    '@typescript-eslint/member-delimiter-style': ['error', {
      multiline: {
        delimiter: 'semi',
        requireLast: true,
      },
      singleline: {
        delimiter: 'semi',
        requireLast: true,
      },
    }],

  },
  settings: {
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx'],
    },
    'import/resolver': {
      typescript: {},
    },
  },
};

настройки. json

  ...
  "eslint.validate": [
    "javascript",
    "javascriptreact",
  ],
  ...
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...