Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed May 11, 2024
1 parent 6c7e73f commit 3f60f85
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 15 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ^20.8
node-version: '22'
- run: |
npm install
npm run lint
Expand All @@ -27,7 +27,7 @@ jobs:

strategy:
matrix:
node-version: ['12.22.0', '12', '14.17.0', '14', '16.0.0', '16', '18', '20', '21']
node-version: ['12.22.0', '12', '14.17.0', '14', '16.0.0', '16', '18', '20', '22']

steps:
- uses: actions/checkout@v4
Expand All @@ -36,19 +36,21 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: |
npm install
npm install --force [email protected]
npm test
test-eslint-8_4:
test-eslint-9:

name: Test (ESLint 8.4)
name: Test (ESLint 9)

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
- run: |
npm install --force [email protected]
npm install
npm install --force eslint@9
npm test
4 changes: 2 additions & 2 deletions lib/format-code-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ function formatCodePath(codePath, { segmentNames } = { })
{
const { id } = segment;
const lines = segment.internal.nodes || [];
if (!segment.reachable)
lines.unshift('❮❮unreachable❯❯');
if (segmentNames)
lines.unshift(`【${id}】`);
else if (!lines.length)
lines.push(id);
const label = lines.join('\n');
text += `state ${JSON.stringify(label)} as ${id}\n`;
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"test": "mocha --check-leaks"
},
"dependencies": {
"eslint": "^8.4",
"eslint": ">=8.4",
"postrequire": "2"
},
"devDependencies": {
"@origin-1/eslint-config": "latest",
"@origin-1/eslint-config": "eslint-8",
"c8js": "latest",
"eslint-formatter-compact": "latest",
"globals": "latest",
Expand Down
2 changes: 1 addition & 1 deletion test/expected/graph-2.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ classDef unreachable fill: #FF9800, stroke-dasharray: 5 5
class s1_2 unreachable
classDef thrown fill: none, stroke: none
state "Program:enter\nThrowStatement:enter\nIdentifier (foo)\nThrowStatement:exit" as s1_1
state "Program:exit" as s1_2
state "❮❮unreachable❯❯\nProgram:exit" as s1_2
thrown:::thrown: ✘
[*] --> s1_1
s1_1 --> s1_2
Expand Down
2 changes: 1 addition & 1 deletion test/expected/graph-3.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ classDef thrown fill: none, stroke: none
state "【s1_1】" as s1_1
state "【s1_2】" as s1_2
state "【s1_4】" as s1_4
state "【s1_3】" as s1_3
state "【s1_3】\n❮❮unreachable❯❯" as s1_3
thrown:::thrown: ✘
[*] --> s1_1
s1_1 --> s1_2
Expand Down
2 changes: 1 addition & 1 deletion test/expected/graph-4.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ classDef thrown fill: none, stroke: none
state "【s1_1】\nProgram:enter\nIfStatement:enter\nIdentifier (foo)" as s1_1
state "【s1_2】\nThrowStatement:enter\nIdentifier (bar)\nThrowStatement:exit" as s1_2
state "【s1_4】\nIfStatement:exit\nProgram:exit" as s1_4
state "【s1_3】" as s1_3
state "【s1_3】\n❮❮unreachable❯❯" as s1_3
thrown:::thrown: ✘
[*] --> s1_1
s1_1 --> s1_2
Expand Down
2 changes: 1 addition & 1 deletion test/expected/graph-7.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class s1_1, s1_2 common
classDef unreachable fill: #FF9800, stroke-dasharray: 5 5
class s1_2 unreachable
state "Program:enter\nReturnStatement:enter\nIdentifier (foo)\nReturnStatement:exit" as s1_1
state "Program:exit" as s1_2
state "❮❮unreachable❯❯\nProgram:exit" as s1_2
[*] --> s1_1
s1_1 --> s1_2
s1_1 --> [*]
2 changes: 1 addition & 1 deletion test/expected/graph-8.mermaid
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class s1_3 unreachable
state "Program:enter\nIfStatement:enter\nIdentifier (foo)" as s1_1
state "ReturnStatement" as s1_2
state "IfStatement:exit\nProgram:exit" as s1_4
state "s1_3" as s1_3
state "❮❮unreachable❯❯" as s1_3
[*] --> s1_1
s1_1 --> s1_2
s1_1 --> s1_4
Expand Down

0 comments on commit 3f60f85

Please sign in to comment.