我正在按照教程打开保存文件时的 ESLint 自动修复。教程演示了如何选中复选框。我找不到它。我需要任何扩展或 smth 吗?
转到:查看 -> 命令面板 -> 首选项:打开工作区设置 -> 扩展 -> ESLint
这是教程中设置页面的样子:
这就是我所看到的:
我正在尝试创建 Windows 窗体应用程序并将 menuStrip 项添加到我的设计器窗口。在 VS 2017 中,您只需单击 menuStrip 并添加项目,但在 VS 2019 中,您必须通过属性 -> 数据 -> 项目手动添加所有项目。我对吗?或者我应该打开一些属性来回到 2017 年添加元素的风格?
VS 2017 menuStrip 设计:
那么我可以做些什么来恢复到 2017 年那种方便的编辑状态吗?
c# user-interface winforms visual-studio-2017 visual-studio-2019
我有一个简单的项目,只有几个 html 和 js 文件。为 VS 代码安装 ESLint 扩展并将 ESLint 设置为默认格式化程序:
此外,此设置已转向所有
这是我的 settings.json 文件:
"window.zoomLevel": 1,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"eslint.validate": ["javascript"],
"git.enableSmartCommit": true,
"eslint.alwaysShowStatus": true,
"files.autoSave": "off",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"git.ignoreWindowsGit27Warning": true,
"eslint.options": {
"eslint brace-style": [
"error",
"allman",
{
"allowSingleLine": true
}
]
},
"eslint.codeAction.showDocumentation": {
"enable": true
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"eslint.format.enable": true
}
Run Code Online (Sandbox Code Playgroud)
当按下保存 ESLint 对我的 js 文件不起作用(没有括号、空格等被更正)。我之前在 React 应用程序中使用过 ESLint,所以它在一年前就成功了。
当我尝试推送到 GitHub 时,每次我都会收到这样的警告:
warning: LF will be replaced by CRLF in app/bingey-api/models/user.js.
The file will have its original line endings in your working directory
Run Code Online (Sandbox Code Playgroud)
即使我在这些地方将行结尾设置更改为“/n”:
用户 -> 文本编辑器 -> 文件 -> Eol:
另外,工作区 -> 文本编辑器 -> 文件 -> Eol:
我的 ESLint 选项文件也有默认行结尾“\n”:
Prettier 也配置为默认的“\n”结束符:
这很奇怪,也许有人知道我还应该在哪里更改设置?谢谢。
我在 VS Code 中用 Python 编写代码。如果我在函数之前添加注释并点击保存按钮,VS code 将添加两个空行:
# comment
def MyMethod():
return 0
Run Code Online (Sandbox Code Playgroud)
我无法找到导致这个恼人问题的原因。也许我可以在某处配置设置?
我正在我的 React 功能组件中动态添加卡片。卡片存储在状态中。我映射它们并给每个人提供 id。OnClick 在那些卡片上我成功地获得了他们的 id。现在我想 getElementById 来改变卡片颜色:
function Clicked(pressedGifId) {
if (pressedGifId === 'correctGif') CorrectMatch();
else WrongMatch();
}
function CorrectMatch(pressedGifId) {
// / THERE I GET Element: null
console.log('Element:', document.getElementById(pressedGifId));
}
function WrongMatch() {
console.log('wrong a match!');
}
export default function GameObject(props) {
const addedToGameGif = [];
const [pressedGifId, gifPressed] = useState(null);
const [photoCards, setPhotoCards] = useState([]);
useEffect(() => {
Clicked(pressedGifId);
}, [pressedGifId]);
// add randomly picked photos to addedToGameGif array
// ...
addedToGameGif.map(gifId =>
photoCards.push(
<Card id={gifId} onClick={() …Run Code Online (Sandbox Code Playgroud) 我尝试通过 API 请求访问 Google 用户信息;
https://www.googleapis.com/oauth2/v1/userinfo?access_token=ya29.a0Ael9sCMYNzgxZT27Cb....
Run Code Online (Sandbox Code Playgroud)
我得到的回复只是 ID 和个人资料图片:
{
"id": "1.....",
"picture": "https://lh3.googleusercontent.com/a-/ACB-R5Sg...."
}
Run Code Online (Sandbox Code Playgroud)
我需要更多用户信息:电子邮件、姓名等。
我已在开发人员控制台中添加了 user.profile 和 userinfo.email 以及 userinfo.profile 范围。
我知道添加的范围可能需要 5 分钟甚至几个小时才能工作,但我在大约 12 小时前添加了它。
如何修复我的 API REST 调用以从 Google API 获取更多用户信息?
编辑
这个问题是相同的,但答案对我不起作用。这个请求:
https://people.googleapis.com/v1/people/me?personFields=names,emailAddresses&access_token=ya29.a0...&key=498...apps.googleusercontent.com
Run Code Online (Sandbox Code Playgroud)
给我带来了Request had insufficient authentication scopes错误。
也许我在那里提供了错误的密钥?那么 api 密钥应该是什么,它来自凭证页面的客户端 ID 吗?
formatting ×3
eslint ×2
access-token ×1
api ×1
c# ×1
eol ×1
google-api ×1
google-oauth ×1
javascript ×1
line-endings ×1
pylance ×1
python ×1
reactjs ×1
rest ×1
use-effect ×1
use-ref ×1
use-state ×1
winforms ×1