wp-cli / i18n-command

Provides internationalization tools for WordPress projects.
MIT License
96 stars 52 forks source link

Cannot parse JS file - Invalid exponential notation #277

Closed vkurko closed 3 years ago

vkurko commented 3 years ago

Bug Report

Describe the current, buggy behavior

The wp i18n make-pot fails to parse a JS file with the following content (simplified):

8e-5.toFixed(3)

The result is:

Debug (make-pot): Could not parse file test.js: Invalid exponential notation (line 1, column 5) (0.097s)

Describe how other contributors can replicate this bug

Create a test.js file with the mentioned content inside a WordPress plugin and run wp i18n make-pot.

Describe what you would expect as the correct outcome

The file is parsed and processed by the wp i18n command.

Let us know what environment you are running this on

$ wp --info

OS:     Linux 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64
Shell:  /bin/bash
PHP binary:     /usr/bin/php7.4
PHP version:    7.4.3
php.ini used:   /etc/php/7.4/cli/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
SQL modes:      
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /home/xxx/xxx
WP-CLI packages dir:    /home/xxx/.wp-cli/packages/
WP-CLI global config:   
WP-CLI project config:  
WP-CLI version: 2.5.1-alpha-632cc05

$ wp package list

+---------------------+-----------------+------------+-----------+----------------+
| name                | authors         | version    | update    | update_version |
+---------------------+-----------------+------------+-----------+----------------+
| wp-cli/i18n-command | Pascal Birchler | dev-master | available | 2.x-dev        |
+---------------------+-----------------+------------+-----------+----------------+
swissspidy commented 3 years ago

Confirmed and reported upstream: https://github.com/mck89/peast/issues/40

swissspidy commented 3 years ago

This was now fixed upstream.

It will be resolved in WP-CLI with the next dependency updates.