39

PHPCS is checking my JS files on PhpStorm,

I need to disable this feature

I added this line in the file phpcs.xml.dist but no luck

<exclude-pattern>*\.(inc|css|js)</exclude-pattern>

2 Answers 2

83

Finally found it, I had to disable some extensions in PhpStorm config
File | Settings | Editor | Inspections > PHP Code Sniffer Validation
Or search:
PHP Code Sniffer Validation
or
PHP_CodeSniffer validation

enter image description here

There is a related bug though
https://youtrack.jetbrains.com/issue/WI-44308

Sign up to request clarification or add additional context in comments.

3 Comments

I found that setting too, but PHPCS still inspects my .js files. Did you do anything else? Do you still have that exclude line in your phpcs.xml.dist?
I didn't do any additional steps, the line has no effect as far as my tests go. Maybe it's a bug on your phpstorm version. I have 2018.3.2 currently
I encountered the same issue on another machine but I solved it by updating phpcs. sudo composer global require "squizlabs/php_codesniffer=*"
10

Update for newest PhpStorm (2022.3).

The location to change the checked files is now under File | Settings | PHP | Quality Tools and select PHP_CodeSniffer or search for PHP_CodeSniffer

There is not checkbox anymore, it is now a text input with file extensions separated by commas. In the screenshot I removed js and css extensions which are there by default.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.