Kaynağa Gözat

chore: Fix a couple of regex related eslint issues

/puter/packages/phoenix/src/puter-shell/providers/ScriptCommandProvider.js
  27:38  error  Unnecessary escape character: \/  no-useless-escape

/puter/packages/phoenix/src/util/wrap-text.js
  24:33  error  Unexpected control character(s) in regular expression: \x1b  no-control-regex
Sam Atkins 1 yıl önce
ebeveyn
işleme
96e9c154bd

+ 1 - 1
packages/phoenix/src/puter-shell/providers/ScriptCommandProvider.js

@@ -24,7 +24,7 @@ export class ScriptCommandProvider {
     async lookup (id, { ctx }) {
         const { filesystem } = ctx.platform;
 
-        const is_path = id.match(/^[.\/]/);
+        const is_path = id.match(/^[./]/);
         if ( ! is_path ) return undefined;
 
         const absPath = resolveRelativePath(ctx.vars, id);

+ 2 - 0
packages/phoenix/src/util/wrap-text.js

@@ -16,6 +16,8 @@
  * You should have received a copy of the GNU Affero General Public License
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  */
+/* eslint-disable no-control-regex */
+
 export function lengthIgnoringEscapes(text) {
     const escape = '\x1b';
     // There are a lot of different ones, but we only use graphics-mode ones, so only parse those for now.