Skip to content

Commit 24cfe78

Browse files
committed
chore: upgrade (dev)Dependencies, prepare for eslint 8
1 parent e0461d1 commit 24cfe78

File tree

11 files changed

+2093
-2336
lines changed

11 files changed

+2093
-2336
lines changed

codechecks.yml

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

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"clean": "rimraf packages/*/{lib,*.tsbuildinfo} node_modules/@1stg/eslint-config/node_modules",
1717
"lint": "run-p lint:*",
1818
"lint:es": "eslint . --cache -f friendly",
19-
"lint:ts": "tslint -p . -t stylish",
19+
"lint:tsc": "tsc --noEmit",
2020
"postinstall": "simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0",
2121
"prelint": "yarn build",
2222
"prerelease": "yarn build",
@@ -25,28 +25,26 @@
2525
"typecov": "type-coverage"
2626
},
2727
"devDependencies": {
28-
"@1stg/lib-config": "^3.0.0",
29-
"@1stg/tslint-config": "^2.1.0",
30-
"@types/eslint": "^7.28.0",
28+
"@1stg/lib-config": "^4.1.2",
29+
"@types/eslint": "^7.28.1",
3130
"@types/eslint-plugin-markdown": "^2.0.0",
32-
"@types/jest": "^27.0.1",
33-
"@types/node": "^16.7.1",
34-
"@types/react": "^17.0.19",
31+
"@types/jest": "^27.0.2",
32+
"@types/node": "^16.10.9",
33+
"@types/react": "^17.0.29",
3534
"@types/unist": "^2.0.6",
3635
"lerna": "^4.0.0",
3736
"npm-run-all": "^4.1.5",
3837
"react": "^17.0.2",
3938
"remark-frontmatter": "2",
4039
"remark-validate-links": "^10.0.4",
4140
"ts-jest": "^27.0.5",
42-
"ts-node": "^10.2.1",
43-
"tslint": "^6.1.3",
41+
"ts-node": "^10.3.0",
4442
"type-coverage": "^2.18.2",
45-
"typescript": "^4.3.5",
43+
"typescript": "^4.4.4",
4644
"yarn-deduplicate": "^3.1.0"
4745
},
4846
"resolutions": {
49-
"prettier": "^2.3.2"
47+
"prettier": "^2.4.1"
5048
},
5149
"commitlint": {
5250
"extends": [

packages/eslint-mdx/src/parser.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,14 @@ export class Parser {
157157

158158
parseForESLint(code: string, options: ParserOptions) {
159159
const extname = path.extname(options.filePath)
160-
const isMdx = DEFAULT_EXTENSIONS.concat(options.extensions || []).includes(
161-
extname,
162-
)
163-
const isMarkdown = MARKDOWN_EXTENSIONS.concat(
164-
options.markdownExtensions || [],
165-
).includes(extname)
160+
const isMdx = [
161+
...DEFAULT_EXTENSIONS,
162+
...(options.extensions || []),
163+
].includes(extname)
164+
const isMarkdown = [
165+
...MARKDOWN_EXTENSIONS,
166+
...(options.markdownExtensions || []),
167+
].includes(extname)
166168
if (!isMdx && !isMarkdown) {
167169
return this._eslintParse(code, options)
168170
}

packages/eslint-plugin-mdx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
},
3434
"dependencies": {
3535
"eslint-mdx": "^1.15.1",
36-
"eslint-plugin-markdown": "^2.2.0",
37-
"synckit": "^0.3.4",
36+
"eslint-plugin-markdown": "^2.2.1",
37+
"synckit": "^0.4.1",
3838
"tslib": "^2.3.1",
3939
"vfile": "^4.2.1"
4040
}

packages/eslint-plugin-mdx/src/rules/remark.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { createSyncFn } from 'synckit'
1212
import type { FrozenProcessor } from 'unified'
1313
import type { VFile, VFileOptions } from 'vfile'
1414
import vfile from 'vfile'
15+
import type { VFileMessage } from 'vfile-message'
1516

1617
import type { RemarkLintMessage } from './types'
1718

@@ -48,12 +49,14 @@ export const remark: Rule.RuleModule = {
4849
const extname = path.extname(filename)
4950
const sourceCode = context.getSourceCode()
5051
const options = context.parserOptions as ParserOptions
51-
const isMdx = DEFAULT_EXTENSIONS.concat(options.extensions || []).includes(
52-
extname,
53-
)
54-
const isMarkdown = MARKDOWN_EXTENSIONS.concat(
55-
options.markdownExtensions || [],
56-
).includes(extname)
52+
const isMdx = [
53+
...DEFAULT_EXTENSIONS,
54+
...(options.extensions || []),
55+
].includes(extname)
56+
const isMarkdown = [
57+
...MARKDOWN_EXTENSIONS,
58+
...(options.markdownExtensions || []),
59+
].includes(extname)
5760
return {
5861
// eslint-disable-next-line sonarjs/cognitive-complexity
5962
Program(node) {
@@ -102,8 +105,11 @@ export const remark: Rule.RuleModule = {
102105
)
103106
file.messages = messages
104107
fixedText = content
105-
} else if (!file.messages.includes(err)) {
106-
file.message(err).fatal = true
108+
} else if (!file.messages.includes(err as VFileMessage)) {
109+
file.message(
110+
// @ts-expect-error Error is fine
111+
err,
112+
).fatal = true
107113
}
108114
}
109115
}

packages/eslint-plugin-mdx/src/worker.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getRemarkProcessor } from 'eslint-mdx'
22
import { runAsWorker } from 'synckit'
33
import type { VFileOptions } from 'vfile'
44
import vfile from 'vfile'
5+
import type { VFileMessage } from 'vfile-message'
56

67
runAsWorker(
78
async (
@@ -14,8 +15,11 @@ runAsWorker(
1415
try {
1516
await remarkProcessor.process(file)
1617
} catch (err) {
17-
if (!file.messages.includes(err)) {
18-
file.message(err).fatal = true
18+
if (!file.messages.includes(err as VFileMessage)) {
19+
file.message(
20+
// @ts-expect-error Error is fine
21+
err,
22+
).fatal = true
1923
}
2024
}
2125
return {

test/no-unused-expressions.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { parser, ruleTester } from './helpers'
2+
13
import { DEFAULT_PARSER_OPTIONS as parserOptions } from 'eslint-mdx'
24
import { noUnusedExpressions } from 'eslint-plugin-mdx'
35

4-
import { parser, ruleTester } from './helpers'
5-
66
ruleTester.run('no-unused-expressions', noUnusedExpressions, {
77
valid: [
88
{

test/parser.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-disable sonarjs/no-duplicate-string */
2+
import { noop } from './helpers'
3+
24
import type { Node, Parent, ParserConfig, ParserOptions } from 'eslint-mdx'
35
import {
46
DEFAULT_PARSER_OPTIONS as parserOptions,
@@ -9,8 +11,6 @@ import {
911
parser,
1012
} from 'eslint-mdx'
1113

12-
import { noop } from './helpers'
13-
1414
const stringToNode = (text: string) =>
1515
first(
1616
(getRemarkProcessor(PLACEHOLDER_FILE_PATH, true).parse(text) as Parent)

test/remark.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1+
import { homedir } from 'os'
12
import path from 'path'
23

4+
import { parser, ruleTester } from './helpers'
5+
36
import {
47
DEFAULT_PARSER_OPTIONS as parserOptions,
58
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
69
// @ts-ignore
710
processorCache,
811
} from 'eslint-mdx'
912
import { remark } from 'eslint-plugin-mdx'
10-
import { homedir } from 'os'
11-
12-
import { parser, ruleTester } from './helpers'
1313

1414
const userDir = homedir()
1515

tslint.json

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

0 commit comments

Comments
 (0)