错误消息和我的代码:
在索引0 处找到具有非文字参数的fs.existsSync
if (!fs.existsSync(dbFolder)){
在索引0 处找到具有非文字参数的fs.mkdirSync
fs.mkdirSync(dbFolder);
在索引0 处找到具有非文字参数的fs.readFileSync
const content = JSON.parse(fs.readFileSync(`${this.dbFolder}/${this.dbName}.json`, "utf8"));
在索引0 处找到具有非文字参数的fs.writeFileSync
fs.writeFileSync(`${dbFolder}/${dbName}.json`, "{}");
如果您想知道问题出在哪里,请查看错误消息。在fs.readFileSync的第一个参数上使用非文字(变量(是不好的做法。
请参阅https://github.com/nodesecurity/eslint-plugin-security#detect-非文字fs文件名