HaxeCheckstyle / haxe-checkstyle

Haxe Checkstyle
http://haxecheckstyle.github.io/docs
MIT License
124 stars 27 forks source link

UnusedImport: take imports.hx into account #189

Open Gama11 opened 8 years ago

Gama11 commented 8 years ago

See http://haxe.org/blog/importhx-intro.

This probably requires a haxeVersion to be added to the config, so you don't get unnecessary warnings if you're targetting older Haxe versions?

AlexHaxe commented 8 years ago

Regular Haxe files should start with an upper case letter, so UnusedImportCheck can just skip performing checks on import.hx files, regardless of Haxe version.

Since import.hx applies to all files in a folder, it's hard to find unused imports, unless UnusedImportCheck has a special mode for import.hx files, where it checks imports against all files from the same folder.

Detecting duplicate imports might be possible, if UnusedImportCheck populates seenModules from import.hx before checking a file.

Gama11 commented 8 years ago

Hm.. I brought up the Haxe version thing to have a way of avoiding false positives, but I suppose if you have files named import.hx, it's pretty safe to assume are you're using Haxe 3.3.0+. :)