Skip to content

Commit 9dc7427

Browse files
committed
Cleanup
1 parent 0b0226a commit 9dc7427

File tree

6 files changed

+6
-30
lines changed

6 files changed

+6
-30
lines changed

lib/__tests__/find-properties.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {
66
findAttributeBindings,
77
findClassNames,
88
findClassNameBindings,
9-
} = require('../utils');
9+
} = require('../utils/classic');
1010

1111
describe('findTagName()', () => {
1212
const TESTS = [

lib/transform/classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const {
1111
findAriaRole,
1212
isMethod,
1313
isProperty,
14-
} = require('../utils');
14+
} = require('../utils/classic');
1515

1616
const EVENT_HANDLER_METHODS = [
1717
// Touch events

lib/transform/native.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ const {
77
addClassDecorator,
88
findTagName,
99
findElementId,
10-
findDecorator,
1110
findClassNames,
1211
findClassNameBindings,
1312
findAttributeBindings,
1413
isMethod,
1514
removeDecorator,
1615
ensureImport,
17-
removeImport,
1816
isProperty,
1917
} = require('../utils/native');
2018

lib/transform/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { indentLines } = require('../utils');
1+
const { indentLines } = require('../utils/classic');
22

33
const templateRecast = require('ember-template-recast');
44

lib/utils.js renamed to lib/utils/classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const j = require('jscodeshift').withParser('ts');
22

3-
const SilentError = require('./silent-error');
3+
const SilentError = require('../silent-error');
44

55
function isProperty(path, name) {
66
let node = path.value;

lib/utils/native.js

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,8 @@ function findTagName(path) {
7878
return findStringDecorator(path, 'tagName', 'div');
7979
}
8080

81-
function findElementId(properties) {
82-
return findStringProperty(properties, 'elementId');
83-
}
84-
85-
function findStringArrayProperties(properties, name) {
86-
let propertyPath = properties.filter(path => isProperty(path, name))[0];
87-
if (!propertyPath) {
88-
return [];
89-
}
90-
91-
let arrayPath = propertyPath.get('value');
92-
if (arrayPath.value.type !== 'ArrayExpression') {
93-
throw new SilentError(`Unexpected \`${name}\` value: ${j(arrayPath).toSource()}`);
94-
}
95-
96-
return arrayPath.get('elements').value.map(element => {
97-
if (element.type !== 'StringLiteral') {
98-
throw new SilentError(`Unexpected \`${name}\` value: ${j(arrayPath).toSource()}`);
99-
}
100-
101-
return element.value;
102-
});
81+
function findElementId(path) {
82+
return findStringProperty(path, 'elementId');
10383
}
10484

10585
function findStringArrayDecorator(path, name) {
@@ -251,8 +231,6 @@ module.exports = {
251231
addClassDecorator,
252232
isProperty,
253233
isMethod,
254-
findStringProperty,
255-
findStringArrayProperties,
256234
findAttributeBindings,
257235
findClassNames,
258236
findClassNameBindings,

0 commit comments

Comments
 (0)