javascript true, false & null reported as sniff violations

Created on 10 September 2022, almost 2 years ago
Updated 2 April 2023, about 1 year ago

Problem/Motivation

phpcs using drupal ruleset reports use of valid javascript constants, true|false|null as sniff violations. Javascript is case sensitive so true|false|null are the only valid uses of these constants

Steps to reproduce

1. Have a javascript file which includes one or more uses of the generic javascript constants, true|false|null, as part of some Drupal code, e.g. an example module.

2. Run phpcs --standard=Drupal example.module

3. Each use of true, false or null in the javascript file will be reported as a sniff violation

Proposed resolution

Exclude javascript files files from the rule, Generic.PHP.UpperCaseConstant
Add Generic.PHP.LowerCaseConstant rule for javascript files.

πŸ› Bug report
Status

Closed: won't fix

Version

8.3

Component

Coder Sniffer

Created by

πŸ‡¬πŸ‡§United Kingdom Chris--S

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024