PhpStorm: How to disable PHPCS for Javascript
Asked Answered
C

2

36

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>
Cheat answered 23/11, 2018 at 21:39 Comment(0)
A
5

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

Anastasio answered 18/12, 2022 at 3:34 Comment(0)
C
81

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

Cheat answered 24/11, 2018 at 11:28 Comment(3)
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?Damondamour
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 currentlyCheat
I encountered the same issue on another machine but I solved it by updating phpcs. sudo composer global require "squizlabs/php_codesniffer=*"Cheat
A
5

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

Anastasio answered 18/12, 2022 at 3:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.