Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 89 additions & 5 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = [
],
},

// Configuration for build and config files (CommonJS) - MUST come before js.configs.recommended
// Configuration for build and config files (CommonJS)
{
files: [
"webpack.config.js",
Expand All @@ -50,7 +50,7 @@ module.exports = [
},
},

// Configuration for Vite config files (ES modules) - MUST come before js.configs.recommended
// Configuration for Vite config files (ES modules)
{
files: [
"openlibrary/components/vite.config.mjs",
Expand All @@ -68,7 +68,7 @@ module.exports = [
},
},

// Configuration for Storybook preview files (ES modules) - MUST come before js.configs.recommended
// Configuration for Storybook preview files (ES modules)
{
files: ["stories/.storybook/preview.js"],
languageOptions: {
Expand All @@ -89,7 +89,7 @@ module.exports = [
// Vue plugin configuration
...vuePlugin.configs["flat/recommended"],

// Base configuration for all JS/Vue files (except config and build files)
// Base configuration for all JS/Vue files
{
files: ["**/*.js", "**/*.vue"],
plugins: {
Expand Down Expand Up @@ -135,14 +135,20 @@ module.exports = [
"quote-props": ["error", "as-needed"],
"keyword-spacing": ["error", { before: true, after: true }],
"key-spacing": ["error", { mode: "strict" }],

// GLOBALLY ENFORCED FORMATTING RULES
"semi": ["error", "always"],
"space-before-function-paren": ["error", "never"],
"comma-spacing": ["error", { "before": false, "after": true }],

"vue/no-mutating-props": "off",
"vue/multi-word-component-names": [
"error",
{
ignores: ["Bookshelf", "Shelf"],
},
],
// jQuery deprecated rules (from plugin:no-jquery/deprecated)
// jQuery deprecated rules
"no-jquery/no-box-model": "warn",
"no-jquery/no-browser": "warn",
"no-jquery/no-live": "warn",
Expand Down Expand Up @@ -222,4 +228,82 @@ module.exports = [
},
},
},

// TEMPORARY EXEMPTIONS: Turn off new formatting rules for files locked in active PRs
{
files: [
"openlibrary/components/BarcodeScanner.vue",
"openlibrary/components/BarcodeScanner/components/LazyBookCard.vue",
"openlibrary/components/BarcodeScanner/utils/classes.js",
"openlibrary/components/BulkSearch.vue",
"openlibrary/components/BulkSearch/components/BookCard.vue",
"openlibrary/components/BulkSearch/components/BulkSearchControls.vue",
"openlibrary/components/BulkSearch/components/MatchRow.vue",
"openlibrary/components/BulkSearch/components/MatchTable.vue",
"openlibrary/components/BulkSearch/components/NoBookCard.vue",
"openlibrary/components/BulkSearch/utils/classes.js",
"openlibrary/components/BulkSearch/utils/searchUtils.js",
"openlibrary/components/HelloWorld.vue",
"openlibrary/components/IdentifiersInput.vue",
"openlibrary/components/IdentifiersInput/utils/utils.js",
"openlibrary/components/LibraryExplorer.vue",
"openlibrary/components/LibraryExplorer/components/BookCover3D.vue",
"openlibrary/components/LibraryExplorer/components/BookRoom.vue",
"openlibrary/components/LibraryExplorer/components/BooksCarousel.vue",
"openlibrary/components/LibraryExplorer/components/CSSBox.vue",
"openlibrary/components/LibraryExplorer/components/ClassSlider.vue",
"openlibrary/components/LibraryExplorer/components/DemoA.vue",
"openlibrary/components/LibraryExplorer/components/FlatBookCover.vue",
"openlibrary/components/LibraryExplorer/components/LibraryToolbar.vue",
"openlibrary/components/LibraryExplorer/components/OLCarousel.vue",
"openlibrary/components/LibraryExplorer/components/Shelf.vue",
"openlibrary/components/LibraryExplorer/components/ShelfIndex.vue",
"openlibrary/components/LibraryExplorer/components/ShelfLabel.vue",
"openlibrary/components/LibraryExplorer/components/ShelfProgressBar.vue",
"openlibrary/components/LibraryExplorer/utils.js",
"openlibrary/components/LibraryExplorer/utils/lcc.js",
"openlibrary/components/MergeUI/MergeTable.vue",
"openlibrary/components/MergeUI/utils.js",
"openlibrary/components/ObservationForm/ObservationService.js",
"openlibrary/components/ObservationForm/Utils.js",
"openlibrary/components/lit/OLChip.js",
"openlibrary/components/lit/OLChipGroup.js",
"openlibrary/components/lit/OLReadMore.js",
"openlibrary/components/lit/OlPagination.js",
"openlibrary/components/lit/OlPopover.js",
"openlibrary/components/rollupInputCore.js",
"openlibrary/plugins/openlibrary/js/Browser.js",
"openlibrary/plugins/openlibrary/js/SearchBar.js",
"openlibrary/plugins/openlibrary/js/SearchPage.js",
"openlibrary/plugins/openlibrary/js/SearchUtils.js",
"openlibrary/plugins/openlibrary/js/Toast.js",
"openlibrary/plugins/openlibrary/js/add-book.js",
"openlibrary/plugins/openlibrary/js/add_provider.js",
"openlibrary/plugins/openlibrary/js/admin.js",
"openlibrary/plugins/openlibrary/js/affiliate-links.js",
"openlibrary/plugins/openlibrary/js/autocomplete.js",
"openlibrary/plugins/openlibrary/js/banner/index.js",
"openlibrary/plugins/openlibrary/js/bulk-tagger/BulkTagger.js",
"openlibrary/plugins/openlibrary/js/carousel/Carousel.js",
"openlibrary/plugins/openlibrary/js/carousel/index.js",
"openlibrary/plugins/openlibrary/js/dialog.js",
"openlibrary/plugins/openlibrary/js/edit.js",
"openlibrary/plugins/openlibrary/js/goodreads_import.js",
"openlibrary/plugins/openlibrary/js/i18n.js",
"openlibrary/plugins/openlibrary/js/ile/index.js",
"openlibrary/plugins/openlibrary/js/ile/utils/SelectionManager/SelectionManager.js",
"openlibrary/plugins/openlibrary/js/markdown-editor/index.js",
"openlibrary/plugins/openlibrary/js/merge-request-table/MergeRequestService.js",
"openlibrary/plugins/openlibrary/js/merge.js",
"openlibrary/plugins/openlibrary/js/modals/index.js",
"openlibrary/plugins/openlibrary/js/my-books/MyBooksDropper/ReadingLogForms.js",
"openlibrary/plugins/openlibrary/js/password-toggle.js",
"openlibrary/plugins/openlibrary/js/service-worker-init.js"
],
rules: {
"semi": "off",
"space-before-function-paren": "off",
"comma-spacing": "off"
}
}
];
2 changes: 1 addition & 1 deletion openlibrary/components/BulkSearch/utils/samples.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions openlibrary/components/MergeUI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@
</template>

<script>
import MergeTable from './MergeUI/MergeTable.vue'
import MergeTable from './MergeUI/MergeTable.vue';
import { do_merge, update_merge_request, createMergeRequest, DEFAULT_EDITION_LIMIT } from './MergeUI/utils.js';

const DO_MERGE = 'Do Merge'
const REQUEST_MERGE = 'Request Merge'
const LOADING = 'Loading...'
const SAVING = 'Saving...'
const DO_MERGE = 'Do Merge';
const REQUEST_MERGE = 'Request Merge';
const LOADING = 'Loading...';
const SAVING = 'Saving...';

export default {
name: 'App',
Expand Down Expand Up @@ -88,7 +88,7 @@ export default {
mergeOutput: null,
show_diffs: false,
comment: ''
}
};
},
computed: {
olids() {
Expand All @@ -101,19 +101,19 @@ export default {
},

isSuperLibrarian() {
return this.canmerge === 'true'
return this.canmerge === 'true';
},

isDisabled() {
return this.mergeStatus !== DO_MERGE && this.mergeStatus !== REQUEST_MERGE
return this.mergeStatus !== DO_MERGE && this.mergeStatus !== REQUEST_MERGE;
},

showRejectButton() {
return this.mrid && this.isSuperLibrarian
return this.mrid && this.isSuperLibrarian;
}
},
mounted() {
const readyCta = this.isSuperLibrarian ? DO_MERGE : REQUEST_MERGE
const readyCta = this.isSuperLibrarian ? DO_MERGE : REQUEST_MERGE;
this.$watch(
'$refs.mergeTable.merge',
(new_value) => {
Expand Down Expand Up @@ -141,10 +141,10 @@ export default {
}
this.mergeOutput = await r.json();
if (this.mrid) {
await update_merge_request(this.mrid, 'approve', this.comment)
await update_merge_request(this.mrid, 'approve', this.comment);
} else {
const workIds = [master.key].concat(Array.from(dupes, item => item.key))
await createMergeRequest(workIds)
const workIds = [master.key].concat(Array.from(dupes, item => item.key));
await createMergeRequest(workIds);
}
} catch (e) {
this.mergeOutput = e.message;
Expand All @@ -153,33 +153,33 @@ export default {
}
} else {
// Create a new merge request with "pending" status
const workIds = [master.key].concat(Array.from(dupes, item => item.key))
const splitKey = master.key.split('/')
const primaryRecord = splitKey[splitKey.length - 1]
const workIds = [master.key].concat(Array.from(dupes, item => item.key));
const splitKey = master.key.split('/');
const primaryRecord = splitKey[splitKey.length - 1];
await createMergeRequest(workIds, primaryRecord, 'create-pending', this.comment)
.then(response => response.json())
.then(data => {
if (data.status === 'ok') {
// Redirect to merge table on success:
window.location.replace(`/merges#mrid-${data.id}`)
window.location.replace(`/merges#mrid-${data.id}`);
}
})
});
}
this.mergeStatus = 'Done';
},

async rejectMerge() {
try {
await update_merge_request(this.mrid, 'decline', this.comment)
this.mergeOutput = 'Merge request closed'
await update_merge_request(this.mrid, 'decline', this.comment);
this.mergeOutput = 'Merge request closed';
} catch (e) {
this.mergeOutput = e.message;
throw e;
}
this.mergeStatus = 'Reject Merge';
}
}
}
};
</script>

<style>
Expand Down
2 changes: 1 addition & 1 deletion openlibrary/components/MergeUI/AuthorRoleTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ export default {
return _.uniq(_.flatMap(this.roles, Object.keys)).sort();
}
}
}
};
</script>
2 changes: 1 addition & 1 deletion openlibrary/components/MergeUI/ExcerptsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ export default {
return _.uniq(_.flatMap(this.excerpts, Object.keys));
}
}
}
};
</script>
2 changes: 1 addition & 1 deletion openlibrary/components/MergeUI/TextDiff.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
return fn[this.resolution](this.left, this.right);
}
}
}
};
</script>

<style scoped>
Expand Down
20 changes: 10 additions & 10 deletions openlibrary/components/ObservationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
</template>

<script>
import CategorySelector from './ObservationForm/components/CategorySelector.vue'
import SavedTags from './ObservationForm/components/SavedTags.vue'
import ValueCard from './ObservationForm/components/ValueCard.vue'
import CategorySelector from './ObservationForm/components/CategorySelector.vue';
import SavedTags from './ObservationForm/components/SavedTags.vue';
import ValueCard from './ObservationForm/components/ValueCard.vue';

import { decodeAndParseJSON, resizeColorbox } from './ObservationForm/Utils'
import { decodeAndParseJSON, resizeColorbox } from './ObservationForm/Utils';

export default {
name: 'ObservationForm',
Expand Down Expand Up @@ -113,7 +113,7 @@ export default {
* An array containing all book tag types and values.
*/
observationsArray: null,
}
};
},
computed: {
/**
Expand All @@ -125,7 +125,7 @@ export default {
if (this.selectedObservation) {
return this.selectedObservation.id;
}
return null
return null;
}
},
created: function() {
Expand All @@ -138,11 +138,11 @@ export default {
resizeColorbox();
});

this.observer.observe(this.$refs.form)
this.observer.observe(this.$refs.form);
},
beforeUnmount: function() {
if (this.observer) {
this.observer.disconnect()
this.observer.disconnect();
}
},
methods: {
Expand All @@ -152,7 +152,7 @@ export default {
* @param {Object | null} observation The new selected observation, or `null` if no type is selected.
*/
updateSelected: function(observation) {
this.selectedObservation = observation
this.selectedObservation = observation;
},
/**
* Randomly sets a selected observation.
Expand All @@ -162,7 +162,7 @@ export default {
this.selectedObservation = this.observationsArray[randomNumber % this.observationsArray.length];
}
}
}
};
</script>

<style scoped>
Expand Down
Loading
Loading