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

Add support for decorators #40

Merged
merged 1 commit into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
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
12 changes: 12 additions & 0 deletions __snapshots__/test.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test Fixtures decorators 1`] = `
"[1/4] 🔍 Finding JS and HBS files...
[2/4] 🔍 Searching for translations keys in JS and HBS files...
[3/4] ⚙️ Checking for unused translations...
[4/4] ⚙️ Checking for missing translations...

👏 No unused translations were found!

👏 No missing translations were found!
"
`;

exports[`Test Fixtures emblem 1`] = `
"[1/4] 🔍 Finding JS and HBS files...
[2/4] 🔍 Searching for translations keys in JS and HBS files...
Expand Down
8 changes: 8 additions & 0 deletions fixtures/decorators/app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Controller from '@ember/controller';

export default class extends Controller {
@computed('intl.locale')
get foo() {
return this.intl.t('js-translation');
}
}
3 changes: 3 additions & 0 deletions fixtures/decorators/translations/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"js-translation": "JS!"
}
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async function analyzeJsFile(content) {
// parse the JS file
let ast = BabelParser.parse(content, {
sourceType: 'module',
plugins: ['dynamicImport'],
plugins: ['decorators-legacy', 'dynamicImport'],
});

// find translation keys in the syntax tree
Expand Down