lint working for remix-url-resolver

pull/5/head
aniket-engg 4 years ago
parent 24d5fa2e0a
commit e209a82098
  1. 16
      libs/remix-url-resolver/.eslintrc
  2. 8
      libs/remix-url-resolver/src/resolve.ts
  3. 22
      libs/remix-url-resolver/tsconfig.json
  4. 16
      libs/remix-url-resolver/tsconfig.lib.json
  5. 18
      workspace.json

@ -0,0 +1,16 @@
{
"extends": "../../.eslintrc",
"rules": {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/explicit-module-boundary-types": "off"
},
"env": {
"browser": true,
"amd": true,
"node": true,
"es6": true
},
"ignorePatterns": ["!**/*"]
}

@ -27,8 +27,9 @@ export class RemixURLResolver {
* @params filePath path of the file in github * @params filePath path of the file in github
*/ */
async handleGithubCall(root: string, filePath: string) { async handleGithubCall(root: string, filePath: string) {
//eslint-disable-next-line no-useless-catch
try { try {
let req: string = 'https://api.github.com/repos/' + root + '/contents/' + filePath const req: string = 'https://api.github.com/repos/' + root + '/contents/' + filePath
const response: AxiosResponse = await axios.get(req) const response: AxiosResponse = await axios.get(req)
return Buffer.from(response.data.content, 'base64').toString() return Buffer.from(response.data.content, 'base64').toString()
} catch(e) { } catch(e) {
@ -41,6 +42,7 @@ export class RemixURLResolver {
* @params cleanURL * @params cleanURL
*/ */
async handleHttp(url: string, _: string) { async handleHttp(url: string, _: string) {
//eslint-disable-next-line no-useless-catch
try { try {
const response: AxiosResponse = await axios.get(url) const response: AxiosResponse = await axios.get(url)
return response.data return response.data
@ -54,6 +56,7 @@ export class RemixURLResolver {
* @params cleanURL * @params cleanURL
*/ */
async handleHttps(url: string, _: string) { async handleHttps(url: string, _: string) {
//eslint-disable-next-line no-useless-catch
try { try {
const response: AxiosResponse = await axios.get(url) const response: AxiosResponse = await axios.get(url)
return response.data return response.data
@ -71,6 +74,7 @@ export class RemixURLResolver {
async handleIPFS(url: string) { async handleIPFS(url: string) {
// replace ipfs:// with /ipfs/ // replace ipfs:// with /ipfs/
url = url.replace(/^ipfs:\/\/?/, 'ipfs/') url = url.replace(/^ipfs:\/\/?/, 'ipfs/')
//eslint-disable-next-line no-useless-catch
try { try {
const req = 'https://gateway.ipfs.io/' + url const req = 'https://gateway.ipfs.io/' + url
// If you don't find greeter.sol on ipfs gateway use local // If you don't find greeter.sol on ipfs gateway use local
@ -112,7 +116,7 @@ export class RemixURLResolver {
} }
public async resolve(filePath: string, customHandlers?: Handler[]): Promise<Imported> { public async resolve(filePath: string, customHandlers?: Handler[]): Promise<Imported> {
var imported: Imported = this.previouslyHandled[filePath] let imported: Imported = this.previouslyHandled[filePath]
if(imported) { if(imported) {
return imported return imported
} }

@ -1,21 +1,9 @@
{ {
"compileOnSave": false, "extends": "../../tsconfig.json",
"include": ["./src"],
"compilerOptions": { "compilerOptions": {
"baseUrl": "./src", "types": ["node"],
"outDir": "./dist",
"sourceMap": true,
"declaration": true,
"module": "commonjs", "module": "commonjs",
"strict": true, "esModuleInterop": true
"noImplicitAny": false, },
"strictPropertyInitialization": false, "include": ["**/*.ts"]
"experimentalDecorators": true,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"lib": ["dom", "es2018"],
"paths": {
"remix-url-resolver": ["./"]
}
}
} }

@ -0,0 +1,16 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"outDir": "../../dist/out-tsc",
"declaration": true,
"rootDir": "./src",
"types": ["node"]
},
"exclude": [
"**/*.spec.ts",
"tests/"
],
"include": ["**/*.ts"]
}

@ -354,23 +354,20 @@
"schematics": {}, "schematics": {},
"architect": { "architect": {
"lint": { "lint": {
"builder": "@nrwl/workspace:run-commands", "builder": "@nrwl/linter:lint",
"options": { "options": {
"commands": [ "linter": "eslint",
{ "config": "libs/remix-url-resolver/.eslintrc",
"command": "./../../node_modules/.bin/npm-run-all lint" "tsConfig": [
} "libs/remix-url-resolver/tsconfig.lib.json"
], ],
"cwd": "libs/remix-url-resolver" "exclude": ["**/node_modules/**", "libs/remix-url-resolver/tests/**/*"]
} }
}, },
"test": { "test": {
"builder": "@nrwl/workspace:run-commands", "builder": "@nrwl/workspace:run-commands",
"options": { "options": {
"commands": [ "commands": [
{
"command": "rm -rf ../../dist"
},
{ {
"command": "./../../node_modules/.bin/npm-run-all test" "command": "./../../node_modules/.bin/npm-run-all test"
} }
@ -382,9 +379,6 @@
"builder": "@nrwl/workspace:run-commands", "builder": "@nrwl/workspace:run-commands",
"options": { "options": {
"commands": [ "commands": [
{
"command": "rm -rf ../../dist"
},
{ {
"command": "./../../node_modules/.bin/npm-run-all build" "command": "./../../node_modules/.bin/npm-run-all build"
} }

Loading…
Cancel
Save