Skip to content

Commit e2f5185

Browse files
authored
Merge pull request #1237 from Patternslib/upgrade-dev
Upgrade dev
2 parents 2abd355 + 1d13a7d commit e2f5185

19 files changed

+2595
-2368
lines changed

Diff for: .eslintignore

-1
This file was deleted.

Diff for: .eslintrc.js

-1
This file was deleted.

Diff for: .husky/.gitignore

-1
This file was deleted.

Diff for: .husky/commit-msg

-4
This file was deleted.

Diff for: Makefile

+3-9
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,12 @@ PACKAGE_NAME = "patternslib"
2727
all:: bundle css
2828

2929

30-
.PHONY: install
31-
stamp-yarn install:
30+
yarn.lock install:
3231
$(YARN) install
33-
# Install pre commit hook
34-
$(YARN) husky install
35-
# We have checked in the .husky files, so no need to add the commitlint hook again.
36-
# $(YARN) husky add .husky/commit-msg "npx yarn commitlint --edit $1"
37-
touch stamp-yarn
3832

3933

4034
.PHONY: watch
41-
watch: stamp-yarn
35+
watch: install
4236
$(YARN) watch
4337

4438

@@ -47,7 +41,7 @@ build: bundle css
4741

4842

4943
.PHONY: depends-parser
50-
depends-parser: stamp-yarn
44+
depends-parser: install
5145
$(PEGJS) -O size -f es src/lib/depends_parse.pegjs
5246

5347

Diff for: eslint.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const config_eslint = require("@patternslib/dev/eslint.config.js");
2+
3+
module.exports = [
4+
...config_eslint,
5+
{
6+
ignores: [
7+
// Ignore auto-generated depends_parse.js file.
8+
"src/lib/depends_parse.js",
9+
],
10+
},
11+
]

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
"tippy.js": "^6.3.7"
3737
},
3838
"devDependencies": {
39-
"@patternslib/dev": "^3.6.0",
39+
"@patternslib/dev": "^3.7.2",
4040
"@patternslib/pat-content-mirror": "^4.0.1",
4141
"@patternslib/pat-doclock": "^3.0.0",
4242
"@patternslib/pat-shopping-cart": "^3.0.0",

Diff for: src/core/parser.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class ArgumentParser {
322322
if (parameter.match(this.json_param_pattern)) {
323323
try {
324324
return JSON.parse(parameter);
325-
} catch (e) {
325+
} catch {
326326
this.log.warn(`Invalid JSON argument found: ${parameter}.`);
327327
}
328328
}
@@ -348,7 +348,7 @@ class ArgumentParser {
348348
try {
349349
result[name] = this.parameters[name].value($el, name);
350350
this.parameters[name].type = typeof result[name];
351-
} catch (e) {
351+
} catch {
352352
this.log.error(`Default function for ${name} failed.`);
353353
}
354354
} else {

Diff for: src/core/store.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ var store = {
125125
// reported in #326
126126
try {
127127
store.supported = typeof window.sessionStorage !== "undefined";
128-
} catch (e) {
128+
} catch {
129129
// just ignore.
130130
}
131131

Diff for: src/core/utils.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,12 @@ const debounce = (func, ms, timer = { timer: null }, postpone = true) => {
608608
};
609609
};
610610

611+
// TODO: Remove in next major release.
611612
const isIE = () => {
612613
// See: https://stackoverflow.com/a/9851769/1337474
613614
// Internet Explorer 6-11
614-
return /*@cc_on!@*/ false || !!document.documentMode;
615+
// eslint-disable-next-line no-constant-binary-expression
616+
return /*@cc_on!@*/false || !!document.documentMode;
615617
};
616618

617619
const jqToNode = (el) => {

Diff for: src/pat/auto-suggest/auto-suggest.js

+21-9
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,14 @@ export default Base.extend({
7777
selectionClasses = JSON.parse(this.options.selectionClasses)[
7878
obj.text
7979
];
80-
} catch (SyntaxError) {
81-
log.error(
82-
"SyntaxError: non-JSON data given to pat-autosuggest (selection-classes)"
83-
);
80+
} catch (e) {
81+
if (e instanceof SyntaxError) {
82+
log.error(
83+
"SyntaxError: non-JSON data given to pat-autosuggest (selection-classes)"
84+
);
85+
} else {
86+
throw e;
87+
}
8488
}
8589
if (selectionClasses) {
8690
// According to Cornelis the classes need to be applied on
@@ -161,9 +165,13 @@ export default Base.extend({
161165
if (this.options.wordsJson?.length) {
162166
try {
163167
words = JSON.parse(this.options.wordsJson);
164-
} catch (SyntaxError) {
165-
words = [];
166-
log.error("SyntaxError: non-JSON data given to pat-autosuggest");
168+
} catch (e) {
169+
if (e instanceof SyntaxError) {
170+
words = [];
171+
log.error("SyntaxError: non-JSON data given to pat-autosuggest");
172+
} else {
173+
throw e;
174+
}
167175
}
168176
if (!Array.isArray(words)) {
169177
words = words.map((v, k) => {
@@ -243,8 +251,12 @@ export default Base.extend({
243251
}
244252
callback(_data);
245253
};
246-
} catch (SyntaxError) {
247-
log.error("SyntaxError: non-JSON data given to pat-autosuggest");
254+
} catch (e) {
255+
if (e instanceof SyntaxError) {
256+
log.error("SyntaxError: non-JSON data given to pat-autosuggest");
257+
} else {
258+
throw e;
259+
}
248260
}
249261
}
250262

Diff for: src/pat/auto-suggest/auto-suggest.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var testutils = {
3030
var cfg = c || {};
3131
return $("<input/>", {
3232
"id": cfg.id || "select2",
33-
"data-pat-autosuggest": "" || cfg.data,
33+
"data-pat-autosuggest": cfg.data,
3434
"class": "pat-autosuggest",
3535
"type": "text",
3636
}).appendTo($("div#lab"));

Diff for: src/pat/inject/inject.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ const inject = {
280280
if (cfg.delay) {
281281
try {
282282
cfg.delay = utils.parseTime(cfg.delay);
283-
} catch (e) {
283+
} catch {
284284
log.warn("Invalid delay value: ", cfg.delay);
285285
cfg.delay = null;
286286
}

Diff for: src/pat/masonry/masonry.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default Base.extend({
9696
var containerStyle;
9797
try {
9898
containerStyle = JSON.parse(this.options.containerStyle);
99-
} catch (e) {
99+
} catch {
100100
containerStyle = { position: "relative" };
101101
log.warn(
102102
"Invalid value passed in as containerStyle. Needs to " +

Diff for: src/pat/push/push.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default Base.extend({
5555
try {
5656
const response = await fetch(this.options.url);
5757
data = await response.text();
58-
} catch (e) {
58+
} catch {
5959
logger.error(
6060
`Could not fetch from ${this.options.url} on push-id ${this.options.pushId}.`
6161
);
@@ -110,7 +110,7 @@ export default Base.extend({
110110
try {
111111
const response = await fetch(this.options.url);
112112
data = await response.json();
113-
} catch (e) {
113+
} catch {
114114
logger.error(
115115
`Could not fetch from ${this.options.url} on push-id ${this.options.pushId}.`
116116
);

Diff for: src/pat/stacks/stacks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Pattern extends BasePattern {
6767
if (selected) {
6868
try {
6969
this.$active = $sheets.filter("#" + selected);
70-
} catch (e) {
70+
} catch {
7171
selected = undefined;
7272
}
7373
}

Diff for: src/pat/tooltip/tooltip.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ class Pattern extends BasePattern {
354354
});
355355
const text = await response.text();
356356
content = await handler(text, url, selector);
357-
} catch (e) {
357+
} catch {
358358
log.error("Error on ajax request. ${e}");
359359
}
360360
} else if (selector) {

Diff for: src/pat/tooltip/tooltip.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const testutils = {
2323
"id": cfg.id || "tooltip",
2424
"href": cfg.href || "#anchor",
2525
"title": cfg.title || "tooltip title attribute",
26-
"data-pat-tooltip": "" || cfg.data,
26+
"data-pat-tooltip": cfg.data,
2727
"class": "pat-tooltip",
2828
})
2929
.text(cfg.content)

0 commit comments

Comments
 (0)