All checks have failed due to Warning: RequireJS failed. Use --force to continue

Viewed 297

I am not a regular developer.
All I wanted was to add a language translation to select2; translated the default src/js/select2/i18n/en.js file contents, created new file with changing labels from English to non-english.
Upon submitting the pull request, I see the All checks have failed and below the CI/Linting result:

Run grunt compile lint
Running "requirejs:dist" (requirejs) task
Error: ENOENT: no such file or directory, open
'/home/runner/work/select2/select2/src/js/select2/i18n/en.js'
In module tree:
select2/core
select2/options
select2/defaults
Warning: RequireJS failed. Use --force to continue.

Aborted due to warnings.
##[error]Process completed with exit code 6.

Same is the results with CI/Tests and CI/Minification. What needs to be done to get the translation file successfully merged.

1 Answers

The build of your first pull request failed as your commit had deleted the en.js file as mentioned in this PR comment. That is the error log that you have mentioned in this question of yours.

Your second pull request is failing due to the below mentioned reasons in the build log

Running "jshint:code" (jshint) task

   src/js/select2/i18n/te.js
     13 |                var message = overChars + ' అక్షరం తొలిగించండి';
                             ^ 'message' is already defined.
     16 |            return message;
                            ^ 'message' used out of scope.
     31 |                var message = 'మీరు ' + args.maximum + ' అంశాల్ని మాత్రమే ఎంచుకోగలరు';
                                                                                              ^ Line is too long.
     33 |                var message = 'మీరు ' + args.maximum + ' అంశాన్ని మాత్రమే ఎంచుకోగలరు';
                                                                                              ^ Line is too long.
     33 |                var message = 'మీరు ' + args.maximum + ' అంశాన్ని మాత్రమే ఎంచుకోగలరు';
                             ^ 'message' is already defined.
     36 |            return message;
                            ^ 'message' used out of scope.

>> 6 errors in 103 files

Wherever you see 'message' is already defined and 'message' used out of scope, it is due to incorrectly defining the message variable multiple times and using the variable outside its scope. The error Line is too long is due to the particular line exceeding the max limit per line set as part of the linting config.

Change your inputTooLong function to

   inputTooLong: function (args) {
        var overChars = args.input.length - args.maximum;
        var message = overChars;

        if (overChars != 1) {
            message += ' అక్షరాలు తొలిగించండి';
        } else {
            message += ' అక్షరం తొలిగించండి';
        }

        return message;
    }

And change your maximumSelected function to

   maximumSelected: function (args) {
        var message = 'మీరు ' + args.maximum;

        if (args.maximum != 1) {
            message += ' అంశాల్ని మాత్రమే ఎంచుకోగలరు';
        } else {
            message += ' అంశాన్ని మాత్రమే ఎంచుకోగలరు';
        }

        return message;
    }

You also have given more indentation than what's expected. Compare the file en.js in the repo with your changes and get rid of the extra indentation too accordingly.

Note: I would advise you to run the linting build on your local machine using the command grunt compile lint as specified in their GitHub action config, so that you can get to know of any errors before pushing your change to the GitHub repository.

Related