Skip to content

Commit b0880f1

Browse files
committed
style: Make it prettier (use tabs)
1 parent 9cf3980 commit b0880f1

31 files changed

+23268
-7580
lines changed

.eslintrc.cjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module.exports = {
2+
extends: [
3+
"unobtrusive",
4+
"plugin:jest/recommended",
5+
6+
"plugin:prettier/recommended",
7+
"prettier/@typescript-eslint",
8+
"plugin:@typescript-eslint/recommended",
9+
],
10+
env: {
11+
node: true,
12+
"jest/globals": true,
13+
},
14+
parser: "@typescript-eslint/parser",
15+
plugins: ["@typescript-eslint", "prettier", "jest"],
16+
parserOptions: {
17+
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
18+
sourceType: "module", // Allows for the use of imports
19+
},
20+
rules: {
21+
"no-console": ["error", { allow: ["warn", "error"] }],
22+
"prettier/prettier": "error",
23+
camelcase: "off",
24+
"jest/no-disabled-tests": "off",
25+
"@typescript-eslint/camelcase": ["error", { properties: "never" }],
26+
"@typescript-eslint/no-unused-vars": [
27+
"warn",
28+
{ args: "after-used", varsIgnorePattern: "^_" },
29+
],
30+
"@typescript-eslint/no-unused-vars": [
31+
"warn",
32+
{ args: "after-used", varsIgnorePattern: "^_", argsIgnorePattern: "^_" },
33+
],
34+
"@typescript-eslint/no-explicit-any": "off",
35+
"@typescript-eslint/explicit-function-return-type": "off",
36+
"@typescript-eslint/no-non-null-assertion": "off",
37+
"@typescript-eslint/interface-name-prefix": "off",
38+
"@typescript-eslint/no-var-requires": "off",
39+
},
40+
};

.eslintrc.js

Lines changed: 0 additions & 40 deletions
This file was deleted.
File renamed without changes.

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16.13.1
1+
v18.13.0

.vscode/settings.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@
1212
"titleBar.inactiveForeground": "#15202b99",
1313
"statusBar.background": "#d477f6",
1414
"statusBarItem.hoverBackground": "#c547f3",
15-
"statusBar.foreground": "#15202b"
15+
"statusBar.foreground": "#15202b",
16+
"activityBar.activeBackground": "#e3a7f9",
17+
"commandCenter.border": "#15202b99",
18+
"editorGroup.border": "#e3a7f9",
19+
"panel.border": "#e3a7f9",
20+
"sash.hoverBorder": "#e3a7f9",
21+
"sideBar.border": "#e3a7f9",
22+
"statusBar.border": "#d477f6",
23+
"statusBar.debuggingBackground": "#99f677",
24+
"statusBar.debuggingBorder": "#99f677",
25+
"statusBar.debuggingForeground": "#15202b",
26+
"statusBarItem.remoteBackground": "#d477f6",
27+
"statusBarItem.remoteForeground": "#15202b",
28+
"tab.activeBorder": "#e3a7f9",
29+
"titleBar.border": "#d477f6"
1630
},
1731
"peacock.color": "#d477f6",
1832
"spellright.language": [
@@ -24,4 +38,4 @@
2438
"latex",
2539
"plaintext"
2640
]
27-
}
41+
}

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ Options:
4949

5050
## Troubleshooting
5151

52-
The following error indicates that `$DISPLAY` is not set to a valid display: `Error: Both xsel and fallback failed`
52+
The following error indicates that `$DISPLAY` is not set to a valid display: `Error: Both xsel and fallback failed`
5353

54-
**html2md** relies on a valid `$DISPLAY` because it uses clipboard via **xsel**.
55-
In some environments (for example, **tmux**) you may need to run the command as follows:
54+
**html2md** relies on a valid `$DISPLAY` because it uses clipboard via **xsel**.
55+
In some environments (for example, **tmux**) you may need to run the command as follows:
5656

5757
```plain
5858
DISPLAY=:0 html2md ... # or whatever your display id is.
5959
```
60+
6061
Fully headless systems may not be able to use **html2md**.
6162

6263
## Contributors
@@ -98,12 +99,11 @@ Build on these great modules:
9899

99100
## License
100101

101-
Copyright (c) 2017-2020 Fabian Morón Zirfas
102-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
102+
Copyright (c) 2017-2020 Fabian Morón Zirfas
103+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
103104
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
104-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
105+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
105106

106107
see also http://www.opensource.org/licenses/mit-license.php
107108

108-
109109
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Ffabianmoronzirfas%2Fto-markdown-cli.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Ffabianmoronzirfas%2Fto-markdown-cli?ref=badge_large)

__tests__/files/write-out-test.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
foo
2-
===
1+
# foo

__tests__/index.html

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,50 @@ <h2>subtitle</h2>
33
<h3>even smaller title</h3>
44

55
<ul>
6-
<li><input disabled="" type="checkbox"> foo</li>
7-
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt <del>mollit</del> anim id est laborum.</p>
8-
<ul>
9-
<li>Point of <code>view</code> should be impersonal.</li>
10-
<li>Acronyms and technical abbreviations are first introduced, then used consistently.</li>
11-
<li>No slang, idioms, colloquialisms, or contractions are used.</li>
12-
<li>Each sentence is grammatically correct.</li>
13-
<li>Each paragraph has a clear topic with details.</li>
14-
<li>The paper has a clearly defined topic. It follows a logical progression to the conclusion.</li>
15-
<li>Resources are clearly cited, using one citation style consistently.</li>
16-
</ul>
17-
<ol>
18-
<li>Point of view should be impersonal.</li>
19-
<li>Acronyms and technical abbreviations are first introduced, then used consistently.</li>
20-
<li>No slang, idioms, colloquialisms, or contractions are used.</li>
21-
<li>Each sentence is grammatically correct.</li>
22-
<li>Each paragraph has a clear topic with details.</li>
23-
<li>The paper has a clearly defined topic. It follows a logical progression to the conclusion.</li>
24-
<li>Resources are clearly cited, using one citation style consistently.</li>
25-
</ol>
6+
<li><input disabled="" type="checkbox" /> foo</li>
7+
<p>
8+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
9+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
10+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
11+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
12+
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
13+
non proident, sunt in culpa qui officia deserunt <del>mollit</del> anim id
14+
est laborum.
15+
</p>
16+
<ul>
17+
<li>Point of <code>view</code> should be impersonal.</li>
18+
<li>
19+
Acronyms and technical abbreviations are first introduced, then used
20+
consistently.
21+
</li>
22+
<li>No slang, idioms, colloquialisms, or contractions are used.</li>
23+
<li>Each sentence is grammatically correct.</li>
24+
<li>Each paragraph has a clear topic with details.</li>
25+
<li>
26+
The paper has a clearly defined topic. It follows a logical progression to
27+
the conclusion.
28+
</li>
29+
<li>Resources are clearly cited, using one citation style consistently.</li>
30+
</ul>
31+
<ol>
32+
<li>Point of view should be impersonal.</li>
33+
<li>
34+
Acronyms and technical abbreviations are first introduced, then used
35+
consistently.
36+
</li>
37+
<li>No slang, idioms, colloquialisms, or contractions are used.</li>
38+
<li>Each sentence is grammatically correct.</li>
39+
<li>Each paragraph has a clear topic with details.</li>
40+
<li>
41+
The paper has a clearly defined topic. It follows a logical progression to
42+
the conclusion.
43+
</li>
44+
<li>Resources are clearly cited, using one citation style consistently.</li>
45+
</ol>
2646

27-
<pre>
47+
<pre>
2848
<code>
2949
var foo = 'bar'
3050
</code>
3151
</pre>
52+
</ul>

__tests__/index.md

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
title
2-
=====
1+
# title
32

4-
subtitle
5-
--------
3+
## subtitle
64

75
### even smaller title
86

9-
* foo
7+
- foo
108

119
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
1210

13-
* Point of `view` should be impersonal.
14-
* Acronyms and technical abbreviations are first introduced, then used consistently.
15-
* No slang, idioms, colloquialisms, or contractions are used.
16-
* Each sentence is grammatically correct.
17-
* Each paragraph has a clear topic with details.
18-
* The paper has a clearly defined topic. It follows a logical progression to the conclusion.
19-
* Resources are clearly cited, using one citation style consistently.
11+
- Point of `view` should be impersonal.
12+
- Acronyms and technical abbreviations are first introduced, then used consistently.
13+
- No slang, idioms, colloquialisms, or contractions are used.
14+
- Each sentence is grammatically correct.
15+
- Each paragraph has a clear topic with details.
16+
- The paper has a clearly defined topic. It follows a logical progression to the conclusion.
17+
- Resources are clearly cited, using one citation style consistently.
2018

2119
1. Point of view should be impersonal.
2220
2. Acronyms and technical abbreviations are first introduced, then used consistently.
@@ -26,4 +24,4 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
2624
6. The paper has a clearly defined topic. It follows a logical progression to the conclusion.
2725
7. Resources are clearly cited, using one citation style consistently.
2826

29-
`var foo = 'bar'`
27+
`var foo = 'bar'`

__tests__/parse-flags.test.ts

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
1-
import { IParseFlagsOptions } from './../src/lib/parse-flags';
2-
import * as writer from '../src/lib/write-out';
3-
import clipboardy from 'clipboardy';
4-
import { parseFlags } from '../src/lib/parse-flags';
5-
import fs from 'fs';
1+
import { IParseFlagsOptions } from "./../src/lib/parse-flags";
2+
import * as writer from "../src/lib/write-out";
3+
import clipboardy from "clipboardy";
4+
import { parseFlags } from "../src/lib/parse-flags";
5+
import fs from "fs";
66

7-
jest.spyOn(process.stdout, 'write').mockImplementation();
7+
jest.spyOn(process.stdout, "write").mockImplementation();
88
afterAll(() => {
9-
jest.restoreAllMocks();
9+
jest.restoreAllMocks();
1010
});
11-
describe('testing parse flags function', () => {
12-
test('write out call', () => {
13-
const writeOutMock = jest.spyOn(writer, 'writeOut');
14-
parseFlags({
15-
data: '<h1>foo</h1>',
16-
inPath: undefined,
17-
outPath: undefined,
18-
});
19-
expect(writeOutMock).toHaveBeenCalledTimes(1);
20-
writeOutMock.mockRestore();
21-
});
11+
describe("testing parse flags function", () => {
12+
test("write out call", () => {
13+
const writeOutMock = jest.spyOn(writer, "writeOut");
14+
parseFlags({
15+
data: "<h1>foo</h1>",
16+
inPath: undefined,
17+
outPath: undefined,
18+
});
19+
expect(writeOutMock).toHaveBeenCalledTimes(1);
20+
writeOutMock.mockRestore();
21+
});
2222

23-
test('input from file', () => {
24-
const mockOut = jest.spyOn(process.stdout, 'write');
25-
const options: IParseFlagsOptions = {
26-
data: '',
27-
inPath: '__tests__/files/index.html',
28-
};
29-
parseFlags(options);
30-
expect(mockOut.mock.calls[0][0]).toBe('foo\n===\n');
31-
mockOut.mockRestore();
32-
});
23+
test("input from file", () => {
24+
const mockOut = jest.spyOn(process.stdout, "write");
25+
const options: IParseFlagsOptions = {
26+
data: "",
27+
inPath: "__tests__/files/index.html",
28+
};
29+
parseFlags(options);
30+
expect(mockOut.mock.calls[0][0]).toBe("foo\n===\n");
31+
mockOut.mockRestore();
32+
});
3333

34-
test('input from file fs read', () => {
35-
const orig = process.stdin.isTTY;
36-
process.stdin.isTTY = true;
37-
const mockFsReadSync = jest.spyOn(fs, 'readFileSync');
38-
const options: IParseFlagsOptions = {
39-
data: '',
40-
inPath: '__tests__/files/index.html',
41-
};
42-
parseFlags(options);
43-
expect(mockFsReadSync).toHaveBeenCalled();
44-
mockFsReadSync.mockRestore();
45-
process.stdin.isTTY = orig;
46-
});
34+
test("input from file fs read", () => {
35+
const orig = process.stdin.isTTY;
36+
process.stdin.isTTY = true;
37+
const mockFsReadSync = jest.spyOn(fs, "readFileSync");
38+
const options: IParseFlagsOptions = {
39+
data: "",
40+
inPath: "__tests__/files/index.html",
41+
};
42+
parseFlags(options);
43+
expect(mockFsReadSync).toHaveBeenCalled();
44+
mockFsReadSync.mockRestore();
45+
process.stdin.isTTY = orig;
46+
});
4747

48-
test('set and write to clipboard', () => {
49-
const orig = process.stdin.isTTY;
50-
process.stdin.isTTY = true;
51-
jest.spyOn(process, 'exit').mockImplementation();
52-
const mockClippy = jest.spyOn(clipboardy, 'writeSync');
53-
const data = '<h1>foo</h1>';
54-
clipboardy.writeSync(data);
55-
const options: IParseFlagsOptions = {
56-
data: '',
57-
toClipboard: true,
58-
};
59-
parseFlags(options);
60-
expect(mockClippy).toHaveBeenCalled();
61-
expect(clipboardy.readSync()).toBe('foo\n===\n');
62-
process.stdin.isTTY = orig;
63-
});
48+
test("set and write to clipboard", () => {
49+
const orig = process.stdin.isTTY;
50+
process.stdin.isTTY = true;
51+
jest.spyOn(process, "exit").mockImplementation();
52+
const mockClippy = jest.spyOn(clipboardy, "writeSync");
53+
const data = "<h1>foo</h1>";
54+
clipboardy.writeSync(data);
55+
const options: IParseFlagsOptions = {
56+
data: "",
57+
toClipboard: true,
58+
};
59+
parseFlags(options);
60+
expect(mockClippy).toHaveBeenCalled();
61+
expect(clipboardy.readSync()).toBe("foo\n===\n");
62+
process.stdin.isTTY = orig;
63+
});
6464
});

0 commit comments

Comments
 (0)