Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
202 views
in Technique[技术] by (71.8m points)

javascript - vscode is not showing linting warnings

I made a typescript react app where I would like to use my eslintrc file to lint my files in vs code but the warnings are not showing up in the ide.

My eslintrc:

{
    "extends": ["react-app"],
    "rules": {
      "space-infix-ops": ["warn", { "int32Hint": false }],
      "semi": ["warn", "never"],
      "quotes": ["warn", "single"],
      "jsx-quotes": ["warn", "prefer-single"],
      "no-trailing-spaces": ["warn"],
      "comma-dangle": ["warn", "never"],
      "space-before-function-paren": ["warn", "never"],
      "space-before-blocks": "warn",
      "keyword-spacing": ["warn", { "after": true, "before": true, 
        "overrides": { 
          "if": { "after": false },
          "else": { "after": true },
          "switch": { "after": false },
          "case": {"after": true },
          "for": { "after": false }
          }
        }
      ],
      "key-spacing": [ "warn", { "afterColon": true }],
      "no-multi-spaces": ["warn"],
      "no-console": ["warn"]
    }
  }

my settings.json:

{
    "editor.fontSize": 15,
    "eslint.enable": true,
    "javascript.updateImportsOnFileMove.enabled": "always",
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        { "language": "typescript", "autoFix": true },
        { "language": "typescriptreact", "autoFix": true }
    ],
}

Output tab:

[Info  - 6:07:05 PM] ESLint server stopped.
[Info  - 6:07:05 PM] ESLint server running in node v8.9.3
[Info  - 6:07:05 PM] ESLint server is running.
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SyntaxError: Unexpected token {
(node:622) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 11): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 12): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 13): SyntaxError: Unexpected token {
(node:622) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 14): SyntaxError: Unexpected token {

I do have the eslint extension installed.

I installed eslint locally for the project with npm install eslint --save-dev

I have googled and looked at other peoples issues but cannot seem to get it working for me. Any help in the right direction would be appreciated.

Thanks

question from:https://stackoverflow.com/questions/65897800/vscode-is-not-showing-linting-warnings

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Check the Output tab on the bottom half of the screen. Select ESLint from the dropdown. Or use the Shortcut: ctrl + shift + U on windows. All ESLint server output gets drawn there.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...