Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
d2184ccd
Commit
d2184ccd
authored
Jul 05, 2021
by
Aniket-Engg
Committed by
Aniket
Jul 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
linting fix
parent
86f2d65e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
slitherClient.ts
libs/remixd/src/services/slitherClient.ts
+13
-11
No files found.
libs/remixd/src/services/slitherClient.ts
View file @
d2184ccd
...
@@ -29,25 +29,27 @@ export class SlitherClient extends PluginClient {
...
@@ -29,25 +29,27 @@ export class SlitherClient extends PluginClient {
const
localNpmDepsPath
=
`
${
this
.
currentSharedFolder
}
/node_modules`
const
localNpmDepsPath
=
`
${
this
.
currentSharedFolder
}
/node_modules`
const
npmDepsExists
=
existsSync
(
remixNpmDepsPath
)
const
npmDepsExists
=
existsSync
(
remixNpmDepsPath
)
const
nodeModulesExists
=
existsSync
(
localNpmDepsPath
)
const
nodeModulesExists
=
existsSync
(
localNpmDepsPath
)
let
isLocalDep
=
false
,
isRemixDep
=
false
let
isLocalDep
=
false
let
allowPathString
=
''
,
remapString
=
''
let
isRemixDep
=
false
let
allowPathString
=
''
let
remapString
=
''
for
(
const
e
of
list
)
{
for
(
const
e
of
list
)
{
const
importPath
=
e
.
replace
(
/import
[
'"
]
/g
,
''
).
trim
()
const
importPath
=
e
.
replace
(
/import
[
'"
]
/g
,
''
).
trim
()
const
packageName
=
importPath
.
split
(
'/'
)[
0
]
const
packageName
=
importPath
.
split
(
'/'
)[
0
]
if
(
nodeModulesExists
&&
readdirSync
(
localNpmDepsPath
).
includes
(
packageName
))
{
if
(
nodeModulesExists
&&
readdirSync
(
localNpmDepsPath
).
includes
(
packageName
))
{
isLocalDep
=
true
isLocalDep
=
true
remapString
+=
`
${
packageName
}
=./node_modules/
${
packageName
}
`
remapString
+=
`
${
packageName
}
=./node_modules/
${
packageName
}
`
}
else
if
(
npmDepsExists
&&
readdirSync
(
remixNpmDepsPath
).
includes
(
packageName
))
{
}
else
if
(
npmDepsExists
&&
readdirSync
(
remixNpmDepsPath
).
includes
(
packageName
))
{
isRemixDep
=
true
isRemixDep
=
true
remapString
+=
`
${
packageName
}
=./.deps/npm/
${
packageName
}
`
remapString
+=
`
${
packageName
}
=./.deps/npm/
${
packageName
}
`
}
}
}
}
if
(
isLocalDep
)
allowPathString
+=
'./node_modules,'
if
(
isLocalDep
)
allowPathString
+=
'./node_modules,'
if
(
isRemixDep
)
allowPathString
+=
'./.deps/npm,'
if
(
isRemixDep
)
allowPathString
+=
'./.deps/npm,'
return
{
remapString
,
allowPathString
}
return
{
remapString
,
allowPathString
}
}
}
transform
(
detectors
:
Record
<
string
,
any
>
[]):
OutputStandard
[]
{
transform
(
detectors
:
Record
<
string
,
any
>
[]):
OutputStandard
[]
{
const
standardReport
:
OutputStandard
[]
=
[]
const
standardReport
:
OutputStandard
[]
=
[]
...
@@ -112,9 +114,9 @@ export class SlitherClient extends PluginClient {
...
@@ -112,9 +114,9 @@ export class SlitherClient extends PluginClient {
const
outputFile
:
string
=
'remix-slitherReport_'
+
Date
.
now
()
+
'.json'
const
outputFile
:
string
=
'remix-slitherReport_'
+
Date
.
now
()
+
'.json'
const
fileContent
=
readFileSync
(
`
${
this
.
currentSharedFolder
}
/
${
filePath
}
`
,
'utf8'
)
const
fileContent
=
readFileSync
(
`
${
this
.
currentSharedFolder
}
/
${
filePath
}
`
,
'utf8'
)
const
importsArr
=
fileContent
.
match
(
/import
[
'"
][^
.|..
](
.+
?)[
'"
]
;/g
)
const
importsArr
=
fileContent
.
match
(
/import
[
'"
][^
.|..
](
.+
?)[
'"
]
;/g
)
let
allowPaths
=
''
,
remaps
=
''
let
allowPaths
=
''
;
let
remaps
=
''
if
(
importsArr
?.
length
)
{
if
(
importsArr
?.
length
)
{
const
{
remapString
,
allowPathString
}
=
this
.
mapNpmDepsDir
(
importsArr
)
const
{
remapString
,
allowPathString
}
=
this
.
mapNpmDepsDir
(
importsArr
)
allowPaths
=
allowPathString
allowPaths
=
allowPathString
remaps
=
remapString
.
trim
()
remaps
=
remapString
.
trim
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment