From a59a4e6e9217b3cc503c0a702b9e3b02b20b980d Mon Sep 17 00:00:00 2001 From: Milos Djermanovic Date: Sat, 2 Apr 2022 02:16:16 +0200 Subject: [PATCH] chore: replace `trimLeft`/`trimRight` with `trimStart`/`trimEnd` (#15750) --- lib/cli-engine/formatters/html.js | 6 +++--- lib/linter/apply-disable-directives.js | 2 +- messages/all-files-ignored.js | 2 +- messages/extend-config-missing.js | 2 +- messages/failed-to-read-json.js | 2 +- messages/file-not-found.js | 2 +- messages/no-config-found.js | 2 +- messages/plugin-invalid.js | 2 +- messages/plugin-missing.js | 2 +- messages/print-config-with-directory-path.js | 2 +- messages/whitespace-found.js | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/cli-engine/formatters/html.js b/lib/cli-engine/formatters/html.js index b6365997117..6e40bbe16b7 100644 --- a/lib/cli-engine/formatters/html.js +++ b/lib/cli-engine/formatters/html.js @@ -151,7 +151,7 @@ function pageTemplate(it) { -`.trimLeft(); +`.trimStart(); } /** @@ -222,7 +222,7 @@ function messageTemplate(it) { ${ruleId ? ruleId : ""} -`.trimLeft(); +`.trimStart(); } /** @@ -280,7 +280,7 @@ function resultTemplate(it) { ${encodeHTML(summary)} -`.trimLeft(); +`.trimStart(); } /** diff --git a/lib/linter/apply-disable-directives.js b/lib/linter/apply-disable-directives.js index f8e4aeedb29..459c8591196 100644 --- a/lib/linter/apply-disable-directives.js +++ b/lib/linter/apply-disable-directives.js @@ -66,7 +66,7 @@ function createIndividualDirectivesRemoval(directives, commentToken) { const listText = commentToken.value .slice(listStartOffset) // remove directive name and all whitespace before the list .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists - .trimRight(); // remove all whitespace after the list + .trimEnd(); // remove all whitespace after the list /* * We can assume that `listText` contains multiple elements. diff --git a/messages/all-files-ignored.js b/messages/all-files-ignored.js index d85828d36e7..70877a4d823 100644 --- a/messages/all-files-ignored.js +++ b/messages/all-files-ignored.js @@ -12,5 +12,5 @@ If you do want to lint these files, try the following solutions: * Check your .eslintignore file, or the eslintIgnore property in package.json, to ensure that the files are not configured to be ignored. * Explicitly list the files from this glob that you'd like to lint on the command-line, rather than providing a glob as an argument. -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/extend-config-missing.js b/messages/extend-config-missing.js index db8a5c64b9f..5b3498fcda4 100644 --- a/messages/extend-config-missing.js +++ b/messages/extend-config-missing.js @@ -9,5 +9,5 @@ ESLint couldn't find the config "${configName}" to extend from. Please check tha The config "${configName}" was referenced from the config file in "${importerName}". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/failed-to-read-json.js b/messages/failed-to-read-json.js index 5114de30980..e7c6cb58759 100644 --- a/messages/failed-to-read-json.js +++ b/messages/failed-to-read-json.js @@ -7,5 +7,5 @@ module.exports = function(it) { Failed to read JSON file at ${path}: ${message} -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/file-not-found.js b/messages/file-not-found.js index 26a5d57eff7..1a62fcf96b9 100644 --- a/messages/file-not-found.js +++ b/messages/file-not-found.js @@ -6,5 +6,5 @@ module.exports = function(it) { return ` No files matching the pattern "${pattern}"${globDisabled ? " (with disabling globs)" : ""} were found. Please check for typing mistakes in the pattern. -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/no-config-found.js b/messages/no-config-found.js index c2f7ac73b40..9860410a602 100644 --- a/messages/no-config-found.js +++ b/messages/no-config-found.js @@ -11,5 +11,5 @@ ESLint couldn't find a configuration file. To set up a configuration file for th ESLint looked for configuration files in ${directoryPath} and its ancestors. If it found none, it then looked in your home directory. If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat/help -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/plugin-invalid.js b/messages/plugin-invalid.js index 7913576f000..8b471d4a336 100644 --- a/messages/plugin-invalid.js +++ b/messages/plugin-invalid.js @@ -12,5 +12,5 @@ module.exports = function(it) { "${configName}" was referenced from the config file in "${importerName}". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/plugin-missing.js b/messages/plugin-missing.js index f58c78ceb38..0b7d34e3aa5 100644 --- a/messages/plugin-missing.js +++ b/messages/plugin-missing.js @@ -15,5 +15,5 @@ It's likely that the plugin isn't installed correctly. Try reinstalling by runni The plugin "${pluginName}" was referenced from the config file in "${importerName}". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/print-config-with-directory-path.js b/messages/print-config-with-directory-path.js index 6a5d571dd37..f65bdaaf770 100644 --- a/messages/print-config-with-directory-path.js +++ b/messages/print-config-with-directory-path.js @@ -4,5 +4,5 @@ module.exports = function() { return ` The '--print-config' CLI option requires a path to a source code file rather than a directory. See also: https://eslint.org/docs/user-guide/command-line-interface#--print-config -`.trimLeft(); +`.trimStart(); }; diff --git a/messages/whitespace-found.js b/messages/whitespace-found.js index 4ce49ca3a4e..8a801bcec6f 100644 --- a/messages/whitespace-found.js +++ b/messages/whitespace-found.js @@ -7,5 +7,5 @@ module.exports = function(it) { ESLint couldn't find the plugin "${pluginName}". because there is whitespace in the name. Please check your configuration and remove all whitespace from the plugin name. If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. -`.trimLeft(); +`.trimStart(); };