A
A
Andrey Titov2018-07-17 18:40:03
PHP
Andrey Titov, 2018-07-17 18:40:03

How to properly configure phpcs to work with WordPress in Visual Code?

An error appears in the editor:

phpcs: Referenced sniff "PHPCompatibility" does not exist

Add-on for phpcs installed:
$ phpcs -i
The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz, Zend, WordPress, WordPress-Core, WordPress-Docs, WordPress-Extra and WordPress-VIP

In the VC parameters it is written:
"phpcs.standard": "WordPress",
What and how else do you need to configure?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2019-03-28
@Liman

Install PHPCompatibility

D
Denis Kirilyuk, 2020-04-08
@denkiril

I installed and added PHPCompatibility to CodeSniffer.conf. After that, the phpcs plugin started swearing that "Referenced sniff "PHPCompatibility.PHP.RemovedExtensions" does not exist"...
I spent the whole day on this, but then I found the phpcs.xml file in my theme, made on the basis of underscores. dist - in which this deprecated PHP.RemovedExtensions was. I deleted the phpcs.xml.dist file from the theme folder - the plugin stopped swearing, validation worked as it should.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question