MiguelCastillo / Brackets-InteractiveLinter

Interactive linting for Brackets
Other
119 stars 26 forks source link

linting different file types #172

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi, I hope you will be able to help with the following. Currently I only installed interactive linter and tried to lint css, js, json, php and html.

css: I expect backgrund-color: aqua; to give me an error because there is a typo but instead the linter says there is no problem at all. The hinting/auto completion is working as expected.

js: I downloaded jshint because I saw others recommend it instead of the internal linter of brackets so from your experience which is better? jshint, jslint (a bit old), the internal js linter of brackets or maybe interactive linter has its own js linter?

json: Seems that interactive linter's for json do the job very well.

php: How can I activate the linter for php? I downloaded php 7.0.3 from here http://windows.php.net/download#php-7.0 (zip file) and php code sniffer from here: https://github.com/squizlabs/PHP_CodeSniffer . Is there a way to make them work with interactive linter?

html: something big like missing a '>' is caught by interactive linter but I hope to get an error even for typos like <div clas="ddd"> (for example) but in this case, I'm told that everything is OK. Is there a linter for this kind of errors?

Thanks!

ghost commented 8 years ago

Assuming this is still alive, I was able to use this linter with all file types except for PHP. I do see lint warnings in the panel at the bottom but not with he bulbs of interactive linter. Please advice.

MiguelCastillo commented 8 years ago

@Amosss perhaps you already found the information, but interactive linter allows you to configure different linters for JS. It has linters for the other languages you mentioned except for PHP. I have no current plans of adding PHP support, but I welcome PRs!

I use http://htmlhint.com/ for linting HTML, so I am limited to their capabilities. But is there another html linter written in JavaScript that would catch that clas is an error and that it should be class? I understand that class is the attribute you want, but clas is technically an ok attribute to use, so it is arguable that htmlhint should warn you.

jwestbrook commented 8 years ago

@MiguelCastillo I'm interested in writing the interface for the PHP linter, but I think that the Worker context doesn't allow me to pull in the child_process module to run the php -l shell command.

Do you have any suggestions on how to run a shell command inside the worker context?

MiguelCastillo commented 8 years ago

@jwestbrook Hi! That's great you are interested in writing a PHP integration. So, calling a child process is definitely one of the things I need to work through. Currently the way that Brackets handles this is not quite straight forward. The integration would need to go through a Node interface that executes the command for you. I need to do something like this in order to have better support for eslint... I have just not had much time to work on this project in a while. :/

There are two things that need to happen.

  1. The plugin system ought to be smart to conditionally load the plugin in a worker thread or via node
  2. Create a node bridge to be able to communicate and process messages from node

You can find some information for node integration with Brackets here. https://github.com/adobe/brackets/wiki/Brackets-Node-Process:-Overview-for-Developers

jwestbrook commented 8 years ago

@MiguelCastillo So it wouldn't be just writing the PHP plugin - it would be adding some architecture to how plugins are loaded as well.

I'll see what trouble I can get into, thanks!

MiguelCastillo commented 8 years ago

Yup. Nothing but fun! :D

MiguelCastillo commented 8 years ago

There is a plugin loader that can be leveraged. https://github.com/MiguelCastillo/Brackets-InteractiveLinter/blob/master/pluginLoader.js

We can leverage the load embedded plugin method to load the plugin. The plugin itself will need to be the bridge to node as described in the link above.

The only "architecture" thing would be to specify which plugins are loaded in the worker thread and which plugins are loaded as embedded. The rest is all plugin code.

MiguelCastillo commented 8 years ago

More info. The plugin manager loads the plugins so that's probably where we can add a way to load plugins one way or the other. https://github.com/MiguelCastillo/Brackets-InteractiveLinter/blob/master/pluginManager.js#L46

I am actually thinking that embedded plugins and worker thread plugins are simply placed in under new directories "embedded" and "threaded"... By convention, the plugin manager will load them accordingly. I think that would work nicely.

ghost commented 7 years ago

I stumble upon this one, since I'm also looking for phpCS support. At the moment It's not possible for me to pick this up. But I will follow up as soon as I can dedicate some time to it.