Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 允许重复常量值的eslint_Javascript_Typescript_Eslint - Fatal编程技术网

Javascript 允许重复常量值的eslint

Javascript 允许重复常量值的eslint,javascript,typescript,eslint,Javascript,Typescript,Eslint,出于某种原因,这并不是说我不能这么做。有人知道我可以在我的皮棉上加些什么使它无效吗 这确实会引起问题,因为如果我最终做了类似于duplicateName=duplicateName的事情,它显然不起作用 const duplicateName = "Hi"; if(1 == 1) { const duplicateName = "Hey" } 皮棉 const声明是块作用域的。@AluanHaddad是的,我知道,在eslint中有什么方法可以阻止它吗?所以你想禁止阴影?那是rea

出于某种原因,这并不是说我不能这么做。有人知道我可以在我的皮棉上加些什么使它无效吗

这确实会引起问题,因为如果我最终做了类似于
duplicateName=duplicateName
的事情,它显然不起作用

const duplicateName = "Hi";

if(1 == 1) {
    const duplicateName = "Hey" 
}
皮棉
const
声明是块作用域的。@AluanHaddad是的,我知道,在eslint中有什么方法可以阻止它吗?所以你想禁止阴影?那是reasonable@AluanHaddad很抱歉,我不知道它的名称,但这似乎是我正在尝试做的。
const
声明是块作用域的。@AluanHaddad是的,我知道,在eslint中有方法阻止它吗?所以你想禁止阴影?那是reasonable@AluanHaddad对不起,我不知道它叫什么,但这似乎是我想做的。
{
  "env": {
      "es6": true,
      "node": true
  },
  "parser": "@typescript-eslint/parser",
  "plugins": ["@typescript-eslint"],
  "extends": [
    "plugin:@typescript-eslint/recommended",
    "prettier",
    "prettier/@typescript-eslint"
  ],
  "rules": {
      "indent": [
          "error",
          "tab"
      ],
      "linebreak-style": [
          "error",
          "unix"
      ],
      "quotes": [
          "error",
          "single"
      ],
      "semi": [
          "error",
          "always"
      ]
  }
}