From 3ad5e4d6e04634dc0d68c7c9ea3ec20fafc470b6 Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 31 Aug 2021 11:52:47 -0600 Subject: [PATCH] Stop checking for `-` in component file names This restriction was lifted a long time ago, and is particularly out of step with Glimmer component usage. --- app/mixins/files.js | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/app/mixins/files.js b/app/mixins/files.js index 808cdce1..0a19c3e8 100644 --- a/app/mixins/files.js +++ b/app/mixins/files.js @@ -1,6 +1,5 @@ import Mixin from '@ember/object/mixin'; import { run } from '@ember/runloop'; -import ErrorMessages from "../utils/error-messages"; import { pushDeletion } from "../utils/push-deletion"; export default Mixin.create({ @@ -32,23 +31,6 @@ export default Mixin.create({ } }, - /* - * Test whether path is valid. Presently only tests whether components are hyphenated. - */ - isPathInvalid(type, path){ - let errorMsg = null; - if (/^component/.test(type)) { - if (!/[^/]+-[^/]+(\/(component\.js|template\.hbs))?$/.test(path)) { - errorMsg = ErrorMessages.componentsNeedHyphens; - } - } - if (errorMsg) { - window.alert(errorMsg); - return true; - } - return false; - }, - updateOpenFiles() { const columns = this.columns; const fileNames = columns.map(column => column.get('file.fileName')); @@ -83,7 +65,7 @@ export default Mixin.create({ if (['twiddle.json','router', 'css'].indexOf(type)===-1) { filePath = prompt('File path', filePath); } - if (!isGlimmer && this.isPathInvalid(type, filePath)) { + if (!isGlimmer) { return; } this.createFile(filePath, fileProperties); @@ -125,7 +107,7 @@ export default Mixin.create({ let isGlimmer = await this.emberCli.twiddleJson.hasAddon(this.model, '@glimmer/component'); - if (!isGlimmer && this.isPathInvalid('component', path)) { + if (!isGlimmer) { return; } @@ -160,9 +142,6 @@ export default Mixin.create({ camelizedModuleName: name }); - if (this.isPathInvalid(type, filePath)) { - return; - } this.createFile(filePath, fileProperties); } });