Skip to content

Commit ebb2a62

Browse files
committed
WIP
1 parent 6c7e73f commit ebb2a62

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

.github/workflows/nodejs.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- uses: actions/setup-node@v4
1616
with:
17-
node-version: ^20.8
17+
node-version: '22'
1818
- run: |
1919
npm install
2020
npm run lint
@@ -27,28 +27,28 @@ jobs:
2727

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

3232
steps:
3333
- uses: actions/checkout@v4
3434
- uses: actions/setup-node@v4
3535
with:
3636
node-version: ${{ matrix.node-version }}
3737
- run: |
38-
npm install
38+
npm install --force [email protected]
3939
npm test
4040
41-
test-eslint-8_4:
41+
test-eslint-9:
4242

43-
name: Test (ESLint 8.4)
43+
name: Test (ESLint 9)
4444

4545
runs-on: ubuntu-latest
4646

4747
steps:
4848
- uses: actions/checkout@v4
4949
- uses: actions/setup-node@v4
5050
with:
51-
node-version: '20'
51+
node-version: '22'
5252
- run: |
53-
npm install --force eslint@8.4
53+
npm install --force eslint@9
5454
npm test

lib/format-code-path.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function formatCodePath(codePath, { segmentNames } = { })
4343
{
4444
const { id } = segment;
4545
const lines = segment.internal.nodes || [];
46+
if (!segment.reachable)
47+
lines.unshift('❮❮unreachable❯❯');
4648
if (segmentNames)
4749
lines.unshift(`【${id}】`);
48-
else if (!lines.length)
49-
lines.push(id);
5050
const label = lines.join('\n');
5151
text += `state ${JSON.stringify(label)} as ${id}\n`;
5252
}

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"test": "mocha --check-leaks"
2121
},
2222
"dependencies": {
23-
"eslint": "^8.4",
23+
"eslint": ">=8.4",
2424
"postrequire": "2"
2525
},
2626
"devDependencies": {
27-
"@origin-1/eslint-config": "latest",
27+
"@origin-1/eslint-config": "eslint-8",
2828
"c8js": "latest",
2929
"eslint-formatter-compact": "latest",
3030
"globals": "latest",

test/expected/graph-2.mermaid

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ classDef unreachable fill: #FF9800, stroke-dasharray: 5 5
55
class s1_2 unreachable
66
classDef thrown fill: none, stroke: none
77
state "Program:enter\nThrowStatement:enter\nIdentifier (foo)\nThrowStatement:exit" as s1_1
8-
state "Program:exit" as s1_2
8+
state "❮❮unreachable❯❯\nProgram:exit" as s1_2
99
thrown:::thrown: ✘
1010
[*] --> s1_1
1111
s1_1 --> s1_2

test/expected/graph-3.mermaid

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ classDef thrown fill: none, stroke: none
77
state "【s1_1】" as s1_1
88
state "【s1_2】" as s1_2
99
state "【s1_4】" as s1_4
10-
state "【s1_3】" as s1_3
10+
state "【s1_3】\n❮❮unreachable❯❯" as s1_3
1111
thrown:::thrown: ✘
1212
[*] --> s1_1
1313
s1_1 --> s1_2

test/expected/graph-4.mermaid

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ classDef thrown fill: none, stroke: none
77
state "【s1_1】\nProgram:enter\nIfStatement:enter\nIdentifier (foo)" as s1_1
88
state "【s1_2】\nThrowStatement:enter\nIdentifier (bar)\nThrowStatement:exit" as s1_2
99
state "【s1_4】\nIfStatement:exit\nProgram:exit" as s1_4
10-
state "【s1_3】" as s1_3
10+
state "【s1_3】\n❮❮unreachable❯❯" as s1_3
1111
thrown:::thrown: ✘
1212
[*] --> s1_1
1313
s1_1 --> s1_2

test/expected/graph-7.mermaid

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class s1_1, s1_2 common
44
classDef unreachable fill: #FF9800, stroke-dasharray: 5 5
55
class s1_2 unreachable
66
state "Program:enter\nReturnStatement:enter\nIdentifier (foo)\nReturnStatement:exit" as s1_1
7-
state "Program:exit" as s1_2
7+
state "❮❮unreachable❯❯\nProgram:exit" as s1_2
88
[*] --> s1_1
99
s1_1 --> s1_2
1010
s1_1 --> [*]

test/expected/graph-8.mermaid

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class s1_3 unreachable
66
state "Program:enter\nIfStatement:enter\nIdentifier (foo)" as s1_1
77
state "ReturnStatement" as s1_2
88
state "IfStatement:exit\nProgram:exit" as s1_4
9-
state "s1_3" as s1_3
9+
state "❮❮unreachable❯❯" as s1_3
1010
[*] --> s1_1
1111
s1_1 --> s1_2
1212
s1_1 --> s1_4

0 commit comments

Comments
 (0)