Skip to content

Commit

Permalink
chore: bump deps, fix typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed May 2, 2023
1 parent 8de1c46 commit b038db9
Show file tree
Hide file tree
Showing 9 changed files with 3,836 additions and 3,960 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
- ubuntu-latest
- windows-latest
node:
- 14
- 16
- 18
- 20
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'CodeQL'

on:
push:
branches: ['master']
pull_request:
branches: ['master']
schedule:
- cron: '41 19 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [javascript]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{ matrix.language }}'
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
"typecov": "type-coverage"
},
"devDependencies": {
"@1stg/lib-config": "^10.2.1",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.4",
"@types/eslint": "^8.4.6",
"@1stg/lib-config": "^11.1.0",
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.1",
"@types/eslint": "^8.37.0",
"@types/eslint-plugin-markdown": "^2.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^18.7.14",
"@types/react": "^18.0.18",
"@types/jest": "^29.5.1",
"@types/node": "^18.16.3",
"@types/react": "^18.2.0",
"@types/unist": "^2.0.6",
"jest": "^29.0.1",
"patch-package": "^6.4.7",
"jest": "^29.5.0",
"patch-package": "^7.0.0",
"react": "^18.2.0",
"ts-jest": "^28.0.8",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"type-coverage": "^2.22.0",
"typescript": "^4.8.2",
"yarn-deduplicate": "^6.0.0"
"type-coverage": "^2.25.0",
"typescript": "^5.0.4",
"yarn-deduplicate": "^6.0.1"
},
"resolutions": {
"prettier": "^2.7.1"
"prettier": "^2.8.8"
},
"commitlint": {
"extends": [
Expand Down
18 changes: 9 additions & 9 deletions packages/eslint-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@
"eslint": ">=8.0.0"
},
"dependencies": {
"acorn": "^8.8.0",
"acorn": "^8.8.2",
"acorn-jsx": "^5.3.2",
"cosmiconfig": "^7.0.1",
"espree": "^9.4.0",
"estree-util-visit": "^1.2.0",
"remark-mdx": "^2.1.3",
"cosmiconfig": "^8.1.3",
"espree": "^9.5.1",
"estree-util-visit": "^1.2.1",
"remark-mdx": "^2.3.0",
"remark-parse": "^10.0.1",
"remark-stringify": "^10.0.2",
"synckit": "^0.8.4",
"tslib": "^2.4.0",
"synckit": "^0.8.5",
"tslib": "^2.5.0",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.1",
"unist-util-visit": "^4.1.2",
"uvu": "^0.5.6",
"vfile": "^5.3.4"
"vfile": "^5.3.7"
}
}
19 changes: 13 additions & 6 deletions packages/eslint-mdx/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import type {
ObjectExpression,
Program,
SpreadElement,
TemplateElement,
} from 'estree'
import type { JSXClosingElement, JSXElement, JSXFragment } from 'estree-jsx'
import type { BlockContent, PhrasingContent } from 'mdast'
import type {
BlockContent,
PhrasingContent,
Literal as MdastLiteral,
} from 'mdast'
import type { Options } from 'micromark-extension-mdx-expression'
import type { Root } from 'remark-mdx'
import { extractProperties, runAsWorker } from 'synckit'
Expand Down Expand Up @@ -301,7 +304,9 @@ runAsWorker(

processed.add(node)

function handleChildren(node: BlockContent | PhrasingContent) {
function handleChildren(
node: BlockContent | MdastLiteral | PhrasingContent,
) {
return 'children' in node
? (node.children as Array<BlockContent | PhrasingContent>).reduce<
JSXElement['children']
Expand Down Expand Up @@ -336,7 +341,9 @@ runAsWorker(
: []
}

function handleNode(node: BlockContent | PhrasingContent) {
function handleNode(
node: BlockContent | MdastLiteral | PhrasingContent,
) {
if (
node.type !== 'mdxJsxTextElement' &&
node.type !== 'mdxJsxFlowElement'
Expand All @@ -355,7 +362,7 @@ runAsWorker(

let expression: BaseExpression

if (node.name) {
if ('name' in node && node.name) {
const nodeNameLength = node.name.length
const nodeNameStart = nextCharOffset(nodeStart + 1)

Expand Down Expand Up @@ -612,7 +619,7 @@ runAsWorker(
/**
* Copied from @see https://github.com/eslint/espree/blob/main/lib/espree.js#L206-L220
*/
const templateElement = node as TemplateElement
const templateElement = node

const startOffset = -1
const endOffset = templateElement.tail ? 1 : 2
Expand Down
6 changes: 3 additions & 3 deletions packages/eslint-plugin-mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
"dependencies": {
"eslint-mdx": "^2.0.5",
"eslint-plugin-markdown": "^3.0.0",
"remark-mdx": "^2.1.3",
"remark-mdx": "^2.3.0",
"remark-parse": "^10.0.1",
"remark-stringify": "^10.0.2",
"tslib": "^2.4.0",
"tslib": "^2.5.0",
"unified": "^10.1.2",
"vfile": "^5.3.4"
"vfile": "^5.3.7"
}
}
1 change: 1 addition & 0 deletions packages/eslint-plugin-mdx/src/processors/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ESLinter.prototype.verify = function (
(typeof config.extractConfig === 'function'
? config.extractConfig(
/* istanbul ignore next */
// eslint-disable-next-line unicorn/no-typeof-undefined
typeof options === 'undefined' || typeof options === 'string'
? options
: options.filename,
Expand Down
79 changes: 79 additions & 0 deletions test/__snapshots__/fixtures.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ exports[`fixtures should match all snapshots: 292.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 5,
"line": 5,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
]
`;
Expand Down Expand Up @@ -277,6 +288,7 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"severity": 2,
"suggestions": [
{
"data": {},
"desc": "First argument is an \`array\`.",
"fix": {
"range": [
Expand All @@ -290,6 +302,7 @@ exports[`fixtures should match all snapshots: 380.mdx 1`] = `
"messageId": "argument-is-spreadable",
},
{
"data": {},
"desc": "First argument is not an \`array\`.",
"fix": {
"range": [
Expand Down Expand Up @@ -738,6 +751,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 1,
"line": 1,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
{
"column": 9,
"endColumn": 58,
Expand All @@ -759,6 +783,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 5,
"line": 5,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
{
"column": 9,
"endColumn": 58,
Expand All @@ -780,6 +815,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 9,
"line": 9,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
{
"column": 9,
"endColumn": 58,
Expand All @@ -801,6 +847,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 13,
"line": 13,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
{
"column": 9,
"endColumn": 58,
Expand All @@ -822,6 +879,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 17,
"line": 17,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
{
"column": 9,
"endColumn": 58,
Expand All @@ -843,6 +911,17 @@ exports[`fixtures should match all snapshots: jsx-in-list.mdx 1`] = `
"ruleId": "prettier/prettier",
"severity": 2,
},
{
"column": 46,
"endColumn": 51,
"endLine": 21,
"line": 21,
"message": "Unknown property 'story' found",
"messageId": "unknownProp",
"nodeType": "JSXAttribute",
"ruleId": "react/no-unknown-property",
"severity": 2,
},
]
`;
Expand Down
Loading

0 comments on commit b038db9

Please sign in to comment.