Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:35
    Patrick-Spiegel commented #12937
  • 06:26
    maddhruv commented #12936
  • 03:46
    Caryyon commented #12933
  • 03:44
    Caryyon synchronize #12933
  • 03:42
    Caryyon reopened #12933
  • 03:40
    Caryyon closed #12933
  • 02:35
    Caryyon synchronize #12933
  • 02:11
    thescientist13 commented #12938
  • 02:11
    thescientist13 commented #12938
  • 02:11
    thescientist13 commented #12938
  • 01:55
    Caryyon synchronize #12933
  • 01:54
    Caryyon synchronize #12933
  • 01:11
    backbone87 labeled #12942
  • 01:11
    backbone87 labeled #12942
  • 01:11
    backbone87 labeled #12942
  • 01:11
    backbone87 opened #12942
  • 00:53
    ron23 commented #12579
  • Feb 19 22:43
    eslint[bot] labeled #12014
  • Feb 19 22:43
    eslint[bot] locked #12014
  • Feb 19 22:43
    eslint[bot] labeled #12147
Beni
@beniman8
@react-native-community/eslint-config > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0"
Alok Mittal
@mittalalok
how can I bundle eslint for browser?
YeonJuan
@yeonjuan
Hello ESLint team, I'm looking for a reviewer to get eslint/eslint#12596 included. Is there anyone else from the @eslint/eslint-team available to review?
Kai Cataldo
@kaicataldo
@mittalalok ESLint doesn't currently officially support browser environments
raghukiranp
@raghukiranp

Hello,

I have a unique requirement to enable a certain rule for a specific file with options

Problem statement:

  • we have an eslint config with max-lines rule set at 250 lines per file. We are ok with this setting for most of the files.
  • However, there are some legitimate files and code where we would like to set a higher limit in order for this rule not to throw error as mentioned below.
  • We do not want to increase global limit and risk unnecessarily bigger js files.
  • we do not want to go for /* eslint-disable max-lines */ for those specific files with the fear that they might grow beyond capacity unless some keeps reviewing file length, eslint does not show this up.
  • we considered option of adding eslintrc to a specific directory to include higher limits but we are afraid other files in the directory can grow beyond limits.
  • we are considering adding specific exclusions/overrides but that does not look like a cleaner solution to me.

Considering the above factors, I wanted to see if there is an option to selectively enable a rule per file with specific settings overriding global config. Something that looks like below per file.

I am ok to have below file having 500 lines while global config could be at
workspace/some/modules/index.js

/* eslint-enable 'max-lines': ['error', {max: 500, skipBlankLines: true, skipComments: true}]
imports ....

code that exceeds global limit of 250 lines. 

file ends...

// revert back to global config?
/* eslint-enable 'max-lines': ['error', {max: 250, skipBlankLines: true, skipComments: true}]

I am afraid adding `/* eslint-disable 'max-lines' */ to this file allows it to grow way beyond 500 lines and there is no way for us look at this in a huge project unless someone micro monitors during reviewing.

I am open to other ideas and suggestions too...

Thanks :)

Ilya Volodin
@ilyavolodin
@raghukiranp You can just use /* eslint */ comment for this
Roy Sutton
@webOS101
Wow, I never knew about overrides. >mind blown<
I’m unsure how I missed this before.
Ilya Volodin
@ilyavolodin
Overrides are pretty advanced topic that most of the users don't really need (or can achieve easily by other means). But it is very powerful
Roy Sutton
@webOS101
Seems like it might be useful for overriding for test spec files.
Ilya Volodin
@ilyavolodin
That was one of the primary use-cases for overrides
Byron Ferguson
@byronferguson
ugh
I have a .eslintrc.json in the root folder, but when I run —debug it is searching up a ton of directories
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.