pull/3827/head
commit
6ab8ac79b8
@ -0,0 +1,48 @@ |
||||
import { Monaco } from "@monaco-editor/react" |
||||
import monaco from "../../types/monaco" |
||||
import { EditorUIProps } from "../remix-ui-editor" |
||||
import { default as fixes } from "./quickfixes" |
||||
|
||||
export class RemixCodeActionProvider implements monaco.languages.CodeActionProvider { |
||||
props: EditorUIProps |
||||
monaco: Monaco |
||||
constructor(props: any, monaco: any) { |
||||
this.props = props |
||||
this.monaco = monaco |
||||
} |
||||
|
||||
async provideCodeActions ( |
||||
model /**ITextModel*/, |
||||
range /**Range*/, |
||||
context /**CodeActionContext*/, |
||||
token /**CancellationToken*/ |
||||
) { |
||||
|
||||
const actions = context.markers.map(error => { |
||||
const errStrings = Object.keys(fixes) |
||||
const errStr = errStrings.find(es => error.message.includes(es)) |
||||
const fix = fixes[errStr] |
||||
return { |
||||
title: fix.title, |
||||
diagnostics: [error], |
||||
kind: "quickfix", |
||||
edit: { |
||||
edits: [ |
||||
{ |
||||
resource: model.uri, |
||||
edit: { |
||||
range: fix.range || error, |
||||
text: fix.message |
||||
} |
||||
} |
||||
] |
||||
}, |
||||
isPreferred: true |
||||
} |
||||
}) |
||||
return { |
||||
actions: actions, |
||||
dispose: () => {} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,16 @@ |
||||
export default { |
||||
"Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing \"SPDX-License-Identifier: <SPDX-License>\" to each source file. Use \"SPDX-License-Identifier: UNLICENSED\" for non-open-source code. Please see https://spdx.org for more information.": { |
||||
"title": "Add open-source license", |
||||
"message": "// SPDX-License-Identifier: GPL-3.0" |
||||
}, |
||||
"Warning: Source file does not specify required compiler version! Consider adding" : { |
||||
"title": "Add pragma line", |
||||
"message": "pragma solidity ^0.*.*;", |
||||
"range": { |
||||
startLineNumber: 2, |
||||
endLineNumber: 2, |
||||
startColumn: 1, |
||||
endColumn: 1 |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,23 @@ |
||||
const { spawnSync, execSync } = require('child_process') |
||||
const fs = require('fs') |
||||
const { exit } = require('process') |
||||
|
||||
execSync('yarn nx graph --file=./projects.json') |
||||
|
||||
const file = fs.readFileSync('projects.json') |
||||
const projects = JSON.parse(file) |
||||
console.log(Object.keys(projects.graph.nodes)) |
||||
|
||||
|
||||
for(let node of Object.keys(projects.graph.nodes)){ |
||||
if(projects.graph.nodes[node].data.targets.lint){ |
||||
console.log(projects.graph.nodes[node].data.name) |
||||
const result = spawnSync('yarn', ['lint', projects.graph.nodes[node].data.name, '--fix']) |
||||
if(result.status == 0){ |
||||
console.log('success') |
||||
}else{ |
||||
console.log(result.stdout.toString()) |
||||
console.log(result.stderr.toString()) |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue