Linting issue
See original GitHub issueFrom @pronebird on February 8, 2017 12:34
Hi,
I use babel-eslint 7.1.1. and I see syntax issue with the following piece in my JSX:
<button onClick={::this.handleLogin}>Log In</button>
It points at ::
and says that “expression expected”
My .eslintrc:
{
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"plugins": [ "react" ],
"rules": {
"indent": [ 2, 2 ],
"quotes": [ 2, "single" ],
"linebreak-style": [ 2, "unix" ],
"semi": [ 2, "always" ],
"no-console": [ 0 ],
"no-loop-func": [ 0 ],
"new-cap": [ 0 ],
"no-trailing-spaces": [ 0 ],
"no-param-reassign": [ 0 ],
"func-names": [ 0 ],
"comma-dangle": [ 0 ],
"no-unused-expressions" : [ 0 ], // until fixed https://github.com/babel/babel-eslint/issues/158
"block-scoped-var": [ 0 ], // until fixed https://github.com/eslint/eslint/issues/2253
"react/prop-types": [ 0 ]
},
"env": {
"es6": true,
"node": true,
"browser": true,
"mocha": true
}
}
ESLint works as expected and does not produce warnings:
eslint --no-ignore scripts app test *.js
Copied from original issue: Microsoft/vscode#20198
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:9 (5 by maintainers)
Top Results From Across the Web
What is linting and how can it save you time? - freeCodeCamp
Simply put, a linter is a tool that programmatically scans your code with the goal of finding issues that can lead to bugs...
Read more >What is "Linting"? - Stack Overflow
Linting is a process by a linter program that analyzes source code in a particular programming language and flag potential problems like ...
Read more >Linting - Developer Experience Knowledge Base
Lint, or a Linter, is a very useful tool for automated analyzing of your source code to look for bugs and stylistic errors....
Read more >Lint Code: What Is Linting + When To Use Lint Tools - Perforce
Linting is the process of checking code for programmatic and stylistic errors. Learn how to easily use lint programming and lint tools (also ......
Read more >Linting tools to identify and fix code mistakes - IBM
Linting is the process of performing static analysis on source code to flag patterns that might cause errors or other problems. As an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just noticed that vscode-eslint extension does not emit the “Expression expected” message!
As a workaround I can suggest to disable JavaScript validation by putting the following into your user or workspace config:
I think vscode uses TypeScript for JS (because the
javascript.validate.enable
option is listed under TypeScript section in settings). If this is true, JS validation may be enabled back once Microsoft/TypeScript/issues/3508 is resolved.@pronebird I am able to reproduce but I have no idea why this is happening. The ESLint extension actually uses the eslint npm module to do the actual validation. I don’t know why it behaves different when running outside from the command line version inside VS Code.