The issue:
Custom Linter Config textarea,To reproduce the former, just copy/paste various incorrect code examples from almost any "recommended" rule from https://eslint.org/docs/rules/ to a new userscript tab.
Expected behavior:
As an introduction to ESLint I quote from its site:
ESLint is designed to be completely configurable, meaning you can turn off every rule and run only with basic syntax validation, or mix and match the bundled rules and your custom rules to make ESLint perfect for your project.
There are two primary ways to configure ESLint:
For reference, the list of ESLint rules is here: https://eslint.org/docs/rules/
A large group of them is "recommended", and lots of them are "fixable" (autom. by ESLint itself).
An example of custom config:
module.exports = {
"env": {
"browser": true,
"es6": true,
"greasemonkey": true,
"jquery": true,
},
"extends": "eslint:recommended",
// "extends": "eslint:all",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn ": true,
"impliedStrict": true,
},
},
"rules": {
"eqeqeq": "warn",
"indent": ["warn","tab", { "ignoreComments": true, "SwitchCase": 1 } ],
"linebreak-style": ["warn","unix"],
"no-alert": "error",
"no-console": "warn",
}
};
Some notes:
This now should work as expected...
{
"env": {
"browser": true,
"es6": true,
"greasemonkey": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn ": true,
"impliedStrict": true
}
},
"rules": {
"eqeqeq": "warn",
"indent": ["warn","tab", { "ignoreComments": true, "SwitchCase": 1 } ],
"linebreak-style": ["warn","unix"],
"no-alert": "error",
"no-console": "warn"
}
}
Thank you so much! I confirm it works great! Awesome!
Just some suggestions to consider, please:
Unexpected console statement.
eslint(no-console) Unexpected console statement.
Below are screenshots of SublimeLinter for reference:
tooltip with rule name:

statusbar:

panel/output:

Update 2/23: added a total count statusbar in feature suggestions, and inserted SL screenshots.
Thanks a lot for adding tooltip with the related rule name!
I've noticed that many errors are not highlighted:
(using TM beta 4.10.6112 in Chrome 81)
e.g. in the following code example:
var a; // eslint:no-unused-vars 'a' is defined but never used.
var a; // eslint:no-redeclare 'a' is already defined.
b; // eslint:no-undef 'b' is not defined.
using the config from your comment, only the 1st warning is highlighted, even though all 3 rules are 'recommended':

Also, that 1st highlight should be an error, not a warning, because that (recommended) rule is not explicitly defined in your config as such (there's no "no-unused-vars": "warn")
Fixed at TM BETA 4.11.6116
@derjanb Thank you!
I've noticed the following with the new version:
if I add the ESLint config from your comment
and enter my test code from above,
then only the 1nd + 3rd issues appear as Errors (red) - the 2nd appears as Warning (yellow)
although the no-redeclare rule is not explicitly set as "Warn" in the config:

This is because
no-unused-vars is a "problem"
https://github.com/eslint/eslint/blob/8108f49f9fa0c2de80b3b66c847551beff585951/lib/rules/no-unused-vars.js#L20
while no-redeclare is a "suggestion".
https://github.com/eslint/eslint/blob/8108f49f9fa0c2de80b3b66c847551beff585951/lib/rules/no-redeclare.js#L20
(I've deleted my last comment)
What I've noticed is that,
if I use in Tampermonkey a config with an "rules" key with an empty value {}:
config in TM
{
"env": {
"browser": true,
"es6": true,
"greasemonkey": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn ": true,
"impliedStrict": true
}
},
"rules": {}
}
then 2nd rule is highlighted as a warning:

but if I use the same config as a .eslintrc.js file in ESLint CLI (i.e. outside Tampermonkey) :
.eslintrc.js file in ESLint CLI
module.exports = {
"env": {
"browser": true,
"es6": true,
"greasemonkey": true,
"jquery": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 11,
"sourceType": "script",
"ecmaFeatures": {
"globalReturn ": true,
"impliedStrict": true
}
},
"rules": {}
}
then the 2nd problem is an also listed as an error:

In other words, all problems in ESLint CLI are highlighted as errors (regardless of whether the relevant rule is a problem or a suggestion) unless set they are explicitly set as warnings.
What you are referring to as suggestion/problem distinguish has to do with --fix-type CLI option
which allows to specify the type of fixes to apply when using either --fix or --fix-dry-run,
and which is irrelevant to how the problems are highlighted (warning/error), i.e. how rules are configured (off/warn/error) link .
So, can we have the same behavior in Tampermonkey as in CLI ?
Most helpful comment
This now should work as expected...