Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:25
    phenomnomnominal labeled #12666
  • 02:25
    phenomnomnominal labeled #12666
  • 02:25
    phenomnomnominal labeled #12666
  • 02:25
    phenomnomnominal opened #12666
  • 00:11
    mdjermanovic labeled #12665
  • 00:11
    mdjermanovic labeled #12665
  • 00:11
    mdjermanovic labeled #12665
  • 00:11
    mdjermanovic assigned #12665
  • 00:11
    mdjermanovic opened #12665
  • Dec 14 22:43
    eslint[bot] commented #12561
  • Dec 14 22:43
    eslint[bot] labeled #12561
  • Dec 14 22:43
    eslint[bot] closed #12561
  • Dec 14 22:43
    eslint[bot] labeled #11847
  • Dec 14 22:43
    eslint[bot] locked #11847
  • Dec 14 21:58
    mdjermanovic closed #12046
  • Dec 14 21:58
    mdjermanovic commented #12046
  • Dec 14 21:56
    mdjermanovic closed #12047
  • Dec 14 21:56
    mdjermanovic commented #12047
  • Dec 14 21:32
    kaicataldo labeled #12664
  • Dec 14 21:32
    kaicataldo labeled #12664
Byron Ferguson
@byronferguson
why?
Kai Cataldo
@kaicataldo
Do you have root: true set in that config file?
Byron Ferguson
@byronferguson
{
  "env": {
    "browser": true,
    "commonjs": true,
    "node": true
  },
  "rules": {
    "no-duplicate-case": "error",
    "no-empty": "error",
    "no-extra-semi": "error",
    "no-func-assign": "error",
    "no-irregular-whitespace": "error",
    "no-unreachable": "error",
    "curly": "error",
    "dot-notation": "error",
    "eqeqeq": "error",
    "no-empty-function": "error",
    "no-multi-spaces": "error",
    "no-mixed-spaces-and-tabs": "error",
    "no-trailing-spaces": "error",
    "default-case": "error",
    "no-fallthrough": "error",
    "no-unused-vars": "error",
    "no-use-before-define": "error",
    "no-redeclare": "error",
    "camelcase": "error",
    "brace-style": "error",
    "indent": [
      "error",
      2
    ],
    "linebreak-style": [
      "error",
      "unix"
    ],
    "quotes": [
      "error",
      "double"
    ],
    "semi": [
      "error",
      "always"
    ]
  }
}
gotcha, so I need to add root: true on that config to tell eslint that this is the “root” and should stop looking up to parents?
Jordan Harband
@ljharb
yes
Byron Ferguson
@byronferguson
thanks
Amit Surani
@surani444_gitlab
Hi
Screenshot 2019-12-12 at 11.58.43 AM.png
I'm getting this error
Jakob Guddas
@jguddas

are there rules for

x = [
  {
    ...
  },
  {
    ...
  }
]

to be

x = [ {
  ...
}, {
  ...
}]

?

vinaynalla1401
@vinaynalla1401
Hi All, please let me known can we customize the rules or not, can you please share the url
m3dve
@m3dve
Hi All!
I have a question about the EsLint with SonarQube. I checked the EsLint webpage and Google, but i did not found valuable answer for it.
We use our own collections of the javascript rules in a SonarQube server and it connected to our VSCode via SonarLint. Can we replace it with EsLint? Do you have any solution to use the rules from the server(connect server, download rules, use)?
Kai Cataldo
@kaicataldo
Hey there, I don’t know anything about SonarLint, but ESLint is pluggable and has a Node API that you might be able to integrate with a script you write.
Documentation can be found here: https://eslint.org/docs/developer-guide/nodejs-api
Marco Gutierrez
@marcosguti
error.png hi guys can help me with this error? eslint-plugin-prettier not working correctly i cant see any warning and fix eslint problems
Roy Sutton
@webOS101
Does it work if you run eslint from the terminal?
Marco Gutierrez
@marcosguti
example: eslint --fix actionReducer/index.js works but file view in vs-code dont show any warnings and fix suggestion when have errors
Roy Sutton
@webOS101
I think vscode is not setting the correct working directory for linting.
Marco Gutierrez
@marcosguti
not sure i think its really weird
maybe i should remove vs-code and install again?
Roy Sutton
@webOS101
Is the root of your workspace the same as the root directory you’re linting?
Marco Gutierrez
@marcosguti
how i can check that?
BrianD91
@BrianD91

how can I do conditionals in eslint?

Like if I use a certain import statement in my code, then I need to be sure that at the top of the file there's a /** @jsx jsx */ pragma

Marco Gutierrez
@marcosguti
@webOS101 ?
Roy Sutton
@webOS101
When you go to the file list in VS Code, is api the root?
Marco Gutierrez
@marcosguti
yes
Roy Sutton
@webOS101
Then I don’t know. I don’t have VS Code set up the same way so I can’t help debug that.
Jef Braem
@braemJef
Hello, is there anyone online here?
raghukiranp
@raghukiranp

Thanks @ilyavolodin this was what I was looking for... overlooked in the documentation...

Another query as followup to above response, is there a way I can configure eslint lint to warn for one configuration and error for another configuration...

I am looking for something like max-lines should warn if between 250 - 500 lines and error is file has more than 500 lines.

I can write a custom rule for max line ranges, however, does eslint have an option to switch between warn and error based on config? should this be requested as a feature or does not make sense at all.

Lakshay-Sood
@Lakshay-Sood
how can i stop eslint from generating errors on the Current Line?
Haisum
@Haisum92
i think, it was something //eslint-disable-next-line no-console
Lakshay-Sood
@Lakshay-Sood
its not working
Ilya Volodin
@ilyavolodin
@raghukiranp No, this doesn't exist. And it would not be possible with the current setup. Rules don't know anything about reporting levels. They just report an error, it's up to the engine to figure out if that error should be reported as a warning or error based on the config.
m3dve
@m3dve
Thank you @marcosguti , am going to check it.
Kevin Partington
@platinumazure
@Lakshay-Sood Try this: // eslint-disable-line rule-name (eslint-disable-line does the same line, whereas eslint-disable-next-line does the line below)
Ryan Hirsch
@RyanHirsch
I have a rule that I'm attempting to disable. When I run eslint over the file it still is being flagged as an error. When I run eslint with debug, I see 3 values set in the ConfigArray, error from a plugin, off from my rules, error from the same plugin
The names from the ConfigArray for theses settings are
.eslintrc.js#overrides[2] » plugin:@typescript-eslint/recommended
.eslintrc.js#overrides[2]
.eslintrc.js#overrides[3] » plugin:@typescript-eslint/recommended
if it helps
Ryan Hirsch
@RyanHirsch
Figured it out, the 4th override was pulling in some conf from the third, but no the rule overrides. Our config is way too complicated
Tompouce
@Tompouce-onGit

Hello!
So I'm using ESlint in VScode, and I have the 'quotes' rule set up as such:

"quotes": ["warn", { "allowTemplateLiterals":  true }]

But I get a notification from the ESlint extension telling me that it is invalid:
eslint-error
Has anybody else had this issue and knows a fix?

Jordan Harband
@ljharb
what version of eslint?
Tompouce
@Tompouce-onGit
running eslint --version gives v6.7.2
Jordan Harband
@ljharb
https://eslint.org/docs/rules/quotes the object option is the second one
you need to pass one before it, double, single, or backtick
Tompouce
@Tompouce-onGit
Ooh, okay that makes sense, my bad
Thanks
czaylove
@czaylove
image.png
please help me
I have difficulty fixing errors
Kevin Partington
@platinumazure
@czaylove As the error message says, it couldn't find a configuration file. Do you have an ESLint configuration file in your project somewhere?