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.

ESLint rule no-redeclare is no longer working as expected

See original GitHub issue

Tell us about your environment

  • ESLint Version: 4.6.0
  • Node Version: 8.3.0
  • npm Version: 5.3.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Configuration
{
  "root": true,
  "env": {
    "browser": true,
    "node": true,
    "commonjs": true,
    "shared-node-browser": true,
    "es6": true,
    "worker": true,
    "amd": false,
    "mocha": false,
    "jasmine": false,
    "jest": false,
    "phantomjs": false,
    "protractor": false,
    "qunit": false,
    "jquery": false,
    "prototypejs": false,
    "shelljs": false,
    "meteor": false,
    "mongo": false,
    "applescript": false,
    "nashorn": false,
    "serviceworker": false,
    "atomtest": false,
    "embertest": false,
    "webextensions": false,
    "greasemonkey": false
  },
  "rules": {
    "for-direction": "error",
    "no-await-in-loop": "warn",
    "no-compare-neg-zero": "error",
    "no-cond-assign": [
      "error",
      "always"
    ],
    "no-console": "warn",
    "no-constant-condition": [
      "error",
      {
        "checkLoops": false
      }
    ],
    "no-control-regex": "error",
    "no-debugger": "error",
    "no-dupe-args": "error",
    "no-dupe-keys": "error",
    "no-duplicate-case": "error",
    "no-empty-character-class": "error",
    "no-empty": "error",
    "no-ex-assign": "error",
    "no-extra-boolean-cast": "error",
    "no-extra-parens": [
      "error",
      "functions"
    ],
    "no-extra-semi": "error",
    "no-func-assign": "error",
    "no-inner-declarations": [
      "error",
      "both"
    ],
    "no-invalid-regexp": "error",
    "no-irregular-whitespace": "error",
    "no-obj-calls": "error",
    "no-prototype-builtins": "error",
    "no-regex-spaces": "error",
    "no-sparse-arrays": "error",
    "no-template-curly-in-string": "off",
    "no-unexpected-multiline": "error",
    "no-unreachable": "error",
    "no-unsafe-finally": "error",
    "no-unsafe-negation": "error",
    "use-isnan": "error",
    "valid-jsdoc": [
      "error",
      {
        "prefer": {
          "arg": "param",
          "argument": "param",
          "class": "constructor",
          "return": "returns"
        },
        "requireReturn": false,
        "requireReturnType": true,
        "matchDescription": ".+",
        "requireParamDescription": true,
        "requireReturnDescription": true
      }
    ],
    "valid-typeof": [
      "error",
      {
        "requireStringLiterals": true
      }
    ],
    "accessor-pairs": [
      "error",
      {
        "setWithoutGet": true,
        "getWithoutSet": false
      }
    ],
    "array-callback-return": "error",
    "block-scoped-var": "error",
    "class-methods-use-this": "error",
    "complexity": "off",
    "consistent-return": "off",
    "curly": "error",
    "default-case": "error",
    "dot-location": [
      "error",
      "property"
    ],
    "dot-notation": "off",
    "eqeqeq": [
      "error",
      "always"
    ],
    "guard-for-in": "error",
    "no-alert": "error",
    "no-caller": "error",
    "no-case-declarations": "error",
    "no-div-regex": "error",
    "no-else-return": "error",
    "no-empty-function": "error",
    "no-empty-pattern": "error",
    "no-eq-null": "error",
    "no-eval": "error",
    "no-extend-native": "error",
    "no-extra-bind": "error",
    "no-extra-label": "error",
    "no-fallthrough": "error",
    "no-floating-decimal": "error",
    "no-global-assign": "error",
    "no-implicit-coercion": "off",
    "no-implicit-globals": "off",
    "no-implied-eval": "error",
    "no-invalid-this": "error",
    "no-iterator": "error",
    "no-labels": [
      "error",
      {
        "allowLoop": false,
        "allowSwitch": false
      }
    ],
    "no-lone-blocks": "error",
    "no-loop-func": "error",
    "no-magic-numbers": [
      "off",
      {
        "ignoreArrayIndexes": true,
        "enforceConst": false,
        "detectObjects": false
      }
    ],
    "no-multi-spaces": [
      "error",
      {
        "ignoreEOLComments": true
      }
    ],
    "no-multi-str": "error",
    "no-new-func": "error",
    "no-new-wrappers": "error",
    "no-new": "error",
    "no-octal-escape": "error",
    "no-octal": "error",
    "no-param-reassign": "off",
    "no-proto": "error",
    "no-redeclare": [
      "error",
      {
        "builtinGlobals": true
      }
    ],
    "no-restricted-properties": "off",
    "no-return-assign": [
      "error",
      "always"
    ],
    "no-return-await": "error",
    "no-script-url": "error",
    "no-self-assign": [
      "error",
      {
        "props": true
      }
    ],
    "no-self-compare": "off",
    "no-sequences": "error",
    "no-throw-literal": "error",
    "no-unmodified-loop-condition": "off",
    "no-unused-expressions": [
      "error",
      {
        "allowShortCircuit": false,
        "allowTernary": false
      }
    ],
    "no-unused-labels": "error",
    "no-useless-call": "error",
    "no-useless-concat": "error",
    "no-useless-escape": "error",
    "no-useless-return": "error",
    "no-void": "off",
    "no-warning-comments": [
      "warn",
      {
        "terms": [
          "todo",
          "warning",
          "fixme",
          "hack",
          "optimize",
          "xxx"
        ],
        "location": "start"
      }
    ],
    "no-with": "error",
    "radix": [
      "error",
      "always"
    ],
    "require-await": "error",
    "vars-on-top": "error",
    "wrap-iife": [
      "error",
      "inside"
    ],
    "yoda": [
      "error",
      "never",
      {
        "exceptRange": true
      }
    ],
    "strict": [
      "error",
      "global"
    ],
    "init-declarations": "off",
    "no-catch-shadow": "error",
    "no-delete-var": "error",
    "no-label-var": "error",
    "no-restricted-globals": [
      "error",
      "event",
      "fdescribe"
    ],
    "no-shadow-restricted-names": "error",
    "no-shadow": "off",
    "no-undef-init": "error",
    "no-undef": "error",
    "no-undefined": "error",
    "no-unused-vars": [
      "error",
      {
        "vars": "all",
        "args": "after-used",
        "caughtErrors": "all"
      }
    ],
    "no-use-before-define": [
      "error",
      {
        "functions": false,
        "classes": true
      }
    ],
    "callback-return": [
      "warn",
      [
        "callback",
        "clbk",
        "cb",
        "done",
        "next"
      ]
    ],
    "global-require": "off",
    "handle-callback-err": [
      "error",
      "^(err|error)$"
    ],
    "no-buffer-constructor": "warn",
    "no-mixed-requires": [
      "error",
      {
        "grouping": false,
        "allowCall": true
      }
    ],
    "no-new-require": "error",
    "no-path-concat": "error",
    "no-process-env": "error",
    "no-process-exit": "warn",
    "no-restricted-modules": [
      "error",
      {
        "paths": [
          "underscore",
          "lodash",
          "async"
        ],
        "patterns": [
          "lodash*",
          "async/*"
        ]
      }
    ],
    "no-sync": "warn",
    "array-bracket-newline": [
      "off",
      {
        "multiline": true,
        "minItems": null
      }
    ],
    "array-bracket-spacing": [
      "off",
      "always",
      {
        "singleValue": true,
        "objectsInArrays": false,
        "arraysInArrays": false
      }
    ],
    "array-element-newline": [
      "off",
      {
        "multiline": true,
        "minItems": null
      }
    ],
    "block-spacing": [
      "error",
      "always"
    ],
    "brace-style": [
      "off",
      "1tbs",
      {
        "allowSingleLine": false
      }
    ],
    "camelcase": [
      "error",
      {
        "properties": "never"
      }
    ],
    "capitalized-comments": [
      "warn",
      "always",
      {
        "ignoreInlineComments": true
      }
    ],
    "comma-dangle": [
      "error",
      "never"
    ],
    "comma-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ],
    "comma-style": [
      "error",
      "last"
    ],
    "computed-property-spacing": [
      "off",
      "always"
    ],
    "consistent-this": [
      "error",
      "self"
    ],
    "eol-last": [
      "error",
      "always"
    ],
    "func-call-spacing": [
      "error",
      "never"
    ],
    "func-name-matching": "off",
    "func-names": [
      "error",
      "always"
    ],
    "func-style": [
      "error",
      "declaration",
      {
        "allowArrowFunctions": false
      }
    ],
    "id-blacklist": "off",
    "id-length": [
      "warn",
      {
        "min": 1,
        "max": 25,
        "properties": "never"
      }
    ],
    "id-match": "off",
    "indent": [
      "error",
      "tab",
      {
        "SwitchCase": 0,
        "VariableDeclarator": 1,
        "outerIIFEBody": 1,
        "MemberExpression": 1,
        "FunctionDeclaration": {
          "body": 1,
          "parameters": "off"
        },
        "FunctionExpression": {
          "body": 1,
          "parameters": "off"
        },
        "CallExpression": {
          "arguments": "off"
        },
        "ArrayExpression": 1,
        "ObjectExpression": 1,
        "flatTernaryExpressions": true
      }
    ],
    "jsx-quotes": "off",
    "key-spacing": [
      "error",
      {
        "beforeColon": false,
        "afterColon": true,
        "mode": "strict"
      }
    ],
    "keyword-spacing": [
      "error",
      {
        "before": true,
        "after": true
      }
    ],
    "line-comment-position": "off",
    "linebreak-style": [
      "error",
      "unix"
    ],
    "lines-around-comment": [
      "off",
      {
        "beforeBlockComment": true,
        "afterBlockComment": false,
        "beforeLineComment": true,
        "afterLineComment": false,
        "allowBlockStart": true,
        "allowBlockEnd": true,
        "allowObjectStart": true,
        "allowObjectEnd": true,
        "allowArrayStart": true,
        "allowArrayEnd": true
      }
    ],
    "max-depth": [
      "error",
      {
        "max": 5
      }
    ],
    "max-len": [
      "error",
      {
        "code": 80,
        "tabWidth": 4,
        "ignoreComments": true,
        "ignoreUrls": true,
        "ignoreStrings": true,
        "ignoreTemplateLiterals": true,
        "ignoreRegExpLiterals": true
      }
    ],
    "max-lines": [
      "warn",
      {
        "max": 300,
        "skipBlankLines": true,
        "skipComments": true
      }
    ],
    "max-nested-callbacks": [
      "error",
      {
        "max": 3
      }
    ],
    "max-params": [
      "error",
      {
        "max": 10
      }
    ],
    "max-statements-per-line": [
      "error",
      {
        "max": 1
      }
    ],
    "max-statements": [
      "warn",
      {
        "max": 100
      }
    ],
    "multiline-ternary": "off",
    "new-cap": [
      "error",
      {
        "newIsCap": false,
        "capIsNew": true,
        "properties": true
      }
    ],
    "new-parens": "error",
    "newline-per-chained-call": "off",
    "no-array-constructor": "error",
    "no-bitwise": "off",
    "no-continue": "off",
    "no-inline-comments": "off",
    "no-lonely-if": "error",
    "no-mixed-operators": [
      "error",
      {
        "allowSamePrecedence": true
      }
    ],
    "no-mixed-spaces-and-tabs": "error",
    "no-multiple-empty-lines": [
      "error",
      {
        "max": 2,
        "maxEOF": 1,
        "maxBOF": 1
      }
    ],
    "no-negated-condition": "error",
    "no-nested-ternary": "error",
    "no-new-object": "error",
    "no-plusplus": [
      "error",
      {
        "allowForLoopAfterthoughts": true
      }
    ],
    "no-restricted-syntax": [
      "error",
      "ArrowFunctionExpression",
      "ClassBody",
      "ClassDeclaration",
      "ClassExpression",
      "DebuggerStatement",
      "ExperimentalRestProperty",
      "ExperimentalSpreadProperty",
      "FunctionExpression",
      "LabeledStatement",
      "RestElement",
      "SpreadElement",
      "TaggedTemplateExpression",
      "TemplateElement",
      "TemplateLiteral",
      "WithStatement",
      "YieldExpression",
      "JSXIdentifier",
      "JSXNamespacedName",
      "JSXMemberExpression",
      "JSXEmptyExpression",
      "JSXExpressionContainer",
      "JSXElement",
      "JSXClosingElement",
      "JSXOpeningElement",
      "JSXAttribute",
      "JSXSpreadAttribute",
      "JSXText",
      "ExportDefaultDeclaration",
      "ExportNamedDeclaration",
      "ExportAllDeclaration",
      "ExportSpecifier",
      "ImportDeclaration",
      "ImportSpecifier",
      "ImportDefaultSpecifier",
      "ImportNamespaceSpecifier"
    ],
    "no-tabs": "off",
    "no-ternary": "off",
    "no-trailing-spaces": [
      "error",
      {
        "skipBlankLines": false
      }
    ],
    "no-underscore-dangle": [
      "error",
      {
        "allowAfterThis": true,
        "allowAfterSuper": true
      }
    ],
    "no-unneeded-ternary": [
      "error",
      {
        "defaultAssignment": false
      }
    ],
    "no-whitespace-before-property": "error",
    "nonblock-statement-body-position": [
      "error",
      "beside"
    ],
    "object-curly-newline": [
      "error",
      {
        "ObjectExpression": {
          "minProperties": 1,
          "consistent": true
        },
        "ObjectPattern": "never"
      }
    ],
    "object-curly-spacing": [
      "warn",
      "always",
      {
        "objectsInObjects": false,
        "arraysInObjects": false
      }
    ],
    "object-property-newline": [
      "error",
      {
        "allowMultiplePropertiesPerLine": false
      }
    ],
    "one-var-declaration-per-line": "off",
    "one-var": [
      "error",
      {
        "var": "never",
        "let": "never",
        "const": "never"
      }
    ],
    "operator-assignment": [
      "warn",
      "always"
    ],
    "operator-linebreak": [
      "error",
      "after"
    ],
    "padded-blocks": [
      "error",
      "never"
    ],
    "padding-line-between-statements": [
      "error",
      {
        "blankLine": "never",
        "prev": "*",
        "next": "directive"
      },
      {
        "blankLine": "always",
        "prev": "directive",
        "next": "*"
      },
      {
        "blankLine": "any",
        "prev": "directive",
        "next": "directive"
      },
      {
        "blankLine": "any",
        "prev": "var",
        "next": "*"
      },
      {
        "blankLine": "any",
        "prev": "*",
        "next": "return"
      }
    ],
    "quote-props": [
      "error",
      "always"
    ],
    "quotes": [
      "error",
      "single",
      {
        "avoidEscape": true
      }
    ],
    "require-jsdoc": [
      "error",
      {
        "require": {
          "FunctionDeclaration": true,
          "ClassDeclaration": true,
          "MethodDefinition": true,
          "ArrowFunctionExpression": true
        }
      }
    ],
    "semi": [
      "error",
      "always"
    ],
    "semi-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ],
    "semi-style": [
      "error",
      "last"
    ],
    "sort-keys": "off",
    "sort-vars": "off",
    "space-before-blocks": [
      "error",
      {
        "functions": "always",
        "keywords": "always",
        "classes": "always"
      }
    ],
    "space-before-function-paren": [
      "error",
      {
        "anonymous": "always",
        "named": "never",
        "asyncArrow": "always"
      }
    ],
    "space-in-parens": "off",
    "space-infix-ops": "off",
    "space-unary-ops": [
      "error",
      {
        "words": true,
        "nonwords": false
      }
    ],
    "spaced-comment": [
      "error",
      "always",
      {
        "block": {
          "balanced": true
        }
      }
    ],
    "switch-colon-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ],
    "template-tag-spacing": [
      "error",
      "never"
    ],
    "unicode-bom": "off",
    "wrap-regex": "off",
    "arrow-body-style": [
      "error",
      "always"
    ],
    "arrow-parens": [
      "error",
      "always"
    ],
    "arrow-spacing": [
      "error",
      {
        "before": true,
        "after": true
      }
    ],
    "constructor-super": "error",
    "generator-star-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ],
    "no-class-assign": "error",
    "no-confusing-arrow": [
      "error",
      {
        "allowParens": false
      }
    ],
    "no-const-assign": "error",
    "no-dupe-class-members": "error",
    "no-duplicate-imports": [
      "error",
      {
        "includeExports": true
      }
    ],
    "no-new-symbol": "error",
    "no-restricted-imports": [
      "error",
      {
        "paths": [
          "lodash",
          "underscore",
          "async"
        ],
        "patterns": [
          "lodash*",
          "async*"
        ]
      }
    ],
    "no-this-before-super": "error",
    "no-useless-computed-key": "error",
    "no-useless-constructor": "error",
    "no-useless-rename": "error",
    "no-var": "off",
    "object-shorthand": [
      "error",
      "never"
    ],
    "prefer-arrow-callback": "off",
    "prefer-const": [
      "warn",
      {
        "destructuring": "any",
        "ignoreReadBeforeAssign": false
      }
    ],
    "prefer-destructuring": "off",
    "prefer-numeric-literals": "off",
    "prefer-rest-params": "off",
    "prefer-spread": "off",
    "prefer-template": "off",
    "require-yield": "error",
    "rest-spread-spacing": [
      "error",
      "never"
    ],
    "sort-imports": "off",
    "symbol-description": "error",
    "template-curly-spacing": [
      "error",
      "never"
    ],
    "yield-star-spacing": [
      "error",
      {
        "before": false,
        "after": true
      }
    ]
  },
  "parserOptions": {
    "version": 6,
    "sourceType": "script",
    "ecmaFeatures": {
      "globalReturn": false,
      "impliedStrict": false,
      "jsx": false,
      "experimentalObjectRestSpread": false
    }
  }
}

What did you do? Please include the actual source code causing the issue.

'use strict';

var resolve = require( 'path' ).resolve;
var join = require( 'path' ).join;

var config = join( __dirname, 'eslint', '.eslintrc.markdown.js' );
var eslint = resolve( __dirname, '..', 'tools', 'remark', 'plugins', 'remark-lint-eslint' );
var opts = {
	'config': config,
	'ignore': false,
	'useEslintrc': false
};

var plugin = [ [ require( eslint ).factory( opts ), [ 'error' ] ] ];

module.exports = plugin;

What did you expect to happen?

I expected this to pass linting.

What actually happened? Please include the actual, raw output from ESLint.

/Users/beep/boop/etc/remark/plugins/eslint/index.js
  6:5  error  'config' is already defined  no-redeclare

✖ 1 problem (1 error, 0 warnings)

This file was passing linting until the most recent ESLint release (released today).

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
not-an-aardvarkcommented, Sep 2, 2017

I think I can reproduce this issue. I’m looking into it now.

0reactions
not-an-aardvarkcommented, Oct 15, 2017

Yes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-redeclare - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Why is the @typescript-eslint/no-redeclare rule indicating a ...
I have a typescript project where linting is supported via eslint and typescript-eslint. Please note that this is just a minimal working ......
Read more >
no-redeclare | typescript-eslint
This rule extends the base eslint/no-redeclare rule. It adds support for TypeScript function overloads, and declaration merging.
Read more >
ESLint Plugin TypeScript - npm
Name ✓ 🔧 💭 @typescript‑eslint/adjacent‑overload‑signatures ✓ @typescript‑eslint/array‑type 🔧 @typescript‑eslint/await‑thenable ✓ 💭
Read more >
Medium level issues - Embold Help Center
Once again, the intent here is to show that the developer intended for there to be no default behavior. Robustness, https://eslint.org/docs/rules/default- ...
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