@@ -12,19 +12,47 @@ module.exports = {
1212
1313 availableOptions : [ ] ,
1414
15- run ( ) {
15+ appRoot ( ) {
16+ let project = this . project ;
17+
18+ if ( project . isEmberCLIAddon ( ) ) {
19+ return 'addon' ;
20+ } else if ( project . isModuleUnification ( ) ) {
21+ return 'src' ;
22+ } else {
23+ return 'app' ;
24+ }
25+ } ,
26+
27+ _scanForHbsFiles ( dir ) {
28+ return walkSync ( dir , { globs : [ '**/*.hbs' ] } ) ;
29+ } ,
30+
31+ getTemplateFiles ( ) {
1632 let project = this . project ;
17- let modulePrefix = project . config ( ) . modulePrefix ;
33+ let appRoot = this . appRoot ( ) ;
34+
35+ if ( project . isEmberCLIAddon ( ) ) {
36+ let files = this . _scanForHbsFiles ( appRoot ) ;
37+ let moreFiles = this . _scanForHbsFiles ( 'tests/dummy/app' ) ;
38+
39+ return files . concat ( moreFiles ) ;
40+ } else if ( project . isModuleUnification ( ) ) {
41+ return this . _scanForHbsFiles ( appRoot ) ;
42+ } else {
43+ return this . _scanForHbsFiles ( appRoot ) ;
44+ }
45+ } ,
46+
47+ run ( ) {
48+ let appRoot = this . appRoot ( ) ;
49+ let modulePrefix = this . project . config ( ) . modulePrefix ;
1850 let linter = new Linter ( ) ;
1951 let templatesWithErrors = [ ] ;
20-
21- let templateFiles = walkSync ( 'app' ) . filter ( file => {
22- // remove any non-hbs files
23- return path . extname ( file ) === '.hbs' ;
24- } ) ;
52+ let templateFiles = this . getTemplateFiles ( ) ;
2553
2654 templateFiles . forEach ( file => {
27- let filePath = path . join ( 'app' , file ) ;
55+ let filePath = path . join ( appRoot , file ) ;
2856 let contents = fs . readFileSync ( filePath , { encoding : 'utf8' } ) ;
2957 let moduleId = path . join ( modulePrefix , file ) . slice ( 0 , - 4 ) ;
3058
0 commit comments