Skip to content

Commit

Permalink
use double quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
platers committed Aug 7, 2021
1 parent 77a17d7 commit 7f1adc3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
26 changes: 13 additions & 13 deletions main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { App, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian';
import { rules, Rule } from './rules';
import { App, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from "obsidian";
import { rules, Rule } from "./rules";

interface LinterSettings {
enabledRules: string[];
}

const DEFAULT_SETTINGS: LinterSettings = {
enabledRules: [
'trailing-spaces',
'headings-should-be-surrounded-by-blank-lines',
'space-after-list-markers',
"trailing-spaces",
"headings-should-be-surrounded-by-blank-lines",
"space-after-list-markers",
]
}

Expand All @@ -23,8 +23,8 @@ export default class LinterPlugin extends Plugin {
this.rulesDict = rules.reduce((dict, rule) => (dict[rule.alias()] = rule, dict), {} as Record<string, Rule>);

this.addCommand({
id: 'lint-file',
name: 'Lint the current file',
id: "lint-file",
name: "Lint the current file",
callback: () => this.runLinter(),
hotkeys: [
{
Expand All @@ -46,7 +46,7 @@ export default class LinterPlugin extends Plugin {
}

runLinter() {
console.log('running linter');
console.log("running linter");

const view = this.app.workspace.activeLeaf.view;
if (view instanceof MarkdownView) {
Expand Down Expand Up @@ -81,16 +81,16 @@ class SettingTab extends PluginSettingTab {

containerEl.empty();

containerEl.createEl('h2', {text: 'Settings for Linter.'});
containerEl.createEl("h2", {text: "Settings for Linter."});

new Setting(containerEl)
.setName('Rules to apply')
.setDesc('List the rules to apply to the markdown file')
.setName("Rules to apply")
.setDesc("List the rules to apply to the markdown file")
.addTextArea(text => {
text
.setValue(this.plugin.settings.enabledRules.join('\n'))
.setValue(this.plugin.settings.enabledRules.join("\n"))
.onChange(async (value) => {
this.plugin.settings.enabledRules = value.split('\n');
this.plugin.settings.enabledRules = value.split("\n");
await this.plugin.saveSettings()});
text.inputEl.rows = 8;
text.inputEl.cols = 40;
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "obsidian-linter",
"name": "Linter",
"version": "1.0.0",
"minAppVersion": "0.9.12",
"minAppVersion": "0.9.7",
"description": "Enforces consistent markdown styling.",
"author": "Victor Tao",
"authorUrl": "https://github.com/platers",
Expand Down
6 changes: 3 additions & 3 deletions rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export const rules: Rule[] = [
},
[
new Test(
'',
"",
dedent`
---
Expand Down Expand Up @@ -213,7 +213,7 @@ export const rules: Rule[] = [
},
[
new Test(
'',
"",
dedent`
# H1
Expand All @@ -239,7 +239,7 @@ export const rules: Rule[] = [
},
[
new Test(
'',
"",
dedent`
Some text
Expand Down
10 changes: 5 additions & 5 deletions test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import MockDate from 'mockdate'
MockDate.set('2020-01-01');
import { rules, Test } from './rules';
import MockDate from "mockdate"
MockDate.set("2020-01-01");
import { rules, Test } from "./rules";

describe('Rules', () => {
describe("Rules", () => {
for (const rule of rules) {
describe(rule.name, () => {
test.each(rule.tests)('$description', (testObject: Test) => {
test.each(rule.tests)("$description", (testObject: Test) => {
expect(rule.apply(testObject.before)).toBe(testObject.after);
});
});
Expand Down

0 comments on commit 7f1adc3

Please sign in to comment.