Vscode-eslint: "ESLint is not running. By default only TypeScript and JavaScript files are validated."

Created on 26 Oct 2020  路  7Comments  路  Source: microsoft/vscode-eslint

Symptoms

  • Eslint works fine in other projects, but in this one project, nothing happens.
  • When trying to use the "Eslint: Show Output Channel" command, it says (even if js files are open):
    > ESLint is not running. By default only TypeScript and JavaScript files are validated.
  • The "Manage Library Execution" command yields the same.
  • I do not see any eslint-related buttons in my status bar either.
  • When looking for it manually, there is no Eslint Output channel.

These are the commands I see. Notice that there is no way to manually start/stop eslint anymore (used to be able to do that in the past):
image

What could this possibly be?

needs more info

Most helpful comment

Well, now I feel kind of stupid, for whatever reason, a file named setting.json was created in my repository .vscode folder. In this file the following configuration was added.

image

Guess what happened when i changed this to true?....

Maybe @Domiii is having the same issue? :)

All 7 comments

@Domiii can you please provide me with a GitHub repository I can clone that demos what you are experiencing.

Same problem here, i have a few repositories and one of them in particular has this problem since today. I don't have a way of providing a repository but i'm glad to help in any other way. I have already tried to re-install all traces of eslint out of my computer and even re-install vscode.

I have changed my .eslintrc completely with just a basic configuration.

image

Well, now I feel kind of stupid, for whatever reason, a file named setting.json was created in my repository .vscode folder. In this file the following configuration was added.

image

Guess what happened when i changed this to true?....

Maybe @Domiii is having the same issue? :)

Ha! The same thing happened to me. But I don't remember setting that value to off 馃
Would be possible to tweak the message? As messing up with eslint.probe has nothing to do with it

Aha!

Problem was that my settings.json has no eslint.enable in it at all!
Adding eslint.enable: true fixes it.

It is an option that has now been deprecated, but since it defaults to false, omiting it still disables all of eslint.

The fix would be for the developers to set the default to true, and as long as it does not happen, use the manual override as a workaround.

Oh... you just fixed it - thanks, @dbaeumer! :)

I'm having the same problem. All of a sudden now when I CMD+Shift+P and try and find >eslint: enable it doesn't show up. And when I click >eslint: show output channel I get the message:

ESLint is not running. By default only TypeScript and JavaScript files are validated. If you want to validate other file types please specify them in the 'eslint.probe' setting.

It's like it doesn't realize that the file is a Javascript file?

Here's my .eslintrc.js:

'use strict';

module.exports = {
  extends: [
    'airbnb-base',
    'plugin:import/errors',
    'plugin:import/warnings',
    'plugin:react/recommended',
  ],
  parserOptions: {
    ecmaVersion: 2018,
    sourceType: 'script',
  },
  plugins: ['mocha', 'chai-friendly', 'testcafe', 'react'],
  settings: {
    react: {
      version: '16.7',
    },
  },
  rules: {
    'mocha/handle-done-callback': 'error',
    'mocha/no-exclusive-tests': 'error',
    'mocha/no-global-tests': 'error',
    'mocha/no-identical-title': 'error',
    'mocha/no-nested-tests': 'error',
    'mocha/no-pending-tests': 'error',
    'mocha/no-skipped-tests': 'warn',
    'mocha/no-return-and-callback': 'error',
    'mocha/no-sibling-hooks': 'error',

    'array-bracket-spacing': 'off',
    'object-curly-spacing': 'off',
    'object-curly-newline': [
      'error',
      {
        ObjectExpression: {
          multiline: true,
          consistent: true,
        },
        ObjectPattern: {
          multiline: true,
          consistent: true,
        },
      },
    ],
    'no-console': 'error',
    'no-param-reassign': 'off',
    'no-confusing-arrow': 'off',
    'no-mixed-operators': 'off',
    'no-useless-call': 'error',
    'callback-return': 'error',
    'handle-callback-err': 'error',
    'prefer-destructuring': ['error', { object: true, array: false }],
    'no-underscore-dangle': 'off',
    'max-len': [
      'error',
      {
        code: 100,
        ignoreUrls: true,
        ignoreStrings: true,
        ignoreTemplateLiterals: true,
        ignoreRegExpLiterals: true,
      },
    ],
    camelcase: 'warn',
    'no-magic-numbers': [
      'off',
      {
        ignore: [-1, 0, 1],
      },
    ],
    strict: ['error', 'global'],
    'arrow-parens': ['error', 'always'],
    'function-paren-newline': 'off',
    'no-plusplus': 'off',
    'no-process-env': 'error',
    'no-process-exit': 'error',
    'capitalized-comments': 'error',
    'max-depth': ['error', 3],
    'max-nested-callbacks': ['error', 5],
    'max-params': ['error', 5],
    'comma-dangle': 'off',
    'chai-friendly/no-unused-expressions': 'error',
    'no-unused-expressions': 'off',
    'func-names': ['error', 'as-needed'],
    'implicit-arrow-linebreak': 'off',
    'no-warning-comments': 'warn',
    'operator-linebreak': [
      'error',
      'before',
      {
        overrides: {
          '=': 'after',
          '+': 'after',
          '-': 'after',
          '||': 'after',
          '&&': 'after',
          '/': 'after',
          '+=': 'after',
          '*': 'after',
        },
      },
    ],
    'import/no-extraneous-dependencies': [
      'error',
      {
        devDependencies: ['**/test/**/*.js'],
      },
    ],
    'space-before-function-paren': [
      'error',
      {
        anonymous: 'never',
        named: 'never',
        asyncArrow: 'always',
      },
    ],
  },
  overrides: [
    {
      files: ['**/test/**/*.js'],
      parserOptions: {
        ecmaVersion: 2018,
      },
      env: {
        mocha: true,
      },
      globals: {
        chai: false,
        expect: false,
        assert: false,
        mockery: false,
        sinon: false,
        webdriver: false,
        serverData: false,
      },
      rules: {
        'import/no-extraneous-dependencies': [
          'error',
          {
            devDependencies: ['**/test/**/*.js'],
          },
        ],
      },
    },
    {
      files: ['**/test/test-cafe/**/*.js'],
      parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module',
      },
      globals: {
        fixture: false,
        test: false,
      },
      rules: {
        'mocha/handle-done-callback': 'off',
        'import/no-unresolved': ['error', { ignore: ['^testcafe$'] }],
        'mocha/no-global-tests': 'off',
        'import/no-extraneous-dependencies': [
          'error',
          {
            devDependencies: ['**/*Test.js', '**/*Page*.js'],
          },
        ],
      },
    },
    {
      files: [
        '**/www/app/**/*.js',
        '**/public/app/**/*.js',
        '**/public/assets/**/*.js',
        '**/public/QBORecovery/**/*.js',
        '**/public/test/**/*.js',
      ],
      excludedFiles: ['*.test.js'],
      parserOptions: {
        ecmaVersion: 5,
      },
      env: {
        amd: true,
      },
      rules: {
        'array-bracket-spacing': 'off',
        'arrow-body-style': 'off',
        'arrow-parens': 'off',
        'arrow-spacing': 'off',
        'constructor-super': 'off',
        'generator-star-spacing': 'off',
        'no-class-assign': 'off',
        'no-confusing-arrow': 'off',
        'no-const-assign': 'off',
        'no-dupe-class-members': 'off',
        'no-duplicate-imports': 'off',
        'no-new-symbol': 'off',
        'no-restricted-imports': 'off',
        'no-this-before-super': 'off',
        'no-useless-computed-key': 'off',
        'no-useless-constructor': 'off',
        'no-useless-rename': 'off',
        'no-var': 'off',
        'object-shorthand': 'off',
        'prefer-arrow-callback': 'off',
        'prefer-const': 'off',
        'prefer-destructuring': 'off',
        'prefer-numeric-literals': 'off',
        'prefer-rest-params': 'off',
        'prefer-spread': 'off',
        'prefer-template': 'off',
        'require-yield': 'off',
        'rest-spread-spacing': 'off',
        'sort-imports': 'off',
        'symbol-description': 'off',
        'template-curly-spacing': 'off',
        'yield-star-spacing': 'off',
        'comma-dangle': 'off',
        'func-names': 'off',
        'vars-on-top': 'off',
        strict: ['error', 'function'],
      },
      globals: {
        define: false,
        window: false,
        cordova: false,
        Backbone: false,
        $: false,
      },
    },
    {
      files: [
        '**/components/**/*.test.js',
        '**/frontend/components/**/*.test.js',
        '**/hoc/**/*.test.js',
        '**/reducers/**/*.test.js',
        '**/sagas/**/*.test.js',
        '**/selectors/**/*.test.js',
        '**/__mocks__/**/*.js',
      ],
      parserOptions: {
        ecmaVersion: 2018,
        sourceType: 'module',
        ecmaFeatures: {
          jsx: true,
        },
      },
      env: {
        mocha: true,
        browser: true,
      },
      globals: {
        shallow: false,
        expect: false,
        jest: false,
      },
      rules: {
        'mocha/no-global-tests': 'off',
        'import/no-unresolved': 'off',
      },
    },
  ],
};

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sebastian-nowak picture sebastian-nowak  路  4Comments

greggman picture greggman  路  7Comments

Jamesernator picture Jamesernator  路  5Comments

LinusU picture LinusU  路  7Comments

NickHeiner picture NickHeiner  路  4Comments