gpt4 book ai didi

node.js - JSHint 和下划线问题 '_'

转载 作者:搜寻专家 更新时间:2023-10-31 23:17:49 24 4
gpt4 key购买 nike

运行jshint时出现如下错误;

line 4   col 5  Redefinition of '_'.

代码正在提示;

var _ = require('lodash');

项目中的jshint

{
"node": true,
"esnext": true,
"bitwise": true,
"eqeqeq": true,
"immed": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"regexp": true,
"undef": true,
"smarttabs": true,
"asi": true,
"debug": true,
"globals": {
"angular": false,
"_": false
}
}

最佳答案

将 .jshintrc 更新为以下似乎已解决问题的内容。

{
"node": true,
"browser": true,
"esnext": true,
"bitwise": false,
"camelcase": false,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": false,
"strict": true,
"trailing": true,
"smarttabs": true,
"globals": {
"jQuery": true,
"angular": true,
"console": true,
"AppConfig": true,
"$": true,
"_": true,
"moment": true,
"module": true,
"inject": true,
"browser": true,
"element": true,

"describe": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true,
"expect": true,
"it": true,
"by": true,
"chai": true
}
}

还创建了一个 .jshintrc-spec

{
"extends": ".jshintrc",
"globals": {
"describe": true,
"it": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true,
"chai": true,
"inject" : true
}
}

关于node.js - JSHint 和下划线问题 '_',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188210/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com