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.

Warnings about strings in eslintrc

See original GitHub issue

The ESLint documentation suggests that the strings “error”, “warn”, and “off” can be used instead of the integer values, for example semi: ["error", "always"].

Currently, VSCode brings up a warning when using this syntax:

Incorrect type. Expected one of integer, array

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mitorezcommented, May 26, 2016

@dbaeumer thank you

1reaction
dbaeumercommented, May 25, 2016

OK. Here is what I found out using eslint version 2.10.2 (the latest)

  • using “off”, “warning”, “error” is not allowed of a rules if this is the primary property
        "semi": "warning"

doing so result in the following error when executing eslint from the command line:

P:\mseng\VSCode\Playgrounds\linters\.eslintrc.json:
        Configuration for rule "semi" is invalid:
        Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"warning"').

Error: P:\mseng\VSCode\Playgrounds\linters\.eslintrc.json:
        Configuration for rule "semi" is invalid:
        Severity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '"warning"').

    at validateRuleOptions (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config\config-validator.js:116:15)
    at P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config\config-validator.js:163:13
    at Array.forEach (native)
    at Object.validate (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config\config-validator.js:162:35)
    at Object.load (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config\config-file.js:518:19)
    at loadConfig (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config.js:64:33)
    at getLocalConfig (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config.js:126:23)
    at Config.getConfig (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\config.js:227:22)
    at processText (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\cli-engine.js:217:27)
    at processFile (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\cli-engine.js:292:18)

Using this inside an array works as expected and Code doesn’t print any warning/error.

        "semi": [
            "error",
            "always"
        ]

I will close the issue since there is nothing VS Code can do about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

quotes - ESLint - Pluggable JavaScript Linter
JavaScript allows you to define strings in one of three ways: double quotes, single quotes, and backticks (as of ECMAScript 6). For example:....
Read more >
eslint-plugin-prohibited-strings - npm
eslint plugin to prohibit specified strings. Installation. You'll first need to install ESLint: $ npm i eslint --save-dev.
Read more >
How to tell eslint that you prefer single quotes around your ...
Another useful option is to allow single or double quotes as long as the string contains an escapable quote like "lorem ipsum 'donor'...
Read more >
Understanding ESLint Rules - Mastering JS
Rules are how you configure ESLint. By configuring which rules are errors or warnings, you can build your own ESLint config.
Read more >
vue/no-bare-strings-in-template
This rule disallows the use of bare strings in <template> . In order to be able to internationalize your application, you will need...
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