mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 21:14:28 -08:00
linter
This commit is contained in:
22
.eslintrc.json
Normal file
22
.eslintrc.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"browser": true,
|
||||||
|
"es6": true
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-unsafe-finally": "off",
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"no-use-before-define": [2, { "functions": false , "classes": false, "variables": false}],
|
||||||
|
"no-console": "off"
|
||||||
|
},
|
||||||
|
"globals": {
|
||||||
|
"globalThis": true
|
||||||
|
},
|
||||||
|
"extends": "eslint:recommended"
|
||||||
|
}
|
||||||
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -15,5 +15,6 @@ jobs:
|
|||||||
|
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
|
eslint src test
|
||||||
node test/run.js
|
node test/run.js
|
||||||
node test/self_hosted_test.js
|
node test/self_hosted_test.js
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class Editor {
|
|||||||
this.markers = {}
|
this.markers = {}
|
||||||
this.sessions = {}
|
this.sessions = {}
|
||||||
|
|
||||||
this.ace_editor = ace.edit(this.editor_container)
|
this.ace_editor = globalThis.ace.edit(this.editor_container)
|
||||||
|
|
||||||
this.ace_editor.setOptions({
|
this.ace_editor.setOptions({
|
||||||
behavioursEnabled: false,
|
behavioursEnabled: false,
|
||||||
@@ -141,7 +141,7 @@ export class Editor {
|
|||||||
ensure_session(file, code) {
|
ensure_session(file, code) {
|
||||||
let session = this.sessions[file]
|
let session = this.sessions[file]
|
||||||
if(session == null) {
|
if(session == null) {
|
||||||
session = ace.createEditSession(code)
|
session = globalThis.ace.createEditSession(code)
|
||||||
this.sessions[file] = session
|
this.sessions[file] = session
|
||||||
session.setUseWorker(false)
|
session.setUseWorker(false)
|
||||||
session.setOptions({
|
session.setOptions({
|
||||||
@@ -389,7 +389,7 @@ export class Editor {
|
|||||||
const from_pos = session.doc.indexToPosition(from)
|
const from_pos = session.doc.indexToPosition(from)
|
||||||
const to_pos = session.doc.indexToPosition(to)
|
const to_pos = session.doc.indexToPosition(to)
|
||||||
const markerId = session.addMarker(
|
const markerId = session.addMarker(
|
||||||
new ace.Range(from_pos.row,from_pos.column,to_pos.row,to_pos.column),
|
new globalThis.ace.Range(from_pos.row,from_pos.column,to_pos.row,to_pos.column),
|
||||||
className
|
className
|
||||||
)
|
)
|
||||||
if(this.markers[file] == null){
|
if(this.markers[file] == null){
|
||||||
|
|||||||
@@ -136,7 +136,6 @@ export const header = object => {
|
|||||||
} else {
|
} else {
|
||||||
return object.toString()
|
return object.toString()
|
||||||
}
|
}
|
||||||
return header
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const get_path = (o, path) => {
|
const get_path = (o, path) => {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ globalThis.clear_directory_handle = () => {
|
|||||||
let dir_handle
|
let dir_handle
|
||||||
|
|
||||||
const request_directory_handle = async () => {
|
const request_directory_handle = async () => {
|
||||||
dir_handle = await showDirectoryPicker()
|
dir_handle = await globalThis.showDirectoryPicker()
|
||||||
await send_message({type: 'SET', data: dir_handle})
|
await send_message({type: 'SET', data: dir_handle})
|
||||||
return dir_handle
|
return dir_handle
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ const concat_path = (base, i) => {
|
|||||||
} else {
|
} else {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const topsort_modules = (modules) => {
|
export const topsort_modules = (modules) => {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const tokenize_js = (str) => {
|
|||||||
|
|
||||||
{name: 'comment' , re: '//[^\n]*'},
|
{name: 'comment' , re: '//[^\n]*'},
|
||||||
{name: 'comment' , re: '\\/\\*[\\s\\S]*?\\*\\/'},
|
{name: 'comment' , re: '\\/\\*[\\s\\S]*?\\*\\/'},
|
||||||
{name: 'newline' , re: '[\r\n\]+'},
|
{name: 'newline' , re: '[\r\n]+'},
|
||||||
|
|
||||||
|
|
||||||
// whitespace except newline
|
// whitespace except newline
|
||||||
@@ -1423,11 +1423,6 @@ const update_children_not_rec = (node, children = node.children) => {
|
|||||||
}
|
}
|
||||||
} else if(node.type == 'call_args') {
|
} else if(node.type == 'call_args') {
|
||||||
return node
|
return node
|
||||||
} else if(node.type == 'member_access') {
|
|
||||||
return {...node,
|
|
||||||
object: children[0],
|
|
||||||
property: children[1],
|
|
||||||
}
|
|
||||||
} else if(node.type == 'spread') {
|
} else if(node.type == 'spread') {
|
||||||
return {...node,
|
return {...node,
|
||||||
expr: children[0],
|
expr: children[0],
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ const do_run = function*(module_fns, cxt, io_cache){
|
|||||||
io_cache_resolver_is_set: false,
|
io_cache_resolver_is_set: false,
|
||||||
// Map of (index in io_cache) -> resolve
|
// Map of (index in io_cache) -> resolve
|
||||||
io_cache_resolvers: new Map(),
|
io_cache_resolvers: new Map(),
|
||||||
io_cache_is_replay_aborted: false,
|
|
||||||
io_cache_index: 0,
|
io_cache_index: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user