Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
marklundin committed Sep 18, 2024
1 parent f235b9b commit 830c651
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
16 changes: 1 addition & 15 deletions src/parsers/attribute-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,21 +256,7 @@ export class AttributeParser {

if (ts.isPropertyAssignment(property)) {
const name = property.name && ts.isIdentifier(property.name) && property.name.text;
let value;

const node = property.initializer;

value = getLiteralValue(node, this.typeChecker);

// Enums can only contain primitives (string|number|boolean)
// if (ts.isNumericLiteral(node)) {
// value = parseFloat(node.getText());
// } else if (node.kind === ts.SyntaxKind.TrueKeyword || node.kind === ts.SyntaxKind.FalseKeyword) {
// value = node.kind === ts.SyntaxKind.TrueKeyword;
// } else {
// value = node.getText();
// }

const value = getLiteralValue(property.initializer, this.typeChecker);
members.push({ [name]: value });
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/tests/valid/enum.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('VALID: Enum attribute', function () {
expect(data[0].example.attributes.h.name).to.equal('h');
expect(data[0].example.attributes.h.type).to.equal('string');
expect(data[0].example.attributes.h.array).to.equal(false);
expect(data[0].example.attributes.h.enum).to.be.an('array').with.lengthOf(3)
expect(data[0].example.attributes.h.enum).to.be.an('array').with.lengthOf(3);
expect(data[0].example.attributes.h.enum[0]).to.deep.equal({ A: 'a' });
expect(data[0].example.attributes.h.enum[1]).to.deep.equal({ B: 'b' });
expect(data[0].example.attributes.h.enum[2]).to.deep.equal({ C: 'c' });
Expand Down

0 comments on commit 830c651

Please sign in to comment.