diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..5a60043 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,5 @@ +plugins: + eslint: + enabled: true + config: + config: ./eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 786f60c..eb21c4e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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', diff --git a/.prettierrc b/.prettierrc index f081f7d..70f3a97 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,5 +1,5 @@ --- -trailingComma: "es5" +trailingComma: "none" tabWidth: 2 semi: true singleQuote: true diff --git a/__tests__/Document.test.js b/__tests__/Document.test.js index 95da4a1..85686ad 100644 --- a/__tests__/Document.test.js +++ b/__tests__/Document.test.js @@ -27,7 +27,7 @@ async function readFixture(filename) { return { presentation, style, - subject, + subject }; } @@ -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' }) ); }); diff --git a/__tests__/_intergration.test.js b/__tests__/_intergration.test.js index d2d7839..e10dc62 100644 --- a/__tests__/_intergration.test.js +++ b/__tests__/_intergration.test.js @@ -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 ); @@ -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' }) ); diff --git a/babel.config.js b/babel.config.js index f037a1a..6c3be4c 100644 --- a/babel.config.js +++ b/babel.config.js @@ -4,9 +4,9 @@ module.exports = { '@babel/preset-env', { targets: { - node: 'current', - }, - }, - ], - ], + node: 'current' + } + } + ] + ] }; diff --git a/bin/presentation-merger.js b/bin/presentation-merger.js index f50c374..21ddb06 100755 --- a/bin/presentation-merger.js +++ b/bin/presentation-merger.js @@ -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) { diff --git a/src/Document.js b/src/Document.js index 92bd64d..a9d484a 100644 --- a/src/Document.js +++ b/src/Document.js @@ -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' + } }; } @@ -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' + } ]; } @@ -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' ]; } @@ -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' ]; } @@ -131,8 +131,8 @@ export default class Document extends EventEmitter { streamFiles: true, compression: 'DEFLATE', compressionOptions: { - level: 9, - }, + level: 9 + } }; } @@ -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; @@ -197,7 +197,7 @@ export default class Document extends EventEmitter { return format(toXml(object), { xmlSelfClosingSpace: true, xmlWhitespaceSensitivity: 'ignore', - parser: 'xml', + parser: 'xml' }); } @@ -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 }; } } diff --git a/src/Presentation.js b/src/Presentation.js index 1a08ef4..e6be420 100644 --- a/src/Presentation.js +++ b/src/Presentation.js @@ -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); });