Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sniffer for other file extensions #109

Closed
farhadsakhaei opened this issue Feb 21, 2024 · 11 comments
Closed

Sniffer for other file extensions #109

farhadsakhaei opened this issue Feb 21, 2024 · 11 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@farhadsakhaei
Copy link

Hi,
How can I enable sniffer for other file extensions?
like CSS and JS files?

Thank you

@valeryan
Copy link
Owner

Do your CSS and JS files have PHP in them? I don't think phpcs or phpcbf has any concept of scanning non-PHP files.

@farhadsakhaei
Copy link
Author

@valeryan
Yes, They do
Some sniffers perform CSS , JS and other files analysis

@valeryan
Copy link
Owner

Do you have a document source for what you are talking about? I don't see anything in the documentation for PHPcs doing anything for css or js.

I feel like you may be confused about what this extension does. It's not a general sniffer it's a wrapper for phpcs and phpcbf

@farhadsakhaei
Copy link
Author

farhadsakhaei commented Feb 24, 2024

@valeryan
Yes, I am doing this everyday, actually I found another extension that it do that
Actually WordPress coding standard do this too for CSS files and JS files too

@valeryan
Copy link
Owner

I can look into it but ultimately this is a php tool and the concept of using it for css or js is weird to me and I think it would be better to use something specialized in those file types like prettier and eslint.

@farhadsakhaei
Copy link
Author

Some projects have their own standards for any file type
So they apply such standards, like WordPress

@valeryan
Copy link
Owner

Yeah, but PHPcs does not lint the files it just passes the standards definitions to another tool such as csslint. https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-path-to-csslint

That will require some development of new configuration, detection and tooling to support. If one of the other maintainers wants to pick up and support this it might get added. Currently I am not looking to do more than maintain this extension with bug or security fixes.

@farhadsakhaei
Copy link
Author

farhadsakhaei commented Feb 24, 2024

@valeryan
BTW, Thank you for your development

I currently resolved that with the extension:
https://marketplace.visualstudio.com/items?itemName=wongjn.php-sniffer

phpSniffer.extraFiles: Glob patterns of extra files to match that this extension should run on. Useful for standards that don't just validate PHP files. This extension will always run on PHP files — be sure to have your files.associations setting correctly setup for PHP files.

@valeryan valeryan added the enhancement New feature or request label Feb 27, 2024
@valeryan
Copy link
Owner

valeryan commented Feb 28, 2024

I am familiar with wongjin's extension. I went and found where the generic files support was added. here is the commit for reference: wongjn/vscode-php-sniffer@89ddc08. We should be able to adapt the concept into this extension but I can't give you anything close to a timeline.

@jonathanbossenger
Copy link
Collaborator

@valeryan it's worth noting that PHPCS has deprecated and will eventually drop support for any JS and CSS sniffs.

Relevant links

Therefore it's probably not worth adding support for something that will not be supported in newer PHPCS versions.

@valeryan valeryan added the wontfix This will not be worked on label Feb 29, 2024
@valeryan
Copy link
Owner

@jonathanbossenger thanks for researching that for us. Given that the feature is on the way out/gone I am closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants