Skip to content

Commit 5d998e0

Browse files
committed
Add online AST viewer
1 parent e7bbba5 commit 5d998e0

File tree

17 files changed

+739
-2
lines changed

17 files changed

+739
-2
lines changed

.github/workflows/GHPages.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: GHPages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
deploy-docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v1
13+
- name: Install And Build
14+
run: |+
15+
npm install
16+
npm run build
17+
cd explorer
18+
npm install
19+
npm run build
20+
- name: Deploy
21+
uses: peaceiris/actions-gh-pages@v3
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
publish_dir: ./explorer/dist
25+
force_orphan: true

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
"typescript.tsdk": "node_modules/typescript/lib",
1414
"editor.codeActionsOnSave": {
1515
"source.fixAll.eslint": true,
16-
}
16+
},
17+
"vetur.validation.template": false
1718
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ If not specified, all syntaxes that express static values ​​are accepted. Fo
6363

6464
- [AST.md](./docs/AST.md) is AST specification.
6565
- [no-template-literals.ts](https://github.com/ota-meshi/eslint-plugin-jsonc/blob/master/lib/rules/no-template-literals.ts) is an example.
66+
- You can see the AST on the [DEMO](https://ota-meshi.github.io/jsonc-eslint-parser/).
6667

6768
## :lock: License
6869

explorer/.eslintrc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
parserOptions: {
3+
sourceType: "module",
4+
ecmaVersion: 2020,
5+
},
6+
extends: ["plugin:@ota-meshi/+vue3", "plugin:@ota-meshi/+prettier"],
7+
rules: {
8+
"node/no-unsupported-features/es-syntax": "off",
9+
},
10+
}

explorer/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

explorer/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ["@vue/cli-plugin-babel/preset"],
3+
}

explorer/package.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "jsonc-eslint-parser-ast-explorer",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build"
8+
},
9+
"dependencies": {
10+
"core-js": "^3.6.5",
11+
"vue": "^3.0.0"
12+
},
13+
"devDependencies": {
14+
"@vue/cli-plugin-babel": "~4.5.0",
15+
"@vue/cli-service": "~4.5.0",
16+
"@vue/compiler-sfc": "^3.0.0"
17+
},
18+
"browserslist": [
19+
"> 1%",
20+
"last 2 versions",
21+
"not dead"
22+
]
23+
}

explorer/public/index.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>jsonc-eslint-parser</title>
9+
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.2/min/vs/loader.min.js"></script>
10+
<script>
11+
window.require.config({
12+
paths: {
13+
vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.21.2/min/vs"
14+
},
15+
'vs/nls': {
16+
availableLanguages: {
17+
'*': 'ja'
18+
}
19+
}
20+
})
21+
</script>
22+
</head>
23+
<body>
24+
<noscript>
25+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
26+
</noscript>
27+
<div id="app"></div>
28+
<!-- built files will be auto injected -->
29+
</body>
30+
</html>

explorer/shim/module.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
createRequire: () => () => null,
3+
}

explorer/src/App.vue

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<template>
2+
<header class="header">
3+
<label class="title">jsonc-eslint-parser</label>
4+
<SnsBar />
5+
<a
6+
href="https://github.com/ota-meshi/jsonc-eslint-parser"
7+
class="github-link"
8+
>View on GitHub</a
9+
>
10+
</header>
11+
<main class="main">
12+
<AstExplorer />
13+
</main>
14+
</template>
15+
16+
<script>
17+
import AstExplorer from "./components/AstExplorer.vue"
18+
import SnsBar from "./components/SnsBar.vue"
19+
20+
export default {
21+
name: "App",
22+
components: {
23+
AstExplorer,
24+
SnsBar,
25+
},
26+
}
27+
</script>
28+
<style scoped>
29+
.header {
30+
height: 32px;
31+
display: flex;
32+
border-bottom: 1px #ddd solid;
33+
}
34+
.title {
35+
font-size: 120%;
36+
flex-grow: 1;
37+
display: flex;
38+
align-items: center;
39+
}
40+
.github-link {
41+
display: flex;
42+
align-items: center;
43+
}
44+
.main {
45+
position: relative;
46+
height: calc(100vh - 32px - 16px);
47+
}
48+
</style>

0 commit comments

Comments
 (0)