[英]Why eslint gives an error message when any enum present in types.ts?
I have a project with Vue3, Quasar, Typescript & Eslint.我有一个 Vue3、Quasar、Typescript 和 Eslint 的项目。 When I've added a enum in my types file, like this:
当我在类型文件中添加枚举时,如下所示:
/* eslint-disable */
export type TableFieldType = 'default' | 'expandable' | 'editable' | 'button' | 'custom' | 'json';
export type Selection = 'select' | 'multiselect' | undefined;
export enum SortDirection {
'asc' = 1, 'desc' = -1, 'nd' = 0
}
node started to give a very strange error:节点开始给出一个非常奇怪的错误:
[eslint] Node must be provided when reporting error if location is not provided
Occurred while linting /home/hvedrung/projects/table-component/src/types.ts:2
(the line 2 because code start from this line. If I remove comment in the line 1, error will refer to line 1. It don't like the types.ts at all) (第 2 行,因为代码从这一行开始。如果我删除第 1 行中的注释,错误将引用第 1 行。它根本不喜欢 types.ts)
If I remove enum error disappearing.如果我删除枚举错误消失。
What I've tried:我试过的:
With no any result.没有任何结果。
Had anybody seen such error?有人见过这样的错误吗? What am I doing wrong?
我究竟做错了什么?
Ok, I've solve the issue.好的,我已经解决了问题。 Just removed quotes in enum keys.
刚刚删除了枚举键中的引号。 I don't know why it works so.
我不知道为什么它会这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.