How to ignore node shebang error in Eclipse?

前端 未结 2 1864
遥遥无期
遥遥无期 2020-12-15 05:11

I am writing some node command line utilities. They all start with the line:

#!/usr/bin/env node

With Eclipse Juno and the Nodeclipse Node

2条回答
  •  心在旅途
    2020-12-15 05:37

    There are 2 option for JavaScript validation in Eclipse:

    • JSDT
    • JSHint (default since Nodeclipse 0.7)

    As configration is stored per project, copy .* settings files from project created with 0.7 or re-configure it manually (just compare .* files with newly created project). Then put .jshintrc file like https://github.com/Nodeclipse/nodeclipse-1/blob/master/org.nodeclipse.ui/templates/.jshintrc

    Try to check JSHint options, if it is possible.

    Note that with JSHint usage, ~~this question becomes general JSHint question (not Eclipse or Nodeclipse related).~~

    UPDATE:

    .project content since 0.7 :

    
    
        ProjectName
        
        
        
        
            
                com.eclipsesource.jshint.ui.builder
                
                
            
        
        
            org.nodeclipse.ui.NodeNature
            org.eclipse.wst.jsdt.core.jsNature
        
    
    

    As @Jess discovered this was error shown by JSDT, not JSHInt, so removing org.eclipse.wst.jsdt.core.jsNature will stop JSDT from displaying it (even with JavaScript semantic validation already turned off since 0.7)

    UPDATE 3:

    Drawback of org.eclipse.wst.jsdt.core.jsNature removed will be that code assist and click-though to definition will not work (It actually works in rare cases when JSDocs are defined e.g. http://www.nodeclipse.org/nodejs/javascript/sources/books/2013/10/22/JSDT-require-JSDoc.html or within 1 .js file)

    JSDoc support

    Even click-through to definition click-through to definition

提交回复
热议问题