Skip to content

Commit 715cb2b

Browse files
committed
eslint
1 parent fa65a86 commit 715cb2b

File tree

7 files changed

+39
-31
lines changed

7 files changed

+39
-31
lines changed

.eslintrc.cjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// eslint-disable-next-line no-undef
2+
module.exports = {
3+
env: {
4+
browser: true,
5+
node: true,
6+
es6: true
7+
},
8+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
9+
parser: '@typescript-eslint/parser',
10+
plugins: ['@typescript-eslint'],
11+
root: true,
12+
rules: {
13+
"@typescript-eslint/no-explicit-any": "off",
14+
"@typescript-eslint/no-var-requires": "off",
15+
}
16+
};

.eslintrc.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

lib/checkbox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Token from 'markdown-it/lib/token'
33

44
// modified from https://github.com/mcecot/markdown-it-checkbox
55
export function MarkdownItCheckbox(md: MarkdownIt) {
6-
let lastId: number = 0
6+
let lastId = 0
77
function createTokens(checked: boolean, label: string): Token[] {
88
const nodes: Token[] = []
99

@@ -31,7 +31,7 @@ export function MarkdownItCheckbox(md: MarkdownIt) {
3131
}
3232

3333
function splitTextToken(token: Token): Token[] | null {
34-
let matches = token.content.match(/\[(X|\s|\_|\-)\]\s(.*)/i)
34+
const matches = token.content.match(/\[(X|\s|_|-)\]\s(.*)/i)
3535
if (matches === null) {
3636
return null
3737
}
@@ -47,7 +47,7 @@ export function MarkdownItCheckbox(md: MarkdownIt) {
4747

4848

4949
function checkbox(state: any): void {
50-
let blockTokens = state.tokens
50+
const blockTokens = state.tokens
5151
const l = blockTokens.length
5252
let k = -1
5353
for (let j = 0; j < l; j++) {

lib/container.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import MarkdownIt from "markdown-it/lib"
33

44
const names = ['success', 'info', 'warning', 'danger', 'spoiler']
5+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
56
export function MarkdownItContainer(md: MarkdownIt, _options: any) {
67
// Second param may be useful if you decide
78
// to increase minimal allowed marker length
@@ -67,7 +68,7 @@ export function MarkdownItContainer(md: MarkdownIt, _options: any) {
6768
const params: string = state.src.slice(pos, max)
6869

6970
const parse: string[] = params.trim().split(' ')
70-
const name: string = parse?.length > 0 ? parse[0]! : ''
71+
const name: string = parse?.length > 0 ? (parse[0] || '') : ''
7172
const summary: string = parse.length > 1 ? parse.slice(1).join(' ') : ''
7273
if (!names.includes(name)) {
7374
return false

lib/yaml-metadata.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function MarkdownItYAMLMetadata(md: MarkdownIt, callback: (option: any) =
4949
return true
5050
}
5151

52+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
5253
function renderer(tokens: any, idx: number, _options: any, _evn: any): string {
5354
const token = tokens[idx]
5455
if (callback) {

package-lock.json

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

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"scripts": {
2222
"build": "tsc",
2323
"test": "tsc & npx hmd2html -s ./example",
24-
"lint": "eslint lib/**"
24+
"lint": "npx eslint lib/**"
2525
},
2626
"author": "Kashiwa",
2727
"license": "MIT",
@@ -44,12 +44,12 @@
4444
"markdown-it-sub": "^1.0.0",
4545
"markdown-it-sup": "^1.0.0",
4646
"markdown-it-table-of-contents": "^0.6.0",
47-
"typescript": "^4.5.2",
4847
"yaml": "^2.2.1"
4948
},
5049
"devDependencies": {
51-
"@typescript-eslint/eslint-plugin": "^5.50.0",
52-
"@typescript-eslint/parser": "^5.50.0",
53-
"eslint": "^8.33.0"
50+
"@typescript-eslint/eslint-plugin": "^5.53.0",
51+
"@typescript-eslint/parser": "^5.53.0",
52+
"eslint": "^8.34.0",
53+
"typescript": "^4.9.5"
5454
}
5555
}

0 commit comments

Comments
 (0)