关于vue告警:Missing space before function parentheses

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/dreamstone_xiaoqw/article/details/90453318

vscode环境开发vue-cli脚手架工程,eslint规范检查工具告警笔记

告警

告警内容:

✘  http://eslint.org/docs/rules/space-before-function-paren  Missing space before function parentheses
  src\components\question.vue:70:10
    mounted() {
            ^

这行警告的关键信息:

Missing space before function parentheses

百度翻译如下:

函数括号前缺少空格

用代码来说明,即:将

    mounted() {
            ^

修改为

    mounted () {
            ^

即可。(vscode邮件自动格式化很方便)

官网指南

eslint官网关于此问题的链接:http://eslint.org/docs/rules/space-before-function-paren

不同类型的函数,可单独配置是否加空格

比如官网示例配置:

{"anonymous": "always", "named": "never", "asyncArrow": "always"}

示例代码

/*eslint space-before-function-paren: ["error", {"anonymous": "always", "named": "never", "asyncArrow": "always"}]*/
/*eslint-env es6*/

function foo() {
    // ...
}

var bar = function () {
    // ...
};

class Foo {
    constructor() {
        // ...
    }
}

var foo = {
    bar() {
        // ...
    }
};

var foo = async (a) => await a

小编向来懒惰,改配置麻烦,还是改改习惯凑合用吧。

展开阅读全文

missing ';' before identifier 'm_prop2'

06-22

#if !defined(AFX_PROPSHEET_H__5B2D3A30_DDC2_472E_895E_E9BC0C6F0DE2__INCLUDED_)rn#define AFX_PROPSHEET_H__5B2D3A30_DDC2_472E_895E_E9BC0C6F0DE2__INCLUDED_rnrn#if _MSC_VER > 1000rn#pragma oncern#endif // _MSC_VER > 1000rn// PropSheet.h : header filern//rn#include"Prop1.h"rn#include"Prop2.h"rn#include"Prop3.h"rn#include"Prop4.h"rn/////////////////////////////////////////////////////////////////////////////rn// CPropSheetrnrnclass CPropSheet : public CPropertySheetrnrn DECLARE_DYNAMIC(CPropSheet)rnrn// Constructionrnpublic:rn CPropSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);rn CPropSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);rnrn// Attributesrnpublic:rnrn// Operationsrnpublic:rnCProp1 m_prop1;rnCProp2 m_prop2;// missing ';' before identifier 'm_prop2'CProp3 m_prop3;rnCProp4 m_prop4;rnrn// Overridesrn // ClassWizard generated virtual function overridesrn //AFX_VIRTUAL(CPropSheet)rn //AFX_VIRTUALrnrn// Implementationrnpublic:rn virtual ~CPropSheet();rnrn // Generated message map functionsrnprotected:rn //AFX_MSG(CPropSheet)rn // NOTE - the ClassWizard will add and remove member functions here.rn //AFX_MSGrn DECLARE_MESSAGE_MAP()rn;rnrn/////////////////////////////////////////////////////////////////////////////rnrn//AFX_INSERT_LOCATIONrn// Microsoft Visual C++ will insert additional declarations immediately before the previous line.rnrn#endif // !defined(AFX_PROPSHEET_H__5B2D3A30_DDC2_472E_895E_E9BC0C6F0DE2__INCLUDED_) 论坛

syntax error : missing ';' before '<'

09-07

代码如下:rn错误:syntax error : missing ';' before '<'rn原工程是vs2005的,我在vc6.0下编译有误。如题所示。求指点。rn[code=C/C++]#pragma oncernrnrnclass CListCtrl_Column_Picker : public CListCtrlrnrn struct ColumnStatern rn ColumnState()rn :m_Visible(false)rn ,m_OrgWidth(0)rn ,m_OrgPosition(-1)rn rn bool m_Visible;rn int m_OrgWidth; // Width it had before being hiddenrn int m_OrgPosition; // Position it had before being hiddenrn ;rn CSimpleArray m_ColumnStates;//error here,提示这里错误如题rn int GetColumnStateCount();rn void InsertColumnState(int nCol, bool bVisible, int nOrgWidth = 0);rn void DeleteColumnState(int nCol);rn ColumnState& GetColumnState(int nCol);rn rn DECLARE_MESSAGE_MAP()rn rn virtual afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);rn virtual afx_msg LRESULT OnDeleteColumn(WPARAM wParam, LPARAM lParam);rn virtual afx_msg LRESULT OnInsertColumn(WPARAM wParam, LPARAM lParam);rn virtual afx_msg LRESULT OnSetColumnWidth(WPARAM wParam, LPARAM lParam);rn virtual afx_msg BOOL OnHeaderBeginResize(UINT id, NMHDR* pNmhdr, LRESULT* pResult);rn virtual afx_msg BOOL OnHeaderEndDrag(UINT id, NMHDR* pNmhdr, LRESULT* pResult);rn virtual afx_msg void OnContextMenu(CWnd*, CPoint point);rn virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);rn rn virtual void PreSubclassWindow();rn rn public:rn bool IsColumnVisible(int nCol);rn int GetFirstVisibleColumn();rn BOOL ShowColumn(int nCol, bool bShow);rn BOOL SetColumnWidthAuto(int nCol = -1, bool includeHeader = false);rn;[/code] 论坛

error C129: missing ';' before ''

08-25

Build target 'Target 1'rnassembling STARTUP.A51...rncompiling main.c...rncompiling delay.c...rncompiling settingtime.c...rncompiling VTK_dis_zhuantai.c...rncompiling dht11.c...rncompiling app.c...rnAPP.C(9): error C129: missing ';' before ''rnTarget not createdrnrnrn找不到哪里出了错rnrnrnrn#include"app.h"rninclude"reg52.h"rn//#include"gsm.h"rn//#include"delay.h"rnrnrnrn//static void gpio_init(void);rnvoid timer0_init(void); //问题就在这里rnvoid com_init(void);rnvoid interrupt_init(void);rnvoid timer2_init(void);rn//static void CNMIinit(void); rnrnrnrnvoid hardware_init(void)rnrn //gpio_init();rn timer0_init();rn com_init();rn interrupt_init();rn timer2_init();rn //CNMIinit(); rnrnrnvoid timer0_init(void)rnrn TH0=(unsigned char)((65536-50000)>>8);rn TH0=(unsigned char)(65536-50000);rn TMOD|=0X01;rn TR0=1;rn ET0=1;rn //EA=1;rnrnrnrnvoid com_init(void)rnrn SCON = 0x50;//方式1,允许接收 rn TMOD |= 0x20; //T1作波特率发生器,工作方式2rn //PCON = 0x80;//设定波特率,11.0592MHz,19200bpsrn TH1 = 0xfd;//rn TL1 = 0xfd;//rn TR1 = 1;//启动T1rn // EA = 0; //关中断rn // ES = 0; //关串行接口中断rnrnrnrnvoid timer2_init(void)rnrn EXF2=0; /* reset flag 定时器2外部标志位清除*/rn rn TCLK=0;RCLK=0; /* disable baud rate generator 不用于波特率发生器*/rn rn EXEN2=0; /* ignore events on T2EX 视T2EX(P1.1)端信号无效*/rn rn TH2=0xd8; /* Init msb_value 填入初始化值*/rn rn TL2=0xf0; /* Init lsb_value */rn rn RCAP2H=0xd8; /* reload msb_value重载值 */rn rn RCAP2L=0xf0; /* reload lsb_value */rn rn C_T2=0; /* timer mode 定时模式*/rn rn CP_RL2=0; /* reload mode 重载模式*/rn rn ET2=1; /* enable timer2 interrupt 允许T2中断*/rn rn TR2=1; /* timer2 run 开始计时*/rnrnrnrnvoid interrupt_init(void)rnrn EA=1;rnrn 论坛

missing ';' before identifier 'LRESULT'

04-12

#include rn#include "sysmets.h"rn;rnLRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);rnrnint WINAPI WinMain(HINSTANCE hInstance ,HINSTANCE hPrevInstance,PSTR szCmdLine,int iCmdShow)rnrn static TCHAR szAppName[]=TEXT("Sysmets1");rn HWND hwnd;rn MSG msg;rn WNDCLASS wndclass;rn rn rn wndclass.style =CS_HREDRAW | CS_VREDRAW;rn wndclass.lpfnWndProc=WndProc;rn wndclass.cbClsExtra=0;rn wndclass.cbWndExtra=0;rn wndclass.hInstance=hInstance;rn wndclass.hIcon=LoadCursor (NULL,IDC_ARROW);rn wndclass.hCursor=LoadCursor(NULL,IDC_ARROW);rn wndclass.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);rn wndclass.lpszMenuName=NULL;rn wndclass.lpszClassName=szAppName;rn rn if(!RegisterClass(&wndclass))rn rn MessageBox(NULL,TEXT("This progam requires Windows NT"),rn szAppName,MB_ICONERROR);rn return 0;rn rn rn rn hwnd=CreateWindow(szAppName,TEXT("Get System Metrics No.1"),rn WS_OVERLAPPEDWINDOW,rn CW_USEDEFAULT,CW_USEDEFAULT,rn CW_USEDEFAULT,CW_USEDEFAULT,rn NULL,NULL,hInstance,NULL);rn rn ShowWindow(hwnd,iCmdShow);rn UpdateWindow(hwnd);rn rn while(GetMessage(&msg,NULL,0,0))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rn rn return msg.wParam;rnrn rn rnLRESULT CALLBACK WndProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)rnrn static int cxChar,cxCaps,cyChar;rn HDC hdc;rn int i;rn PAINTSTRUCT ps;rn TCHAR szBuffer[10];rn TEXTMETRIC tm;rn rn rn switch (message)rn rn case WM_CREATE:rn hdc=GetDC(hwnd);rn rn GetTextMetrics(hdc,&tm);rn cxChar=tm.tmAveCharWidth;rn cxCaps=(tm.tmPitchAndFamily & 1?3:2)*cxChar/2;rn cyChar=tm.tmHeight+tm.tmExternalLeading;rn ReleaseDC(hwnd,hdc);rn return 0;rn rn case WM_PAINT:rn hdc=BeginPaint(hwnd,&ps);rn rn for(i=0;irn#include "sysmets.h"rn;rnLRESULT CALLBACK WndProc (HWND,UINT,WPARAM,LPARAM);rnrn为什么我一少了LRESULT前面的分号 就会报错missing ';' before identifier 'LRESULT'rn请大侠指点rn rn 论坛

没有更多推荐了,返回首页