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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | coder-javascript_generic_constants-3309040-2.patch | 685 bytes | chris--s |
Issue fork coder-3309040
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:
- 3309040-javascript-true-false
changes, plain diff MR !19
Comments
Comment #3
chris--s commentedPatch per code changes in #2
Comment #4
chris--s commentedComment #5
klausiSorry, Javascript support has been removed from Coder. To check and fix Javascript files please use ESLint and see the Drupal ESLint documentation.