question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Show eslint warnings/errors in vscode?

See original GitHub issue

Plugin version

5.0.3

ESLint version

8.6.0

Node.js version

16.13.2

npm/yarn version

yarn 1.22.17

Operating system

macOS Monterey 12.2.1

Bug description

I have this plugin installed and configured. I would expect to see warnings in my test files in vscode, but don’t. I do see them when I run them on the command line.

Steps to reproduce

install https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint into vscode.

set up a basic eslint config, and write a test. I am able to see the errors when run in the command line, but not in vscode.

Error output/screenshots

No response

ESLint configuration

const fs = require('fs');
const path = require('path');

const schemaString = fs.readFileSync(
  path.resolve(__dirname, '../server/dist/schema.graphqls'),
  'utf8'
);

module.exports = {
  extends: ['@tock'],
  root: true,
  plugins: ['testing-library', 'jest-dom'],
  rules: {
    'graphql/template-strings': ['error', { env: 'apollo', schemaString }],
    'jsx-a11y/no-static-element-interactions': 'off',
    'jsx-a11y/tabindex-no-positive': 'off',
    'jsx-a11y/no-autofocus': 'off',
    'jsx-a11y/label-has-associated-control': 'off',
    'jsx-a11y/anchor-is-valid': 'off',
    'no-restricted-imports': [
      'warn',
      {
        paths: [
          {
            name: '@material-ui/core',
            importNames: [
              'Button',
              'Dialog',
              'DialogActions',
              'DialogContent',
              'DialogTitle',
              'Divider',
              'Drawer',
              'Grid',
              'Tooltip',
              'Typography',
              'makeStyles',
              'Theme',
              'createStyles',
              'WithStyles',
              'withStyles',
            ],
            message:
              "Please import from from 'ui' instead. For styles and theme related imports, import from from '@material-ui/core/styles' instead.",
          },
          {
            // These are fine to import in a local branch, but not meant to be merged into master.
            name: 'shared/utils/devUtils',
          },
        ],
      },
    ],
  },
  overrides: [
    {
      files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
      extends: ['plugin:testing-library/react', 'plugin:jest-dom/recommended'],
      rules: {
        'testing-library/no-node-access': 'off',
      },
    },
  ],
};

Rule(s) affected

all are affected in vscode but not in command line.

Anything else?

here’s the command that will show errors/warnings for tests:

npx eslint --cache --cache-location ./.eslint-cache -c .eslintrc.js --no-eslintrc --max-warnings 0 'src/*/js/**/*.{ts,tsx}' '../shared/src/js/**/*.{ts,tsx}' 'test/client/js/**/*.{ts,tsx}'

Do you want to submit a pull request to fix this bug?

No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kelly-tockcommented, Mar 3, 2022

yeah, I have what I consider a workaround. my guess is the plugin is taking only the one in that directory that it finds.

0reactions
Belco90commented, Mar 3, 2022

Yeah, I understand your use case. Just wanted to see if we could spot something else by extending the plugin outside the overrides section.

Oh, I see. If you have another ESLint config file that can take more priority than the overrides property from the main config file (I don’t remember the exact order for this right now). You need to stick to just one of those 2 ways then: or enabling eslint-plugin-testing-library in the overrides of the main one and removing the test config one, or remove eslint-plugin-testing-library from the main config file and enable it in the test config file.

Is it 100% solved then?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Show all warnings and errors in visual studio code
First the task run on the terminal! ... You can see a detailed report! You can use the click link on terminal feature...
Read more >
How to use ESLint in VSCode - Robin Wieruch
Try it yourself by violation an ESLint rule, validating that you see the warning/error in VSCode, and checking whether VS Code is able...
Read more >
How To Lint and Format Code with ESLint in Visual Studio Code
You can use a linter to do this. Linters check your code for syntax errors and highlight errors to make sure you can...
Read more >
Errors and warnings not highlighted in the code (JS, ESLint)
Open VSCode (stable or insiders); Write something wrong ... Since the last update errors and warnings are no longer being highlighted in the...
Read more >
[2022]How to show Typescript error with ESLint and VScode.
ESLint is a very powerful and useful tool that notifies you of errors and other problems as you are editing code. However, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found