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.

global-require false positive

See original GitHub issue

What version of ESLint are you using? v3.0.1 What parser (default, Babel-ESLint, etc.) are you using? babel-eslint Please show your full configuration:

{
    "extends": "airbnb-base/legacy",
    "parser": "babel-eslint",
    "rules": {
        "max-len": [2, 211, 2, {
          "ignoreUrls": true,
          "ignoreComments": false
        }],
        "no-unused-vars": 0,
        "func-names": 0,
        "vars-on-top": 0,
        "no-param-reassign": 0,
        "eqeqeq": 0,
        "guard-for-in": 0,
        "no-use-before-define": 0,
        "no-underscore-dangle": 0,
        "no-restricted-syntax": [
            2,
            "DebuggerStatement",
            "LabeledStatement",
            "WithStatement"
        ],
        "comma-dangle": 0
    },
    "settings": {
        "import/resolver": "webpack"
    }
}

What did you do? Please include the actual source code causing the issue. var apiUrl = require(‘…/config’).apiUrl + ‘/api/v1/’; What did you expect to happen? should be valid under global-require rules. What actually happened? Please include the actual, raw output from ESLint. [1] /redacted/file.js [1] 1:14 error Unexpected require() global-require [1] [1] ✖ 1 problem (1 error, 0 warnings)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nzakascommented, Jul 20, 2016

IIRC, the require("foo").default() case was allowed because it was pretty common, but I’m not 100% sure. It doesn’t really matter in the evaluation of this proposal, though, as we can’t really remove existing functionality that people might be relying on whereas we can decide not to add new functionality without paying a cost.

I’m of the mind that we shouldn’t make any change here, but I’ll leave open to see if any other team members feel strongly otherwise.

0reactions
kaicataldocommented, Sep 18, 2016

I’m closing this issues because it looks like consensus couldn’t be reached. While we wish we could accommodate all requests, we have limited resources and do need to prioritize. We’ve found that issues failing to reach consensus after 21 days tend to never reach consensus, and as a team have decided to close such issues. This doesn’t mean the idea isn’t interesting or valuable, only that it’s not something the team can commit to at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

False positive for global-require · Issue #8784 · eslint ... - GitHub
I expect this code to work without warnings, as the statement is at the top level of the file. Notably, as the documentation...
Read more >
Typescript + Eslint false positive for imports + `declare global`
1 Answer 1 ... Turn off "no-undef": "off"(disallow the use of undeclared variables unless mentioned in /*global */ comments) and to be handled...
Read more >
Address false positives/negatives in Microsoft Defender for ...
Learn how to handle false positives or false negatives in Microsoft Defender for Endpoint.
Read more >
False Positive Rate - Feature Flag Management Platform
False positive rate (FPR) is a measure of accuracy for a test: be it a medical diagnostic test, a machine learning model, or...
Read more >
Intrusion Detection - OWASP Foundation
A false positive state is when the IDS identifies an activity as an attack but the activity is acceptable behavior. A false positive...
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