You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Getting false errors on JavaScript files within template literals that have operator characters. The false sniffs include:
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore
Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
Squiz.Formatting.OperatorBracket.MissingBrackets
Code sample
`foo/bar`;`foo-bar`;`foo+bar`;`foo%bar`;
To reproduce
Steps to reproduce the behavior:
Create a file called test.js with the code sample above.
Run ./vendor/bin/phpcs test.js --standard=Squiz
See many incorrect errors displayed
----------------------------------------------------------------------
FOUND 12 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
1 | ERROR | [ ] Missing file doc comment
1 | ERROR | [x] Operation must be bracketed
1 | ERROR | [x] Expected 1 space before "/"; 0 found
1 | ERROR | [x] Expected 1 space after "/"; 0 found
2 | ERROR | [x] Operation must be bracketed
2 | ERROR | [x] Expected 1 space before "-"; 0 found
2 | ERROR | [x] Expected 1 space after "-"; 0 found
3 | ERROR | [x] Expected 1 space before "+"; 0 found
3 | ERROR | [x] Expected 1 space after "+"; 0 found
4 | ERROR | [x] Operation must be bracketed
4 | ERROR | [x] Expected 1 space before "%"; 0 found
4 | ERROR | [x] Expected 1 space after "%"; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 11 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Expected behavior
No errors from:
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore
Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
Squiz.Formatting.OperatorBracket.MissingBrackets
Versions:
OS: Ubuntu 18.04
PHP: 7.4
PHPCS: 3.6.1
Standard: Squiz
The text was updated successfully, but these errors were encountered:
The ability to sniff JS and CSS files is deprecated. All JS functionality will be removed in version 4 and no bugs will be fixed in version 3. I strongly suggest switching to a dedicated JS linting tool like eslint.
Describe the bug
Getting false errors on JavaScript files within template literals that have operator characters. The false sniffs include:
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore
Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
Squiz.Formatting.OperatorBracket.MissingBrackets
Code sample
To reproduce
Steps to reproduce the behavior:
test.js
with the code sample above../vendor/bin/phpcs test.js --standard=Squiz
Expected behavior
No errors from:
Squiz.WhiteSpace.OperatorSpacing.NoSpaceBefore
Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter
Squiz.Formatting.OperatorBracket.MissingBrackets
Versions:
The text was updated successfully, but these errors were encountered: