Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ESLint rule to prefer single quote #958

Merged
merged 1 commit into from
Dec 29, 2023
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
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_", "destructuredArrayIgnorePattern": "^_" }],
"@typescript-eslint/quotes": ["error", "single", { "allowTemplateLiterals": true }],
"@typescript-eslint/semi": "error",
"curly": "error",
"cypress/no-assigning-return-values": "off",
Expand Down
2 changes: 1 addition & 1 deletion src/controls/slick.columnmenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class SlickColumnMenu {
const colName: string = this.columns[i].name instanceof HTMLElement
? (this.columns[i].name as HTMLElement).innerHTML
: (this.columns[i].name || '') as string;
excludeCssClass = this.columns[i].excludeFromColumnPicker ? "hidden" : "";
excludeCssClass = this.columns[i].excludeFromColumnPicker ? 'hidden' : '';

const liElm = document.createElement('li');
liElm.className = excludeCssClass;
Expand Down
4 changes: 2 additions & 2 deletions src/models/editorValidator.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EditorArguments } from "./editorArguments.interface";
import { EditorValidationResult } from "./editorValidationResult.interface";
import { EditorArguments } from './editorArguments.interface';
import { EditorValidationResult } from './editorValidationResult.interface';

export type EditorValidator = (value: any, args?: EditorArguments) => EditorValidationResult;
8 changes: 4 additions & 4 deletions src/models/grouping.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Aggregator } from "./aggregator.interface";
import { GroupingComparerItem } from "./groupingComparerItem.interface";
import { GroupingFormatterItem } from "./groupingFormatterItem.interface";
import { SortDirectionNumber } from "./sortDirectionNumber.enum";
import { Aggregator } from './aggregator.interface';
import { GroupingComparerItem } from './groupingComparerItem.interface';
import { GroupingFormatterItem } from './groupingFormatterItem.interface';
import { SortDirectionNumber } from './sortDirectionNumber.enum';

export type GroupingGetterFunction<T = any> = (value: T) => string;

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/slick.cellselectionmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class SlickCellSelectionModel {
if (rangeHasChanged) {
// provide extra "caller" argument through SlickEventData to avoid breaking pubsub event that only accepts an array of selected range
const eventData = new SlickEventData(null, this._ranges);
Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || "SlickCellSelectionModel.setSelectedRanges" } });
Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || 'SlickCellSelectionModel.setSelectedRanges' } });
this.onSelectedRangesChanged.notify(this._ranges, eventData);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/slick.checkboxselectcolumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ export class SlickCheckboxSelectColumn<T = any> implements SlickPlugin {
id: this._options.columnId,
name: (this._options.hideSelectAllCheckbox || this._options.hideInColumnTitleRow) ? '' : `<input id="header-selector${this._selectAll_UID}" type="checkbox"><label for="header-selector${this._selectAll_UID}"></label>`,
toolTip: (this._options.hideSelectAllCheckbox || this._options.hideInColumnTitleRow) ? '' : this._options.toolTip,
field: "sel",
field: 'sel',
width: this._options.width,
resizable: false,
sortable: false,
Expand All @@ -360,7 +360,7 @@ export class SlickCheckboxSelectColumn<T = any> implements SlickPlugin {

protected addCheckboxToFilterHeaderRow(grid: SlickGrid) {
this._handler.subscribe(grid.onHeaderRowCellRendered, (_e: any, args: any) => {
if (args.column.field === "sel") {
if (args.column.field === 'sel') {
Utils.emptyElement(args.node);
const spanElm = document.createElement('span');
spanElm.id = 'filter-checkbox-selectall-container';
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/slick.draggablegrouping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class SlickDraggableGrouping {
}
}
this._columnsGroupBy = newGroupingOrder;
this.updateGroupBy("sort-group");
this.updateGroupBy('sort-group');
},
});

Expand Down Expand Up @@ -393,7 +393,7 @@ export class SlickDraggableGrouping {

protected addColumnGroupBy(column: Column) {
this._columnsGroupBy.push(column);
this.updateGroupBy("add-group");
this.updateGroupBy('add-group');
}

protected addGroupByRemoveClickHandler(id: string | number, groupRemoveIconElm: HTMLDivElement, headerColumnElm: HTMLDivElement, entry: any) {
Expand Down Expand Up @@ -454,7 +454,7 @@ export class SlickDraggableGrouping {
this._groupToggler.style.display = 'none';
}
}
this.updateGroupBy("remove-group");
this.updateGroupBy('remove-group');
}

protected toggleGroupToggler(targetElm: Element | null, collapsing = true, shouldExecuteDataViewCommand = true) {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/slick.rowselectionmodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class SlickRowSelectionModel {

// provide extra "caller" argument through SlickEventData to avoid breaking pubsub event that only accepts an array of selected range
const eventData = new SlickEventData(null, this._ranges);
Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || "SlickRowSelectionModel.setSelectedRanges" } });
Object.defineProperty(eventData, 'detail', { writable: true, configurable: true, value: { caller: caller || 'SlickRowSelectionModel.setSelectedRanges' } });
this.onSelectedRangesChanged.notify(this._ranges, eventData);
}

Expand Down
10 changes: 5 additions & 5 deletions src/slick.dataview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class SlickDataView<TData extends SlickDataItem = any> implements CustomD
item = this.items[i];
id = item[this.idProperty as keyof TData] as DataIdType;
if (id === undefined) {
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");
throw new Error(`[SlickGrid DataView] Each data element must implement a unique 'id' property`);
}

// if items have been marked as deleted we skip them for the new final items array
Expand Down Expand Up @@ -249,7 +249,7 @@ export class SlickDataView<TData extends SlickDataItem = any> implements CustomD
for (let i = startingIndex, l = this.items.length; i < l; i++) {
id = this.items[i][this.idProperty as keyof TData] as DataIdType;
if (id === undefined) {
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");
throw new Error(`[SlickGrid DataView] Each data element must implement a unique 'id' property`);
}
this.idxById.set(id, i);
}
Expand All @@ -263,7 +263,7 @@ export class SlickDataView<TData extends SlickDataItem = any> implements CustomD
for (let i = 0, l = this.items.length; i < l; i++) {
id = this.items[i][this.idProperty as keyof TData] as DataIdType;
if (id === undefined || this.idxById.get(id) !== i) {
throw new Error("[SlickGrid DataView] Each data element must implement a unique 'id' property");
throw new Error(`[SlickGrid DataView] Each data element must implement a unique 'id' property`);
}
}
}
Expand Down Expand Up @@ -576,7 +576,7 @@ export class SlickDataView<TData extends SlickDataItem = any> implements CustomD
*/
updateItems<T extends TData>(ids: DataIdType[], newItems: T[]) {
if (ids.length !== newItems.length) {
throw new Error("[SlickGrid DataView] Mismatch on the length of ids and items provided to update");
throw new Error('[SlickGrid DataView] Mismatch on the length of ids and items provided to update');
}
for (let i = 0, l = newItems.length; i < l; i++) {
this.updateSingleItem(ids[i], newItems[i]);
Expand Down Expand Up @@ -705,7 +705,7 @@ export class SlickDataView<TData extends SlickDataItem = any> implements CustomD
throw new Error('[SlickGrid DataView] Invalid or non-matching id ' + this.idxById.get(id));
}
if (!this.sortComparer) {
throw new Error("[SlickGrid DataView] sortedUpdateItem() requires a sort comparer, use sort()");
throw new Error('[SlickGrid DataView] sortedUpdateItem() requires a sort comparer, use sort()');
}
const oldItem = this.getItemById(id);
if (this.sortComparer(oldItem, item) !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/slick.grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2441,7 +2441,7 @@ export class SlickGrid<TData = any, C extends Column<TData> = Column<TData>, O e
if (!this.stylesheet) {
const sheets: any = (this._options.shadowRoot || document).styleSheets;

if (this._options.devMode && typeof this._options.devMode?.ownerNodeIndex === "number" && this._options.devMode.ownerNodeIndex >= 0) {
if (this._options.devMode && typeof this._options.devMode?.ownerNodeIndex === 'number' && this._options.devMode.ownerNodeIndex >= 0) {
sheets[this._options.devMode.ownerNodeIndex].ownerNode = this._style;
}

Expand Down
12 changes: 6 additions & 6 deletions src/slick.remotemodel-yahoo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ export class SlickRemoteModelYahoo {
const recStart = (fromPage * this.PAGESIZE);
const recCount = (((toPage - fromPage) * this.PAGESIZE) + this.PAGESIZE);

const url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20rss"
+ "(" + recStart + "%2C" + recCount + ")"
+ "%20where%20url%3D%22http%3A%2F%2Frss.news.yahoo.com%2Frss%2Ftopstories%22"
+ "&format=json";
const url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20rss'
+ '(' + recStart + '%2C' + recCount + ')'
+ '%20where%20url%3D%22http%3A%2F%2Frss.news.yahoo.com%2Frss%2Ftopstories%22'
+ '&format=json';

if (this.h_request !== null) {
clearTimeout(this.h_request);
Expand All @@ -91,7 +91,7 @@ export class SlickRemoteModelYahoo {

this.req = window.$.jsonp({
url,
callbackParameter: "callback",
callbackParameter: 'callback',
cache: true,
success: (json: any) => {
this.onSuccess(json, recStart);
Expand All @@ -108,7 +108,7 @@ export class SlickRemoteModelYahoo {


onError(fromPage: number, toPage: number) {
alert("error loading pages " + fromPage + " to " + toPage);
alert('error loading pages ' + fromPage + ' to ' + toPage);
}

// SAMPLE DATA
Expand Down
8 changes: 4 additions & 4 deletions src/slick.remotemodel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ export class SlickRemoteModel {
return;
}

let url = "http://octopart.com/api/v3/parts/search?apikey=68b25f31&include[]=short_description&show[]=uid&show[]=manufacturer&show[]=mpn&show[]=brand&show[]=octopart_url&show[]=short_description&q=" + this.searchstr + "&start=" + (fromPage * this.PAGESIZE) + "&limit=" + (((toPage - fromPage) * this.PAGESIZE) + this.PAGESIZE);
let url = 'http://octopart.com/api/v3/parts/search?apikey=68b25f31&include[]=short_description&show[]=uid&show[]=manufacturer&show[]=mpn&show[]=brand&show[]=octopart_url&show[]=short_description&q=' + this.searchstr + '&start=' + (fromPage * this.PAGESIZE) + '&limit=' + (((toPage - fromPage) * this.PAGESIZE) + this.PAGESIZE);

if (this.sortcol !== null) {
url += ("&sortby=" + this.sortcol + ((this.sortdir > 0) ? "+asc" : "+desc"));
url += ('&sortby=' + this.sortcol + ((this.sortdir > 0) ? '+asc' : '+desc'));
}

if (this.h_request !== null) {
Expand All @@ -96,7 +96,7 @@ export class SlickRemoteModel {

this.req = window.$.jsonp({
url,
callbackParameter: "callback",
callbackParameter: 'callback',
cache: true,
success: this.onSuccess,
error: () => this.onError(fromPage, toPage)
Expand All @@ -107,7 +107,7 @@ export class SlickRemoteModel {
}

protected onError(fromPage: number | string, toPage: number | string) {
alert("error loading pages " + fromPage + " to " + toPage);
alert('error loading pages ' + fromPage + ' to ' + toPage);
}

protected onSuccess(resp: any) {
Expand Down