Skip to content

Commit

Permalink
🚨 remove trailing comma linter
Browse files Browse the repository at this point in the history
  • Loading branch information
kylewelsby committed Mar 6, 2020
1 parent c01bdea commit 91a6f64
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 35 deletions.
5 changes: 5 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins:
eslint:
enabled: true
config:
config: ./eslintrc.js
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
parser: 'babel-eslint',
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
rules: {
'semi': ['error', 'always'],
'prettier/prettier': 'error',
semi: ['error', 'always'],
'prettier/prettier': ['error', { sindleQuote: true }],
'max-lines-per-function': ['error', 25],
'no-console': [
'error',
Expand Down
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
trailingComma: "es5"
trailingComma: "none"
tabWidth: 2
semi: true
singleQuote: true
Expand Down
8 changes: 4 additions & 4 deletions __tests__/Document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function readFixture(filename) {
return {
presentation,
style,
subject,
subject
};
}

Expand All @@ -48,21 +48,21 @@ describe('Document', () => {
expect.objectContaining({
mimeType: 'application/vnd.oasis.opendocument.presentation',
path: '/',
version: '1.2',
version: '1.2'
})
);

expect(subject.manifestFiles).toContainEqual(
expect.objectContaining({
mimeType: 'text/xml',
path: 'content.xml',
path: 'content.xml'
})
);

expect(subject.manifestFiles).toContainEqual(
expect.objectContaining({
mimeType: 'text/xml',
path: 'styles.xml',
path: 'styles.xml'
})
);
});
Expand Down
8 changes: 4 additions & 4 deletions __tests__/_intergration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Intergration', () => {
await mergeFiles(
[
path.join(__dirname, '__fixtures__/file1.odp'),
path.join(__dirname, '__fixtures__/file2.odp'),
path.join(__dirname, '__fixtures__/file2.odp')
],
filePath
);
Expand All @@ -33,21 +33,21 @@ describe('Intergration', () => {
expect(files).toContainEqual(
expect.objectContaining({
path: 'content.xml',
type: 'file',
type: 'file'
})
);

expect(files).toContainEqual(
expect.objectContaining({
path: 'META-INF/manifest.xml',
type: 'file',
type: 'file'
})
);

expect(files).toContainEqual(
expect.objectContaining({
path: 'mimetype',
type: 'file',
type: 'file'
})
);

Expand Down
10 changes: 5 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module.exports = {
'@babel/preset-env',
{
targets: {
node: 'current',
},
},
],
],
node: 'current'
}
}
]
]
};
2 changes: 1 addition & 1 deletion bin/presentation-merger.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ program
let destination = process.stdout;
if (options.file) {
destination = fs.createWriteStream(path.resolve(options.file), {
flags: 'w',
flags: 'w'
});
}
if (allExist) {
Expand Down
34 changes: 17 additions & 17 deletions src/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export default class Document extends EventEmitter {
this.manifestFiles = this.manifestFilesInitial;
this.counter = 0;
this.doc = {
'office:document-content': {},
'office:document-content': {}
};
this.stylesDoc = {
'office:document-styles': {
'office:version': '1.2',
},
'office:version': '1.2'
}
};
}

Expand All @@ -36,16 +36,16 @@ export default class Document extends EventEmitter {
{
mimeType: 'application/vnd.oasis.opendocument.presentation',
path: '/',
version: '1.2',
version: '1.2'
},
{
mimeType: 'text/xml',
path: 'content.xml',
path: 'content.xml'
},
{
mimeType: 'text/xml',
path: 'styles.xml',
},
path: 'styles.xml'
}
];
}

Expand All @@ -70,7 +70,7 @@ export default class Document extends EventEmitter {
'office:document-content.office:automatic-styles.style:style',
'office:document-content.office:automatic-styles.text:list-style',
'office:document-content.office:body.office:presentation.draw:page',
'office:document-content.office:body.office:presentation.presentation:settings',
'office:document-content.office:body.office:presentation.presentation:settings'
];
}

Expand All @@ -91,7 +91,7 @@ export default class Document extends EventEmitter {
'office:document-styles.office:automatic-styles.style:style',
'office:document-styles.office:master-styles.draw:layer-set',
'office:document-styles.office:master-styles.style:handout-master',
'office:document-styles.office:master-styles.style:master-page',
'office:document-styles.office:master-styles.style:master-page'
];
}

Expand Down Expand Up @@ -131,8 +131,8 @@ export default class Document extends EventEmitter {
streamFiles: true,
compression: 'DEFLATE',
compressionOptions: {
level: 9,
},
level: 9
}
};
}

Expand Down Expand Up @@ -175,14 +175,14 @@ export default class Document extends EventEmitter {
'manifest:manifest': {
'xmlns:manifest': 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0',
'manifest:version': '1.2',
'manifest:file-entry': [],
},
'manifest:file-entry': []
}
};
output['manifest:manifest']['manifest:file-entry'] = this.manifestFiles.map(
file => {
let out = {
'manifest:full-path': file.path,
'manifest:media-type': file.mimeType,
'manifest:media-type': file.mimeType
};
if (file.version) {
out['manifest:version'] = file.version;
Expand All @@ -197,7 +197,7 @@ export default class Document extends EventEmitter {
return format(toXml(object), {
xmlSelfClosingSpace: true,
xmlWhitespaceSensitivity: 'ignore',
parser: 'xml',
parser: 'xml'
});
}

Expand All @@ -219,12 +219,12 @@ export default class Document extends EventEmitter {
this.files.push(file);
this.manifestFiles.push({
mimeType: manifestFile['manifest:media-type'],
path: file.path,
path: file.path
});
return {
mimeType: manifestFile['manifest:media-type'],
pathPrevious: manifestFile['manifest:full-path'],
path: file.path,
path: file.path
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Presentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Presentation {
_uniqueStyleIDs() {
[
'office:document-content.office:automatic-styles.style:style',
'office:document-content.office:automatic-styles.text:list-style',
'office:document-content.office:automatic-styles.text:list-style'
].forEach(key => {
this.data = this._renameStyleKeys(this.data, key);
});
Expand Down

0 comments on commit 91a6f64

Please sign in to comment.