Skip to content

Commit

Permalink
Add linting rules for formatting, and fix current linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmajoor authored and abzainuddin committed Nov 22, 2023
1 parent f1462a1 commit e1172c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"extends": "codeyellow",
"root": true
"root": true,
"rules": {
"object-curly-spacing": ["warn", "always"],
"quotes": ["warn", "single"]
}
}
2 changes: 1 addition & 1 deletion src/Casts.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function checkLuxonDateTime(attr, value) {
}

const LUXON_DATE_FORMAT = 'yyyy-LL-dd';
const LUXON_DATETIME_FORMAT = "yyyy'-'LL'-'dd'T'HH':'mm':'ssZZ";
const LUXON_DATETIME_FORMAT = 'yyyy\'-\'LL\'-\'dd\'T\'HH\':\'mm\':\'ssZZ';

const CASTS = {
momentDate: {
Expand Down
24 changes: 12 additions & 12 deletions src/__tests__/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ test('toBackendAll with model relation', () => {
animal.kind.parse({ id: 5 });
const serialized = animal.toBackendAll({
nestedRelations: {kind: { breed: {}}, owner: {}},
nestedRelations: { kind: { breed: {} }, owner: {} },
});
expect(serialized).toMatchSnapshot();
});
Expand Down Expand Up @@ -644,7 +644,7 @@ test('toBackendAll with partial relations', () => {
},
{ relations: ['kind', 'owner.town'] }
);
const serialized = animal.toBackendAll({ nestedRelations: {owner: {}} });
const serialized = animal.toBackendAll({ nestedRelations: { owner: {} } });
expect(serialized).toMatchSnapshot();
});
Expand All @@ -665,7 +665,7 @@ test('toBackendAll with store relation', () => {
{ id: 10, name: 'R' },
]);
const serialized = animal.toBackendAll({ nestedRelations: {pastOwners: {}} });
const serialized = animal.toBackendAll({ nestedRelations: { pastOwners: {} } });
expect(serialized).toMatchSnapshot();
});
Expand All @@ -682,7 +682,7 @@ test('toBackendAll should de-duplicate relations', () => {
expect(animalBar.cid).toBe(animal.pastOwners.at(1).cid);
const serialized = animal.toBackendAll({
nestedRelations: {pastOwners: {town: {}}},
nestedRelations: { pastOwners: { town: {} } },
});
expect(serialized).toMatchSnapshot();
});
Expand All @@ -701,7 +701,7 @@ test('toBackendAll with deep nested relation', () => {
});
const serialized = animal.toBackendAll({
nestedRelations: {kind: { location: {}, breed: { location: {} }}},
nestedRelations: { kind: { location: {}, breed: { location: {} } } },
});
expect(serialized).toMatchSnapshot();
});
Expand All @@ -726,7 +726,7 @@ test('toBackendAll with nested store relation', () => {
]);
const serialized = animal.toBackendAll({
nestedRelations: {pastOwners: { town: {} }},
nestedRelations: { pastOwners: { town: {} } },
});
expect(serialized).toMatchSnapshot();
});
Expand Down Expand Up @@ -755,7 +755,7 @@ test('toBackendAll with `backendResourceName` property model', () => {
});
const serialized = animal.toBackendAll({
nestedRelations: {blaat: {}, owners: {}, pastOwners: {}},
nestedRelations: { blaat: {}, owners: {}, pastOwners: {} },
});
expect(serialized).toMatchSnapshot();
});
Expand Down Expand Up @@ -1054,7 +1054,7 @@ describe('requests', () => {
});
test('Save model with relations and multiple files', () => {
const fileCabinet = new FileCabinet({ id: 5 },{relations: ['files']});
const fileCabinet = new FileCabinet({ id: 5 },{ relations: ['files'] });
fileCabinet.files.add([
{ dataFile: new Blob(['bar'], { type: 'text/plain' }) },
{ dataFile: new Blob(['foo'], { type: 'text/plain' }) },
Expand Down Expand Up @@ -1787,7 +1787,7 @@ describe('changes', () => {
const output = animal.toBackendAll({
// The `owner` relation is just here to verify that it is not included
nestedRelations: {kind: {breed: {}}, pastOwners: {}},
nestedRelations: { kind: { breed: {} }, pastOwners: {} },
onlyChanges: true,
});
expect(output).toEqual({
Expand Down Expand Up @@ -1833,7 +1833,7 @@ describe('changes', () => {
const output = animal.toBackendAll({
// The `kind` and `breed` relations are just here to verify that they are not included
nestedRelations: {kind: {breed: {}}, pastOwners: {}},
nestedRelations: { kind: { breed: {} }, pastOwners: {} },
onlyChanges: true,
});
expect(output).toEqual({
Expand Down Expand Up @@ -1862,7 +1862,7 @@ describe('changes', () => {
const output = animal.toBackendAll({
// The `kind` and `breed` relations are just here to verify that they are not included
nestedRelations: {kind: {breed: {}}, pastOwners: {}},
nestedRelations: { kind: { breed: {} }, pastOwners: {} },
onlyChanges: true,
});
expect(output).toEqual({
Expand All @@ -1887,7 +1887,7 @@ describe('changes', () => {
{ relations: ['kind.breed', 'owner', 'pastOwners'] }
);
const output = animal.toBackendAll({
nestedRelations: {kind: {breed: {}}, pastOwners: {}},
nestedRelations: { kind: { breed: {} }, pastOwners: {} },
onlyChanges: false,
});
expect(output).toEqual({
Expand Down

0 comments on commit e1172c4

Please sign in to comment.