Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upHow to check code inside php files? #965
Comments
This comment has been minimized.
This comment has been minimized.
|
Not sure, but I would broaden the search to see if anyone has gotten eslint looking inside PHP files. |
This comment has been minimized.
This comment has been minimized.
|
Yes, I see there are overlapping responsibilities with this use case and it is not totally clear where it should be handled - why should a JS linter take care of PHP tags? Also PHP tags in JS are simply syntax errors, so eslint does the right thing to report them as syntax errors. But fixing things is sometimes done in situations where people did not care about standards or even correct syntax (unfortunately), so I feel like a solution for this kind of problem might have a place here, but I am not sure - I am just asking, not arguing. I just found eslint-plugin-exclude-php-tags and will try to use this with Otherwise I will try some |
This comment has been minimized.
This comment has been minimized.
|
Unfortunately you might have to put a custom eslint stack together, using the shareable configs directly. But yeah, if you find a way to do it we could add it to the FAQ. |
This comment has been minimized.
This comment has been minimized.
|
I think @bcomnes is right; This will need to be done with eslint directly (with I'm closing this issue for now. If you have questions on or need further advice please feel free to reply to the thread! |
wowcut commentedAug 7, 2017
I found the hint about
eslint-plugin-htmlin the readme, however I would like to check code inside some php files and did not find anything similar - usingeslint-plugin-htmldoes not work for php files, it unfortunately produces parsing errors.Yes, I know JS in PHP files is a very bad practice - this is a legacy code base and that is why I would love to fix all the JS inside all files with
standard --fix *.php.