Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb01bf4f

Browse files
committed
lint web-app
1 parentb5a6656 commitb01bf4f

File tree

53 files changed

+1804
-1644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1804
-1644
lines changed

‎web-app/.eslintrc.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module.exports={
2-
parser:'typescript-eslint-parser',
3-
extends:[
4-
// 'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
5-
// 'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
6-
// 'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
7-
// 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
8-
],
2+
parser:'@typescript-eslint/parser',// Specifies the ESLint parser
3+
extends:[
4+
'plugin:@typescript-eslint/recommended',// Uses the recommended rules from the@typescript-eslint/eslint-plugin
5+
'prettier/@typescript-eslint',// Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
6+
'plugin:prettier/recommended',// Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array
7+
],
98
parserOptions:{
109
ecmaVersion:2018,// Allows for the parsing of modern ECMAScript features
1110
sourceType:'module',// Allows for the use of imports
@@ -52,6 +51,11 @@ module.exports = {
5251
'no-return-assign':'off',
5352
'no-case-declarations':'off',
5453
'react/no-array-index-key':'off',
54+
'@typescript-eslint/explicit-function-return-type':'off',
55+
'@typescript-eslint/no-explicit-any':'off',
56+
'@typescript-eslint/ban-ts-ignore':'off',
57+
'@typescript-eslint/no-unused-vars':'off',
58+
'@typescript-eslint/camelcase':'off',
5559
},
5660
settings:{
5761
react:{

‎web-app/package-lock.json

Lines changed: 217 additions & 41 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎web-app/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,15 @@
6060
"@types/react":"^16.9.11",
6161
"@types/react-dom":"^16.9.4",
6262
"@types/storybook__react":"^4.0.2",
63+
"@typescript-eslint/eslint-plugin":"^2.7.0",
64+
"@typescript-eslint/parser":"^2.7.0",
6365
"babel-loader":"8.0.5",
6466
"babel-plugin-import":"^1.12.1",
67+
"eslint":"^6.6.0",
68+
"eslint-config-prettier":"^6.5.0",
69+
"eslint-plugin-prettier":"^3.1.1",
6570
"node-sass":"^4.13.0",
71+
"prettier":"^1.19.1",
6672
"react-scripts":"^3.2.0",
6773
"sass-loader":"^8.0.0",
6874
"typescript-eslint-parser":"^22.0.0"

‎web-app/src/App.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import client from './services/apollo'
66
importRoutesfrom'./Routes'
77

88
constApp=()=>(
9-
<ErrorBoundary>
10-
<ApolloProviderclient={client}>
11-
<Routes/>
12-
</ApolloProvider>
13-
</ErrorBoundary>
9+
<ErrorBoundary>
10+
<ApolloProviderclient={client}>
11+
<Routes/>
12+
</ApolloProvider>
13+
</ErrorBoundary>
1414
)
1515

1616
exportdefaultApp

‎web-app/src/Routes.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,36 @@ const { Route } = Router
1515
consttempSend=(action:any)=>console.log('sent')
1616

1717
constRoutes=()=>{
18-
return(
19-
<Workspace>
20-
<Router>
21-
<Routepath={['Start.Startup','Start.Authenticate','Start.NewOrContinue']}>
22-
<LoadingPagetext="Launching..."/>
23-
</Route>
24-
<Routepath="Start.SelectTutorial">
25-
<NewPagesend={tempSend}/>
26-
</Route>
27-
<Routepath="Start.ContinueTutorial">
28-
<ContinuePagesend={tempSend}context={{}asCR.MachineContext}/>
29-
</Route>
30-
<Routepath="Tutorial.Initialize">
31-
<LoadingPagetext="Initializing..."/>
32-
</Route>
33-
<Routepath="Tutorial.LoadNext">
34-
<LoadingPagetext="Loading..."/>
35-
</Route>
36-
<Routepath="Tutorial.Summary">
37-
<OverviewPagesend={tempSend}context={{}asCR.MachineContext}/>
38-
</Route>
39-
<Routepath="Tutorial.Level">
40-
<LevelSummaryPagesend={tempSend}context={{}asCR.MachineContext}/>
41-
</Route>
42-
<Routepath="Tutorial.Completed">
43-
<CompletedPagesend={tempSend}context={{}asCR.MachineContext}/>
44-
</Route>
45-
</Router>
46-
</Workspace>
47-
)
18+
return(
19+
<Workspace>
20+
<Router>
21+
<Routepath={['Start.Startup','Start.Authenticate','Start.NewOrContinue']}>
22+
<LoadingPagetext="Launching..."/>
23+
</Route>
24+
<Routepath="Start.SelectTutorial">
25+
<NewPagesend={tempSend}/>
26+
</Route>
27+
<Routepath="Start.ContinueTutorial">
28+
<ContinuePagesend={tempSend}context={{}asCR.MachineContext}/>
29+
</Route>
30+
<Routepath="Tutorial.Initialize">
31+
<LoadingPagetext="Initializing..."/>
32+
</Route>
33+
<Routepath="Tutorial.LoadNext">
34+
<LoadingPagetext="Loading..."/>
35+
</Route>
36+
<Routepath="Tutorial.Summary">
37+
<OverviewPagesend={tempSend}context={{}asCR.MachineContext}/>
38+
</Route>
39+
<Routepath="Tutorial.Level">
40+
<LevelSummaryPagesend={tempSend}context={{}asCR.MachineContext}/>
41+
</Route>
42+
<Routepath="Tutorial.Completed">
43+
<CompletedPagesend={tempSend}context={{}asCR.MachineContext}/>
44+
</Route>
45+
</Router>
46+
</Workspace>
47+
)
4848
}
4949

5050
exportdefaultRoutes

‎web-app/src/components/Button/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import * as React from 'react'
22
import{ButtonasAlifdButton}from'@alifd/next'
33

44
interfaceProps{
5-
style?:React.CSSProperties
6-
children:string|React.ReactNode
7-
disabled?:boolean
8-
type?:'primary'|'secondary'|'normal'
9-
onClick?:()=>void
5+
style?:React.CSSProperties
6+
children:string|React.ReactNode
7+
disabled?:boolean
8+
type?:'primary'|'secondary'|'normal'
9+
onClick?:()=>void
1010
}
1111

1212
constButton=(props:Props)=>(
13-
<AlifdButtononClick={props.onClick}type={props.type}disabled={props.disabled}style={props.style}>
14-
{props.children}
15-
</AlifdButton>
13+
<AlifdButtononClick={props.onClick}type={props.type}disabled={props.disabled}style={props.style}>
14+
{props.children}
15+
</AlifdButton>
1616
)
1717

1818
exportdefaultButton

‎web-app/src/components/Card/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import * as React from 'react'
22
import{CardasAlifdCard}from'@alifd/next'
33

44
conststyles={
5-
card:{
6-
display:'flex',
7-
width:'100%',
8-
},
5+
card:{
6+
display:'flex',
7+
width:'100%',
8+
},
99
}
1010

1111
interfaceProps{
12-
children:React.ReactNode
13-
onClick?:()=>void
14-
style?:React.CSSProperties
12+
children:React.ReactNode
13+
onClick?:()=>void
14+
style?:React.CSSProperties
1515
}
1616

1717
constCard=(props:Props)=>(
18-
<AlifdCard
19-
showTitleBullet={false}
20-
contentHeight="auto"
21-
onClick={props.onClick}
22-
style={{ ...styles.card, ...props.style}}
23-
>
24-
{props.children}
25-
</AlifdCard>
18+
<AlifdCard
19+
showTitleBullet={false}
20+
contentHeight="auto"
21+
onClick={props.onClick}
22+
style={{ ...styles.card, ...props.style}}
23+
>
24+
{props.children}
25+
</AlifdCard>
2626
)
2727

2828
exportdefaultCard
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
import*asReactfrom'react'
22

33
conststyles={
4-
box:{
5-
display:'flex',
6-
alignItems:'center',
7-
justifyContent:'center',
8-
},
9-
input:{
10-
border:'1px solid black',
11-
backgroundColor:'yellow',
12-
},
4+
box:{
5+
display:'flex',
6+
alignItems:'center',
7+
justifyContent:'center',
8+
},
9+
input:{
10+
border:'1px solid black',
11+
backgroundColor:'yellow',
12+
},
1313
}
1414

1515
interfaceProps{
16-
status:'COMPLETE'|'INCOMPLETE'|'ACTIVE'|'LOADING'
16+
status:'COMPLETE'|'INCOMPLETE'|'ACTIVE'|'LOADING'
1717
}
1818

1919
constCheckbox=(props:Props)=>{
20-
constchecked=props.status==='COMPLETE'
21-
// const loading = props.state === 'LOADING'
22-
constonChange=()=>{
23-
/* read */
24-
}
25-
return(
26-
<divstyle={styles.box}>
27-
<label>
28-
<inputstyle={styles.input}type="checkbox"checked={checked}onChange={onChange}/>
29-
</label>
30-
</div>
31-
)
20+
constchecked=props.status==='COMPLETE'
21+
// const loading = props.state === 'LOADING'
22+
constonChange=()=>{
23+
/* read */
24+
}
25+
return(
26+
<divstyle={styles.box}>
27+
<label>
28+
<inputstyle={styles.input}type="checkbox"checked={checked}onChange={onChange}/>
29+
</label>
30+
</div>
31+
)
3232
}
3333

3434
exportdefaultCheckbox

‎web-app/src/components/Debugger/debuggerWrapper.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ import stateToString from './stateToString'
55
constSHOW_DEBUGGER=JSON.parse(process.env.REACT_APP_DEBUG||'false')
66

77
constdebuggerWrapper=(element:React.ReactElement,state:any)=>{
8-
if(SHOW_DEBUGGER){
9-
return(
10-
<Debuggerstate={stateToString(state.value)}{...state.context}>
11-
{element}
12-
</Debugger>
13-
)
14-
}
15-
returnelement
8+
if(SHOW_DEBUGGER){
9+
return(
10+
<Debuggerstate={stateToString(state.value)}{...state.context}>
11+
{element}
12+
</Debugger>
13+
)
14+
}
15+
returnelement
1616
}
1717

1818
exportdefaultdebuggerWrapper

‎web-app/src/components/Debugger/index.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ import * as G from 'typings/graphql'
33
import*asCRfrom'typings'
44

55
interfaceProps{
6-
state:string
7-
tutorial:G.Tutorial
8-
env:CR.Environment
9-
position:CR.Position
10-
progress:CR.Progress
11-
children:React.ReactElement
6+
state:string
7+
tutorial:G.Tutorial
8+
env:CR.Environment
9+
position:CR.Position
10+
progress:CR.Progress
11+
children:React.ReactElement
1212
}
1313

1414
constDebugger=({ state, children, env, position, progress, tutorial}:Props)=>(
15-
<divstyle={{backgroundColor:'#FFFF99',color:'black',padding:'.5rem'}}>
16-
<h4>state:{state}</h4>
17-
<p>MachineId:{env.machineId}</p>
18-
<p>SessionId:{env.sessionId}</p>
19-
<p>tutorial:{tutorial ?tutorial.id :'none'}</p>
20-
<pstyle={{backgroundColor:'khaki',padding:'.5rem'}}>position:{JSON.stringify(position)}</p>
21-
<pstyle={{backgroundColor:'moccasin',padding:'.5rem'}}>progress:{JSON.stringify(progress)}</p>
22-
{children}
23-
</div>
15+
<divstyle={{backgroundColor:'#FFFF99',color:'black',padding:'.5rem'}}>
16+
<h4>state:{state}</h4>
17+
<p>MachineId:{env.machineId}</p>
18+
<p>SessionId:{env.sessionId}</p>
19+
<p>tutorial:{tutorial ?tutorial.id :'none'}</p>
20+
<pstyle={{backgroundColor:'khaki',padding:'.5rem'}}>position:{JSON.stringify(position)}</p>
21+
<pstyle={{backgroundColor:'moccasin',padding:'.5rem'}}>progress:{JSON.stringify(progress)}</p>
22+
{children}
23+
</div>
2424
)
2525

2626
exportdefaultDebugger
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
conststateToString=(state:string|object,str:string=''):string=>{
2-
if(typeofstate==='object'){
3-
constkeys=Object.keys(state)
4-
if(keys&&keys.length){
5-
constkey=keys[0]
6-
//@ts-ignore
7-
returnstateToString(state[key],str.length ?`${str}.${key}` :key)
8-
}
9-
returnstr
10-
}elseif(typeofstate==='string'){
11-
returnstr.length ?`${str}.${state}` :state
12-
}
13-
return''
1+
conststateToString=(state:string|object,str=''):string=>{
2+
if(typeofstate==='object'){
3+
constkeys=Object.keys(state)
4+
if(keys&&keys.length){
5+
constkey=keys[0]
6+
//@ts-ignore
7+
returnstateToString(state[key],str.length ?`${str}.${key}` :key)
8+
}
9+
returnstr
10+
}elseif(typeofstate==='string'){
11+
returnstr.length ?`${str}.${state}` :state
12+
}
13+
return''
1414
}
1515

16-
exportdefaultstateToString
16+
exportdefaultstateToString

‎web-app/src/components/Divider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import*asReactfrom'react'
22

33
conststyles={
4-
divider:{
5-
backgroundColor:'#e8e8e8',
6-
height:'0.1rem',
7-
},
4+
divider:{
5+
backgroundColor:'#e8e8e8',
6+
height:'0.1rem',
7+
},
88
}
99

1010
constDivider=()=><divstyle={styles.divider}/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp