Skip to content

Commit 55c3e85

Browse files
committed
fix eslint
1 parent cc96abb commit 55c3e85

19 files changed

+54
-46
lines changed

.eslintrc

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,19 @@
44
"env": {
55
"node": true
66
},
7-
"plugins": ["@typescript-eslint"],
7+
"plugins": ["@typescript-eslint", "only-warn"],
88
"extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"],
99
"parserOptions": {
1010
"sourceType": "module"
1111
},
1212
"rules": {
1313
"no-unused-vars": "off",
14-
"@typescript-eslint/no-unused-vars": [
15-
"error",
16-
{
17-
"args": "none"
18-
}
19-
],
14+
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
2015
"@typescript-eslint/ban-ts-comment": "off",
2116
"no-prototype-builtins": "off",
22-
"no-useless-escape": "off",
23-
"@typescript-eslint/no-inferrable-types": "off",
2417
"@typescript-eslint/no-empty-function": "off",
25-
"@typescript-eslint/explicit-function-return-type": ["error"]
18+
"@typescript-eslint/no-inferrable-types": "off",
19+
"@typescript-eslint/no-explicit-any": "off",
20+
"@typescript-eslint/explicit-function-return-type": ["warn"]
2621
}
2722
}

esbuild.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ esbuild
4747
],
4848
format: 'cjs',
4949
watch: !prod,
50-
target: 'es2016',
50+
target: 'es2018',
5151
logLevel: 'info',
5252
sourcemap: prod ? false : 'inline',
5353
treeShaking: true,

package-lock.json

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
99
"version": "node version-bump.mjs && git add manifest.json versions.json",
1010
"test": "jest",
11-
"format": "prettier --write ."
11+
"format": "prettier --write .",
12+
"lint": "eslint --max-warnings=0 src/**"
1213
},
1314
"keywords": [],
1415
"author": "Moritz Jung",
@@ -23,6 +24,7 @@
2324
"esbuild": "^0.14.47",
2425
"esbuild-plugin-copy-watch": "^0.0.7",
2526
"esbuild-svelte": "^0.7.1",
27+
"eslint-plugin-only-warn": "^1.0.3",
2628
"jest": "^28.1.1",
2729
"jest-environment-jsdom": "^28.1.1",
2830
"obsidian": "latest",

src/InputFieldMarkdownRenderChild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
215215

216216
if (this.error) {
217217
this.containerEl.empty();
218-
const originalText = this.containerEl.createEl('span', { text: this.fullDeclaration, cls: 'meta-bind-code' });
218+
this.containerEl.createEl('span', { text: this.fullDeclaration, cls: 'meta-bind-code' });
219219
container.innerText = ` -> ERROR: ${this.error}`;
220220
container.addClass('meta-bind-plugin-error');
221221
this.containerEl.appendChild(container);
@@ -224,7 +224,7 @@ export class InputFieldMarkdownRenderChild extends MarkdownRenderChild {
224224

225225
if (!this.inputField) {
226226
this.containerEl.empty();
227-
const originalText = this.containerEl.createEl('span', { text: this.fullDeclaration, cls: 'meta-bind-code' });
227+
this.containerEl.createEl('span', { text: this.fullDeclaration, cls: 'meta-bind-code' });
228228
container.innerText = ` -> ERROR: ${new MetaBindInternalError('input field is undefined and error is empty').message}`;
229229
container.addClass('meta-bind-plugin-error');
230230
this.containerEl.appendChild(container);

src/inputFieldArguments/AbstractInputFieldArgument.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export abstract class AbstractInputFieldArgument {
1717
return this.allowedInputFields.contains(inputFieldType);
1818
}
1919

20-
getAllowedInputFieldsAsString() {
20+
getAllowedInputFieldsAsString(): string {
2121
return this.allowedInputFields.length === 0 ? 'all' : this.allowedInputFields.join(', ');
2222
}
2323
}

src/inputFieldArguments/InputFieldArgumentContainer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class InputFieldArgumentContainer {
1818
for (const argument of this.arguments) {
1919
map[argument.identifier] += 1;
2020
if (map[argument.identifier] > 1 && !argument.allowMultiple) {
21-
throw new MetaBindParsingError(`argument \'${argument.identifier}\' does not allow duplicates`);
21+
throw new MetaBindParsingError(`argument '${argument.identifier}' does not allow duplicates`);
2222
}
2323
}
2424
}

src/inputFields/DateInputField.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class DateInputField extends AbstractInputField {
6464

6565
this.date = DateParser.parse(value);
6666
if (!this.date) {
67-
console.warn(new MetaBindBindValueError(`invalid value \'${value}\' at dateInputField ${this.inputFieldMarkdownRenderChild.uid}`));
67+
console.warn(new MetaBindBindValueError(`invalid value '${value}' at dateInputField ${this.inputFieldMarkdownRenderChild.uid}`));
6868
this.date = DateParser.getDefaultDate();
6969
}
7070

src/inputFields/InputFieldFactory.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ export class InputFieldFactory {
9999
static checkInputFieldMarkdownRenderChildTypeAllowed(inputFieldType: InputFieldType, type: InputFieldMarkdownRenderChildType): void {
100100
const allowCodeBlock: { codeBlock: boolean; inlineCodeBlock: boolean } = InputFieldFactory.allowCodeBlockMap[inputFieldType];
101101
if (type === InputFieldMarkdownRenderChildType.CODE_BLOCK && !allowCodeBlock.codeBlock) {
102-
throw new MetaBindParsingError(`\'${inputFieldType}\' is not allowed as code block`);
102+
throw new MetaBindParsingError(`'${inputFieldType}' is not allowed as code block`);
103103
}
104104
if (type === InputFieldMarkdownRenderChildType.INLINE_CODE_BLOCK && !allowCodeBlock.inlineCodeBlock) {
105-
throw new MetaBindParsingError(`\'${inputFieldType}\' is not allowed as inline code block`);
105+
throw new MetaBindParsingError(`'${inputFieldType}' is not allowed as inline code block`);
106106
}
107107
}
108108
}

src/inputFields/NumberInputField.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class NumberInputField extends AbstractInputField {
2121
if (value != null && (typeof value == 'number' || typeof value == 'string')) {
2222
this.numberComponent.setValue(numberToString(value));
2323
} else {
24-
console.warn(new MetaBindBindValueError(`invalid value \'${value}\' at numberInputField ${this.inputFieldMarkdownRenderChild.uid}`));
24+
console.warn(new MetaBindBindValueError(`invalid value '${value}' at numberInputField ${this.inputFieldMarkdownRenderChild.uid}`));
2525
this.numberComponent.setValue(this.getDefaultValue());
2626
}
2727
}

0 commit comments

Comments
 (0)