Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop checking for - in component file names #752

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 2 additions & 23 deletions app/mixins/files.js
Original file line number Diff line number Diff line change
@@ -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({
Expand Down Expand Up @@ -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'));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -160,9 +142,6 @@ export default Mixin.create({
camelizedModuleName: name
});

if (this.isPathInvalid(type, filePath)) {
return;
}
this.createFile(filePath, fileProperties);
}
});