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.

Issue fork coder-3309040

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Chris--S created an issue. See original summary.

chris--s’s picture

Patch per code changes in #2

chris--s’s picture

Status: Active » Needs review
klausi’s picture

Status: Needs review » Closed (won't fix)

Sorry, Javascript support has been removed from Coder. To check and fix Javascript files please use ESLint and see the Drupal ESLint documentation.